Sft โ
Calls โ
burn โ
Burn a token ๐ฅ
Caller must be the token owner
Namespace
api.tx.sft.burnType
function burn(
collection_id: u32,
serial_numbers: Vec<(u32,u128)>
)createCollection โ
Create a new collection to group multiple semi-fungible tokens Tokens can be created within the collection by calling create_token
collection_name - the name of the collection collection_owner - the collection 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.
The collectionUuid used to store the SFT CollectionInfo is retrieved from the NFT pallet. This is so that CollectionUuids are unique across all collections, regardless of if they are SFT or NFT collections.
Namespace
api.tx.sft.createCollectionType
function createCollection(
collection_name: Bytes,
collection_owner: Option<SeedPrimitivesSignatureAccountId20>,
metadata_scheme: Bytes,
royalties_schedule: Option<SeedPrimitivesNftRoyaltiesSchedule>
)createToken โ
Create additional tokens for an existing collection These tokens act similar to tokens within an ERC1155 contract Each token has individual issuance, max_issuance,
Namespace
api.tx.sft.createTokenType
function createToken(
collection_id: u32,
token_name: Bytes,
initial_issuance: u128,
max_issuance: Option<u128>,
token_owner: Option<SeedPrimitivesSignatureAccountId20>
)createTokenWithAdditionalData โ
Create additional tokens for an existing collection with additional data. These tokens act similar to tokens within an ERC1155 contract. Each token has individual issuance, max_issuance, and additional data.
Namespace
api.tx.sft.createTokenWithAdditionalDataType
function createTokenWithAdditionalData(
collection_id: u32,
token_name: Bytes,
initial_issuance: u128,
max_issuance: Option<u128>,
token_owner: Option<SeedPrimitivesSignatureAccountId20>,
additional_data: Bytes
)mint โ
Mints some balances into some serial numbers for an account This acts as a batch mint function and allows for multiple serial numbers and quantities to be passed in simultaneously. Must be called by the collection owner
collection_id - the SFT collection to mint into serial_numbers - A list of serial numbers to mint into quantities - A list of quantities to mint into each serial number token_owner - The owner of the tokens, defaults to the caller
Namespace
api.tx.sft.mintType
function mint(
collection_id: u32,
serial_numbers: Vec<(u32,u128)>,
token_owner: Option<SeedPrimitivesSignatureAccountId20>
)setBaseUri โ
Set the base URI of a collection (MetadataScheme) Caller must be the current collection owner
Namespace
api.tx.sft.setBaseUriType
function setBaseUri(
collection_id: u32,
metadata_scheme: Bytes
)setMaxIssuance โ
Set the max issuance of a collection Caller must be the current collection owner
Namespace
api.tx.sft.setMaxIssuanceType
function setMaxIssuance(
token_id: (u32,u32),
max_issuance: u128
)setMintFee โ
Namespace
api.tx.sft.setMintFeeType
function setMintFee(
token_id: (u32,u32),
pricing_details: Option<(u32,u128)>
)setName โ
Set the name of a collection Caller must be the current collection owner
Namespace
api.tx.sft.setNameType
function setName(
collection_id: u32,
collection_name: Bytes
)setOwner โ
Set the owner of a collection Caller must be the current collection owner
Namespace
api.tx.sft.setOwnerType
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.sft.setRoyaltiesScheduleType
function setRoyaltiesSchedule(
collection_id: u32,
royalties_schedule: SeedPrimitivesNftRoyaltiesSchedule
)togglePublicMint โ
Namespace
api.tx.sft.togglePublicMintType
function togglePublicMint(
token_id: (u32,u32),
enabled: bool
)setTokenName โ
Namespace
api.tx.sft.setTokenNameType
function setTokenName(
token_id: (u32, u32),
token_name: Bytes
)transfer โ
Transfer ownership of an SFT Caller must be the token owner
Namespace
api.tx.sft.transferType
function transfer(
collection_id: u32,
serial_numbers: Vec<(u32,u128)>,
new_owner: SeedPrimitivesSignatureAccountId20
)setUtilityFlags โ
Set utility flags of a collection. This allows restricting certain operations on a collection such as transfer, burn or mint.
Caller must be the collection owner.
- collection_id - The id of the collection
- utility_flags - An object containing the utility flags.
CollectionUtilityFlags { transferable: bool, burnable: bool, mintable: bool, }
Namespace
api.tx.sft.setUtilityFlagsType
function setUtilityFlags(
collection_id: u32,
utility_flags: CollectionUtilityFlags,
)setTokenTransferableFlag โ
Set transferable flag on a token, allowing or disallowing transfers.
Caller must be the collection owner.
Namespace
api.tx.sft.setTokenTransferableFlagType
function setTokenTransferableFlag(
token_id: (u32, u32),
transferable: bool,
)setTokenBurnAuthority โ
Set burn authority on a token. This value will be immutable once set.
Caller must be the collection owner.
- token_id -. The token id
- burn_authority - The token burn authority. This value will dictate which account is allowed to burn the token.
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.sft.setTokenBurnAuthority
Type
function setTokenBurnAuthority(
token_id: (u32, u32),
burn_authority: TokenBurnAuthority
)setAdditionalData โ
Set additional data for a token. This allows collection owners or token owners to store custom data associated with specific tokens.
token_id- The token id to set additional data foradditional_data- Custom data to associate with the token
Namespace
api.tx.sft.setAdditionalDataType
function setAdditionalData(
token_id: (u32,u32),
additional_data: Bytes
)burnAsCollectionOwner โ
Burn a token as the collection owner.
The burn authority must have already been set and set to either the collection owner or both.
- token_owner - The account id of the token owner
- collection_id - The collection id
- serial_numbers - Array of serial number and the amount of tokens to burn
Namespace
api.tx.sft.burnAsCollectionOwnerType
function burnAsCollectionOwner(
token_owner: SeedPrimitivesSignatureAccountId20,
collection_id: u32,
serial_numbers: Vec<u32, u32>
)issueSoulbound โ
Issue soulbound tokens. The issuance will be pending until the token owner accepts the issuance.
The burn authority for the specified tokens must already have been set prior to attempting to issue the tokens.
- token_owner - Account id of the token owner. The tokens will be burned for this account.
- collection_id - The collection id to issue the tokens for
- serial_numbers - List of token ids and the amount to issue
Namespace
api.tx.sft.issueSoulboundType
function issueSoulbound(
colelction_id: u32,
serial_numbers: Vec<(u32, u32)>,
token_owner:
)acceptSoulboundIssuance โ
Accept the issuance of a soulbound tokens
- collection_id - The collection id
- issuance_id - The issuance id. An issuance id is created and emitted on issuance. All pending issuances for an account can be retrieved by querying the collection's pending issuances.
Namespace
api.tx.sft.acceptSoulboundIssuanceType
function acceptSoulboundIssuance(
collection_id: u32,
issuance_idL u32
)Storage โ
publicMintInfo โ
Map from collection to its public minting information
Namespace
api.query.sft.publicMintInfoType
function publicMintInfo(
(u32,u32)
): Option<SeedPalletCommonUtilsPublicMintInformation>sftCollectionInfo โ
Map from collection to its information
Namespace
api.query.sft.sftCollectionInfoType
function sftCollectionInfo(
u32
): Option<PalletSftSftCollectionInformation>tokenInfo โ
Map from token to its token information, including ownership information
Namespace
api.query.sft.tokenInfoType
function tokenInfo(
(u32,u32)
): Option<PalletSftSftTokenInformation>utilityFlags โ
Map from a collection id to it's utility flags
Namespace
api.query.sft.utilityFlagsType
function utilityFlags(u32): CollectionUtilityFlagstokenUtilityFlags โ
Map from a token id to its utility flags
Namespace
api.query.sft.tokenUtilityFlagsType
type TokenUtilityFlags = {
transferable: bool,
burnAuthority: Option<TokenBurnAuthority>,
}
function tokenUtilityFlags(
(u32, u32)
): TokenUtilityFlagsadditionalData โ
Map from a token id to its additional data
Namespace
api.query.sft.additionalDataType
function additionalData(
(u32, u32)
): Option<Bytes>pendingIssuances โ
Map from a collection id to the collection's pending issuances
Namespace
api.query.sft.pendingIssuancesType
type SftPendingIssuance = {
issuanceId: u32;
serial_numbers: Vec<(u32, u32)>
}
type CollectionPendingIssuances = {
nextIssuanceId: u32;
pendingIssuances: Vec(AccountId, PendingIssuance)
}
function pendingIssuances(
u32
): CollectionPendingIssuancesCan be used to retrieve pending issuances for a particular account.
const collectionIssuances = await api.query.sft.pendingIssuances(collectionId);
const pendingIssuances =
collectionIssuances.
pendingIssuances.
toJSON().
find((p) => p[0] === accountId);Events โ
BaseUriSet โ
Base URI was set
Namespace
api.events.sft.BaseUriSetType
type BaseUriSet = {
collection_id: u32,
metadata_scheme: Bytes
}Burn โ
A token was burned
Namespace
api.events.sft.BurnType
type Burn = {
collection_id: u32,
serial_numbers: Vec<u32>,
balances: Vec<u128>,
owner: SeedPrimitivesSignatureAccountId20
}CollectionCreate โ
A new collection of tokens was created
Namespace
api.events.sft.CollectionCreateType
type CollectionCreate = {
collection_id: u32,
collection_owner: SeedPrimitivesSignatureAccountId20,
metadata_scheme: Bytes,
name: Bytes,
royalties_schedule: Option<SeedPrimitivesNftRoyaltiesSchedule>,
origin_chain: SeedPrimitivesNftOriginChain
}MaxIssuanceSet โ
Max issuance was set
Namespace
api.events.sft.MaxIssuanceSetType
type MaxIssuanceSet = {
token_id: (u32,u32),
max_issuance: u128
}Mint โ
Token(s) were minted
Namespace
api.events.sft.MintType
type Mint = {
collection_id: u32,
serial_numbers: Vec<u32>,
balances: Vec<u128>,
owner: SeedPrimitivesSignatureAccountId20
}MintFeePaid โ
Payment was made to cover a public mint
Namespace
api.events.sft.MintFeePaidType
type MintFeePaid = {
who: SeedPrimitivesSignatureAccountId20,
token_id: (u32,u32),
payment_asset: u32,
payment_amount: u128,
token_count: u128
}MintPriceSet โ
A mint price was set for a collection
Namespace
api.events.sft.MintPriceSetType
type MintPriceSet = {
token_id: (u32,u32),
payment_asset: Option<u32>,
mint_price: Option<u128>
}NameSet โ
Name was set
Namespace
api.events.sft.NameSetType
type NameSet = {
collection_id: u32,
collection_name: Bytes
}OwnerSet โ
A new owner was set
Namespace
api.events.sft.OwnerSetType
type OwnerSet = {
collection_id: u32,
new_owner: SeedPrimitivesSignatureAccountId20
}PublicMintToggle โ
Public minting was enabled/disabled for a collection
Namespace
api.events.sft.PublicMintToggleType
type PublicMintToggle = {
token_id: (u32,u32),
enabled: bool
}RoyaltiesScheduleSet โ
Royalties schedule was set
Namespace
api.events.sft.RoyaltiesScheduleSetType
type RoyaltiesScheduleSet = {
collection_id: u32,
royalties_schedule: SeedPrimitivesNftRoyaltiesSchedule
}TokenCreate โ
A new token was created within a collection
Namespace
api.events.sft.TokenCreateType
type TokenCreate = {
token_id: (u32,u32),
initial_issuance: u128,
max_issuance: Option<u128>,
token_name: Bytes,
token_owner: SeedPrimitivesSignatureAccountId20
}Transfer โ
A token was transferred
Namespace
api.events.sft.TransferType
type Transfer = {
previous_owner: SeedPrimitivesSignatureAccountId20,
collection_id: u32,
serial_numbers: Vec<u32>,
balances: Vec<u128>,
new_owner: SeedPrimitivesSignatureAccountId20
}UtilityFlagsSet โ
Utility flags were set for a collection
Namespace
api.events.sft.UtilityFlagsSetType
type UtilityFlagsSet = {
collection_id: u32,
utility_flags: CollectionUtilityFlags,
}TokenTransferableFlagSet โ
Token transferable flag was set
Namespace
api.events.sft.TokenTransferableFlagSetType
type TokenTransferableFlagSet = {
token_id: (u32, u32),
transferable: bool,
}AdditionalDataSet โ
Additional data was set for a token
Namespace
api.events.sft.AdditionalDataSetType
type AdditionalDataSet = {
token_id: (u32, u32),
additional_data: Bytes
}PendingIssuanceCreated โ
A pending issuance for a soulbound token has been created
Namespace
api.events.sft.PendingIssuanceCreatedType
PendingIssuanceCreated = {
collection_id: u32,
issuance_id: u32,
serial_numbers: Vec<u32>,
balances: Vec<u32>,
token_owner: SeedPrimitivesSignatureAccountId20,
}Issued โ
Soulbound tokens were successfully issued
Namespace
api.events.sft.IssuedType
type Issued = {
token_owner: SeedPrimitivesSignatureAccountId20,
serial_numbers: Vec<u32>,
balances: Vec<u32>,
}Errors โ
InsufficientBalance โ
The user does not own enough of this token to perform the operation
Namespace
api.errors.sft.InsufficientBalanceInvalidMaxIssuance โ
Max issuance needs to be greater than 0 and initial_issuance Cannot exceed MaxTokensPerCollection
Namespace
api.errors.sft.InvalidMaxIssuanceInvalidNewOwner โ
Caller can not be the new owner
Namespace
api.errors.sft.InvalidNewOwnerInvalidQuantity โ
The specified quantity must be greater than 0
Namespace
api.errors.sft.InvalidQuantityMaxIssuanceAlreadySet โ
The max issuance has already been set and can't be changed
Namespace
api.errors.sft.MaxIssuanceAlreadySetMaxIssuanceReached โ
The collection max issuance has been reached and no more tokens can be minted
Namespace
api.errors.sft.MaxIssuanceReachedMaxOwnersReached โ
The max amount of owners per token has been reached
Namespace
api.errors.sft.MaxOwnersReachedNameInvalid โ
Given collection or token name is invalid (invalid utf-8, empty)
Namespace
api.errors.sft.NameInvalidNoCollectionFound โ
The collection does not exist
Namespace
api.errors.sft.NoCollectionFoundNotCollectionOwner โ
Origin is not the collection owner and is not permitted to perform the operation
Namespace
api.errors.sft.NotCollectionOwnerNoToken โ
The token does not exist
Namespace
api.errors.sft.NoTokenOverflow โ
The operation would cause a numeric overflow
Namespace
api.errors.sft.OverflowPublicMintDisabled โ
This collection has not allowed public minting
Namespace
api.errors.sft.PublicMintDisabledRoyaltiesInvalid โ
Total royalties would exceed 100% of sale or an empty vec is supplied
Namespace
api.errors.sft.RoyaltiesInvalidInvalidAdditionalData โ
The additional data provided is invalid or exceeds the maximum allowed size
Namespace
api.errors.sft.InvalidAdditionalDataConstants โ
maxOwnersPerSftToken โ
Max unique owners that can own an SFT token
Namespace
api.consts.sft.maxOwnersPerSftTokenType
type maxOwnersPerSftToken = u32maxSerialsPerMint โ
Max tokens that can be minted in one transaction
Namespace
api.consts.sft.maxSerialsPerMintType
type maxSerialsPerMint = u32maxTokensPerSftCollection โ
Max tokens that a collection can contain
Namespace
api.consts.sft.maxTokensPerSftCollectionType
type maxTokensPerSftCollection = u32palletId โ
This pallet's Id, used for deriving a sovereign account ID
Namespace
api.consts.sft.palletIdType
type palletId = FrameSupportPalletIdstringLimit โ
The maximum length of a collection or token name, stored on-chain
Namespace
api.consts.sft.stringLimitType
type stringLimit = u32