CAVYAR

CAVYAR AI

Verify Collection NFT with Umi

Verify Collection
Umi
Verify
Collection
Collection NFT

Once the Collection attribute is set on an NFT, an authority of the Collection NFT can send a Verify instruction on the Token Metadata to flip its verify attribute from false to true.

import { verifyCollectionV1, mplTokenMetadata, } from "@metaplex-foundation/mpl-token-metadata"; import { generateSigner, publicKey } from "@metaplex-foundation/umi"; import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; const umi = createUmi("https://api.mainnet-beta.solana.com", "processed").use( mplTokenMetadata() ); const metadata = publicKey("YourMetadataAccount"); // Address of the NFTs metadata account const collectionMint = publicKey("YourCollectionMint"); // The mint account of the collection const collectionAuthority = generateSigner(umi); // Authority of the collection NFT, can also be a Delegate await verifyCollectionV1(umi, { metadata, collectionMint, authority: collectionAuthority, }).sendAndConfirm(umi);

CAVYAR AI

CAVYAR AI is in its earliest stages of development and the quality of generated descriptions will improve massively over time. At this stage, there is a risk of false information being generated.

The given code snippet is used to verify a collection NFT using Umi on the Solana blockchain. Here's what the code does:

  1. It imports the necessary functions and modules from the "@metaplex-foundation/mpl-token-metadata" and "@metaplex-foundation/umi" packages.

  2. It creates an instance of Umi using the createUmi function, passing the Solana API endpoint and the network environment as parameters. The mplTokenMetadata function is then used to enable the Token Metadata extension for Umi.

  3. The publicKey function is used to create a public key object for the NFT's metadata account and the collection mint account. These public key objects are assigned to the metadata and collectionMint variables, respectively.

  4. The generateSigner function is used to generate the authority for the collection NFT. The umi instance is passed as a parameter to the generateSigner function, and the resulting authority is assigned to the collectionAuthority variable.

  5. The verifyCollectionV1 function is called with the umi instance and an object containing the metadata, collectionMint, and authority parameters. This function verifies the collection NFT by flipping its verify attribute from false to true.

  6. The sendAndConfirm method is called on the result of the verifyCollectionV1 function, passing the umi instance as a parameter. This method sends the verify instruction to the Solana blockchain and confirms its execution.

In summary, the code verifies a collection NFT by calling the verifyCollectionV1 function with the necessary parameters and then sends and confirms the verify instruction using the sendAndConfirm method.

Ask

Soon™

Created by:

Axax...GsG2

Give this snippet a feedback!

Published on

April 24, 2025

Want to support the author?