Plugins

Freeze Delegate

Overview

The Freeze Plugin is a Owner Managed plugin that freezes the Asset disallowing transfer. The authority of the plugin can revoke themselves or unfreeze at any time.

The Freeze Plugin will work in areas such as:

  • Escrowless staking.
  • Escrowless listing of an NFT on a marketplace.

Works With

MPL Core Asset
MPL Core Collection

Arguments

ArgValue
frozenbool

Adding the Freeze Delegate Plugin to an Asset

Adding a Freeze Plugin to an MPL Core Asset

import { publicKey } from '@metaplex-foundation/umi'
import { addPlugin } from '@metaplex-foundation/mpl-core'

const assetAddress = publicKey('11111111111111111111111111111111')

await addPlugin(umi, {
  asset: assetAddress,
  plugin: { type: 'FreezeDelegate', data: { frozen: true } },
}).sendAndConfirm(umi)

Delegate the Freeze Authority

The Authority to freeze and thaw an Asset can be delegated to a different Address than the owner.

Thaw an MPL Core Asset

import { publicKey } from '@metaplex-foundation/umi'
import { approvePluginAuthority } from '@metaplex-foundation/mpl-core'

const asset = publicKey('11111111111111111111111111111111')
const delegateAddress = publicKey('22222222222222222222222222222222')

await approvePluginAuthority(umi, {
  asset: asset.publicKey,
  plugin: { type: 'FreezeDelegate' },
  newAuthority: { type: 'Address', address: delegateAddress },
}).sendAndConfirm(umi)

Freezing an Asset

Freeze an MPL Core Asset

import { publicKey } from '@metaplex-foundation/umi'
import { freezeAsset, fetchAsset } from '@metaplex-foundation/mpl-core'

const assetAddress = publicKey('11111111111111111111111111111111')
const assetAccount = await fetchAsset(umi, assetAddress)

const delegateSigner = generateSigner(umi)

await freezeAsset(umi, {
    asset: assetAccount,
    delegate: delegateSigner.publicKey,
    authority: delegateSigner,
  })

Thawing a Frozen Asset

When an Asset is frozen it can be thawed again by the plugin authority.

Thaw an MPL Core Asset

import { publicKey } from '@metaplex-foundation/umi'
import { thawAsset, fetchAsset } from '@metaplex-foundation/mpl-core'

const assetAddress = publicKey('11111111111111111111111111111111')
const assetAccount = await fetchAsset(umi, assetAddress)

const delegateSigner = generateSigner(umi)

  await thawAsset(umi, {
    asset: assetAccount,
    delegate: delegateSigner,
  })
Previous
Transfer Delegate Plugin