Plugins

Attribute Plugin

The Attribute Plugin is a Authority Managed plugin that can store key value pairs of data within the asset.

The Attribute Plugin will work in areas such as:

  • Storing on chain attributes/traits of the Asset which can be read by on chain programs.
  • Storing health and other statistical data that can be modified by a game/program.

Works With

MPL Core Asset
MPL Core Collection

Arguments

ArgValue
attributeListArray<{key: string, value: string}>

AttributeList

The attribute list consists of an Array[] then an object of key-value pairs {key: "value"} string value pairs.

AttributeList

const attributeList = [
  { key: 'key0', value: 'value0' },
  { key: 'key1', value: 'value1' },
]

Adding the Attributes Plugin to an Asset

Adding a Attribute Plugin to an MPL Core Asset

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

const asset = publicKey('11111111111111111111111111111111')

await addPlugin(umi, {
  asset: asset.publicKey,
  plugin: {
    type: 'Attributes',
    attributeList: [
      { key: 'key0', value: 'value0' },
      { key: 'key1', value: 'value1' },
    ],
  },
}).sendAndConfirm(umi)

Updating the Attributes Plugin on an Asset

Updating the Attributes Plugin on an Asset

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

const assetAddress = publicKey('11111111111111111111111111111111')

await updatePlugin(umi, {
  asset: assetAddress,
  plugin: {
    type: 'Attributes',
    attributeList: [
      { key: 'key0', value: 'value0' },
      { key: 'key1', value: 'value1' },
    ],
  },
}).sendAndConfirm(umi)
Previous
Update Delegate Plugin