Skip to content
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

fix: parse tx logs on contractInteraction to refresh NFT state #25380

Merged
merged 12 commits into from
Jun 28, 2024

Conversation

sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Jun 18, 2024

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

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

Before

Screen.Recording.2024-06-20.at.10.02.42.mov

After

Screen.Recording.2024-06-20.at.10.37.15.mov

Pre-merge author checklist

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.

Copy link
Contributor

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.

@@ -145,8 +145,6 @@ describe('Send NFT', function () {
// Go back to NFTs tab and check the imported NFT is shown as previously owned
await driver.clickElement('[data-testid="account-overview__nfts-tab"]');

await driver.clickElement('[data-testid="refresh-list-button"]');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to click on refresh button because this Tx is safetransferfrom and ownership has been already refreshed in MM controller

@sahar-fehri sahar-fehri marked this pull request as ready for review June 20, 2024 08:52
@sahar-fehri sahar-fehri requested a review from a team as a code owner June 20, 2024 08:52
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

Attention: Patch coverage is 7.89474% with 70 lines in your changes missing coverage. Please review.

Project coverage is 65.12%. Comparing base (dbdbaf1) to head (88f1388).
Report is 48 commits behind head on develop.

Files Patch % Lines
app/scripts/metamask-controller.js 4.11% 70 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25380      +/-   ##
===========================================
- Coverage    65.19%   65.12%   -0.07%     
===========================================
  Files         1405     1405              
  Lines        55571    55636      +65     
  Branches     14592    14636      +44     
===========================================
+ Hits         36229    36231       +2     
- Misses       19342    19405      +63     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sahar-fehri sahar-fehri added the needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. label Jun 20, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [dd12fd3]
Page Load Metrics (118 ± 139 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint63275864421
domContentLoaded98314168
load391374118290139
domInteractive98314168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.82 KiB (0.05%)
  • ui: 0 Bytes (0.00%)
  • common: 135 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [88f1388]
Page Load Metrics (56 ± 6 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6811388126
domContentLoaded9151121
load418756136
domInteractive9151121
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.84 KiB (0.05%)
  • ui: 0 Bytes (0.00%)
  • common: 135 Bytes (0.00%)

@sahar-fehri sahar-fehri merged commit fde960a into develop Jun 28, 2024
74 checks passed
@sahar-fehri sahar-fehri deleted the feat/parse-tx-logs-for-nft-refresh branch June 28, 2024 09:11
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-assets
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants