anyl-wallet
anyl-wallet copied to clipboard
eth unit converter
We'll need a helper function that can convert between different ethereum units.
The function should take an uint256
as an input, and convert & format it to a desired unit type.
int eth_convert(const uint256_t *amount, enum unit from, enum unit to, char *buf, size_t buf_size);
example
>> eth_convert(0x2406d0096ba0007624, ETH_UNIT_WEI, ETH_UNIT_ETH, out, out_size);
>> print out
664.5736893707777777
Hi @pcppcp I would like to implement the eth unit converter. I intend to put the function in `src/web3.h' and add unit tests.
Hi @mislavn ! Feel free to take on the task, and whenever you are ready, please create a PR! If you have any questions regarding the build, our slack is a best place to ask.
Hi @pcppcp, do you want me to do any other changes.