parseEther
Throws an error when the value is smaller than 0.001 ETH and has a lot of decimals
#4834
Unanswered
haidarally
asked this question in
Q&A
Replies: 2 comments
-
Yes. That will cause underflow to occur. You should not use JavaScript decimal numbers for any aspect of blockchain, as they will round which almost certainly result in failed interactions. You should perform any maths needed using the You ever find yourself using |
Beta Was this translation helpful? Give feedback.
0 replies
-
(moving to discussion) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ethers Version
6.9.0
Search Terms
parse, parseEther, Ether
Describe the Problem
The
parseEther
helper Throws an error when the value is smaller than 0.001 ETH and has a big amount of decimal places.For example: "0.0004985398760370963"
I expect it to correctly convert it to wei values.
please see error attached
Code Snippet
Contract ABI
No response
Errors
Environment
node.js (v12 or newer)
Environment (Other)
No response
Beta Was this translation helpful? Give feedback.
All reactions