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

add validation that the nft standard matches the type argument #1455

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Jun 27, 2023

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/854

Currently when wallet_watchAsset is called with type ERC721 or ERC1155, we don't check whether the asset actually matches the type passed - we push it into a flow for suggested NFTs do a bunch of other validation, and if it passes we add it with the correct value for standard even if it doesn't match the type (standard) originally passed in the request. This adds validation of this type.

After:
https://github.com/MetaMask/core/assets/34557516/92a9bba5-c466-4ebc-b82c-b395649be52b

Changelog

@metamask/assets-controllers

  • ADDED: Adds validation that the standard of an NFT added via the watchNFT method matches the type argument passed with the request.

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

@adonesky1 adonesky1 requested a review from a team as a code owner June 27, 2023 19:18
@adonesky1 adonesky1 merged commit 080a4cd into main Jun 27, 2023
91 checks passed
@adonesky1 adonesky1 deleted the validate-watchAsset-nft-type branch June 27, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants