Replies: 1 comment
-
Hey @StErMi, You can create Dinero objects in ETH, then convert them in USD with the Note that I'm using native If you want to use Ethers formatting utilities, you'll need to create a custom calculator using For documentation on how to use a custom type and implement a calculator, please refer to the docs. |
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
-
Hi there,
I'm new to the library, but it seems the must-have library when dealing with currencies. I'm building a web app that deals with cryptocurrencies and their prices.
Each crypto has their own decimals and when I need to display the value of an amount of token X I need to multiply the amount for the value in dollars.
Now I'm having difficulties to understand how this should be handled via dinero.
For example:
4564660073892638156894
(this is the balance of the user with 18 decimals)formatUnits(BigNumber.from(balance), decimals)
0.223703
(each token is worth that value, 1 token === 1e18)1021.1281525100048
How should I use
dinero
to correctly format this and then use it when I need to do math with different token prices toBeta Was this translation helpful? Give feedback.
All reactions