Theme

Features

Freezing and Thawing Compressed NFTs

With Bubblegum V2, we can freeze and thaw Compressed NFTs. This is useful for various use cases, such as staking.

Freezing a Compressed NFT

To freeze a Compressed NFT that has been delegated to a leaf delegate before, we can use the freezeV2 instruction. If it has not been delegated yet, see delegateAndFreezeV2 below. The freezeV2 instruction can be used like this:

Freeze a Compressed NFT as a leaf delegate

import {
  getAssetWithProof,
  freezeV2,
} from '@metaplex-foundation/mpl-bubblegum';

const assetWithProof = await getAssetWithProof(umi, assetId);
await freezeV2(umi, {
  ...assetWithProof,
  leafOwner: umi.identity.publicKey,
  authority: leafDelegate, // this would default to the payer
  leafDelegate: leafDelegate.publicKey,
  // If the cNFT is part of a collection, pass the collection address.
  //coreCollection: collectionSigner.publicKey,
}).sendAndConfirm(umi);

Delegate and Freeze a Compressed NFT

To freeze a Compressed NFT, we can use the delegateAndFreezeV2 instruction. This instruction can be used like this:

Delegate and Freeze a Compressed NFT

import {
  getAssetWithProof,
  delegateAndFreezeV2,
} from '@metaplex-foundation/mpl-bubblegum';

// newLeafDelegate should be a publicKey that will be able to thaw the cNFT later.

const assetWithProof = await getAssetWithProof(umi, assetId);
await delegateAndFreezeV2(umi, {
  ...assetWithProof,
  leafOwner: umi.identity.publicKey,
  newLeafDelegate,
}).sendAndConfirm(umi);

Thawing a Compressed NFT

To thaw a Compressed NFT, we can use the thawV2 instruction. This instruction can be used like this:

Thaw a Compressed NFT as a leaf delegate

import {
  getAssetWithProof,
  thawV2,
} from '@metaplex-foundation/mpl-bubblegum';

const assetWithProof = await getAssetWithProof(umi, assetId);
// delegateAuthority should be a Signer that has been approved as a delegate authority for the cNFT.
await thawV2(umi, {
  ...assetWithProof,
  authority: delegateAuthority,
}).sendAndConfirm(umi);

If the cNFT has been delegated to a permanent freeze delegate, we can thaw it like this:

Thaw a Compressed NFT as a permanent freeze delegate

import {
  getAssetWithProof,
  thawV2,
} from '@metaplex-foundation/mpl-bubblegum';

const assetWithProof = await getAssetWithProof(umi, assetId);
await thawV2(umi, {
  ...assetWithProof,
  authority: permanentFreezeDelegate,
}).sendAndConfirm(umi);

Thaw and Revoke a Delegate Authority

To thaw and revoke a Delegate Authority at the same time, we can use the thawAndRevokeV2 instruction. This instruction can be used like this:

Thaw and Revoke a Delegate Authority

import {
  getAssetWithProof,
  thawAndRevokeV2,
} from '@metaplex-foundation/mpl-bubblegum';

// delegateAuthority should be a Signer that has been approved as a delegate authority for the cNFT.
const assetWithProof = await getAssetWithProof(umi, assetId);
await thawAndRevokeV2(umi, {
  ...assetWithProof,
  authority: delegateAuthority,
}).sendAndConfirm(umi);

Make a cNFT Soulbound

To make a cNFT Soulbound the cNFT has to be part of a mpl-core collection with the permanentFreezeDelegate Plugin. Using the setNonTransferableV2 instruction, we can make the cNFT non-transferable.

Make a cNFT Soulbound

import {
  getAssetWithProof,
  setNonTransferableV2,
} from '@metaplex-foundation/mpl-bubblegum';

const assetWithProof = await getAssetWithProof(umi, assetId);

await setNonTransferableV2(umi, {
    ...assetWithProof,
    authority, // The permanent freeze delegate on collection
    coreCollection: collection.publicKey,
}).sendAndConfirm(umi);
Previous
Transferring cNFTs