No good replacement for hexStripZeros
#4002
Unanswered
thebrianchen
asked this question in
Q&A
Replies: 2 comments 1 reply
-
For quantity values (which JSON-RPC uses for numeric values), use v6 |
Beta Was this translation helpful? Give feedback.
1 reply
-
Same here, I was using:
But toQuantity doesn't seem to be the fit I need |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Ethers Version
6.3.0
Search Terms
hexstripzeros, stripzerosleft
Describe the Problem
I am migrating from ethers v5 to ethers v6. I used to use
hexStripZeros
to strip the leading zeros in my hex string, since some json-rpc methods do not accept hex strings with leading zeros. However, I cannot find the equivalent in ethers v6. If it's purposely removed, can you include it in the migration guide? I was usingstripLeftZeros
blindly for a bit, until I realized it was forBytesLike
inputs only.For example,
stripLeftZeros("0x01054ea")
will still return"0x01054ea"
, whereashexStripZeros()
would return"0x1054ea"
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
Beta Was this translation helpful? Give feedback.
All reactions