プラグイン

プラグインの追加

Last updated January 31, 2026

このガイドでは、Core AssetとCollectionにプラグインを追加する方法を説明します。プラグインは、ロイヤリティ、凍結、属性、委任権限などの機能を追加します。

学べること

  • 既存のAssetとCollectionにプラグインを追加
  • デフォルトとカスタムのプラグイン権限を設定
  • 追加時にプラグインデータを設定
  • 権限タイプの違いを理解

概要

addPlugin()を使用してAssetに、またはaddCollectionPlugin()を使用してCollectionにプラグインを追加します。各プラグインにはデフォルトの権限タイプがありますが、上書きすることができます。

  • Owner ManagedプラグインはデフォルトでOwner権限
  • Authority ManagedプラグインはデフォルトでUpdateAuthority
  • Permanentプラグインは作成時にのみ追加可能
  • authorityパラメータでカスタム権限を設定可能

範囲外

Permanentプラグイン(作成時に追加が必要)、プラグインの削除(プラグインの削除を参照)、プラグインの更新(プラグインの更新を参照)。

クイックスタート

ジャンプ: Assetに追加 · Collectionに追加 · カスタム権限

  1. プラグイン概要からプラグインを選択
  2. Assetアドレスとプラグイン設定でaddPlugin()を呼び出す
  3. トランザクションを送信
  4. トランザクション確認後、プラグインがアクティブになる プラグインはMPL Core AssetとMPL Core Collectionの両方に割り当てることができます。MPL Core AssetとMPL Core Collectionは、利用可能なプラグインの同様のリストを共有しています。各プラグインがどれで使用できるかについては、プラグイン概要エリアをご覧ください。

Core Assetにプラグインを追加

プラグインは、プラグインに対する権限を割り当てる機能をサポートしています。initAuthority引数が指定された場合、希望するプラグイン権限タイプに権限が設定されます。未指定の場合、プラグインのデフォルト権限タイプが割り当てられます(次のセクション)。 createPluginヘルパー createPlugin()ヘルパーは、addPlugin()プロセス中にプラグインを割り当てることができる型付きメソッドを提供します。 プラグインとその引数の完全なリストについては、プラグイン概要ページを参照してください。

デフォルト権限でプラグインを追加

プラグインの権限を指定せずにAssetまたはCollectionにプラグインを追加すると、権限はそのプラグインのデフォルト権限タイプに設定されます。

  • Owner ManagedプラグインはデフォルトでOwnerタイプのプラグイン権限になります。
  • Authority ManagedプラグインはデフォルトでUpdateAuthorityタイプのプラグイン権限になります。
  • PermanentプラグインはデフォルトでUpdateAuthorityタイプのプラグイン権限になります。

デフォルト権限でプラグインを追加

import { publicKey } from '@metaplex-foundation/umi'
import { addPlugin } from '@metaplex-foundation/mpl-core'
const assetId = publicKey('11111111111111111111111111111111')
await addPlugin(umi, {
asset: assetId,
plugin: {
type: 'Attributes',
attributeList: [{ key: 'key', value: 'value' }],
},
}).sendAndConfirm(umi)

権限を指定してプラグインを追加

プラグインの権限を設定するためのいくつかの権限ヘルパーがあります。 Address

await addPlugin(umi, {
...
plugin: {
...
authority: {
type: 'Address',
address: publicKey('22222222222222222222222222222222'),
},
},
}).sendAndConfirm(umi);

これにより、プラグインの権限が特定のアドレスに設定されます。 Owner

await addPlugin(umi, {
...
plugin: {
...
authority: {
type: 'Owner'
},
},
}).sendAndConfirm(umi);

これにより、プラグインの権限がOwnerタイプに設定されます。 Assetの現在のオーナーがこのプラグインにアクセスできます。 UpdateAuthority

await addPlugin(umi, {
...
plugin: {
...
authority: {
type: "UpdateAuthority",
},
},
}).sendAndConfirm(umi);

これにより、プラグインの権限がUpdateAuthorityタイプに設定されます。 Assetの現在のupdate authorityがこのプラグインにアクセスできます。 None

await addPlugin(umi, {
...
plugin: {
...
authority: {
type: "None",
},
},
}).sendAndConfirm(umi);

これにより、プラグインの権限がNoneタイプに設定されます。 プラグインのデータがある場合、この時点で不変になります。

権限を指定してプラグインを追加

use mpl_core::{
instructions::AddPluginV1Builder,
types::{FreezeDelegate, Plugin, PluginAuthority},
};
use solana_client::nonblocking::rpc_client;
use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction};
use std::str::FromStr;
pub async fn add_plugin_with_authority() {
let rpc_client = rpc_client::RpcClient::new("https://api.devnet.solana.com".to_string());
let authority = Keypair::new();
let asset = Pubkey::from_str("11111111111111111111111111111111").unwrap();
let plugin_authority = Pubkey::from_str("22222222222222222222222222222222").unwrap();
let add_plugin_with_authority_ix = AddPluginV1Builder::new()
.asset(asset)
.payer(authority.pubkey())
.plugin(Plugin::FreezeDelegate(FreezeDelegate { frozen: false }))
.init_authority(PluginAuthority::Address {
address: plugin_authority,
})
.instruction();
let signers = vec![&authority];
let last_blockhash = rpc_client.get_latest_blockhash().await.unwrap();
let add_plugin_with_authority_tx = Transaction::new_signed_with_payer(
&[add_plugin_with_authority_ix],
Some(&authority.pubkey()),
&signers,
last_blockhash,
);
let res = rpc_client
.send_and_confirm_transaction(&add_plugin_with_authority_tx)
.await
.unwrap();
println!("Signature: {:?}", res)
}

Collectionにプラグインを追加

Core Collectionにプラグインを追加することは、Core Assetに追加するのと似ています。作成中にプラグインを追加することも、addCollectionV1命令を使用して追加することもできます。CollectionはAuthority PluginsPermanent Pluginsにのみアクセスできます。

デフォルト権限でCollectionプラグインを追加

デフォルト権限でCollectionプラグインを追加

import { publicKey } from '@metaplex-foundation/umi'
import { addCollectionPlugin, ruleSet } from '@metaplex-foundation/mpl-core'
const collection = publicKey('11111111111111111111111111111111')
const creator = publicKey('22222222222222222222222222222222')
await addCollectionPlugin(umi, {
collection: collection,
plugin: {
type: 'Royalties',
data: {
basisPoints: 5000,
creators: [
{
address: creator,
percentage: 100,
},
],
ruleSet: ruleSet('None'),
},
},
}).sendAndConfirm(umi)

権限を指定してCollectionプラグインを追加

Assetのバーン

import { publicKey } from '@metaplex-foundation/umi'
import {
addCollectionPlugin,
ruleSet,
} from '@metaplex-foundation/mpl-core'
const collection = publicKey('11111111111111111111111111111111')
const delegate = publicKey('22222222222222222222222222222222')
await addCollectionPlugin(umi, {
collection: collection.publicKey,
plugin: {
type: 'Attributes',
attributeList: [{ key: 'key', value: 'value' }],
authority: {
type: 'Address',
address: delegate,
},
},
}).sendAndConfirm(umi)

一般的なエラー

Authority mismatch

このプラグインを追加する権限がありません。Owner Managedプラグインはオーナーの署名が必要で、Authority Managedプラグインはupdate authorityが必要です。

Plugin already exists

Asset/Collectionには既にこのプラグインタイプがあります。代わりにupdatePluginを使用して変更してください。

Cannot add permanent plugin

Permanentプラグインは作成時にのみ追加できます。既存のAsset/Collectionには追加できません。

注意事項

  • Owner Managedプラグインは追加にオーナー署名が必要
  • Authority Managedプラグインはupdate authority署名が必要
  • Permanentプラグインは作成時にのみ追加可能
  • プラグインを追加するとアカウントサイズとrentが増加

クイックリファレンス

デフォルト権限タイプ

プラグインタイプデフォルト権限
Owner ManagedOwner
Authority ManagedUpdateAuthority
PermanentUpdateAuthority

権限オプション

権限タイプ説明
Owner現在のAssetオーナー
UpdateAuthority現在のupdate authority
Address特定の公開鍵
None不変(誰も更新不可)

FAQ

1つのトランザクションで複数のプラグインを追加できますか?

はい、Assetの作成時に可能です。既存のAssetの場合、各addPlugin呼び出しは別々の命令です。複数の命令を1つのトランザクションに組み合わせることができます。

権限をNoneに設定するとどうなりますか?

プラグインは不変になります。誰も更新や削除ができなくなります。

update authorityとしてOwner Managedプラグインを追加できますか?

いいえ。Owner Managedプラグインは、誰が署名しても常にオーナーの署名が必要です。

なぜPermanentプラグインを追加できないのですか?

Permanentプラグインは、Asset/Collection作成時にのみ追加できます。既存のアカウントには追加できません。

関連操作

用語集

用語定義
Owner Managed追加にオーナー署名が必要なプラグイン
Authority Managedupdate authorityが追加できるプラグイン
Permanent作成時にのみ追加可能なプラグイン
initAuthorityカスタムプラグイン権限を設定するパラメータ
Previous
概要