-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: parse tx logs on contractInteraction to refresh NFT state (#25380)
## **Description** On this PR, we aim to refresh NFT ownership status or add NFTs to state if necessary by parsing transaction logs once the user submits a transaction with MM. MM controller already had the logic that calls `_updateNFTOwnership` after creating the transaction notification. That logic refreshed NFT ownerhsip when transaction type is `transferfrom`. We are adding the case when transaction type is a contract interaction and then look for specific topics. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25380?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Switch to Ethereum mainnet and go to NFTs tab (this will trigger a call to fetch your NFTs) 2. Go to opensea to buy a new NFT. 3. Click on buy and submit transaction with your MM 4. Go back to NFTs tab and you should see your new NFT without having to import it. Im using Ethereum mainnet in the videos because we support NFT detection on Ethereum mainnet. But this should also work if you are submitting transaction on Sepolia or any other test network. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-extension/assets/10994169/7a21efd4-c93c-4ec6-9a3d-3649b6b553df ### **After** <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-extension/assets/10994169/b3cbaf49-f73b-4a09-96b8-b6156a5f3b98 ## **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
1 parent
b37e39d
commit fde960a
Showing
4 changed files
with
223 additions
and
35 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