Calls

burn

Burn a token 🔥

Caller must be the token owner

Namespace

api.tx.nft.burn

Type

function burn(
  token_id: (u32,u32)
)

claimUnownedCollection

Bridged collections from Ethereum will initially lack an owner. These collections will be assigned to the pallet. This allows for claiming those collections assuming they were assigned to the pallet

Namespace

api.tx.nft.claimUnownedCollection

Type

function claimUnownedCollection(
  collection_id: u32,
  new_owner: SeedPrimitivesSignatureAccountId20
)

createCollection

Create a new collection Additional tokens can be minted via mint

  • name - the name of the collection

  • initial_issuance - number of tokens to mint now

  • max_issuance - maximum number of tokens allowed in collection

  • token_owner - the token owner, defaults to the caller

  • metadata_scheme - The off-chain metadata referencing scheme for tokens in this

  • royalties_schedule - defacto royalties plan for secondary sales, this will apply to all tokens in the collection by default

  • cross_chain_compatibility - Is this collection XLS-20 compatible. Note, if enabled, the metadata_scheme will be immutable

Namespace

api.tx.nft.createCollection

Type

function createCollection(
  name: Bytes,
  initial_issuance: u32,
  max_issuance: Option<u32>,
  token_owner: Option<SeedPrimitivesSignatureAccountId20>,
  metadata_scheme: Bytes,
  royalties_schedule: Option<SeedPrimitivesNftRoyaltiesSchedule>,
  cross_chain_compatibility: PalletNftCrossChainCompatibility
)

mint

Mint tokens for an existing collection

  • collection_id - the collection to mint tokens in

  • quantity - how many tokens to mint

  • token_owner - the token owner, defaults to the caller if unspecified Caller must be the collection owner

----------- Weight is O(N) where N is quantity

Namespace

api.tx.nft.mint

Type

function mint(
  collection_id: u32,
  quantity: u32,
  token_owner: Option<SeedPrimitivesSignatureAccountId20>
)

setBaseUri

Set the base URI of a collection Caller must be the current collection owner.\

Cannot change if XLS20 compatibility is enabled.

Namespace

api.tx.nft.setBaseUri

Type

function setBaseUri(
  collection_id: u32,
  base_uri: Bytes
)

setMaxIssuance

Set the max issuance of a collection Caller must be the current collection owner

Namespace

api.tx.nft.setMaxIssuance

Type

function setMaxIssuance(
  collection_id: u32,
  max_issuance: u32
)

setMintFee

Namespace

api.tx.nft.setMintFee

Type

function setMintFee(
  collection_id: u32,
  pricing_details: Option<(u32,u128)>
)

setName

Set the name of a collection Caller must be the current collection owner

Namespace

api.tx.nft.setName

Type

function setName(
  collection_id: u32,
  name: Bytes
)

setOwner

Set the owner of a collection Caller must be the current collection owner

Namespace

api.tx.nft.setOwner

Type

function setOwner(
  collection_id: u32,
  new_owner: SeedPrimitivesSignatureAccountId20
)

setRoyaltiesSchedule

Set the royalties schedule of a collection Caller must be the current collection owner

Namespace

api.tx.nft.setRoyaltiesSchedule

Type

function setRoyaltiesSchedule(
  collection_id: u32,
  royalties_schedule: SeedPrimitivesNftRoyaltiesSchedule
)

togglePublicMint

Namespace

api.tx.nft.togglePublicMint

Type

function togglePublicMint(
  collection_id: u32,
  enabled: bool
)

transfer

Transfer ownership of an NFT Caller must be the token owner

Namespace

api.tx.nft.transfer

Type

function transfer(
  collection_id: u32,
  serial_numbers: Vec<u32>,
  new_owner: SeedPrimitivesSignatureAccountId20
)

setUtilityFlags

Set utility flags of a collection. Allows the restriction of certain operations on a collection such as transfer, burn or mint. Flags apply to all tokens in the collection.

  • collection_id - The collection to set the utility flags for
  • utility_flags - An object containing the utility flags.
    CollectionUtilityFlags {
      transferable: bool,
      burnable: bool,
      mintable: bool,
    }
    

Namespace

api.tx.nft.setUtilityFlags

Type

function setUtilityFlags(
  collection_id: u32,
  utility_flags: CollectionUtilityFlags,
)

setTokenTransferableFlag

Set transferable flag on a token, allowing or disallowing transfers. Token utility flags take priority over the collection utlity flags.

  • token_id - The token id to set the flags for
  • transferable - Transferable utility flag

Namespace

api.tx.nft.setTokenTransferableFlag

Type

function setTokenTransferableFlag(
  collection_id: u32,
  quantity: u32,
  token_owner: SeedPrimitivesSignatureAccountId20,
  burn_authority: TokenBurnAuthority
)

issueSoulbound

Issue soulbound tokens. The issuance will be pending until the designated token owner accepts the issuance.

Soulbound tokens will always be non-transferable.

  • collection_id - The collection id to create the issuance for
  • quantity - The number of tokens to issue
  • token_owner - Account id of the token owner
  • burn_authority - The token burn authority. This value will dictate which account is allowed to burn the token, and cannot be altered post-issuance.
    TokenBurnAuthority {
      /// The token can be burned by the collection_owner
      CollectionOwner,
      /// The token can be burned by the token_owner
      TokenOwner,
      /// The token can be burned by either token or collection owner
      Both,
      /// The token cannot be burned by anyone
      Neither,
    }
    

Namespace

api.tx.nft.issueSoulbound

Type

function issueSoulbound(
  token_id: u32,
  transferable: bool,
)

acceptSoulboundIssuance

Accept the issuance of a soulbound token

  • collection_id - The collection id the issuance is for
  • issuance_id - The issuance id. An issuance id is created and emitted when a soulbound token is issued. All pending issuances for an account can be retrieved by querying the collection’s pending issuances.

Namespace

api.tx.nft.acceptSoulboundIssuance

Type

function acceptSoulboundIssuance(
  collection_id: u32,
  issuance_id: u32,
)

Storage

collectionInfo

Map from collection to its information

Namespace

api.query.nft.collectionInfo

Type

function collectionInfo(
  u32
): Option<PalletNftCollectionInformation>

nextCollectionId

The next available incrementing collection id

Namespace

api.query.nft.nextCollectionId

Type

function nextCollectionId(

): u32

publicMintInfo

Map from collection to its public minting information

Namespace

api.query.nft.publicMintInfo

Type

function publicMintInfo(
  u32
): Option<SeedPalletCommonUtilsPublicMintInformation>

tokenLocks

Map from a token to lock status if any

Namespace

api.query.nft.tokenLocks

Type

function tokenLocks(
  (u32,u32)
): Option<SeedPrimitivesNftTokenLockReason>

utilityFlags

Map from a collection id to it’s utility flags

Namespace

api.query.nft.utilityFlags

Type

function utilityFlags(u32): CollectionUtilityFlags

tokenUtilityFlags

Map from a token id to its utility flags

Namespace

api.query.nft.tokenUtilityFlags

Type

type TokenUtilityFlags = {
	transferable: bool,
	burnAuthority: Option<TokenBurnAuthority>,
}

function tokenUtilityFlags(
  (u32, u32)
): TokenUtilityFlags

pendingIssuances

Map from a collection id to the collection’s pending issuances

Namespace

api.query.nft.pendingIssuances

Type

type PendingIssuance = {
  issuanceId: u32;
  quantity: u32;
  burnAuthority: TokenBurnAuthority;
}

type CollectionPendingIssuances = {
  nextIssuanceId: u32;
  pendingIssuances: Vec<(AccountId, PendingIssuance)>;
}

function pendingIssuances(
  u32
): CollectionPendingIssuances

Can be used to retrieve pending issuances for a particular account.

const collectionIssuances = await api.query.nft.pendingIssuances(collectionId);
const pendingIssuances =
  collectionIssuances.
    pendingIssuances.
    toJSON().
    find((p) => p[0] === accountId);

Events

BaseUriSet

Base URI was set

Namespace

api.events.nft.BaseUriSet

Type

type BaseUriSet = {
  collection_id: u32,
  base_uri: Bytes
}

BridgedMint

Token(s) were bridged

Namespace

api.events.nft.BridgedMint

Type

type BridgedMint = {
  collection_id: u32,
  serial_numbers: Vec<u32>,
  owner: SeedPrimitivesSignatureAccountId20
}

Burn

A token was burned

Namespace

api.events.nft.Burn

Type

type Burn = {
  collection_id: u32,
  serial_number: u32
}

CollectionClaimed

Collection has been claimed

Namespace

api.events.nft.CollectionClaimed

Type

type CollectionClaimed = {
  account: SeedPrimitivesSignatureAccountId20,
  collection_id: u32
}

CollectionCreate

A new collection of tokens was created

Namespace

api.events.nft.CollectionCreate

Type

type CollectionCreate = {
  collection_uuid: u32,
  initial_issuance: u32,
  max_issuance: Option<u32>,
  collection_owner: SeedPrimitivesSignatureAccountId20,
  metadata_scheme: Bytes,
  name: Bytes,
  royalties_schedule: Option<SeedPrimitivesNftRoyaltiesSchedule>,
  origin_chain: SeedPrimitivesNftOriginChain,
  compatibility: PalletNftCrossChainCompatibility
}

MaxIssuanceSet

Max issuance was set

Namespace

api.events.nft.MaxIssuanceSet

Type

type MaxIssuanceSet = {
  collection_id: u32,
  max_issuance: u32
}

Mint

Token(s) were minted

Namespace

api.events.nft.Mint

Type

type Mint = {
  collection_id: u32,
  start: u32,
  end: u32,
  owner: SeedPrimitivesSignatureAccountId20
}

MintFeePaid

Payment was made to cover a public mint

Namespace

api.events.nft.MintFeePaid

Type

type MintFeePaid = {
  who: SeedPrimitivesSignatureAccountId20,
  collection_id: u32,
  payment_asset: u32,
  payment_amount: u128,
  token_count: u32
}

MintPriceSet

A mint price was set for a collection

Namespace

api.events.nft.MintPriceSet

Type

type MintPriceSet = {
  collection_id: u32,
  payment_asset: Option<u32>,
  mint_price: Option<u128>
}

NameSet

Name was set

Namespace

api.events.nft.NameSet

Type

type NameSet = {
  collection_id: u32,
  name: Bytes
}

OwnerSet

A new owner was set

Namespace

api.events.nft.OwnerSet

Type

type OwnerSet = {
  collection_id: u32,
  new_owner: SeedPrimitivesSignatureAccountId20
}

PublicMintToggle

Public minting was enabled/disabled for a collection

Namespace

api.events.nft.PublicMintToggle

Type

type PublicMintToggle = {
  collection_id: u32,
  enabled: bool
}

RoyaltiesScheduleSet

Royalties schedule was set

Namespace

api.events.nft.RoyaltiesScheduleSet

Type

type RoyaltiesScheduleSet = {
  collection_id: u32,
  royalties_schedule: SeedPrimitivesNftRoyaltiesSchedule
}

Transfer

A token was transferred

Namespace

api.events.nft.Transfer

Type

type Transfer = {
  previous_owner: SeedPrimitivesSignatureAccountId20,
  collection_id: u32,
  serial_numbers: Vec<u32>,
  new_owner: SeedPrimitivesSignatureAccountId20
}

CollectionClaimed

Collection has been claimed

Namespace

api.events.nft.CollectionClaimed

Type

type CollectionClaimed = {
  account: SeedPrimitivesSignatureAccountId20,
  collection_id: u32
}

UtilityFlagsSet

Utility flags were set for a collection

Namespace

api.events.nft.UtilityFlagsSet

Type

type UtilityFlagsSet = {
  collection_id: u32,
  utility_flags: CollectionUtilityFlags
}

TokenTransferableFlagSet

Token transferable flag was set

Namespace

api.events.nft.TokenTransferableFlagSet

Type

type TokenTransferableFlagSet = {
  token_id: (u32, u32),
  transferable: bool
}

PendingIssuanceCreated

A pending issuance for a soulbound token was created

Namespace

api.events.nft.PendingIssuanceCreated

Type

type PendingIssuanceCreated = {
  collection_id: u32,
  issuance_id: u32,
  token_owner: SeedPrimitivesSignatureAccountId20,
  quantity: u32,
  burn_authority: TokenBurnAuthority,
}

Issued

Soulbound tokens were successfully issued

Namespace

api.events.nft.Issued

Type

type Issue = {
  token_owner: SeedPrimitivesSignatureAccountId20,
  start: u32,
  end: u32,
  burn_authority: TokenBurnAuthority,
}

Errors

AttemptedMintOnBridgedToken

Attemped to mint a token that was bridged from a different chain

Namespace

api.errors.nft.AttemptedMintOnBridgedToken

BlockedMint

Token(s) blocked from minting during the bridging process

Namespace

api.errors.nft.BlockedMint

CannotClaimNonClaimableCollections

Cannot claim already claimed collections

Namespace

api.errors.nft.CannotClaimNonClaimableCollections

CollectionIssuanceNotZero

Total issuance of collection must be zero to add xls20 compatibility

Namespace

api.errors.nft.CollectionIssuanceNotZero

CollectionNameInvalid

Given collection name is invalid (invalid utf-8, too long, empty)

Namespace

api.errors.nft.CollectionNameInvalid

InitialIssuanceNotZero

Initial issuance on XLS-20 compatible collections must be zero

Namespace

api.errors.nft.InitialIssuanceNotZero

InvalidMaxIssuance

Max issuance needs to be greater than 0 and initial_issuance Cannot exceed MaxTokensPerCollection

Namespace

api.errors.nft.InvalidMaxIssuance

InvalidMetadataPath

The metadata path is invalid (non-utf8 or empty)

Namespace

api.errors.nft.InvalidMetadataPath

InvalidNewOwner

The caller can not be the new owner

Namespace

api.errors.nft.InvalidNewOwner

MaxIssuanceAlreadySet

The max issuance has already been set and can’t be changed

Namespace

api.errors.nft.MaxIssuanceAlreadySet

MaxIssuanceReached

The collection max issuance has been reached and no more tokens can be minted

Namespace

api.errors.nft.MaxIssuanceReached

MintLimitExceeded

The quantity exceeds the max tokens per mint limit

Namespace

api.errors.nft.MintLimitExceeded

NoAvailableIds

No more Ids are available, they’ve been exhausted

Namespace

api.errors.nft.NoAvailableIds

NoCollectionFound

The collection does not exist

Namespace

api.errors.nft.NoCollectionFound

NotCollectionOwner

Origin is not the collection owner and is not permitted to perform the operation

Namespace

api.errors.nft.NotCollectionOwner

NoToken

The token does not exist

Namespace

api.errors.nft.NoToken

NotTokenOwner

Origin does not own the NFT

Namespace

api.errors.nft.NotTokenOwner

PublicMintDisabled

This collection has not allowed public minting

Namespace

api.errors.nft.PublicMintDisabled

RoyaltiesInvalid

Total royalties would exceed 100% of sale or an empty vec is supplied

Namespace

api.errors.nft.RoyaltiesInvalid

TokenLimitExceeded

The number of tokens have exceeded the max tokens allowed

Namespace

api.errors.nft.TokenLimitExceeded

TokenLocked

Cannot operate on a listed NFT

Namespace

api.errors.nft.TokenLocked

TransferUtilityBlocked

Transfer has been disabled for tokens within this collection

Namespace

api.errors.nft.TransferUtilityBlocked

BurnUtilityBlocked

Burning has been disabled for tokens within this collection

Namespace

api.errors.nft.BurnUtilityBlocked

PendingIssuanceLimitExceeded

The number of pending issuances has exceeded the max for a collection

Namespace

api.errors.nft.PendingIssuanceLimitExceeded

InvalidPendingIssuance

Attempted to accept an issuance that does not exist, or is not set for the caller

Namespace

api.errors.nft.InvalidPendingIssuance

CannotUpdateTokenUtility

Attempted to update the token utility flags for a soulbound token

Namespace

api.errors.nft.CannotUpdateTokenUtility

InvalidBurnAuthority

Attempted to burn a token from an account that does not adhere to the token’s burn authority

Namespace

api.errors.nft.InvalidBurnAuthority

Constants

palletId

This pallet’s Id, used for deriving a sovereign account ID

Namespace

api.consts.nft.palletId

Type

type palletId = FrameSupportPalletId

stringLimit

The maximum length of a collection name, stored on-chain

Namespace

api.consts.nft.stringLimit

Type

type stringLimit = u32

JSON-RPC Methods

ownedTokens

Get all NFTs owned by an account

Interface

api.rpc.nft.ownedTokens(collectionId: CollectionUuid, who: AccountId, cursor: SerialNumber, limit: u16): Json

JSON

{ "id":1, "jsonrpc":"2.0", "method":"nft_ownedTokens", "params":[collectionId: CollectionUuid, who: AccountId, cursor: SerialNumber, limit: u16] }

tokenUri

Get the URI of a token

Interface

api.rpc.nft.tokenUri(tokenId: TokenId): Json

JSON

{ "id":1, "jsonrpc":"2.0", "method":"nft_tokenUri", "params":[tokenId: TokenId] }

collectionDetails

Get information related to a collection such as name, owner and max issuance

Interface

api.rpc.nft.collectionDetails(collectionId: CollectionUuid): Json

JSON

{ "id":1, "jsonrpc":"2.0", "method":"nft_collectionDetails", "params":[collectionId: CollectionUuid] }