Plugins
Delegating and Revoking Plugins
Delegating an Authority
Plugins can be delegated to another address with a Delegate Authority instruction update. Delegated plugins allow addresses other than the main authority to have control over that plugins functionality.
Delegate a Plugin Authority
import { publicKey } from '@metaplex-foundation/umi'
import { approvePluginAuthority } from '@metaplex-foundation/mpl-core'
const assetAddress = publicKey('11111111111111111111111111111111')
const delegate = publicKey('33333333333333333333333333333')
await approvePluginAuthority(umi, {
asset: assetAddress,
plugin: { type: 'Attributes' },
newAuthority: { type: 'Address', address: delegate },
}).sendAndConfirm(umi)
Revoking an Authority
Revoking an Authority on a plugin results in different behaviours depending on the plugin type that's being revoked.
Owner Managed Plugins: If an address is revoked from an
Owner Managed Plugin
then the plugin will default back to theOwner
authority type.Authority Managed Plugins: If an address is revoked from an
Authority Managed Plugin
then the plugin will default back to theUpdateAuthority
authority type.
Who can Revoke a Plugin?
Owner Managed Plugins
- An Owner Managed Plugin can be revoked by the owner which revokes the delegate and sets the pluginAuthority type to
Owner
. - The delegated Authority of the plugin can revoke themselves which then sets the plugin authority type to
Owner
. - On Transfer, delegated Authorities of owner managed plugins are automatically revoked back to the
Owner Authority
type.
Authority Managed Plugins
- The Update Authority of an Asset can revoke a delegate which thens sets the pluginAuthority type to
UpdateAuthority
. - The delegated Authority of the plugin can revoke themselves which then sets the plugin authority type to
UpdateAuthority
.
A list of plugins and their types can be viewed on the Plugins Overview page.
Revoking a Plugin Authority
import { publicKey } from '@metaplex-foundation/umi'
import { revokePluginAuthority } from '@metaplex-foundation/mpl-core'
await revokePluginAuthority(umi, {
asset: asset.publicKey,
plugin: { type: 'Attributes' },
}).sendAndConfirm(umi)
Delegate Resets Upon Asset Transfer
All Owner Managed plugins will have their delegated authorities revoked and set back to the authority type of Owner
upon Transfer of an Asset.
This includes:
- Freeze Delegate
- Transfer Delegate
- Burn Delegate
Making Plugin Data Immutable
By updating your plugin's authority to a None
value will effectively make your plugin's data immutable.
WARNING - Doing so will leave your plugin data immutable. Proceed with caution!
Making a Plugin Immutable
import {
approvePluginAuthority
} from '@metaplex-foundation/mpl-core'
await approvePluginAuthority(umi, {
asset: asset.publicKey,
plugin: { type: 'FreezeDelegate' },
newAuthority: { type: 'None' },
}).sendAndConfirm(umi)