hexlify is padding the number with 0s #1703
-
Hello I have a number:
How do we strip out leading 0's from hex? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
To mitigate, I am resorting to non ethers hex by converting to number and running using |
Beta Was this translation helpful? Give feedback.
-
The The safest way to handle this is |
Beta Was this translation helpful? Give feedback.
-
I had an issue with hardhat
|
Beta Was this translation helpful? Give feedback.
The
utils.hexValue(hexString)
method will serialize as aQUANTITY
, which has. I leading 0’s except that 0 is0x0
. This should be what you want.The safest way to handle this is
hexValue(BigNumber.from(v).toHexString())
. This will handle all sorts of edge cases for you. :)