-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: fix usdc send precision #3385
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Coverage Report
File CoverageNo changed files found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have tests here?
@@ -46,7 +46,7 @@ function AvailableTestContent({ chain, config }: IProps) { | |||
const toast = useChakraToast() | |||
|
|||
async function onSendTransaction(wagmiConfig: Config) { | |||
const usdcAmount = BigInt(Number(amount) * 1000000) | |||
const usdcAmount = BigInt(Math.round(parseFloat(amount) * 1_000_000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using bignumber.js in AppKit for these kind of calculations (heavily used for swaps) - maybe we could have the same utility in lab for these calculations too? Or expose that utility from AppKit if it's helpful enough?
Description
Number(4.1) * 1_000_000
= 4100000 (right?)haha, computers
Math.round
andparseFloat
to handle USDC amount parsingType of change
Checklist