Skip to content

Uncaught Error: invalid hexlify value (operation="checkSafeInteger", fault="out-of-safe-range", value=1000000000000000000, code=NUMERIC_FAULT, version=bytes/5.5.0) #2767

Answered by ricmoo
NabiKAZ asked this question in Q&A
Discussion options

You must be logged in to vote

Please read the note on IEEE 754 for more info on using numbers in JavaScript.

For your purposes, you would probably want to use BigNumber.from("1000000000000000000").toHexString(). Notice it is a string, which is safe for large values in JavaScript.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@NabiKAZ
Comment options

Answer selected by NabiKAZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2766 on March 08, 2022 00:23.