-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix Asset toAtomicAmount to not return scientific notation #250
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rohan-agarwal-coinbase
force-pushed
the
rohan/fix-atomic-calculation
branch
from
September 18, 2024 21:12
f99cdaf
to
31a4564
Compare
alex-stone
reviewed
Sep 18, 2024
alex-stone
reviewed
Sep 18, 2024
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.
Can we add a createTransfer
test with a sufficiently large value that tests it gets passed properly (a test that would fail without this logic change)?
rohan-agarwal-coinbase
force-pushed
the
rohan/fix-atomic-calculation
branch
from
September 18, 2024 21:52
6ac1b77
to
6e3f254
Compare
alex-stone
reviewed
Sep 18, 2024
alex-stone
approved these changes
Sep 18, 2024
rohan-agarwal-coinbase
added a commit
that referenced
this pull request
Sep 18, 2024
alex-stone
pushed a commit
that referenced
this pull request
Sep 18, 2024
howard-at-cb
pushed a commit
that referenced
this pull request
Sep 19, 2024
howard-at-cb
pushed a commit
that referenced
this pull request
Sep 24, 2024
howard-at-cb
pushed a commit
that referenced
this pull request
Sep 24, 2024
howard-at-cb
pushed a commit
that referenced
this pull request
Sep 25, 2024
howard-at-cb
added a commit
that referenced
this pull request
Sep 25, 2024
) * add eventTypeFilter * Update types.ts * Update webhook_test.ts * Update webhook.ts * Update webhook_test.ts * Update webhook.ts * Update webhook_test.ts * Update webhook_test.ts * Update webhook_test.ts * Update webhook_test.ts * Update webhook_test.ts * wallet.create_webhook * Changelog * Update wallet.ts * Update wallet.ts * Update wallet_test.ts * Update wallet_test.ts * Update wallet_test.ts * Update wallet_test.ts * Update wallet_test.ts * fmt * Update wallet_test.ts * Update wallet_test.ts * Update webhook.ts * Update wallet_test.ts * Update wallet_test.ts * address comments * fix test * Update wallet_test.ts * Update wallet_test.ts * Update wallet_test.ts * Update wallet_test.ts * Update jest.config.js * add sol, lamport asset suppport * Fix Asset toAtomicAmount to not return scientific notation (#250) * Fix merge conflicts between master and v0.6.0 (#255) * fix arb * update version * remove network check logic from sdk * fix coverage * fix lint * [PSDK-443] Quickstart Basenames Registration (#243) * base names quickstart * [PSDK-443] Quickstart Register Basenames for MPC Wallet * [hotfix] Fix L2 Resolver Address on Register Basenames Quickstart (#244) --------- Co-authored-by: Jayasudha Jayakumaran <jayasudha.jayakumaran@coinbase.com> Co-authored-by: Jayasudha Jayakumaran <121061531+jazz-cb@users.noreply.github.com> Co-authored-by: John Peterson <98187317+John-peterson-coinbase@users.noreply.github.com> * address comments * Update api.ts * Update CHANGELOG.md * apply new changes * fix tests * Update wallet.ts * Update CHANGELOG.md * Update CHANGELOG.md * Update jest.config.js --------- Co-authored-by: Rohan Agarwal <rohan.agarwal.1@coinbase.com> Co-authored-by: Rohit Durvasula <rohit.durvasula@coinbase.com> Co-authored-by: Jayasudha Jayakumaran <jayasudha.jayakumaran@coinbase.com> Co-authored-by: Jayasudha Jayakumaran <121061531+jazz-cb@users.noreply.github.com> Co-authored-by: John Peterson <98187317+John-peterson-coinbase@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed? Why?
Earlier,
toAtomicAmount(new Decimal(1000))
where decimals was 18 would result in 2e+21, which then got serialized as a string and failed on our backend as aninvalid_amount
. This PR changestoAtomicAmount
to return a bigint which gets serialized correctly.Testing:
Qualified Impact
We're still returning a numeric but this is technically backward-incompatible. We expect external usages of this function to be low and it to be primarily used by our other classes.