-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle bigints in the
TokenAmountInput
(#699)
Resolves #694 ### Problem We have been using floating point numbers to transform bigints to strings with 18 decimal places. But it was easy to mess up the precision because bigints were larger than max safe int. We need a way to be able to work in the inputs with both very large and very small numbers. ### What has been done Make input component handle value changes with bigints not strings. Adjust components using the `TokenAmountInput` to new format. - show nicely small balances (`<0,0001 TAHO`) - `bigIntToDisplayUserAmount` should be able to display nice label for values smaller than desired precision, let's make it to show the smallest possible number like: `<0.01` for desired precision `2` etc. - Allow using "Max" button and don't allow the input to override the real value with stringified value with less precision. - Add util to display bigints as strings with max precision ![image](https://github.com/tahowallet/dapp/assets/20949277/d9dc904b-e726-4914-b6af-c0a23eef5f31) ### Testing To test it please use stake and unstake forms. Type some value or click "max" and try to unstake/stake - check the value that is displayed on the wallet token allowance screen (make sure you don't have any allowance set on the TAHO or veTAHO on that account so you'll be able to test it that way) - [x] test it with super small amounts (up to 18 decimal places) - [x] test it with big amounts (for example >=3301 TAHO) - [x] test it with big amounts with some values on decimal places (`3000.0000000001`)
- Loading branch information
Showing
8 changed files
with
130 additions
and
50 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
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
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