
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@metaplex-foundation/mpl-token-metadata
Advanced tools
@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.
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,
});
};
This package contains the token vault contract SDK code.
Find the token-metadata API docs published here.
npm install @metaplex-foundation/mpl-token-metadata --save
This will use the new auto-generated API. If you want to use the old deprecated API, you can use the following:
npm install @metaplex-foundation/mpl-token-metadata@^1.2 --save
Alternatively, if you'd like to start using the new API but still have access to the deprecated one, you may use the following:
npm install @metaplex-foundation/mpl-token-metadata@~2.0 --save
And use the deprecated API explicitly like so:
import { deprecated } from "@metaplex-foundation/mpl-token-metadata";
In order to update the generated SDK when the rust contract was updated please run:
yarn gen:api
and then update the wrapper code and tests.
Apache v2.0
FAQs
JavaScript client for Token Metadata
The npm package @metaplex-foundation/mpl-token-metadata receives a total of 261,327 weekly downloads. As such, @metaplex-foundation/mpl-token-metadata popularity was classified as popular.
We found that @metaplex-foundation/mpl-token-metadata demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.