-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix: fix NFT balance in send flow #31239
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
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. |
@@ -2731,9 +2732,7 @@ export function updateSendAsset( | |||
|
|||
if (isCurrentOwner) { | |||
asset.error = null; | |||
asset.balance = details.balance | |||
? addHexPrefix(details.balance) |
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.
Using addHexPrefix
is what triggered the bug in the NFT send flow.
When deploying a tokenId 1 and 2 with amount 10
and 15
using addHexPrefix
resulted in the balance being 0x10
and 0x15
.
In the AssetBalanceText
component we will calculate the number of tokens of nfts
const numberOfTokens = hexToDecimal(asset.balance || '0x0');
Which results in numberOfTokens being 16
and 21
instead of 10
and 15
Builds ready [862b93d]
Page Load Metrics (2829 ± 360 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
## **Description** Fixes balance for NFTs in send flow. [](https://codespaces.new/MetaMask/metamask-extension/pull/31239?quickstart=1) ## **Related issues** Fixes: #28298 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> Please see video in issue 🙏 ### **After** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/eec659f1-4201-4999-9952-b76877cc365b ## **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/main/.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/main/.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.
Description
Fixes balance for NFTs in send flow.
Related issues
Fixes: #28298
Manual testing steps
Screenshots/Recordings
Before
Please see video in issue 🙏
After
Screen.Recording.2025-03-24.at.12.40.35.mov
Pre-merge author checklist
Pre-merge reviewer checklist