外部插件

移除外部插件

Last updated January 31, 2026

本指南展示如何从 Core Asset 和 Collection 移除外部插件。当不再需要 Oracle 或 AppData 插件时移除它们。

您将学到

  • 从 Asset 移除外部插件
  • 从 Collection 移除外部插件
  • 了解权限要求
  • 从移除的插件中回收租金

概要

使用 removePlugin() 移除 Asset 的外部插件,或使用 removeCollectionPlugin() 移除 Collection 的外部插件。只有插件权限可以移除外部插件。

  • 指定插件类型和基础地址
  • 插件数据被删除
  • 租金被回收
  • 需要插件权限签名

超出范围

添加外部插件(参见添加外部插件)、更新插件数据和移除内置插件(参见移除插件)。

快速开始

跳转至: 从 Asset 移除 · 从 Collection 移除

  1. 确定要移除的插件类型和基础地址
  2. 使用插件键调用 removePlugin()
  3. 插件立即移除,租金回收

从 Asset 移除

从 Asset 移除外部插件

要从 Asset 移除外部插件适配器,您需要使用 removePlugin() 函数。

import {publicKey } from '@metaplex-foundation/umi'
import { removePlugin, CheckResult } from '@metaplex-foundation/mpl-core'
const asset = publicKey('1111111111111111111111111111111')
const oracleAccount = publicKey('2222222222222222222222222222222')
await removePlugin(umi, {
asset,
plugin: {
type: 'Oracle',
baseAddress: oracleAccount,
},
})

从 Collection 移除

从 Collection 移除外部插件

要从 Collection 移除外部插件适配器,您需要使用 removeCollectionPlugin() 函数。

import { publicKey } from '@metaplex-foundation/umi'
import { removeCollectionPlugin, CheckResult } from '@metaplex-foundation/mpl-core'
const collection = publicKey('1111111111111111111111111111111')
const oracleAccount = publicKey('2222222222222222222222222222222')
removeCollectionPlugin(umi, {
collection,
plugin: {
type: 'Oracle',
baseAddress: publicKey(oracleAccount),
},
})

常见错误

Authority mismatch

只有插件权限可以移除外部插件。请验证您使用的是正确的密钥对进行签名。

Plugin not found

此 Asset/Collection 上不存在具有指定键的外部插件。

注意事项

  • 移除插件会删除其所有数据
  • 租金被回收并返还给支付者
  • 只有插件权限可以移除(通常是更新权限)
  • 外部 Oracle/AppData 账户不会被删除——只有适配器被删除

常见问题

移除 Oracle 插件会删除 Oracle 账户吗?

不会。只有 Asset 上的插件适配器被移除。外部 Oracle 账户保留,可以重新使用。

移除前可以恢复 AppData 吗?

可以。如果需要保留数据,请在移除插件之前使用 fetchAsset() 读取 AppData。

租金会怎样?

插件适配器的租金会被回收并返还给交易支付者。

相关操作