Skip to content

fix: improve fetching nft details for custom contracts #31432

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

Merged

Conversation

sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Mar 31, 2025

Description

This PR adds fetching NFT image and name from tokenURI and fallsback to the fetched values when they are undefined from NFT-API.

Open in GitHub Codespaces

Related issues

Fixes: #29471

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

I was not able to repro exact behavior in issue but i added fallbacks for the behavior i saw on main for the custom contract

Screen.Recording.2025-03-31.at.20.27.50.mov

After

Screen.Recording.2025-03-31.at.15.36.29.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.

@metamaskbot
Copy link
Collaborator

Builds ready [9b3aab5]
UI Startup Metrics (1260 ± 67 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1260110514326713101376
load109499012416111491241
domContentLoaded10889821237601146986
domInteractive18145961831
firstPaint7821341256426212296
backgroundConnect116648910
firstReactRender20143852132
getState12434779
initialActions001001
loadScripts860760101258894956
setupStore8521389
WebpackHomeuiStartup961768126078966985
load81659897867850920
domContentLoaded81059196468846908
domInteractive16134461432
firstPaint53059968346836911
backgroundConnect17115691539
firstReactRender14122941427
getState7413278
initialActions001000
loadScripts80758095467843899
setupStore7516289
FirefoxBrowserifyHomeuiStartup14111217192514714571776
load12681096175714113151623
domContentLoaded12681095175714113151623
domInteractive11341227327498
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect251680102746
firstReactRender23195652530
getState7414279
initialActions001001
loadScripts12441061173414012961595
setupStore6435368
WebpackHomeuiStartup10538951552154938992
load9177711383138848918
domContentLoaded9177711382138848917
domInteractive119361992714042
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect21147972431
firstReactRender20173332026
getState104901089
initialActions001001
loadScripts8987551359135838926
setupStore135691689
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 1.51 KiB (0.02%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

✅ @MetaMask/confirmations

  • ui/pages/confirmations/components/confirm/info/shared/nft-send-heading/nft-send-heading.tsx
  • ui/pages/confirmations/hooks/useAssetDetails.js

🖥️ @MetaMask/wallet-ux

  • ui/components/multichain/nft-item/nft-item.tsx

@metamaskbot
Copy link
Collaborator

Builds ready [802413a]
UI Startup Metrics (1184 ± 61 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1184109013936112201295
load1033938117258954995
domContentLoaded1027934116758952993
domInteractive16133141627
firstPaint741791178401275994
backgroundConnect11614515910
firstReactRender19134851928
getState10430768
initialActions001001
loadScripts80969694759847919
setupStore7513278
WebpackHomeuiStartup1011805120779980997
load85359497672898954
domContentLoaded84758796572888948
domInteractive16125071434
firstPaint30756969315827925
backgroundConnect18134471638
firstReactRender16123041727
getState5319358
initialActions001000
loadScripts84558496372885946
setupStore8415279
FirefoxBrowserifyHomeuiStartup13421168206415713641680
load12041032189814712341499
domContentLoaded12031032189814712341499
domInteractive9736212278897
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2416162152441
firstReactRender22195452428
getState6324278
initialActions001001
loadScripts11801012187114112101477
setupStore6430368
WebpackHomeuiStartup10008441599172906958
load8757381389154809916
domContentLoaded8757381388154809915
domInteractive119392062715496
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect19128282230
firstReactRender19172721924
getState114911589
initialActions001001
loadScripts8587251366151797951
setupStore7458579
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -560.45 KiB (-9.57%)
  • ui: 61.5 KiB (0.91%)
  • common: -94.6 KiB (-1%)

@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 Mar 31, 2025
@sahar-fehri sahar-fehri requested a review from seaona March 31, 2025 20:36
@sahar-fehri sahar-fehri marked this pull request as ready for review March 31, 2025 20:37
@sahar-fehri sahar-fehri requested review from a team as code owners March 31, 2025 20:37
@metamaskbot
Copy link
Collaborator

Builds ready [995e50c]
UI Startup Metrics (1183 ± 68 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1183105115436812101283
load1035942135362948997
domContentLoaded1028934134462941994
domInteractive16133451627
firstPaint695891351414259984
backgroundConnect106737910
firstReactRender20145182040
getState10434767
initialActions001001
loadScripts814711110461837886
setupStore8419279
WebpackHomeuiStartup995778120983976994
load83560098075870947
domContentLoaded82958197675865943
domInteractive15123561435
firstPaint3105995431079907
backgroundConnect18135281641
firstReactRender17124051728
getState5320356
initialActions001001
loadScripts82657197575864941
setupStore8424389
FirefoxBrowserifyHomeuiStartup13781176186414313981739
load12421058171213712761583
domContentLoaded12421058171213712761583
domInteractive10838195308298
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23169782432
firstReactRender23194752532
getState6417278
initialActions001001
loadScripts12201041168913512561557
setupStore6411267
WebpackHomeuiStartup9838231612180890984
load8587211401157798899
domContentLoaded8587211400157798899
domInteractive114512412515894
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2114109142333
firstReactRender18162621923
getState114781479
initialActions001001
loadScripts8417071378154785879
setupStore8573778
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 1.66 KiB (0.02%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [204df7f]
UI Startup Metrics (1225 ± 51 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1225112013955112551320
load10769731204451110986
domContentLoaded10699521198461112993
domInteractive17136691636
firstPaint8201401204401169291
backgroundConnect106354910
firstReactRender19145451925
getState13530768
initialActions001001
loadScripts81771793244842885
setupStore7414278
WebpackHomeuiStartup22011741269618923062507
load17221350220715817952042
domContentLoaded17151345220215617902027
domInteractive171263111450
firstPaint162663575722283
backgroundConnect3511311373669
firstReactRender188543681205691
getState13458969
initialActions318136
loadScripts17041342219714817821990
setupStore23629938377
FirefoxBrowserifyHomeuiStartup13841176180113214401706
load12421057160212313111527
domContentLoaded12421057160212313111527
domInteractive10037260378797
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2716220222552
firstReactRender22193232229
getState7415288
initialActions001001
loadScripts12181041153811912941502
setupStore6412267
WebpackHomeuiStartup15671343220218616362020
load13521116200417614141775
domContentLoaded13511116200417614141775
domInteractive10037301349196
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25175262640
firstReactRender35295553746
getState1152542589
initialActions002111
loadScripts13291097197917513951749
setupStore1052052089
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 1.63 KiB (0.02%)
  • common: 0 Bytes (0%)

gambinish
gambinish previously approved these changes Apr 7, 2025
Copy link
Contributor

@gambinish gambinish left a comment

Choose a reason for hiding this comment

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

Approving, but before we merge could you take a look at my comments, and lmk what you think? Neither need to block.

@sahar-fehri sahar-fehri enabled auto-merge April 7, 2025 20:35
@metamaskbot
Copy link
Collaborator

Builds ready [de99685]
UI Startup Metrics (1232 ± 54 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1232112114005412621332
load10779511266561124983
domContentLoaded10709381255571136994
domInteractive18136491633
firstPaint8101381264400216968
backgroundConnect107455910
firstReactRender2214136152027
getState12534779
initialActions003000
loadScripts81868695255849908
setupStore8422379
WebpackHomeuiStartup21781749257618922972419
load17051322205215017851963
domContentLoaded16951317204115017741946
domInteractive171283131456
firstPaint158643466126886
backgroundConnect3611388454161
firstReactRender201534531205792
getState12351979
initialActions318135
loadScripts16871307201814617641924
setupStore21627331459
FirefoxBrowserifyHomeuiStartup14061229193714914401784
load12611075179414612891611
domContentLoaded12611074179414612881611
domInteractive10539206338796
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2717111142743
firstReactRender23195742329
getState8446589
initialActions001001
loadScripts12351054177414512691586
setupStore6424367
WebpackHomeuiStartup16001352224716316611968
load13771166197615114401727
domContentLoaded13771166197615114401727
domInteractive10444251298998
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect26184962842
firstReactRender36286353948
getState10435789
initialActions001011
loadScripts13541145195215014201698
setupStore9540589
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.51 KiB (0.02%)
  • ui: -6.65 KiB (-0.1%)
  • common: -125 Bytes (0%)

Copy link
Member

@OGPoyraz OGPoyraz left a comment

Choose a reason for hiding this comment

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

Confirmation changes LGTM

@metamaskbot
Copy link
Collaborator

Builds ready [f9fd8be]
UI Startup Metrics (1230 ± 71 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1230110214167112821354
load10769721250671195993
domContentLoaded10709671246671217988
domInteractive17136081632
firstPaint7551321250433224991
backgroundConnect116579910
firstReactRender21154662135
getState13543978
initialActions001001
loadScripts82071698167871931
setupStore8435578
WebpackHomeuiStartup21611696265516922912407
load16801307201314817681959
domContentLoaded16751300200614717641951
domInteractive171265111453
firstPaint158653686624677
backgroundConnect3510273363761
firstReactRender182533811135789
getState1442252269
initialActions318145
loadScripts16661295198414517581947
setupStore27641156418
FirefoxBrowserifyHomeuiStartup13771195189014314271704
load12351039173313812881535
domContentLoaded12351039173213812881535
domInteractive10240264358997
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2617103162449
firstReactRender23194842329
getState8363689
initialActions002001
loadScripts12101022170913712631515
setupStore7489967
WebpackHomeuiStartup15571377208114616441846
load13391181188113914171642
domContentLoaded13381181188013914161642
domInteractive9540292278896
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect27188892948
firstReactRender38296264148
getState10438789
initialActions002111
loadScripts13151159185913913921619
setupStore9632589
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 1.46 KiB (0.02%)
  • common: 0 Bytes (0%)

@sahar-fehri sahar-fehri added this pull request to the merge queue Apr 8, 2025
Merged via the queue into main with commit ea0b60c Apr 8, 2025
164 checks passed
@sahar-fehri sahar-fehri deleted the fix/fix-display-nft-details-for-custom-test-contracts branch April 8, 2025 09:40
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2025
@metamaskbot metamaskbot added the release-12.17.0 Issue or pull request that will be included in release 12.17.0 label Apr 8, 2025
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.17.0 Issue or pull request that will be included in release 12.17.0 team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Send ERC1155 - When sending an ERC1155 token, the Select token remains unselected
7 participants