js icon indicating copy to clipboard operation
js copied to clipboard

[SDK] - Expose convenience function to do `ethers.utils.formatEther` and `ethers.utils.parseEther`

Open jarrodwatts opened this issue 1 year ago • 0 comments

Background

Working with BigNumber variables requires importing ethers and using ethers.utils.formatEther and parseEther functions which is not very discoverable through our SDK unless you are already familiar with the ethers dependency.

It would be great to expose convenience functions that expose these directly from our SDK package rather than ethers.

Goal

[] Add toEther function

  • Users can import toEther from the @thirdweb-dev/sdk package and convert a number from wei to formatted value. Use the ethers.utils.formatEther functionality under the hood.

[] Add toWei function

  • Same as above, except use parseEther under the hood.

jarrodwatts avatar Nov 26 '22 00:11 jarrodwatts