You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
No response
Anything else?
Can be fixed by changing line 174 at toHex.js from else maxValue = 2n ** (BigInt(size) * 8n) - 1n
to else maxValue = BigInt(2 ** (size * 8) - 1);
The text was updated successfully, but these errors were encountered:
dushebaa
changed the title
Error: Cannot convert a BigInt value to a number at toHex.js
bug: Error: Cannot convert a BigInt value to a number at toHex.js
May 22, 2023
This seems to happen due to the way the bundler treats bigint values according to the browserslist. While the proposed solution does fix it for that exact case, there could be other cases where we may perform operations on those values (ie. maxValue ** BigInt(2)) which would break.
The recommended solution would be to modify the browserslist to filter out very old browsers like IE and ancient Android browsers: hirosystems/stacks.js#1096 (comment)
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.
Is there an existing issue for this?
Package Version
0.3.33
Current Behavior
Getting a "Cannot convert a BigInt value to a number" error while connecting to WalletConnect v2 provider at runtime due to invalid es compilation
Package-json browserslist config:
"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
]
Expected Behavior
No response
Steps To Reproduce
No response
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
No response
Anything else?
Can be fixed by changing line 174 at toHex.js from
else maxValue = 2n ** (BigInt(size) * 8n) - 1n
to
else maxValue = BigInt(2 ** (size * 8) - 1);
The text was updated successfully, but these errors were encountered: