Token Metadata is a legacy program. It remains supported, but is not recommended for new projects. Use Core instead.
Features
Delegated Authorities
Having a single authority on our assets is not always ideal. Sometimes we want to delegate some of these responsibilities to other wallets or programs so they can do things on our behalf. This is why Token Metadata offers a whole set of delegates with different scopes.
Metadata vs Token Delegates
The delegates offered by Token Metadata can be split into two categories: the Metadata Delegates and the Token Delegates. We'll go through each of them in more detail below but let's have a quick look at how they differ.
- Metadata Delegates are associated with the Mint account of the asset and allow the delegated authority to perform updates on the Metadata account. They are approved by the update authority of the asset and there can be as many as needed.
- Token Delegates are associated with the Token account of the asset and allow the delegated authority to transfer, burn and/or lock the token(s). They are approved by the owner of the asset and there can only be one per token account at a time.
Metadata Delegates
Metadata Delegates are delegates that operate at the Metadata level. These delegates are stored using a Metadata Delegate Record PDA — whose seeds are ["metadata", program id, mint id, delegate role, update authority id, delegate id].
That account keeps track of the Delegate authority as well as the Update Authority that approved it.
Here are some key properties of Metadata Delegates:
- There can be as many Metadata delegates as needed for a given asset.
- Metadata delegates are derived from the Mint account which means they exist regardless of the owner of the asset. Thus, transferring an asset does not affect the Metadata delegates.
- Metadata delegates are also derived from the current Update Authority of the asset. This means, whenever the Update Authority is updated on an asset, all Metadata delegates are voided and cannot be used by the new Update Authority. However, if the Update Authority was to be transferred back, all Metadata delegates associated with it would automatically reactivate.
- Metadata delegates can be revoked by the Update Authority that approved them.
- Metadata delegates can also revoke themselves.
There exist 7 different types of Metadata Delegates, each with a different scope of action. Here is a table summarizing the different types of Metadata Delegates:
| Delegate | Self-updates | Update items in collection | Update scope |
|---|---|---|---|
| Authority Item | ✅ | ❌ | newUpdateAuthority ,primarySaleHappened ,isMutable ,tokenStandard |
| Collection | ✅ | ✅ | collection + verify/unverify collection on items |
| Collection Item | ✅ | ❌ | collection |
| Data | ✅ | ✅ | data |
| Data Item | ✅ | ❌ | data |
| Programmable Configs | ✅ | ✅ | programmableConfigs |
| Programmable Configs Item | ✅ | ❌ | programmableConfigs |
Notice that the Metadata delegates whose name ends with Item can only act on themselves, whereas the other ones can also act on the collection items of the delegate asset. For instance, say we have a Collection NFT A that includes NFTs B and C. When we approve a Data delegate on A, we can update the data object of NFTs A, B and C. However, when we approve a Data Item delegate on A, we can only update the data object of NFT A.
Additionally, the Collection delegate is a little special as it also allows us to verify/unverify the delegated NFT on the items of the collection. In the example above, when we approve a Collection delegate on A, we can verify/unverify that collection on NFTs B and C.
Let's go through each of these Metadata delegates in a bit more detail and provide code samples for approving, revoking and using them.
Authority Item Delegate
- The Delegate Authority can update a sub-set of the asset. It can update the following properties of the Metadata account:
newUpdateAuthority: transfers the Update Authority to another account.primarySaleHappened: toggles totruewhen the primary sale of the asset has happened.isMutable: toggles tofalseto make the asset immutable.tokenStandard: can set the token standard if the asset was created before it was mandatory to set it.
1import { delegateAuthorityItemV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, updateAuthority, and authorityItemDelegate are set up
4
5await delegateAuthorityItemV1(umi, {
6 mint,
7 authority: updateAuthority,
8 delegate: authorityItemDelegate,
9 tokenStandard: TokenStandard.NonFungible,
10}).sendAndConfirm(umi);
11
12console.log('Authority Item delegate approved');
1import {
2 getDelegateAuthorityItemV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, updateAuthority, and authorityItemDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9
10// Approve an Authority Item delegate
11const delegateIx = await getDelegateAuthorityItemV1InstructionAsync({
12 mint: mintAddress,
13 delegate: authorityItemDelegate,
14 authority: updateAuthority,
15 payer: updateAuthority,
16 tokenStandard: TokenStandard.NonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [delegateIx],
21 payer: updateAuthority,
22});
23
24console.log('Authority Item delegate approved');
1import { revokeAuthorityItemV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, updateAuthority, and authorityItemDelegate are set up
4
5await revokeAuthorityItemV1(umi, {
6 mint,
7 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke.
8 delegate: authorityItemDelegate,
9 tokenStandard: TokenStandard.NonFungible,
10}).sendAndConfirm(umi);
11
12console.log('Authority Item delegate revoked');
1import {
2 getRevokeAuthorityItemV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, updateAuthority, and authorityItemDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9
10// Revoke an Authority Item delegate
11// Note: Either the update authority or the delegate itself can revoke
12const revokeIx = await getRevokeAuthorityItemV1InstructionAsync({
13 mint: mintAddress,
14 delegate: authorityItemDelegate,
15 authority: updateAuthority, // Or pass the delegate to self-revoke
16 payer: updateAuthority,
17 tokenStandard: TokenStandard.NonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [revokeIx],
22 payer: updateAuthority,
23});
24
25console.log('Authority Item delegate revoked');
1import { updateAsAuthorityItemDelegateV2 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, authorityItemDelegate, and newUpdateAuthority are set up
4
5await updateAsAuthorityItemDelegateV2(umi, {
6 mint,
7 authority: authorityItemDelegate,
8 newUpdateAuthority,
9 isMutable: false,
10}).sendAndConfirm(umi);
11
12console.log('Asset updated by Authority Item delegate');
1import {
2 getUpdateAsAuthorityItemDelegateV2InstructionAsync,
3} from '@metaplex-foundation/mpl-token-metadata-kit';
4
5// Assuming rpc, rpcSubscriptions, sendAndConfirm, and authorityItemDelegate are set up
6
7const mintAddress = 'mintAddress...'; // The NFT mint address
8const newUpdateAuthority = 'newUpdateAuthorityAddress...';
9
10// Update as Authority Item delegate
11const updateIx = await getUpdateAsAuthorityItemDelegateV2InstructionAsync({
12 mint: mintAddress,
13 authority: authorityItemDelegate,
14 payer: authorityItemDelegate,
15 newUpdateAuthority,
16 isMutable: false,
17});
18
19await sendAndConfirm({
20 instructions: [updateIx],
21 payer: authorityItemDelegate,
22});
23
24console.log('Asset updated by Authority Item delegate');
Collection Delegate
- The Delegate Authority can update a sub-set of the asset. It can set the
collectionattribute of the Metadata account. - When applied to a Collection NFT, the Delegate Authority can perform the following actions on the items inside that Collection:
- It can verify and unverify that Collection NFT on the item. It can only do this if the Collection NFT is already set on the item. Otherwise, there is no way of knowing that the item is part of the delegated Collection NFT.
- It can clear the Collection NFT from the item.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateCollectionV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const collectionDelegate = publicKey('delegateAddress...');
10
11await delegateCollectionV1(umi, {
12 mint,
13 authority: updateAuthority,
14 delegate: collectionDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Collection delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateCollectionV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const collectionDelegate = address('delegateAddress...');
9
10const delegateIx = await getDelegateCollectionV1InstructionAsync({
11 mint,
12 authority: updateAuthority,
13 delegate: collectionDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [delegateIx],
19 payer: updateAuthority,
20});
21
22console.log('Collection delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeCollectionV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const collectionDelegate = publicKey('delegateAddress...');
10
11await revokeCollectionV1(umi, {
12 mint,
13 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
14 delegate: collectionDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Collection delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeCollectionV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const collectionDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeCollectionV1InstructionAsync({
11 mint,
12 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
13 delegate: collectionDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [revokeIx],
19 payer: updateAuthority,
20});
21
22console.log('Collection delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsCollectionDelegateV2,
4 collectionToggle,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const collectionDelegate = umi.identity; // The delegate authority
9const collectionMint = publicKey('collectionMintAddress...');
10
11await updateAsCollectionDelegateV2(umi, {
12 mint,
13 authority: collectionDelegate,
14 collection: collectionToggle('Set', [
15 { key: collectionMint, verified: false },
16 ]),
17}).sendAndConfirm(umi);
18
19console.log('Collection set on asset');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsCollectionDelegateV2InstructionAsync,
4 CollectionToggle,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const collectionMint = address('collectionMintAddress...');
9
10const updateIx = await getUpdateAsCollectionDelegateV2InstructionAsync({
11 mint,
12 authority: collectionDelegate,
13 collection: {
14 __kind: 'Set',
15 fields: [{ key: collectionMint, verified: false }],
16 },
17});
18
19await sendAndConfirm({
20 instructions: [updateIx],
21 payer: collectionDelegate,
22});
23
24console.log('Collection set on asset');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsCollectionDelegateV2,
4 collectionToggle,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...'); // The item to clear collection from
8const collectionMint = publicKey('collectionMintAddress...');
9const collectionDelegate = umi.identity; // The delegate authority
10
11await updateAsCollectionDelegateV2(umi, {
12 mint,
13 delegateMint: collectionMint,
14 authority: collectionDelegate,
15 collection: collectionToggle('Clear'),
16}).sendAndConfirm(umi);
17
18console.log('Collection cleared from item');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsCollectionDelegateV2InstructionAsync,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6const mint = address('mintAddress...'); // The item to clear collection from
7const collectionMint = address('collectionMintAddress...');
8
9const updateIx = await getUpdateAsCollectionDelegateV2InstructionAsync({
10 mint,
11 delegateMint: collectionMint,
12 authority: collectionDelegate,
13 collection: { __kind: 'Clear' },
14});
15
16await sendAndConfirm({
17 instructions: [updateIx],
18 payer: collectionDelegate,
19});
20
21console.log('Collection cleared from item');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 verifyCollectionV1,
4 findMetadataPda,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...'); // The item to verify
8const collectionMint = publicKey('collectionMintAddress...');
9const collectionDelegate = umi.identity; // The delegate authority
10
11await verifyCollectionV1(umi, {
12 metadata: findMetadataPda(umi, { mint }),
13 collectionMint,
14 authority: collectionDelegate,
15}).sendAndConfirm(umi);
16
17console.log('Collection verified on item');
1import { address } from '@solana/addresses';
2import {
3 getVerifyCollectionV1InstructionAsync,
4 findMetadataPda,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...'); // The item to verify
8const collectionMint = address('collectionMintAddress...');
9
10const [metadata] = await findMetadataPda({ mint });
11const verifyIx = await getVerifyCollectionV1InstructionAsync({
12 metadata,
13 collectionMint,
14 authority: collectionDelegate,
15});
16
17await sendAndConfirm({
18 instructions: [verifyIx],
19 payer: collectionDelegate,
20});
21
22console.log('Collection verified on item');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 unverifyCollectionV1,
4 findMetadataPda,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...'); // The item to unverify
8const collectionMint = publicKey('collectionMintAddress...');
9const collectionDelegate = umi.identity; // The delegate authority
10
11await unverifyCollectionV1(umi, {
12 metadata: findMetadataPda(umi, { mint }),
13 collectionMint,
14 authority: collectionDelegate,
15}).sendAndConfirm(umi);
16
17console.log('Collection unverified on item');
1import { address } from '@solana/addresses';
2import {
3 getUnverifyCollectionV1InstructionAsync,
4 findMetadataPda,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...'); // The item to unverify
8const collectionMint = address('collectionMintAddress...');
9
10const [metadata] = await findMetadataPda({ mint });
11const unverifyIx = await getUnverifyCollectionV1InstructionAsync({
12 metadata,
13 collectionMint,
14 authority: collectionDelegate,
15});
16
17await sendAndConfirm({
18 instructions: [unverifyIx],
19 payer: collectionDelegate,
20});
21
22console.log('Collection unverified on item');
Collection Item Delegate
- The Delegate Authority can update a sub-set of the asset. It can set the
collectionattribute of the Metadata account. - Even if the asset is a Collection NFT, and contrary to the Collection Delegate, the Collection Item Delegate cannot affect the items of that collection.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateCollectionItemV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const collectionItemDelegate = publicKey('delegateAddress...');
10
11await delegateCollectionItemV1(umi, {
12 mint,
13 authority: updateAuthority,
14 delegate: collectionItemDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Collection Item delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateCollectionItemV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const collectionItemDelegate = address('delegateAddress...');
9
10const delegateIx = await getDelegateCollectionItemV1InstructionAsync({
11 mint,
12 authority: updateAuthority,
13 delegate: collectionItemDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [delegateIx],
19 payer: updateAuthority,
20});
21
22console.log('Collection Item delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeCollectionItemV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const collectionItemDelegate = publicKey('delegateAddress...');
10
11await revokeCollectionItemV1(umi, {
12 mint,
13 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
14 delegate: collectionItemDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Collection Item delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeCollectionItemV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const collectionItemDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeCollectionItemV1InstructionAsync({
11 mint,
12 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
13 delegate: collectionItemDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [revokeIx],
19 payer: updateAuthority,
20});
21
22console.log('Collection Item delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsCollectionItemDelegateV2,
4 collectionToggle,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const collectionMint = publicKey('collectionMintAddress...');
9const collectionItemDelegate = umi.identity; // The delegate authority
10
11await updateAsCollectionItemDelegateV2(umi, {
12 mint,
13 authority: collectionItemDelegate,
14 collection: collectionToggle('Set', [
15 { key: collectionMint, verified: false },
16 ]),
17}).sendAndConfirm(umi);
18
19console.log('Collection set on asset via Collection Item delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsCollectionItemDelegateV2InstructionAsync,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6const mint = address('mintAddress...');
7const collectionMint = address('collectionMintAddress...');
8
9const updateIx = await getUpdateAsCollectionItemDelegateV2InstructionAsync({
10 mint,
11 authority: collectionItemDelegate,
12 collection: {
13 __kind: 'Set',
14 fields: [{ key: collectionMint, verified: false }],
15 },
16});
17
18await sendAndConfirm({
19 instructions: [updateIx],
20 payer: collectionItemDelegate,
21});
22
23console.log('Collection set on asset via Collection Item delegate');
Data Delegate
- The Delegate Authority can update a sub-set of the asset. It can update the entire
dataobject of the Metadata account but nothing else. This means it can update thecreatorsof the asset. - Note that when updating the
creatorsarray inside thedataobject, it can only add and/or remove unverified creators. - When applied to a Collection NFT, the Delegate Authority can perform the same updates on the items inside that Collection.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateDataV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const dataDelegate = publicKey('delegateAddress...');
10
11await delegateDataV1(umi, {
12 mint,
13 authority: updateAuthority,
14 delegate: dataDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Data delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateDataV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const dataDelegate = address('delegateAddress...');
9
10const delegateIx = await getDelegateDataV1InstructionAsync({
11 mint,
12 authority: updateAuthority,
13 delegate: dataDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [delegateIx],
19 payer: updateAuthority,
20});
21
22console.log('Data delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeDataV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const dataDelegate = publicKey('delegateAddress...');
10
11await revokeDataV1(umi, {
12 mint,
13 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
14 delegate: dataDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Data delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeDataV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const dataDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeDataV1InstructionAsync({
11 mint,
12 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
13 delegate: dataDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [revokeIx],
19 payer: updateAuthority,
20});
21
22console.log('Data delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsDataDelegateV2,
4 fetchMetadataFromSeeds,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const dataDelegate = umi.identity; // The delegate authority
9
10const initialMetadata = await fetchMetadataFromSeeds(umi, { mint });
11await updateAsDataDelegateV2(umi, {
12 mint,
13 authority: dataDelegate,
14 data: { ...initialMetadata, name: 'Updated Name' },
15}).sendAndConfirm(umi);
16
17console.log('Asset data updated via Data delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsDataDelegateV2InstructionAsync,
4 fetchMetadata,
5 findMetadataPda,
6} from '@metaplex-foundation/mpl-token-metadata-kit';
7
8const mint = address('mintAddress...');
9
10const [metadataAddress] = await findMetadataPda({ mint });
11const initialMetadata = await fetchMetadata(rpc, metadataAddress);
12
13const updateIx = await getUpdateAsDataDelegateV2InstructionAsync({
14 mint,
15 authority: dataDelegate,
16 data: {
17 ...initialMetadata,
18 name: 'Updated Name',
19 creators: null, // Required when passing data
20 },
21});
22
23await sendAndConfirm({
24 instructions: [updateIx],
25 payer: dataDelegate,
26});
27
28console.log('Asset data updated via Data delegate');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsDataDelegateV2,
4 fetchMetadataFromSeeds,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...'); // The collection item to update
8const collectionMint = publicKey('collectionMintAddress...');
9const dataDelegate = umi.identity; // The delegate authority (delegated on collection)
10
11const initialMetadata = await fetchMetadataFromSeeds(umi, { mint });
12await updateAsDataDelegateV2(umi, {
13 mint,
14 delegateMint: collectionMint,
15 authority: dataDelegate,
16 data: { ...initialMetadata, name: 'Updated Name' },
17}).sendAndConfirm(umi);
18
19console.log('Collection item data updated via Data delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsDataDelegateV2InstructionAsync,
4 fetchMetadata,
5 findMetadataPda,
6} from '@metaplex-foundation/mpl-token-metadata-kit';
7
8const mint = address('mintAddress...'); // The collection item to update
9const collectionMint = address('collectionMintAddress...');
10
11const [metadataAddress] = await findMetadataPda({ mint });
12const initialMetadata = await fetchMetadata(rpc, metadataAddress);
13
14const updateIx = await getUpdateAsDataDelegateV2InstructionAsync({
15 mint,
16 delegateMint: collectionMint,
17 authority: dataDelegate,
18 data: {
19 ...initialMetadata,
20 name: 'Updated Name',
21 creators: null, // Required when passing data
22 },
23});
24
25await sendAndConfirm({
26 instructions: [updateIx],
27 payer: dataDelegate,
28});
29
30console.log('Collection item data updated via Data delegate');
Data Item Delegate
- The Delegate Authority can update a sub-set of the asset. It can update the entire
dataobject of the Metadata account but nothing else. This means it can update thecreatorsof the asset. - Note that when updating the
creatorsarray inside thedataobject, it can only add and/or remove unverified creators. - Even if the asset is a Collection NFT, and contrary to the Data Delegate, the Data Item Delegate cannot affect the items of that collection.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateDataItemV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const dataItemDelegate = publicKey('delegateAddress...');
10
11await delegateDataItemV1(umi, {
12 mint,
13 authority: updateAuthority,
14 delegate: dataItemDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Data Item delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateDataItemV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const dataItemDelegate = address('delegateAddress...');
9
10const delegateIx = await getDelegateDataItemV1InstructionAsync({
11 mint,
12 authority: updateAuthority,
13 delegate: dataItemDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [delegateIx],
19 payer: updateAuthority,
20});
21
22console.log('Data Item delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeDataItemV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const dataItemDelegate = publicKey('delegateAddress...');
10
11await revokeDataItemV1(umi, {
12 mint,
13 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
14 delegate: dataItemDelegate,
15 tokenStandard: TokenStandard.NonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Data Item delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeDataItemV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const dataItemDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeDataItemV1InstructionAsync({
11 mint,
12 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
13 delegate: dataItemDelegate,
14 tokenStandard: TokenStandard.NonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [revokeIx],
19 payer: updateAuthority,
20});
21
22console.log('Data Item delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsDataItemDelegateV2,
4 fetchMetadataFromSeeds,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const dataItemDelegate = umi.identity; // The delegate authority
9
10const initialMetadata = await fetchMetadataFromSeeds(umi, { mint });
11await updateAsDataItemDelegateV2(umi, {
12 mint,
13 authority: dataItemDelegate,
14 data: { ...initialMetadata, name: 'Updated Name' },
15}).sendAndConfirm(umi);
16
17console.log('Asset data updated via Data Item delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsDataItemDelegateV2InstructionAsync,
4 fetchMetadata,
5 findMetadataPda,
6} from '@metaplex-foundation/mpl-token-metadata-kit';
7
8const mint = address('mintAddress...');
9
10const [metadataAddress] = await findMetadataPda({ mint });
11const initialMetadata = await fetchMetadata(rpc, metadataAddress);
12
13const updateIx = await getUpdateAsDataItemDelegateV2InstructionAsync({
14 mint,
15 authority: dataItemDelegate,
16 data: {
17 ...initialMetadata,
18 name: 'Updated Name',
19 creators: null, // Required when passing data
20 },
21});
22
23await sendAndConfirm({
24 instructions: [updateIx],
25 payer: dataItemDelegate,
26});
27
28console.log('Asset data updated via Data Item delegate');
Programmable Config Delegate
- The Programmable Config Delegate is only relevant for Programmable Non-Fungibles.
- The Delegate Authority can update the
programmableConfigsattribute of the Metadata account but nothing else. This means it can update theruleSetof the PNFT. - When applied to a Collection NFT, the Delegate Authority can perform the same updates on the items inside that Collection.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateProgrammableConfigV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const programmableConfigDelegate = publicKey('delegateAddress...');
10
11await delegateProgrammableConfigV1(umi, {
12 mint,
13 authority: updateAuthority,
14 delegate: programmableConfigDelegate,
15 tokenStandard: TokenStandard.ProgrammableNonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Programmable Config delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateProgrammableConfigV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const programmableConfigDelegate = address('delegateAddress...');
9
10const delegateIx = await getDelegateProgrammableConfigV1InstructionAsync({
11 mint,
12 authority: updateAuthority,
13 delegate: programmableConfigDelegate,
14 tokenStandard: TokenStandard.ProgrammableNonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [delegateIx],
19 payer: updateAuthority,
20});
21
22console.log('Programmable Config delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeProgrammableConfigV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const programmableConfigDelegate = publicKey('delegateAddress...');
10
11await revokeProgrammableConfigV1(umi, {
12 mint,
13 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
14 delegate: programmableConfigDelegate,
15 tokenStandard: TokenStandard.ProgrammableNonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Programmable Config delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeProgrammableConfigV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const programmableConfigDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeProgrammableConfigV1InstructionAsync({
11 mint,
12 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
13 delegate: programmableConfigDelegate,
14 tokenStandard: TokenStandard.ProgrammableNonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [revokeIx],
19 payer: updateAuthority,
20});
21
22console.log('Programmable Config delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsProgrammableConfigDelegateV2,
4 ruleSetToggle,
5} from '@metaplex-foundation/mpl-token-metadata';
6import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
7
8const mint = publicKey('mintAddress...');
9const assetOwner = publicKey('ownerAddress...');
10const programmableConfigDelegate = umi.identity; // The delegate authority
11const ruleSet = publicKey('ruleSetAddress...');
12
13await updateAsProgrammableConfigDelegateV2(umi, {
14 mint,
15 token: findAssociatedTokenPda(umi, { mint, owner: assetOwner }),
16 authority: programmableConfigDelegate,
17 ruleSet: ruleSetToggle('Set', [ruleSet]),
18}).sendAndConfirm(umi);
19
20console.log('Rule set updated via Programmable Config delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsProgrammableConfigDelegateV2InstructionAsync,
4 findAssociatedTokenPda,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const assetOwner = address('ownerAddress...');
9const ruleSet = address('ruleSetAddress...');
10
11const [token] = await findAssociatedTokenPda({ mint, owner: assetOwner });
12const updateIx = await getUpdateAsProgrammableConfigDelegateV2InstructionAsync({
13 mint,
14 token,
15 authority: programmableConfigDelegate,
16 ruleSet: { __kind: 'Set', fields: [ruleSet] },
17});
18
19await sendAndConfirm({
20 instructions: [updateIx],
21 payer: programmableConfigDelegate,
22});
23
24console.log('Rule set updated via Programmable Config delegate');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsProgrammableConfigDelegateV2,
4 ruleSetToggle,
5} from '@metaplex-foundation/mpl-token-metadata';
6import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
7
8const mint = publicKey('mintAddress...'); // The collection item
9const collectionMint = publicKey('collectionMintAddress...');
10const assetOwner = publicKey('ownerAddress...');
11const programmableConfigDelegate = umi.identity; // The delegate authority
12const ruleSet = publicKey('ruleSetAddress...');
13
14await updateAsProgrammableConfigDelegateV2(umi, {
15 mint,
16 token: findAssociatedTokenPda(umi, { mint, owner: assetOwner }),
17 delegateMint: collectionMint,
18 authority: programmableConfigDelegate,
19 ruleSet: ruleSetToggle('Set', [ruleSet]),
20}).sendAndConfirm(umi);
21
22console.log('Collection item rule set updated via Programmable Config delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsProgrammableConfigDelegateV2InstructionAsync,
4 findAssociatedTokenPda,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...'); // The collection item
8const collectionMint = address('collectionMintAddress...');
9const assetOwner = address('ownerAddress...');
10const ruleSet = address('ruleSetAddress...');
11
12const [token] = await findAssociatedTokenPda({ mint, owner: assetOwner });
13const updateIx = await getUpdateAsProgrammableConfigDelegateV2InstructionAsync({
14 mint,
15 token,
16 delegateMint: collectionMint,
17 authority: programmableConfigDelegate,
18 ruleSet: { __kind: 'Set', fields: [ruleSet] },
19});
20
21await sendAndConfirm({
22 instructions: [updateIx],
23 payer: programmableConfigDelegate,
24});
25
26console.log('Collection item rule set updated via Programmable Config delegate');
Programmable Config Item Delegate
- The Programmable Config Delegate is only relevant for Programmable Non-Fungibles.
- The Delegate Authority can update the
programmableConfigsattribute of the Metadata account but nothing else. This means it can update theruleSetof the PNFT. - Even if the asset is a Collection NFT, and contrary to the Programmable Config Delegate, the Programmable Config Item Delegate cannot affect the items of that collection.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateProgrammableConfigItemV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const programmableConfigItemDelegate = publicKey('delegateAddress...');
10
11await delegateProgrammableConfigItemV1(umi, {
12 mint,
13 authority: updateAuthority,
14 delegate: programmableConfigItemDelegate,
15 tokenStandard: TokenStandard.ProgrammableNonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Programmable Config Item delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateProgrammableConfigItemV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const programmableConfigItemDelegate = address('delegateAddress...');
9
10const delegateIx = await getDelegateProgrammableConfigItemV1InstructionAsync({
11 mint,
12 authority: updateAuthority,
13 delegate: programmableConfigItemDelegate,
14 tokenStandard: TokenStandard.ProgrammableNonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [delegateIx],
19 payer: updateAuthority,
20});
21
22console.log('Programmable Config Item delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeProgrammableConfigItemV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const updateAuthority = umi.identity;
9const programmableConfigItemDelegate = publicKey('delegateAddress...');
10
11await revokeProgrammableConfigItemV1(umi, {
12 mint,
13 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
14 delegate: programmableConfigItemDelegate,
15 tokenStandard: TokenStandard.ProgrammableNonFungible,
16}).sendAndConfirm(umi);
17
18console.log('Programmable Config Item delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeProgrammableConfigItemV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const programmableConfigItemDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeProgrammableConfigItemV1InstructionAsync({
11 mint,
12 authority: updateAuthority, // Or pass the delegate authority as a Signer to self-revoke
13 delegate: programmableConfigItemDelegate,
14 tokenStandard: TokenStandard.ProgrammableNonFungible,
15});
16
17await sendAndConfirm({
18 instructions: [revokeIx],
19 payer: updateAuthority,
20});
21
22console.log('Programmable Config Item delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 updateAsProgrammableConfigItemDelegateV2,
4 ruleSetToggle,
5} from '@metaplex-foundation/mpl-token-metadata';
6import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
7
8const mint = publicKey('mintAddress...');
9const assetOwner = publicKey('ownerAddress...');
10const programmableConfigItemDelegate = umi.identity; // The delegate authority
11const ruleSet = publicKey('ruleSetAddress...');
12
13await updateAsProgrammableConfigItemDelegateV2(umi, {
14 mint,
15 token: findAssociatedTokenPda(umi, { mint, owner: assetOwner }),
16 authority: programmableConfigItemDelegate,
17 ruleSet: ruleSetToggle('Set', [ruleSet]),
18}).sendAndConfirm(umi);
19
20console.log('Rule set updated via Programmable Config Item delegate');
1import { address } from '@solana/addresses';
2import {
3 getUpdateAsProgrammableConfigItemDelegateV2InstructionAsync,
4 findAssociatedTokenPda,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const assetOwner = address('ownerAddress...');
9const ruleSet = address('ruleSetAddress...');
10
11const [token] = await findAssociatedTokenPda({ mint, owner: assetOwner });
12const updateIx = await getUpdateAsProgrammableConfigItemDelegateV2InstructionAsync({
13 mint,
14 token,
15 authority: programmableConfigItemDelegate,
16 ruleSet: { __kind: 'Set', fields: [ruleSet] },
17});
18
19await sendAndConfirm({
20 instructions: [updateIx],
21 payer: programmableConfigItemDelegate,
22});
23
24console.log('Rule set updated via Programmable Config Item delegate');
Token Delegates
Token Delegates are delegates that operate at the Token level. This means they are spl-token delegates that are stored directly on the Token account of the SPL Token program. As such Token Delegates allow delegates to transfer and burn tokens on behalf of the owner but also lock and unlock tokens to prevent the owner from transferring, burning or even revoking the delegate. These delegates are crucial for applications like escrowless marketplaces, staking, asset loans, etc.
Whilst there is only one type of delegate offered by the SPL Token program, Programmable NFTs (PNFTs) allowed the Token Metadata program to provide more granular delegates that can be selected on a per-case basis. This is because PNFTs are always frozen on the SPL Token program which means we can build a delegate system on top of it.
We store that delegate system on a PNFT-specific account called the Token Record PDA — whose seeds are ["metadata", program id, mint id, "token_record", token account id]. We synchronise the delegated authority on the SPL Token program as well but the tokens are always frozen. It is the responsibility of the Token Record account to keep track of whether the asset is really locked or not.
Here are some key properties of Token Delegates:
- There can only be one Token Delegate per token account. Setting a new Token Delegate on the same Token account will override the existing one.
- Token delegates can be revoked by the owner of the asset as long as the asset is not locked.
- Token delegates cannot revoke themselves as they are also set on the Token Program which does not allow the delegates to self-revoke.
- Token delegates are reset on transfer. When dealing with fungible assets, the Delegate Authority is reset when all delegated tokens are transferred.
- The Standard delegate can be used by all assets except Programmable Non-Fungibles. All other Token delegates can only be used by Programmable Non-Fungibles.
- All Token delegates that can be used by Programmable Non-Fungibles store the current Delegate Authority, its role and its state — locked or unlocked — on the Token Record account of the PNFT.
There exist 6 different types of Token Delegates, each with a different scope of action. Here is a table summarizing the different types of Token Delegates:
| Delegate | Lock/Unlock | Transfer | Burn | For | Note |
|---|---|---|---|---|---|
| Standard | ✅ | ✅ | ✅ | All except PNFTs | |
| Sale | ❌ | ✅ | ❌ | PNFTs only | Owner cannot transfer/burn until they revoke the delegate |
| Transfer | ❌ | ✅ | ❌ | PNFTs only | Owner can transfer/burn even when a delegate is set |
| Locked Transfer | ✅ | ✅ | ❌ | PNFTs only | |
| Utility | ✅ | ❌ | ✅ | PNFTs only | |
| Staking | ✅ | ❌ | ❌ | PNFTs only |
Notice that the Standard delegate has a lot more power than the other PNFT-specific delegates as we must simply defer to the spl-token delegate. However, the other delegates are more granular and can be used in more specific use cases. For instance, the Sale delegate is perfect for listing assets on marketplaces since they forbid the owner to burn or transfer as long as the delegate is set.
Let's go through each of these Token delegates in a bit more detail and provide code samples for approving, revoking and using them.
Standard Delegate
As mentioned above, the Standard Delegate is a wrapper around spl-token delegates. Whilst we could simply send instructions to the Token program directly, this delegate aims to offer the same API on Token Metadata regardless of the Token Standard. Additionally, Standard Delegates are able to lock/unlock assets which is not possible with native spl-token delegates.
Here are some key properties of the Standard Delegate:
- This delegate does not work with Programmable Non-Fungibles.
- The Delegate Authority can transfer the asset to any address. Doing so will revoke the Delegate Authority.
- The Delegate Authority can burn the asset.
- The Delegate Authority can lock the asset — also known as "freezing" the asset on the Token program. Until the Delegate Authority unlocks (or "thaw") the asset, the owner cannot transfer it, burn it, or revoke the Delegate Authority. This is specific to the Standard Delegate and cannot be done with a native spl-token delegate.
- When used with fungible assets, an amount greater than 1 can be provided to specify the number of tokens to delegate to the Delegate Authority.
1import { delegateStandardV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and standardDelegate are set up
4
5await delegateStandardV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: standardDelegate,
10 tokenStandard: TokenStandard.NonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Standard delegate approved');
1import {
2 getDelegateStandardV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and standardDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9
10// Approve a Standard delegate
11const delegateIx = await getDelegateStandardV1InstructionAsync({
12 mint: mintAddress,
13 delegate: standardDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.NonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [delegateIx],
22 payer: owner,
23});
24
25console.log('Standard delegate approved');
1import { revokeStandardV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and standardDelegate are set up
4
5await revokeStandardV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: standardDelegate,
10 tokenStandard: TokenStandard.NonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Standard delegate revoked');
1import {
2 getRevokeStandardV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and standardDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9
10// Revoke a Standard delegate
11const revokeIx = await getRevokeStandardV1InstructionAsync({
12 mint: mintAddress,
13 delegate: standardDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.NonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [revokeIx],
22 payer: owner,
23});
24
25console.log('Standard delegate revoked');
1import { transferV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, standardDelegate, currentOwner, and newOwner are set up
4
5await transferV1(umi, {
6 mint,
7 authority: standardDelegate,
8 tokenOwner: currentOwner,
9 destinationOwner: newOwner,
10 tokenStandard: TokenStandard.NonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Asset transferred by Standard delegate');
1import {
2 getTransferV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, and standardDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9const currentOwner = 'currentOwnerAddress...';
10const newOwner = 'newOwnerAddress...';
11
12// Transfer as Standard delegate
13const transferIx = await getTransferV1InstructionAsync({
14 mint: mintAddress,
15 authority: standardDelegate,
16 payer: standardDelegate,
17 tokenOwner: currentOwner,
18 destinationOwner: newOwner,
19 tokenStandard: TokenStandard.NonFungible,
20});
21
22await sendAndConfirm({
23 instructions: [transferIx],
24 payer: standardDelegate,
25});
26
27console.log('Asset transferred by Standard delegate');
1import { burnV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, standardDelegate, and currentOwner are set up
4
5await burnV1(umi, {
6 mint,
7 authority: standardDelegate,
8 tokenOwner: currentOwner,
9 tokenStandard: TokenStandard.NonFungible,
10}).sendAndConfirm(umi);
11
12console.log('Asset burned by Standard delegate');
1import {
2 getBurnV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, and standardDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9const currentOwner = 'currentOwnerAddress...';
10
11// Burn as Standard delegate
12const burnIx = await getBurnV1InstructionAsync({
13 mint: mintAddress,
14 authority: standardDelegate,
15 payer: standardDelegate,
16 tokenOwner: currentOwner,
17 tokenStandard: TokenStandard.NonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [burnIx],
22 payer: standardDelegate,
23});
24
25console.log('Asset burned by Standard delegate');
1import { lockV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, and standardDelegate are set up
4
5await lockV1(umi, {
6 mint,
7 authority: standardDelegate,
8 tokenStandard: TokenStandard.NonFungible,
9}).sendAndConfirm(umi);
10
11console.log('Asset locked (frozen) by Standard delegate');
1import {
2 getLockV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, standardDelegate, and tokenOwner are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9
10// Lock (freeze) as Standard delegate
11const lockIx = await getLockV1InstructionAsync({
12 mint: mintAddress,
13 authority: standardDelegate,
14 payer: standardDelegate,
15 tokenOwner,
16 tokenStandard: TokenStandard.NonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [lockIx],
21 payer: standardDelegate,
22});
23
24console.log('Asset locked (frozen) by Standard delegate');
1import { unlockV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, and standardDelegate are set up
4
5await unlockV1(umi, {
6 mint,
7 authority: standardDelegate,
8 tokenStandard: TokenStandard.NonFungible,
9}).sendAndConfirm(umi);
10
11console.log('Asset unlocked (thawed) by Standard delegate');
1import {
2 getUnlockV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, standardDelegate, and tokenOwner are set up
7
8const mintAddress = 'mintAddress...'; // The NFT mint address
9
10// Unlock (thaw) as Standard delegate
11const unlockIx = await getUnlockV1InstructionAsync({
12 mint: mintAddress,
13 authority: standardDelegate,
14 payer: standardDelegate,
15 tokenOwner,
16 tokenStandard: TokenStandard.NonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [unlockIx],
21 payer: standardDelegate,
22});
23
24console.log('Asset unlocked (thawed) by Standard delegate');
Sale Delegate (PNFT only)
- This delegate only works with Programmable Non-Fungibles.
- The Delegate Authority can transfer the PNFT to any address. Doing so will revoke the Delegate Authority.
- As long as a Sale Delegate is set on a PNFT, the PNFT enters a special Token State called
Listed. TheListedToken State is a softer variation of theLockedToken State. During that time, the owner cannot transfer or burn the PNFT. However, the owner can revoke the Sale Delegate at any time, which will remove theListedToken State and make the PNFT transferable and burnable again.
1import { delegateSaleV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and saleDelegate are set up
4
5await delegateSaleV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: saleDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Sale delegate approved');
1import {
2 getDelegateSaleV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and saleDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Approve a Sale delegate (pNFT only)
11const delegateIx = await getDelegateSaleV1InstructionAsync({
12 mint: mintAddress,
13 delegate: saleDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [delegateIx],
22 payer: owner,
23});
24
25console.log('Sale delegate approved');
1import { revokeSaleV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and saleDelegate are set up
4
5await revokeSaleV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: saleDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Sale delegate revoked');
1import {
2 getRevokeSaleV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and saleDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Revoke a Sale delegate (pNFT only)
11const revokeIx = await getRevokeSaleV1InstructionAsync({
12 mint: mintAddress,
13 delegate: saleDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [revokeIx],
22 payer: owner,
23});
24
25console.log('Sale delegate revoked');
1import { transferV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, saleDelegate, currentOwner, and newOwner are set up
4
5await transferV1(umi, {
6 mint,
7 authority: saleDelegate,
8 tokenOwner: currentOwner,
9 destinationOwner: newOwner,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('pNFT transferred by Sale delegate');
1import {
2 getTransferV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, and saleDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9const currentOwner = 'currentOwnerAddress...';
10const newOwner = 'newOwnerAddress...';
11
12// Transfer as Sale delegate (pNFT only)
13const transferIx = await getTransferV1InstructionAsync({
14 mint: mintAddress,
15 authority: saleDelegate,
16 payer: saleDelegate,
17 tokenOwner: currentOwner,
18 destinationOwner: newOwner,
19 tokenStandard: TokenStandard.ProgrammableNonFungible,
20});
21
22await sendAndConfirm({
23 instructions: [transferIx],
24 payer: saleDelegate,
25});
26
27console.log('pNFT transferred by Sale delegate');
Transfer Delegate (PNFT only)
- This delegate only works with Programmable Non-Fungibles.
- The Delegate Authority can transfer the PNFT to any address. Doing so will revoke the Delegate Authority.
- Contrary to the Sale Delegate, when a Transfer Delegate is set, the owner can still transfer and burn the PNFT.
1import { delegateTransferV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and transferDelegate are set up
4
5await delegateTransferV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: transferDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Transfer delegate approved');
1import {
2 getDelegateTransferV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and transferDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Approve a Transfer delegate (pNFT only)
11const delegateIx = await getDelegateTransferV1InstructionAsync({
12 mint: mintAddress,
13 delegate: transferDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [delegateIx],
22 payer: owner,
23});
24
25console.log('Transfer delegate approved');
1import { revokeTransferV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and transferDelegate are set up
4
5await revokeTransferV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: transferDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Transfer delegate revoked');
1import {
2 getRevokeTransferV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and transferDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Revoke a Transfer delegate (pNFT only)
11const revokeIx = await getRevokeTransferV1InstructionAsync({
12 mint: mintAddress,
13 delegate: transferDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [revokeIx],
22 payer: owner,
23});
24
25console.log('Transfer delegate revoked');
1import { transferV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, transferDelegate, currentOwner, and newOwner are set up
4
5await transferV1(umi, {
6 mint,
7 authority: transferDelegate,
8 tokenOwner: currentOwner,
9 destinationOwner: newOwner,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('pNFT transferred by Transfer delegate');
1import {
2 getTransferV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, and transferDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9const currentOwner = 'currentOwnerAddress...';
10const newOwner = 'newOwnerAddress...';
11
12// Transfer as Transfer delegate (pNFT only)
13const transferIx = await getTransferV1InstructionAsync({
14 mint: mintAddress,
15 authority: transferDelegate,
16 payer: transferDelegate,
17 tokenOwner: currentOwner,
18 destinationOwner: newOwner,
19 tokenStandard: TokenStandard.ProgrammableNonFungible,
20});
21
22await sendAndConfirm({
23 instructions: [transferIx],
24 payer: transferDelegate,
25});
26
27console.log('pNFT transferred by Transfer delegate');
Locked Transfer Delegate (PNFT only)
- This delegate only works with Programmable Non-Fungibles.
- The Delegate Authority can lock the PNFT. Until the Delegate Authority unlocks the PNFT, the owner cannot transfer it, burn it, or revoke the Delegate Authority.
- The Delegate Authority can transfer the PNFT to any address. Doing so will revoke the Delegate Authority and unlock the PNFT if it was locked.
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 delegateLockedTransferV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const owner = umi.identity;
9const lockedTransferDelegate = publicKey('delegateAddress...');
10const lockedAddress = publicKey('escrowAddress...'); // Destination for locked transfers
11
12await delegateLockedTransferV1(umi, {
13 mint,
14 tokenOwner: owner.publicKey,
15 authority: owner,
16 delegate: lockedTransferDelegate,
17 lockedAddress,
18 tokenStandard: TokenStandard.ProgrammableNonFungible,
19}).sendAndConfirm(umi);
20
21console.log('Locked Transfer delegate approved');
1import { address } from '@solana/addresses';
2import {
3 getDelegateLockedTransferV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const lockedTransferDelegate = address('delegateAddress...');
9const lockedAddress = address('escrowAddress...'); // Destination for locked transfers
10
11const delegateIx = await getDelegateLockedTransferV1InstructionAsync({
12 mint,
13 tokenOwner: owner.address,
14 authority: owner,
15 delegate: lockedTransferDelegate,
16 lockedAddress,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [delegateIx],
22 payer: owner,
23});
24
25console.log('Locked Transfer delegate approved');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 revokeLockedTransferV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const owner = umi.identity;
9const lockedTransferDelegate = publicKey('delegateAddress...');
10
11await revokeLockedTransferV1(umi, {
12 mint,
13 tokenOwner: owner.publicKey,
14 authority: owner,
15 delegate: lockedTransferDelegate,
16 tokenStandard: TokenStandard.ProgrammableNonFungible,
17}).sendAndConfirm(umi);
18
19console.log('Locked Transfer delegate revoked');
1import { address } from '@solana/addresses';
2import {
3 getRevokeLockedTransferV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const lockedTransferDelegate = address('delegateAddress...');
9
10const revokeIx = await getRevokeLockedTransferV1InstructionAsync({
11 mint,
12 tokenOwner: owner.address,
13 authority: owner,
14 delegate: lockedTransferDelegate,
15 tokenStandard: TokenStandard.ProgrammableNonFungible,
16});
17
18await sendAndConfirm({
19 instructions: [revokeIx],
20 payer: owner,
21});
22
23console.log('Locked Transfer delegate revoked');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 transferV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const lockedTransferDelegate = umi.identity; // The delegate authority
9const currentOwner = publicKey('currentOwnerAddress...');
10const newOwner = publicKey('newOwnerAddress...');
11
12await transferV1(umi, {
13 mint,
14 authority: lockedTransferDelegate,
15 tokenOwner: currentOwner,
16 destinationOwner: newOwner,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18}).sendAndConfirm(umi);
19
20console.log('pNFT transferred via Locked Transfer delegate');
1import { address } from '@solana/addresses';
2import {
3 getTransferV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8const currentOwner = address('currentOwnerAddress...');
9const newOwner = address('newOwnerAddress...');
10
11const transferIx = await getTransferV1InstructionAsync({
12 mint,
13 authority: lockedTransferDelegate,
14 tokenOwner: currentOwner,
15 destinationOwner: newOwner,
16 tokenStandard: TokenStandard.ProgrammableNonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [transferIx],
21 payer: lockedTransferDelegate,
22});
23
24console.log('pNFT transferred via Locked Transfer delegate');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 lockV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const lockedTransferDelegate = umi.identity; // The delegate authority
9
10await lockV1(umi, {
11 mint,
12 authority: lockedTransferDelegate,
13 tokenStandard: TokenStandard.ProgrammableNonFungible,
14}).sendAndConfirm(umi);
15
16console.log('pNFT locked via Locked Transfer delegate');
1import { address } from '@solana/addresses';
2import {
3 getLockV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8
9const lockIx = await getLockV1InstructionAsync({
10 mint,
11 authority: lockedTransferDelegate,
12 tokenStandard: TokenStandard.ProgrammableNonFungible,
13});
14
15await sendAndConfirm({
16 instructions: [lockIx],
17 payer: lockedTransferDelegate,
18});
19
20console.log('pNFT locked via Locked Transfer delegate');
1import { publicKey } from '@metaplex-foundation/umi';
2import {
3 unlockV1,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata';
6
7const mint = publicKey('mintAddress...');
8const lockedTransferDelegate = umi.identity; // The delegate authority
9
10await unlockV1(umi, {
11 mint,
12 authority: lockedTransferDelegate,
13 tokenStandard: TokenStandard.ProgrammableNonFungible,
14}).sendAndConfirm(umi);
15
16console.log('pNFT unlocked via Locked Transfer delegate');
1import { address } from '@solana/addresses';
2import {
3 getUnlockV1InstructionAsync,
4 TokenStandard,
5} from '@metaplex-foundation/mpl-token-metadata-kit';
6
7const mint = address('mintAddress...');
8
9const unlockIx = await getUnlockV1InstructionAsync({
10 mint,
11 authority: lockedTransferDelegate,
12 tokenStandard: TokenStandard.ProgrammableNonFungible,
13});
14
15await sendAndConfirm({
16 instructions: [unlockIx],
17 payer: lockedTransferDelegate,
18});
19
20console.log('pNFT unlocked via Locked Transfer delegate');
Utility Delegate (PNFT only)
- This delegate only works with Programmable Non-Fungibles.
- The Delegate Authority can lock the PNFT. Until the Delegate Authority unlocks the PNFT, the owner cannot transfer it, burn it, or revoke the Delegate Authority.
- The Delegate Authority can burn the PNFT.
1import { delegateUtilityV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and utilityDelegate are set up
4
5await delegateUtilityV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: utilityDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Utility delegate approved');
1import {
2 getDelegateUtilityV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and utilityDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Approve a Utility delegate (pNFT only)
11const delegateIx = await getDelegateUtilityV1InstructionAsync({
12 mint: mintAddress,
13 delegate: utilityDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [delegateIx],
22 payer: owner,
23});
24
25console.log('Utility delegate approved');
1import { revokeUtilityV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and utilityDelegate are set up
4
5await revokeUtilityV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: utilityDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Utility delegate revoked');
1import {
2 getRevokeUtilityV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and utilityDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Revoke a Utility delegate (pNFT only)
11const revokeIx = await getRevokeUtilityV1InstructionAsync({
12 mint: mintAddress,
13 delegate: utilityDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [revokeIx],
22 payer: owner,
23});
24
25console.log('Utility delegate revoked');
1import { burnV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, utilityDelegate, and currentOwner are set up
4
5await burnV1(umi, {
6 mint,
7 authority: utilityDelegate,
8 tokenOwner: currentOwner,
9 tokenStandard: TokenStandard.ProgrammableNonFungible,
10}).sendAndConfirm(umi);
11
12console.log('pNFT burned by Utility delegate');
1import {
2 getBurnV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, and utilityDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9const currentOwner = 'currentOwnerAddress...';
10
11// Burn as Utility delegate (pNFT only)
12const burnIx = await getBurnV1InstructionAsync({
13 mint: mintAddress,
14 authority: utilityDelegate,
15 payer: utilityDelegate,
16 tokenOwner: currentOwner,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [burnIx],
22 payer: utilityDelegate,
23});
24
25console.log('pNFT burned by Utility delegate');
1import { lockV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, and utilityDelegate are set up
4
5await lockV1(umi, {
6 mint,
7 authority: utilityDelegate,
8 tokenStandard: TokenStandard.ProgrammableNonFungible,
9}).sendAndConfirm(umi);
10
11console.log('pNFT locked by Utility delegate');
1import {
2 getLockV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, utilityDelegate, and tokenOwner are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Lock as Utility delegate (pNFT only)
11const lockIx = await getLockV1InstructionAsync({
12 mint: mintAddress,
13 authority: utilityDelegate,
14 payer: utilityDelegate,
15 tokenOwner,
16 tokenStandard: TokenStandard.ProgrammableNonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [lockIx],
21 payer: utilityDelegate,
22});
23
24console.log('pNFT locked by Utility delegate');
1import { unlockV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, and utilityDelegate are set up
4
5await unlockV1(umi, {
6 mint,
7 authority: utilityDelegate,
8 tokenStandard: TokenStandard.ProgrammableNonFungible,
9}).sendAndConfirm(umi);
10
11console.log('pNFT unlocked by Utility delegate');
1import {
2 getUnlockV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, utilityDelegate, and tokenOwner are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Unlock as Utility delegate (pNFT only)
11const unlockIx = await getUnlockV1InstructionAsync({
12 mint: mintAddress,
13 authority: utilityDelegate,
14 payer: utilityDelegate,
15 tokenOwner,
16 tokenStandard: TokenStandard.ProgrammableNonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [unlockIx],
21 payer: utilityDelegate,
22});
23
24console.log('pNFT unlocked by Utility delegate');
Staking Delegate (PNFT only)
- This delegate only works with Programmable Non-Fungibles.
- The Delegate Authority can lock the PNFT. Until the Delegate Authority unlocks the PNFT, the owner cannot transfer it, burn it, or revoke the Delegate Authority.
1import { delegateStakingV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and stakingDelegate are set up
4
5await delegateStakingV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: stakingDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Staking delegate approved');
1import {
2 getDelegateStakingV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and stakingDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Approve a Staking delegate (pNFT only)
11const delegateIx = await getDelegateStakingV1InstructionAsync({
12 mint: mintAddress,
13 delegate: stakingDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [delegateIx],
22 payer: owner,
23});
24
25console.log('Staking delegate approved');
1import { revokeStakingV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, owner, and stakingDelegate are set up
4
5await revokeStakingV1(umi, {
6 mint,
7 tokenOwner: owner.publicKey,
8 authority: owner,
9 delegate: stakingDelegate,
10 tokenStandard: TokenStandard.ProgrammableNonFungible,
11}).sendAndConfirm(umi);
12
13console.log('Staking delegate revoked');
1import {
2 getRevokeStakingV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, owner, and stakingDelegate are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Revoke a Staking delegate (pNFT only)
11const revokeIx = await getRevokeStakingV1InstructionAsync({
12 mint: mintAddress,
13 delegate: stakingDelegate,
14 authority: owner,
15 payer: owner,
16 tokenOwner: owner.address,
17 tokenStandard: TokenStandard.ProgrammableNonFungible,
18});
19
20await sendAndConfirm({
21 instructions: [revokeIx],
22 payer: owner,
23});
24
25console.log('Staking delegate revoked');
1import { lockV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, and stakingDelegate are set up
4
5await lockV1(umi, {
6 mint,
7 authority: stakingDelegate,
8 tokenStandard: TokenStandard.ProgrammableNonFungible,
9}).sendAndConfirm(umi);
10
11console.log('pNFT locked by Staking delegate');
1import {
2 getLockV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, stakingDelegate, and tokenOwner are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Lock as Staking delegate (pNFT only)
11const lockIx = await getLockV1InstructionAsync({
12 mint: mintAddress,
13 authority: stakingDelegate,
14 payer: stakingDelegate,
15 tokenOwner,
16 tokenStandard: TokenStandard.ProgrammableNonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [lockIx],
21 payer: stakingDelegate,
22});
23
24console.log('pNFT locked by Staking delegate');
1import { unlockV1 } from '@metaplex-foundation/mpl-token-metadata';
2
3// Assuming umi, mint, and stakingDelegate are set up
4
5await unlockV1(umi, {
6 mint,
7 authority: stakingDelegate,
8 tokenStandard: TokenStandard.ProgrammableNonFungible,
9}).sendAndConfirm(umi);
10
11console.log('pNFT unlocked by Staking delegate');
1import {
2 getUnlockV1InstructionAsync,
3 TokenStandard,
4} from '@metaplex-foundation/mpl-token-metadata-kit';
5
6// Assuming rpc, rpcSubscriptions, sendAndConfirm, stakingDelegate, and tokenOwner are set up
7
8const mintAddress = 'mintAddress...'; // The pNFT mint address
9
10// Unlock as Staking delegate (pNFT only)
11const unlockIx = await getUnlockV1InstructionAsync({
12 mint: mintAddress,
13 authority: stakingDelegate,
14 payer: stakingDelegate,
15 tokenOwner,
16 tokenStandard: TokenStandard.ProgrammableNonFungible,
17});
18
19await sendAndConfirm({
20 instructions: [unlockIx],
21 payer: stakingDelegate,
22});
23
24console.log('pNFT unlocked by Staking delegate');
Legacy Delegates
Finally, it is worth noting that — before this delegate system — collection delegates used to be stored on a specific Collection Authority Record PDA. That PDA is similar to the Metadata Delegate Record except that it supports only one role: Collection. This legacy collection delegate is now deprecated and we recommend using the new delegate system instead.
That being said, the Token Metadata program still accepts these legacy collection delegates wherever a new Collection delegate is expected. This is done to ensure backward compatibility with assets that are still delegating to these legacy delegates.
You can learn more about them in the Token Metadata program directly.
