Ethers.js: sendTransaction() throwing an error event though the transaction is sent

Created on 20 Sep 2019  路  4Comments  路  Source: ethers-io/ethers.js

                        var sendTrans = userWallet.sendTransaction({
                            to: address,
                            value: ethers.utils.parseEther(value) // value being any decimal eg: 0.5
                        });

This code throws:

Error: invalid decimal value (arg="value", value={"_hex":"0x06f05b59d3b20000"}, version=4.0.33)
    at Object.throwError (C:\Users\Martino\Desktop\React\etherumble\backend\node_modules\ethers\errors.js:76:17)
    at parseUnits (C:\Users\Martino\Desktop\React\etherumble\backend\node_modules\ethers\utils\units.js:124:16)
    at Object.parseEther (C:\Users\Martino\Desktop\React\etherumble\backend\node_modules\ethers\utils\units.js:171:12)
    at C:\Users\Martino\Desktop\React\etherumble\backend\socket.js:64:57
    at processTicksAndRejections (internal/process/task_queues.js:85:5) {
  reason: 'invalid decimal value',
  code: 'INVALID_ARGUMENT',
  arg: 'value',
  value: BigNumber { _hex: '0x06f05b59d3b20000' }
}

When I try to set any decimal value, it throws that error, even though the transaction was sent: transaction

discussion

All 4 comments

Looking into this now...

Oh my god, I'm so dumb... The error was because I was misusing ethers.utils.parseEther a few lines below. Guess I need to sleep. Sorry for wasting your time...

Ha ha, no worries.

You had me a bit worried for a minute. ;)

Thanks!

@bruxo00 How update your code? I hope to know about you and your code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zemse picture zemse  路  3Comments

jochenonline picture jochenonline  路  3Comments

adamdossa picture adamdossa  路  3Comments

bbarton picture bbarton  路  3Comments

thegostep picture thegostep  路  3Comments