When dealing with very large numbers (>= 1e+21), result
in the send()
method fails to convert scientific notation to a number, creating downstream BigNumber conversion errors
#16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
First of all, thank you for building this package in the first place, it is really awesome! 💯
I ran into this error when using the MetaMask provider and calling
web3.eth.getBalanceOf(address)
on an account with a lot of ETH. I seed all of my GanacheCLI accounts with 10,000 ETH so I ran into this error easily. I encountered BigNumber conversion errors, complaining that I was trying to convert a scientific-notation number, for example "9.988e+22", into a BN. I added a fix to detect ifresult
is a number in scientific notation and to subsequently convert it.Specific edits:
result
insend()
is in scientific notation, which is possible I believe because nodeJS sometimes automatically converts numbers >= 1e21 into scientific notation. See more hereweb3.eth.getBalanceOf(address)
on anaddress
with a lot of ETH.Other Changes
Checklist
Scripts
Added Scripts:
Updated Scripts:
Dependencies
Added Dependencies:
Updated Dependencies:
Related Issues