-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Token amount sent displays 0 when input contains no decimals #21338
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@@ -43,7 +43,8 @@ export function useTokenDisplayValue( | |||
// and a token object has been provided | |||
token && | |||
// and the provided token object contains a defined decimal value we need to calculate amount | |||
token.decimals && | |||
token.decimals !== null && | |||
token.decimals !== undefined && |
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.
the problem is related to the fact that in Javascript , the boolean expression of 0
return false
.
Builds ready [4dd1249]
Page Load Metrics (966 ± 380 ms)
Bundle size diffs
|
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #21338 +/- ##
========================================
Coverage 68.68% 68.69%
========================================
Files 1019 1019
Lines 40878 40879 +1
Branches 10917 10918 +1
========================================
+ Hits 28077 28078 +1
Misses 12801 12801
☔ View full report in Codecov by Sentry. |
Description
Description
Problem: After sending a token with an amount that doesn’t include decimals (ie 3, 5, 2), the transaction history displays the actual amount sent as 0. If the amount sent has a decimal (ie. 3.1, 0.2), this bug does not exist.
Expected Behavior: The amount I send should be reflected in the transaction history.
the problem is related to the fact that in Javascript , the boolean expression of
0
returnfalse
Manual testing steps
1 - GIVEN I am on the "Activity" page
2 - AFTER I send a token with a decimal amount
3 - WHEN I view the previous transaction
4 - THEN I see the correct token amount sent
Before
sending-erc20-0decimals.mp4
After
Screen.Recording.2023-09-04.at.17.35.17.mov
Related issues
_Fixes #18139
Pre-merge author checklist
Pre-merge reviewer checklist