-
-
Notifications
You must be signed in to change notification settings - Fork 187
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: fix getting nft tokenURI #4136
Conversation
// Do not throw error here, supporting Metadata interface is optional even though majority of ERC721 nfts do support it. | ||
// This change is made because of instances of NFTs that are ERC404( mixed ERC20 / ERC721 implementation). | ||
// As of today, ERC404 is unofficial but some people use it, the contract does not support Metadata interface, but it has the tokenURI() fct. | ||
console.error('Contract does not support ERC721 metadata interface.'); | ||
} | ||
return contract.tokenURI(tokenId); |
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.
In cases where contract is ERC721 and does not have fct tokenURI
, we are already catching the error here
// Ignore error |
Can you share the contract address of this NFT?
|
This is the contract address: 0x93A5467fbC9D7dbB5713752Ec5a934a5A752AC07 The extension of the metadata interface is optional overall for ERC721, but i think a lot of decent NFTs support it already, mostly because latest openzeppelin ERC721 extend the IERC721Metadata automatically |
packages/assets-controllers/src/AssetsContractControllerWithNetworkClientId.test.ts
Show resolved
Hide resolved
I think I figured out my confusion. It looked to me like the contract supports erc-165. And has name, symbol , and tokenUri. So I was thinking it should pass the metadata interface check. But I guess its this part:
where they only announce support for IERC404. Therefore there are cases where it makes sense to call tokenUri even if we don't pass the supportsInterface check for metadata. |
f017e48
to
d8940d0
Compare
packages/assets-controllers/src/Standards/NftStandards/ERC721/ERC721Standard.ts
Show resolved
Hide resolved
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.
LGTM.
## Explanation ## References ## Changelog ## [13.0.0] Accounts Controller ### Changed - Fix update setSelectedAccount to throw if the id is not found ([#4167](#4167)) - Fix normal account indexing naming with index gap ([#4089](#4089)) - **BREAKING** Bump peer dependency `@metamask/snaps-controllers` to `^6.0.3` and dependencies `@metamask/snaps-sdk` to `^3.1.1`, `@metamask/eth-snap-keyring` to `^3.0.0`([#4090](#4090)) ## [28.0.0] Assets Controller ### Added - Add reservoir migration ([#4030](#4030)) ### Changed - Fix getting nft tokenURI ([#4136](#4136)) - **BREAKING** Bump peer dependency on `@metamask/keyring-controller` ([#4090](#4090)) - Fix token detection during account change ([#4133](#4133)) - Fix update nft metadata when toggles off ([#4096](#4096)) - Adds `tokenMethodIncreaseAllowance` ([#4069](#4069)) - Fix mantle token mispriced ([#4045](#4045)) ## [15.0.0] Keyring Controller ### Changed - **BREAKING** use getAccounts on HD Keyring when calling addNewAccount ([#4158](#4158)) - Pass CAIP-2 scope to execution context ([#4090](#4090)) - Allow gas limits to be changed during #addPaymasterData ([#3942](#3942)) ## [10.0.0] Preferences Controller ### Changed - **BREAKING** Bump peer dependency on `@metamask/keyring-controller` to `^15.0.0` ([#4090](#4090)) - Restore previous behavior of toChecksumHexAddress ([#4046](#4046)) ## [15.0.0] Signature Controller ### Changed - **BREAKING** Bump peer dependency on `@metamask/keyring-controller` to `^15.0.0` ([#4090](#4090)) ## [8.0.0] User Operation Controller ### Changed - **BREAKING** Bump peer dependency on `@metamask/keyring-controller` to `^15.0.0` and Pass CAIP-2 scope to execution context ([#4090](#4090)) - Allow gas limits to be changed during #addPaymasterData ([#3942](#3942)) ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## **Description** We have been contacted about an NFT on linea mainnet that was not showing properly on MM. There is this core PR that has been merged to fix fetch behavior for ERC404: MetaMask/core#4136 This PR adds a patch for the core fix. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24029?quickstart=1) ## **Related issues** Fixes: Related: MetaMask/core#4136 ## **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] --> https://github.com/MetaMask/metamask-extension/assets/10994169/cea457c3-87f2-4157-9efb-2ebc69176ac0 ### **After** <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-extension/assets/10994169/783d4292-c2c0-4ea9-9c7d-59dde88b4b3d ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask 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.
Explanation
User has reached out because when they import their NFT they are not able to see it.
The smart contract is deployed on linea-mainnet. It is a ERC404 contract (mixed implementation of ERC721/ERC20).
The contract does not support Metadata interface but it has the function tokenURI().
Contract address with this issue : 0x93A5467fbC9D7dbB5713752Ec5a934a5A752AC07
References
Changelog
@metamask/package-assets-controllers
Checklist