Skip to content

Commit

Permalink
add validation that the nft standard matches the type argument (#1455)
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 authored Jun 27, 2023
1 parent 50e4d50 commit 080a4cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/assets-controllers/src/NftController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,12 @@ export class NftController extends BaseController<NftConfig, NftState> {
asset.tokenId,
);

if (nftMetadata.standard && nftMetadata.standard !== type) {
throw rpcErrors.invalidInput(
`Suggested NFT of type ${nftMetadata.standard} does not match received type ${type}`,
);
}

const suggestedNftMeta: SuggestedNftMeta = {
asset: { ...asset, ...nftMetadata },
type,
Expand Down

0 comments on commit 080a4cd

Please sign in to comment.