ethereum / eth-utils

Utility functions for working with ethereum related codebases.
https://eth-utils.readthedocs.io/en/latest/
MIT License
312 stars 148 forks source link

Added support for custom unit decimals providing #244

Open asimaranov opened 1 year ago

asimaranov commented 1 year ago

What was wrong?

It's useful to be able to provide the custom unit decimals like from_wei(123456789, 6). This is common practice in typescript API and handy when operating with token with decimals amount e.g. 6 is fetched from blockchain

Related to Issue # https://github.com/web3/web3.js/issues/3169 for web3.js library

How was it fixed?

Added support for number passing to from_wei, to_wei that is interpreted as decimals number.

Todo:

Cute Animal Picture

https://github.com/ethereum/eth-utils/assets/25568730/9517b933-4dec-4e0b-972d-c0c31389beb9