What is @metaplex-foundation/mpl-token-metadata?
@metaplex-foundation/mpl-token-metadata is an npm package that provides tools and utilities for interacting with token metadata on the Solana blockchain. It is part of the Metaplex ecosystem, which is designed to facilitate the creation, management, and trading of NFTs and other digital assets on Solana.
What are @metaplex-foundation/mpl-token-metadata's main functionalities?
Create Metadata
This feature allows you to create a new metadata account for a token on the Solana blockchain. The code sample demonstrates how to use the `createCreateMetadataAccountV2Instruction` function to set up the necessary parameters for creating metadata.
const { createCreateMetadataAccountV2Instruction } = require('@metaplex-foundation/mpl-token-metadata');
const createMetadata = (metadataAccount, mint, mintAuthority, payer, updateAuthority, metadataData) => {
return createCreateMetadataAccountV2Instruction({
metadata: metadataAccount,
mint,
mintAuthority,
payer,
updateAuthority,
metadataData,
});
};
Update Metadata
This feature allows you to update the metadata of an existing token. The code sample shows how to use the `createUpdateMetadataAccountV2Instruction` function to update the metadata with new information.
const { createUpdateMetadataAccountV2Instruction } = require('@metaplex-foundation/mpl-token-metadata');
const updateMetadata = (metadataAccount, updateAuthority, metadataData) => {
return createUpdateMetadataAccountV2Instruction({
metadata: metadataAccount,
updateAuthority,
metadataData,
});
};
Verify Collection
This feature allows you to verify a collection of NFTs. The code sample demonstrates how to use the `createVerifyCollectionInstruction` function to verify that a token belongs to a specific collection.
const { createVerifyCollectionInstruction } = require('@metaplex-foundation/mpl-token-metadata');
const verifyCollection = (metadataAccount, collectionAuthority, collectionMint) => {
return createVerifyCollectionInstruction({
metadata: metadataAccount,
collectionAuthority,
collectionMint,
});
};
0
JavaScript client for Mpl Token Metadata
A Umi-compatible JavaScript library for Token Metadata.
Getting started
- First, if you're not already using Umi, follow these instructions to install the Umi framework.
- Next, install this library using the package manager of your choice.
npm install @metaplex-foundation/mpl-token-metadata
- Finally, register the library with your Umi instance like so.
import { mplTokenMetadata } from '@metaplex-foundation/mpl-token-metadata';
umi.use(mplTokenMetadata());
You can learn more about this library's API by reading its generated TypeDoc documentation.
Contributing
Check out the Contributing Guide the learn more about how to contribute to this library.