Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'toHexString' of null #526

Closed
rjkz808 opened this issue May 24, 2019 · 6 comments
Closed

Cannot read property 'toHexString' of null #526

rjkz808 opened this issue May 24, 2019 · 6 comments

Comments

@rjkz808
Copy link

rjkz808 commented May 24, 2019

Description

When I'm trying to call the ethers.Contract function (with a uint type argument(s)) I'm getting the next error:

TypeError: Cannot read property 'toHexString' of null

The stack trace leads me to the ethers.utils.bigNumberify method. I tried to convert args to BigNumber, string, number (using parseInt), BN (why not) - all this tries failed. Initial values are normal integers, when I call the same methods using web3 all is fine. What can be wrong? Thanks in advance for your help 😄

Versions

  • web3 1.0.0-beta.37
  • ethers 4.0.27
@ricmoo
Copy link
Member

ricmoo commented May 24, 2019

Can you include a code snippet? :)

@rjkz808
Copy link
Author

rjkz808 commented May 25, 2019

Can you include a code snippet? :)

Sure, https://gist.github.com/rjkz808/e94afacb1bfe8a0279dbdcb4cbb26a8a

@rjkz808
Copy link
Author

rjkz808 commented May 25, 2019

I've finally found that ethers.js requires from me to specify the gas limit for every tx. This issue can be closed 😄

@rjkz808 rjkz808 closed this as completed May 25, 2019
@jannunen
Copy link

And for those who are thinking "how do I specify the gas limit...".

contractWithSigner.theFunctionYouAreCalling(parameters, { gasLimit : 10})

@mamirpanah
Copy link

After not finding how to call web3.utils.toHex(), just searched in the git repo of geth client and found out how to convert decimals to hex:

Web3.prototype.toHex('8000000')

@ricmoo
Copy link
Member

ricmoo commented Mar 13, 2023

@mamirpanah You probably want ethers.hexlify("800000"). :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants