Features
Burning Assets
Assets can be burnt using the burn
instruction. This will return the rent-exempt fees to the owner. Only a very small amount of SOL will stay in the account to prevent it from being reopened.
Code Example
Here is how you can use our SDKs to burn a Core asset. The snippet assumes that you are the owner of the asset.
Burning an Asset
import { publicKey } from '@metaplex-foundation/umi'
import {
burn,
fetchAsset,
collectionAddress,
fetchCollection,
} from '@metaplex-foundation/mpl-core'
const assetId = publicKey('11111111111111111111111111111111')
const asset = await fetchAsset(umi, assetId)
await burn(umi, {
asset: asset,
}).sendAndConfirm(umi)
Burning an Asset that is part of a Collection
Here is how you can use our SDKs to burn a Core asset that is part of a collection. The snippet assumes that you are the owner of the asset.
Burning an Asset that is part of a collection
import { publicKey } from '@metaplex-foundation/umi'
import { burnV1, fetchAsset } from '@metaplex-foundation/mpl-core'
import { publicKey } from '@metaplex-foundation/umi'
import {
burn,
fetchAsset,
collectionAddress,
fetchCollection,
} from '@metaplex-foundation/mpl-core'
const assetId = publicKey('11111111111111111111111111111111')
const asset = await fetchAsset(umi, assetId)
const collectionId = collectionAddress(asset)
let collection = undefined
if (collectionId) {
collection = await fetchCollection(umi, collection)
}
await burn(umi, {
asset: asset,
collection: collection,
}).sendAndConfirm(umi)