Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Check for values smaller than MIN_SAFE_INTEGER #176

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/discovery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @l2beat/discovery

## 0.47.1

### Patch Changes

- Check for values smaller than MIN_SAFE_INTEGER

## 0.47.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/discovery/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@l2beat/discovery",
"description": "L2Beat discovery - engine & tooling utilized for keeping an eye on L2s",
"version": "0.47.0",
"version": "0.47.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export function toContractValue(value: unknown): ContractValue {
return value
}
if (BigNumber.isBigNumber(value)) {
if (value.gt(Number.MAX_SAFE_INTEGER.toString())) {
if (
value.gt(Number.MAX_SAFE_INTEGER.toString()) ||
value.lt(Number.MIN_SAFE_INTEGER.toString())
) {
return value.toString()
} else {
return value.toNumber()
Expand Down
Loading