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

chore: Add token amount formatter #543

Merged
merged 2 commits into from
Jun 13, 2024
Merged

chore: Add token amount formatter #543

merged 2 commits into from
Jun 13, 2024

Conversation

abcrane123
Copy link
Contributor

@abcrane123 abcrane123 commented Jun 13, 2024

What changed? Why?

  • format amount returned from getSwapQuote

Notes to reviewers

How has it been tested?

// Convert the string amount to a number using decimals value
const numberAmount = Number(amount) / Math.pow(10, decimals);
// Round to a maximum of 11 significant digits
const roundedAmount = Number(numberAmount.toPrecision(11));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i round to 11 digits here so that the amount will fit in the input but let me know if there is another standard we should follow

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's merge this, but I would like the team feedback on what's best. In particular from Jordan Frankfurt and Conner.

@abcrane123 abcrane123 marked this pull request as ready for review June 13, 2024 17:49
@abcrane123 abcrane123 self-assigned this Jun 13, 2024
@abcrane123 abcrane123 requested a review from Zizzamia June 13, 2024 17:49
@Zizzamia Zizzamia merged commit 9af516c into main Jun 13, 2024
9 checks passed
@Zizzamia Zizzamia deleted the alissa.crane/swap-tokens branch June 13, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants