ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Add formatGwei

Open zbcoding opened this issue 2 years ago • 2 comments

Add formatGwei which works similarly to formatEther. Gwei is commonly used for units of eth gas fees.

zbcoding avatar May 25 '23 12:05 zbcoding

How is this different than using formatUnits(value, "gwei")?

ricmoo avatar May 25 '23 13:05 ricmoo

How is this different than using formatUnits(value, "gwei")?

and there's formatEther(value) too, which is simply formatUnits(value, 18) or formatUnits(value, "ether")

So same idea, a special function could be useful since gwei is commonly used . Perhaps too much extra code to add a function for each value in the unit index - but since ether and gwei are the most used having functions for them makes sense

zbcoding avatar May 25 '23 22:05 zbcoding