BigNumber.toHexString() has a 0 prefix, padding to even length #2468
-
Note: Not all sections may be relevant, but please be as thorough while remaining concise as possible. Remove this Notice and any sections that don't feel pertinent. If you are unsure if something is a bug, start a thread in the "discussions" tab above.. Describe the bug the result is 0x016345785d8a00fa, seems like padding to even length. but when i use
I think the return value of bigNumber.toHexString is no need to padding to even length, or is there some method to remove the 0 prefix? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The The JSON-RPC protocols use "quantity" values, which is what the |
Beta Was this translation helpful? Give feedback.
The
.toHexString
returns a bytes representation, which is always even lengthed, and is by design, as it simplifies most interaction with other components which require a valid BytesLike.The JSON-RPC protocols use "quantity" values, which is what the
utils.hexValue
function does; when talking to any protocol which requires a quantity value that method should be used.