essential-eth icon indicating copy to clipboard operation
essential-eth copied to clipboard

etherToWei incorrect value

Open 7flash opened this issue 3 years ago • 2 comments

image

Expected 1 ether.. showing over 4k ether..

image

7flash avatar Jun 25 '22 02:06 7flash

Found solution.. value should be hex encoded..

import { etherToWei, hexValue } from "essential-eth";

hexValue(etherToWei(1))

this is correct example:

image

image

7flash avatar Jun 25 '22 06:06 7flash

Thanks for submitting this, I'll re-open it to make sure I understand how this works

dawsbot avatar Jun 25 '22 14:06 dawsbot

I believe this is the expected behavior of calling window.ethereum directly with a value live this. The recommendation would instead be to use a provider which supports the injected browser instance so that you don't need to handle conversions like this and calling directly functions like eth-sendTransaction @7flash

I may be confused though, please re-open if I am misunderstanding and will consider this again 🙏

dawsbot avatar Jun 06 '23 04:06 dawsbot