Skip to main content

Nft

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_additional

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.

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

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
)

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>

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
}

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

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] }