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

Fixes BigInt parsing losing precision in IntegerInput #893

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

iPaulPro
Copy link
Contributor

@iPaulPro iPaulPro commented Jul 17, 2024

Description

When entering a large number into an IntegerInput component, it is parsed as a JSON string and loses precision.

For example, entering 85604566775863511922702956178915374775782418036268384638508224920020197708340 is parsed into 85604566775863516368369806302131844469805175632226226214501379502487210295296.

This is fixed by first attempting to convert the string value to a BigInt and then returning that value if successful.

Additional Information

Your ENS/address: paulburke.eth

Copy link
Collaborator

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks @iPaulPro for reporting and tackling it!!

Just pushed a commit at 6c601e2, because earlier if we pass empty string they were parsed as 0n.

Screen.Recording.2024-07-17.at.11.50.20.AM.mov

@technophile-04 technophile-04 merged commit cdb6cbc into scaffold-eth:main Jul 17, 2024
1 check passed
@iPaulPro
Copy link
Contributor Author

@technophile-04 Great catch and thanks for the incredibly fast merge!

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

Successfully merging this pull request may close these issues.

2 participants