-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GIX-2154: Add support for token decimals in TokenAmount (#491)
# Motivation Some tokens (like ckETH) have a precision different than 8 decimals. In this PR, support decimals precision in the new TokenAmountV2 class. # Changes * Add mandatory field `decimals` in `Token` type. * Add `decimals` to ICPToken. * `TokenAmount` rejects tokens with `decimals !== 8` * New type `TokenAmountV2` which supports `decimals !== 8` # Tests * Test that `TokenAmount` does not support different decimals. * Test that TokenAmountV2 supports different decimals. # Todos - [x] Add entry to changelog (if necessary). --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
de396fa
commit 4aac1d7
Showing
5 changed files
with
556 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export enum FromStringToTokenError { | ||
FractionalMoreThan8Decimals, | ||
InvalidFormat, | ||
FractionalTooManyDecimals, | ||
} |
Oops, something went wrong.