Protected
Readonly
metaplexYou may use the builders()
client to access the
underlying Transaction Builders of this module.
const buildersClient = metaplex.nfts().builders();
You may use the pdas()
client to build PDAs related to this module.
const pdasClient = metaplex.nfts().pdas();
Finds an NFT or an SFT by its mint address.
const nft = await metaplex
.nfts()
.findByMint({ mintAddress };
Optional
options: OperationOptionsFinds an NFT or an SFT by its metadata address.
const nft = await metaplex
.nfts()
.findByMetadata({ metadata };
Optional
options: OperationOptionsFinds an NFT or an SFT by its token address.
const nft = await metaplex
.nfts()
.findByToken({ token };
Optional
options: OperationOptionsFinds multiple NFTs and SFTs by their creator at a given position.
// Find all by first creator.
const nfts = await metaplex
.nfts()
.findAllByCreator({ creator };
// Find all by second creator.
const nfts = await metaplex
.nfts()
.findAllByCreator({ creator, position: 2 };
Optional
options: OperationOptionsFinds multiple NFTs and SFTs by a given list of mint addresses.
const nfts = await metaplex
.nfts()
.findAllByMintList({ mints: [...] };
Optional
options: OperationOptionsFinds multiple NFTs and SFTs by a given owner.
const nfts = await metaplex
.nfts()
.findAllByOwner({ owner };
Optional
options: OperationOptionsFinds multiple NFTs and SFTs by a given update authority.
const nfts = await metaplex
.nfts()
.findAllByUpdateAuthority({ updateAuthority };
Optional
options: OperationOptionsFinds an NFT or an SFT by its mint address.
const nft = await metaplex
.nfts()
.findByAssetId({ assetId };
Optional
options: OperationOptionsTransforms a Metadata
model into a Nft
or Sft
model.
const nfts = await metaplex
.nfts()
.load({ metadata };
Optional
options: OperationOptionsHelper method that refetches a given model and returns an instance of the same type.
nft = await metaplex.nfts().refresh(nft);
sft = await metaplex.nfts().refresh(sft);
nftWithToken = await metaplex.nfts().refresh(nftWithToken);
Optional
input: Omit<FindNftByMintInput, "mintAddress" | "tokenOwner" | "tokenAddres">Optional
options: OperationOptionsCreates a new NFT.
const { nft } = await metaplex
.nfts()
.create({
name: 'My NFT',
uri: 'https://example.com/my-nft',
sellerFeeBasisPoints: 250, // 2.5%
};
Optional
options: OperationOptionsCreates a new SFT.
const { sft } = await metaplex
.nfts()
.createSft({
name: 'My SFT',
uri: 'https://example.com/my-sft',
sellerFeeBasisPoints: 250, // 2.5%
};
Optional
options: OperationOptionsPrints a new edition from an original NFT.
const { nft } = await metaplex
.nfts()
.printNewEdition({ originalMint };
Optional
options: OperationOptionsUploads a JSON Metadata object to the current storage provider.
const { uri } = await metaplex
.nfts()
.uploadMetadata({
name: "My NFT",
description: "My description",
image: "https://arweave.net/123",
};
Optional
options: OperationOptionsUpdates an existing NFT or SFT.
await metaplex
.nfts()
.update({ nftOrSft, name: "My new NFT name" });
Optional
options: OperationOptionsDeletes an existing NFT.
await metaplex
.nfts()
.delete({ mintAddress };
Optional
options: OperationOptionsApprove a new delegate authority for an NFT or SFT.
await metaplex.nfts().delegate({
nftOrSft,
delegate,
delegateArgs
});
Optional
options: OperationOptionsRevoke an existing delegate authority for an NFT or SFT.
await metaplex.nfts().revoke({ sftOrNft, delegate });
Optional
options: OperationOptionsUtilizes a usable NFT.
await metaplex.nfts().use({ mintAddress });
await metaplex.nfts().use({ mintAddress, numberOfUses: 3 });
Optional
options: OperationOptionsApproves a new use authority.
await metaplex
.nfts()
.approveUseAuthority({ mintAddress, user };
Optional
options: OperationOptionsRevokes an existing use authority.
await metaplex
.nfts()
.revokeUseAuthority({ mintAddress, user };
Optional
options: OperationOptionsVerifies the creator of an NFT or SFT.
await metaplex
.nfts()
.verifyCreator({ mintAddress, creator };
Optional
options: OperationOptionsUnverifies the creator of an NFT or SFT.
await metaplex
.nfts()
.unverifyCreator({ mintAddress, creator };
Optional
options: OperationOptionsVerifies the collection of an NFT or SFT.
await metaplex
.nfts()
.verifyCollection({ mintAddress, collectionMintAddress };
Optional
options: OperationOptionsUnverifies the collection of an NFT or SFT.
await metaplex
.nfts()
.unverifyCollection({ mintAddress, collectionMintAddress };
Optional
options: OperationOptionsApproves a new collection authority.
await metaplex
.nfts()
.approveCollectionAuthority({
mintAddress,
collectionAuthority,
};
Optional
options: OperationOptionsRevokes an existing collection authority.
await metaplex
.nfts()
.revokeCollectionAuthority({ mintAddress, collectionAuthority };
Optional
options: OperationOptionsMigrates a legacy Collection NFT to a sized Collection NFT. Both can act as a Collection for NFTs but only the latter keeps track of the size of the collection on chain.
await metaplex
.nfts()
.migrateToSizedCollection({ mintAddress, size: toBigNumber(10000) };
Optional
options: OperationOptionsLock a programmable NFT.
await metaplex.nfts().lock({ nftOrSft, authority });
Optional
options: OperationOptionsUnlock a programmable NFT.
await metaplex.nfts().unlock({ nftOrSft, authority });
Optional
options: OperationOptionsMint token(s) for an NFT or SFT.
await metaplex.nfts().mint({
nftOrSft,
toOwner,
amount: token(5),
});
Optional
options: OperationOptionsTransfers an NFT or SFT from one account to another.
await metaplex.nfts().transfer({
nftOrSft,
toOwner,
amount: token(5),
});
Optional
options: OperationOptionsFreezes a NFT via its delegate authority.
await metaplex
.nfts()
.freezeDelegatedNft({ mintAddress, delegateAuthority };
Optional
options: OperationOptionsThaws a NFT via its delegate authority.
await metaplex
.nfts()
.thawDelegatedNft({ mintAddress, delegateAuthority };
Optional
options: OperationOptionsGenerated using TypeDoc
This is a client for the NFT module.
It enables us to interact with the Token Metadata program in order to manage NFTs and SFTs.
You may access this client via the
nfts()
method of yourMetaplex
instance.Example
You can upload some custom JSON metadata and use its URI to create a new NFT like so. The owner and update authority of this NFT will, by default, be the current identity of the metaplex instance.