功能

冻结和解冻压缩NFT

Last updated February 24, 2026

Summary

Freezing and thawing compressed NFTs controls transferability using Bubblegum V2's freeze instructions. This page covers freeze, delegate-and-freeze, thaw, thaw-and-revoke, and making cNFTs soulbound (non-transferable).

  • Freeze a cNFT via a leaf delegate or permanent freeze delegate
  • Delegate and freeze in a single transaction with delegateAndFreezeV2
  • Thaw a frozen cNFT and optionally revoke the delegate in one step
  • Make a cNFT permanently non-transferable (soulbound) with setNonTransferableV2

通过Bubblegum V2,我们可以冻结和解冻压缩NFT。这对于各种用例很有用,例如质押。

冻结压缩NFT

要冻结之前已委托给叶子委托人的压缩NFT,我们可以使用freezeV2指令。如果尚未委托,请参阅下面的delegateAndFreezeV2freezeV2指令可以这样使用:

作为叶子委托人冻结压缩NFT

import {
getAssetWithProof,
freezeV2,
} from '@metaplex-foundation/mpl-bubblegum';
const assetWithProof = await getAssetWithProof(umi, assetId);
await freezeV2(umi, {
...assetWithProof,
leafOwner: umi.identity.publicKey,
authority: leafDelegate, // 这默认为付款人
leafDelegate: leafDelegate.publicKey,
// 如果cNFT是集合的一部分,传递集合地址。
//coreCollection: collectionSigner.publicKey,
}).sendAndConfirm(umi);

委托并冻结压缩NFT

要冻结压缩NFT,我们可以使用delegateAndFreezeV2指令。此指令可以这样使用:

委托并冻结压缩NFT

import {
getAssetWithProof,
delegateAndFreezeV2,
} from '@metaplex-foundation/mpl-bubblegum';
// newLeafDelegate应该是一个能够稍后解冻cNFT的publicKey。
const assetWithProof = await getAssetWithProof(umi, assetId);
await delegateAndFreezeV2(umi, {
...assetWithProof,
leafOwner: umi.identity.publicKey,
newLeafDelegate,
}).sendAndConfirm(umi);

解冻压缩NFT

要解冻压缩NFT,我们可以使用thawV2指令。此指令可以这样使用:

作为叶子委托人解冻压缩NFT

import {
getAssetWithProof,
thawV2,
} from '@metaplex-foundation/mpl-bubblegum';
const assetWithProof = await getAssetWithProof(umi, assetId);
// delegateAuthority应该是已被批准为cNFT委托权限的签名者。
await thawV2(umi, {
...assetWithProof,
authority: delegateAuthority,
}).sendAndConfirm(umi);

如果cNFT已委托给永久冻结委托人,我们可以这样解冻它:

作为永久冻结委托人解冻压缩NFT

import {
getAssetWithProof,
thawV2,
} from '@metaplex-foundation/mpl-bubblegum';
const assetWithProof = await getAssetWithProof(umi, assetId);
await thawV2(umi, {
...assetWithProof,
authority: permanentFreezeDelegate,
}).sendAndConfirm(umi);

解冻并撤销委托权限

要同时解冻和撤销委托权限,我们可以使用thawAndRevokeV2指令。此指令可以这样使用:

解冻并撤销委托权限

import {
getAssetWithProof,
thawAndRevokeV2,
} from '@metaplex-foundation/mpl-bubblegum';
// delegateAuthority应该是已被批准为cNFT委托权限的签名者。
const assetWithProof = await getAssetWithProof(umi, assetId);
await thawAndRevokeV2(umi, {
...assetWithProof,
authority: delegateAuthority,
}).sendAndConfirm(umi);

使cNFT成为灵魂绑定

要使cNFT成为灵魂绑定,cNFT必须是带有permanentFreezeDelegate插件的mpl-core集合的一部分。使用setNonTransferableV2指令,我们可以使cNFT不可转让。

使cNFT成为灵魂绑定

import {
getAssetWithProof,
setNonTransferableV2,
} from '@metaplex-foundation/mpl-bubblegum';
const assetWithProof = await getAssetWithProof(umi, assetId);
await setNonTransferableV2(umi, {
...assetWithProof,
authority, // 集合上的永久冻结委托人
coreCollection: collection.publicKey,
}).sendAndConfirm(umi);

Notes

  • A cNFT must be delegated to a leaf delegate before it can be frozen with freezeV2. Use delegateAndFreezeV2 to do both in one transaction.
  • The permanent freeze delegate operates at the collection level and requires the PermanentFreezeDelegate plugin on the collection.
  • Soulbound (non-transferable) status set by setNonTransferableV2 is permanent and cannot be reversed.
  • Frozen cNFTs cannot be transferred or burned by the owner. Only the freeze authority can thaw them.

FAQ

Glossary

TermDefinition
freezeV2Instruction that freezes a cNFT, preventing transfers until thawed
thawV2Instruction that unfreezes a cNFT, allowing transfers again
delegateAndFreezeV2Instruction that delegates to a leaf delegate and freezes the cNFT in one transaction
thawAndRevokeV2Instruction that thaws a cNFT and revokes the delegate authority in one transaction
setNonTransferableV2Instruction that permanently makes a cNFT non-transferable (soulbound)
Permanent Freeze DelegateA collection-level authority that can freeze/thaw any cNFT without owner consent
SoulboundA non-transferable cNFT permanently bound to its owner's wallet