Blockchain Discussion

Bignumber issue in web3 invalid number value

Getting invalid number error when calling a method of a contract which take uint256 argument.

Example:
myContract.methods.transfer(accounts[1], 1e16).send({ from: accounts[0] })

  1. When sending value 1e16 it throw error
    web3 invalid number value (arg=”_value”, coderType=”uint256″, value=10000000000000000)
  2. When sending value 10000000000000000 throw same error
  3. When sending value 1e16 as hex it work okay. No error.
  4. When sending value 1e15 or less value as number like 100000000000000 if work okay. No error

I am using web3 1.0.0-beta.36

https://github.com/ethereum/web3.js/issues/2077

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *