Theme

Features

Transferring Compressed NFTs

The Transfer instruction can be used to transfer a Compressed NFT from one owner to another. To authorize the transfer, either the current owner or the delegate authority — if any — must sign the transaction. The instruction accepts the following parameters:

  • Leaf Owner and Leaf Delegate: The current owner of the Compressed NFT and its delegate authority if any. One of these must sign the transaction.
  • New Leaf Owner: The address of the Compressed NFT's new owner.

Note that this instruction updates the Compressed NFT and therefore replaces the leaf on the Bubblegum Tree. This means additional parameters must be provided to verify the integrity of the Compressed NFT. Since these parameters are common to all instructions that mutate leaves, they are documented in the following FAQ. Fortunately, we can use a helper method that will automatically fetch these parameters for us using the Metaplex DAS API.

Transaction size

If you encounter transaction size errors, consider using { truncateCanopy: true } with getAssetWithProof. See the FAQ for details.

Transfer a Compressed NFT

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

const assetWithProof = await getAssetWithProof(umi, assetId, {truncateCanopy: true});
await transfer(umi, {
  ...assetWithProof,
  leafOwner: currentLeafOwner,
  newLeafOwner: newLeafOwner.publicKey,
}).sendAndConfirm(umi)
Previous
Fetching cNFTs