Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 0 token balance in send flow (#28136)
## **Description** Fixes an issue where token balance showed as 0 during send flow. This occurred when clicking the token in the token list, then clicking the send button from the token details page. When going send first and then picking a token, picking `decimals` was a number: ![image](https://github.com/user-attachments/assets/95d32a68-1076-4050-b129-187672694794) But when going token first and then clicking send , `decimals` was a string and skipped calculating the balance. ![image](https://github.com/user-attachments/assets/99a8fcd4-bd29-4969-b98d-6639d50553ff) `calcTokenAmount` seems to work with either string or number, so changing logic from #27083 which introduced the number check [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28136?quickstart=1) ## **Related issues** Fixes: #28112 ## **Manual testing steps** 1. Click on an erc20 token on the token list 2. Click the send button on the token details page 3. Choose a destination account 4. The balance under the asset picker should be accurate ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information