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 and MajorLift committed Oct 11, 2023
1 parent 62d12a4 commit 2fc8ba0
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 2fc8ba0

Please sign in to comment.