parseUnits large number bug #896
mikemcdonald
started this conversation in
General
Replies: 1 comment 3 replies
-
Could probably just short-circuit with the bigint if the string does not have a fraction component right? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Mentioned here: #490 (comment), but opening a separate discussion for this bug since the
parseUnits
type was updated to a string already which was the original source of the discussion.Example of a token on polygon with 0 decimals and the below balance:
due to
Number()
https://github.com/wagmi-dev/viem/blob/main/src/utils/unit/parseUnits.ts#L12Happy to submit a PR to fix - I see 3 routes to take:
Beta Was this translation helpful? Give feedback.
All reactions