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

Commit

Permalink
Check for values smaller than MIN_SAFE_INTEGER (#176)
Browse files Browse the repository at this point in the history
* Check for values smaller than MIN_SAFE_INTEGER

* Changeset
  • Loading branch information
mateuszradomski authored Apr 11, 2024
1 parent 0230937 commit 56d03fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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

0 comments on commit 56d03fa

Please sign in to comment.