Skip to content

How do I convert a bignumber hex to an integer or string? #1821

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

You must be logged in to vote

The _hex is an internal value (in v6 it will be better hidden).

Use value.toHexString() to get a hex value and value.toString() to get a decimal value.

See the documentation here: https://docs.ethers.io/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--conversion

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@ev4ndropc
Comment options

@ricmoo
Comment options

Answer selected by ricmoo
Comment options

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

zemse Jun 14, 2023
Collaborator

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

This discussion was converted from issue #1820 on August 01, 2021 05:12.