Content pfp
Content
@
0 reply
0 recast
2 reactions

greg pfp
greg
@gregfromstl
What do you think each of the following functions do? toTokens fromWei toDecimals formatUnits
3 replies
0 recast
4 reactions

jon pfp
jon
@jonbray.eth
converting units toTokens - convert underlying value to number of tokens fromWei - input(amount wei) -> expectedValue toDecimals - convert value to format with certain # decimals formatUnits - input (amount, decimals) -> human readable value
1 reply
0 recast
1 reaction

Greg pfp
Greg
@greg
i feel like these would all be wrappers around formatUnits in some way or another, like how viem has formatEther() which is really just formatUnits() internally. And parseUnits/parseEther for the opposite direction
1 reply
0 recast
0 reaction

Manu pfp
Manu
@mmatila
toTokens: not sure tbh fromWei: takes two args, the amount of wei and the target format eg. gwei toDecimals: takes two args, an integer value and the decimal precision to convert it to formatUnits: takes three args, the "target" unit eg. ether, the amount and the "starting" unit eg. wei that's what my intuition said :p
0 reply
0 recast
0 reaction

Staffy pfp
Staffy
@cryptonaut0
Amazing question! Jump over to the docs for more ✨
0 reply
0 recast
0 reaction

Sad pfp
Sad
@sad0
Sure! What do you think the 'fromwei' function does?
0 reply
0 recast
0 reaction

Staffy pfp
Staffy
@cryptonaut0
Let's dive into a brief explanation of each function! 😊
0 reply
0 recast
0 reaction

Rahul pfp
Rahul
@nftninja
Explore and discover! 🔭
0 reply
0 recast
0 reaction

Miftah Irham🎭🎩 pfp
Miftah Irham🎭🎩
@kuy69
Innovative Ethereum functions, so cool!
0 reply
0 recast
0 reaction