功能

转移 Asset

Last updated January 31, 2026

本指南展示如何使用 Metaplex Core SDK 在 Solana 上在钱包之间转移 Core Asset。通过单个指令向其他用户发送 NFT。

您将学到

  • 将 Asset 转移给新所有者
  • 处理 Collection 中 Asset 的转移
  • 使用 Transfer Delegate 进行授权转移
  • 理解转移权限要求

摘要

使用 transfer 指令将 Core Asset 转移给新所有者。只有当前所有者(或授权的 Transfer Delegate)可以发起转移。

  • 使用收件人地址调用 transfer(umi, { asset, newOwner })
  • 对于 Collection Asset,包含 collection 参数
  • Transfer Delegate 可以代表所有者转移
  • 转移是免费的(只收取交易费用)

范围外

Token Metadata 转移(使用 mpl-token-metadata)、批量转移(遍历 Asset)、市场销售(使用托管程序)。

快速开始

跳转至: 基本转移 · 收藏转移 · 委托转移

  1. 安装:npm install @metaplex-foundation/mpl-core @metaplex-foundation/umi
  2. 获取 Asset 以验证所有权和收藏成员资格
  3. 调用 transfer(umi, { asset, newOwner })
  4. 使用 fetchAsset() 验证所有权已更改

前提条件

  • 配置了拥有 Asset(或是其 Transfer Delegate)的签名者的 Umi
  • 要转移的 Asset 的 Asset 地址
  • 新所有者的 收件人地址(公钥) Core Asset 的所有者可以通过使用 transfer 指令到 MPL Core 程序来将所有权转移给另一个账户。

转移 Core Asset

1import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'
2import { transfer } from '@metaplex-foundation/mpl-core'
3import { mplCore } from '@metaplex-foundation/mpl-core'
4import { publicKey } from '@metaplex-foundation/umi'
5
6// Initialize UMI
7const umi = createUmi('https://api.devnet.solana.com')
8 .use(mplCore())
9
10// Transfer an existing NFT asset to a new owner
11const result = await transfer(umi, {
12 asset: publicKey('AssetAddressHere...'),
13 newOwner: publicKey('RecipientAddressHere...'),
14}).sendAndConfirm(umi)
15
16console.log('Asset transferred:', result.signature)

转移 Collection 中的 Core Asset

如果您要转移具有收藏的 Asset,需要传递收藏地址。 如何判断 Asset 是否在 Collection 中?

转移属于 Collection 的 Asset

import { publicKey } from '@metaplex-foundation/umi'
import { transferV1 } from '@metaplex-foundation/mpl-core'
const asset = publicKey('11111111111111111111111111111111')
await transferV1(umi, {
asset: asset.publicKey,
newOwner: newOwner.publicKey,
collection: colleciton.publicKey,
}).sendAndConfirm(umi)

如果我是 Asset 的 Transfer Delegate?

如果您通过 Transfer Delegate 插件成为 Asset 的 Transfer Delegate,您可以像 Asset 所有者一样调用 transferV1 函数。

常见错误

Authority mismatch

您不是 Asset 的所有者或 Transfer Delegate。检查所有权:

const asset = await fetchAsset(umi, assetAddress)
console.log(asset.owner) // 必须与您的签名者匹配

Asset is frozen

Asset 有 Freeze Delegate 插件且当前已冻结。冻结权限必须在转移前解冻它。

Missing collection parameter

对于 Collection 中的 Asset,您必须传递 collection 地址。检查 Asset 是否有收藏:

const asset = await fetchAsset(umi, assetAddress)
if (asset.updateAuthority.type === 'Collection') {
console.log('Collection:', asset.updateAuthority.address)
}

注意事项

  • 转移是免费的 - 无租金成本,只有交易费用(~0.000005 SOL)
  • 新所有者获得 Asset 的完全控制权
  • Transfer、Burn 和 Freeze Delegate 在转移成功后被撤销
  • 冻结的 Asset 在解冻前无法转移
  • 始终先获取 Asset 以检查收藏成员资格

快速参考

转移参数

参数必需描述
assetAsset 地址或获取的对象
newOwner收件人的公钥
collection如果在收藏中Collection 地址
authority默认为签名者(用于委托)

谁可以转移?

权限可以转移?
Asset 所有者
Transfer Delegate是(转移后撤销)
Update Authority
Collection Authority

FAQ

如何知道 Asset 是否在 Collection 中?

获取 Asset 并检查其 updateAuthority

const asset = await fetchAsset(umi, assetAddress)
if (asset.updateAuthority.type === 'Collection') {
// 将 asset.updateAuthority.address 作为 collection 参数传递
}

我可以转移给自己吗?

可以。转移到自己的地址是有效的(对于整合钱包或测试很有用)。

转移后 Transfer Delegate 会怎样?

Transfer Delegate 插件在转移完成时自动撤销。新所有者需要根据需要分配新的委托。

我可以取消转移吗?

不可以。转移是原子性的 - 一旦交易确认,所有权就已更改。没有待处理状态可以取消。

我可以一次转移多个 Asset 吗?

单个指令不行。您可以在一个交易中批量处理多个转移指令(受交易大小限制),但每个 Asset 需要自己的转移调用。

转移会更改 update authority 吗?

不会。转移只更改所有权。update authority 保持不变,除非通过 update 指令明确更改。

术语表

术语定义
所有者当前拥有 Asset 的钱包
Transfer Delegate被授权代表所有者转移的账户
冻结转移被阻止的 Asset 状态
新所有者接收 Asset 的收件人钱包
CollectionAsset 所属的 Collection(影响转移要求)