Destroys the token with token_id from from.
e - Access to the Soroban environment.from - The account whose token is destroyed.token_id - The identifier of the token to burn.crate::non_fungible::NonFungibleTokenError::NonExistentToken] -
When attempting to burn a token that does not exist.crate::non_fungible::NonFungibleTokenError::IncorrectOwner] - If
the current owner (before calling this function) is not from.["burn", from: Address][token_id: u32]fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, token_id: u32)
Returns the token collection name.
e - Access to the Soroban environment.fn name(env: soroban_sdk::Env) -> soroban_sdk::String
Returns the token collection symbol.
e - Access to the Soroban environment.fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
Gives permission to approved to transfer the token with token_id to
another account. The approval is cleared when the token is
transferred.
Only a single account can be approved at a time for a token_id.
To remove an approval, the approver can approve their own address,
effectively removing the previous approved address. Alternatively,
setting the live_until_ledger to 0 will also revoke the approval.
e - Access to Soroban environment.approver - The address of the approver (should be owner or
operator).approved - The address receiving the approval.token_id - Token ID as a number.live_until_ledger - The ledger number at which the allowance
expires. If live_until_ledger is 0, the approval is revoked.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.NonFungibleTokenError::InvalidApprover] - If the owner address is
not the actual owner of the token.NonFungibleTokenError::InvalidLiveUntilLedger] - If the ledgefn approve(
env: soroban_sdk::Env,
approver: soroban_sdk::Address,
approved: soroban_sdk::Address,
token_id: u32,
live_until_ledger: u32,
)
Returns the number of tokens owned by account.
e - Access to the Soroban environment.account - The address for which the balance is being queried.fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> u32
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Returns Some(index) if the account has the specified role,
where index is the position of the account for that role,
and can be used to query [AccessControl::get_role_member()].
Returns None if the account does not have the specified role.
e - Access to Soroban environment.account - The account to check.role - The role to check for.fn has_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
) -> Option
Returns the owner of the token with token_id.
e - Access to the Soroban environment.token_id - Token ID as a number.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.fn owner_of(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::Address
Transfers the token with token_id from from to to.
WARNING: Confirmation that the recipient is capable of receiving the
Non-Fungible is the caller's responsibility; otherwise the NFT may be
permanently lost.
e - Access to the Soroban environment.from - Account of the sender.to - Account of the recipient.token_id - Token ID as a number.NonFungibleTokenError::IncorrectOwner] - If the current owner
(before calling this function) is not from.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.["transfer", from: Address, to: Address][token_id: u32]fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
Destroys the token with token_id from from, by using spenders
approval.
e - Access to the Soroban environment.spender - The account that is allowed to burn the token on behalf of
the owner.from - The account whose token is destroyed.token_id - The identifier of the token to burn.crate::non_fungible::NonFungibleTokenError::NonExistentToken] -
When attempting to burn a token that does not exist.crate::non_fungible::NonFungibleTokenError::IncorrectOwner] - If
the current owner (before calling this function) is not from.crate::non_fungible::NonFungibleTokenError::InsufficientApproval] -
If the spender does not have a valid approval.["burn", from: Address][token_id: u32]fn burn_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
token_id: u32,
)
Returns the admin account.
e - Access to Soroban environment.fn get_admin(env: soroban_sdk::Env) -> Option
Returns the Uniform Resource Identifier (URI) for the token with
token_id.
e - Access to the Soroban environment.token_id - Token ID as a number.If the token does not exist, this function is expected to panic.
fn token_uri(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::String
fn batch_mint(env: soroban_sdk::Env, to: soroban_sdk::Address, amount: u32) -> u32
Grants a role to an account.
e - Access to Soroban environment.account - The account to grant the role to.role - The role to grant.caller - The address of the caller, must be the admin or have the
RoleAdmin for the role.AccessControlError::Unauthorized] - If the caller does not have
enough privileges.AccessControlError::MaxRolesExceeded] - If adding a new role would
exceed the maximum allowed number of roles.["role_granted", role: Symbol, account: Address][caller: Address]fn grant_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Revokes a role from an account.
To revoke the caller's own role, use
[AccessControl::renounce_role()] instead.
e - Access to Soroban environment.account - The account to revoke the role from.role - The role to revoke.caller - The address of the caller, must be the admin or has the
RoleAdmin for the role.AccessControlError::Unauthorized] - If the caller does not have
enough privileges.AccessControlError::RoleNotHeld] - If the account doesn't have
the role.AccessControlError::RoleIsEmpty] - If the role has no members.["role_revoked", role: Symbol, account: Address][caller: Address]fn revoke_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Returns the account approved for the token with token_id.
e - Access to the Soroban environment.token_id - Token ID as a number.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.fn get_approved(env: soroban_sdk::Env, token_id: u32) -> Option
Returns (Address, i128) - A tuple containing the receiver address and
the royalty amount.
e - Access to the Soroban environment.token_id - The identifier of the token.sale_price - The sale price for which royalties are being
calculated.crate::non_fungible::NonFungibleTokenError::NonExistentToken] - If
the token does not exist.fn royalty_info(
env: soroban_sdk::Env,
token_id: u32,
sale_price: i128,
) -> (soroban_sdk::Address, i128)
fn __constructor(
env: soroban_sdk::Env,
uri: soroban_sdk::String,
name: soroban_sdk::String,
symbol: soroban_sdk::String,
admin: soroban_sdk::Address,
manager: soroban_sdk::Address,
default_royalty_bps: u32,
)
Allows an account to renounce a role assigned to itself. Users can only renounce roles for their own account.
e - Access to Soroban environment.role - The role to renounce.caller - The address of the caller, must be the account that has the
role.AccessControlError::RoleNotHeld] - If the caller doesn't have the
role.AccessControlError::RoleIsEmpty] - If the role has no members.["role_revoked", role: Symbol, account: Address][caller: Address]fn renounce_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Transfers the token with token_id from from to to by using
spenders approval.
Unlike transfer(), which is used when the token owner initiates the
transfer, transfer_from() allows an approved third party
(spender) to transfer the token on behalf of the owner. This
function verifies that spender has the necessary approval.
WARNING: Confirmation that the recipient is capable of receiving the
Non-Fungible is the caller's responsibility; otherwise the NFT may be
permanently lost.
e - Access to the Soroban environment.spender - The address authorizing the transfer.from - Account of the sender.to - Account of the recipient.token_id - Token ID as a number.NonFungibleTokenError::IncorrectOwner] - If the current owner
(before calling this function) is not from.NonFungibleTokenError::InsufficientApproval] - If the spender does
not have a valid approval.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
Returns the admin role for a specific role.
If no admin role is explicitly set, returns None.
e - Access to Soroban environment.role - The role to query the admin role for.fn get_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
) -> Option
Allows the current admin to renounce their role, making the contract permanently admin-less. This is useful for decentralization purposes or when the admin role is no longer needed. Once the admin is renounced, it cannot be reinstated.
e - Access to Soroban environment.AccessControlError::AdminNotSet] - If no admin account is set.["admin_renounced", admin: Address][]fn renounce_admin(env: soroban_sdk::Env)
Sets admin_role as the admin role of role.
e - Access to Soroban environment.role - The role to set the admin for.admin_role - The new admin role.["role_admin_changed", role: Symbol][previous_admin_role: Symbol, new_admin_role: Symbol]AccessControlError::AdminNotSet] - If admin account is not set.fn set_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
admin_role: soroban_sdk::Symbol,
)
Approve or remove operator as an operator for the owner.
Operators can call transfer_from() for any token held by owner,
and call approve() on behalf of owner.
e - Access to Soroban environment.owner - The address holding the tokens.operator - Account to add to the set of authorized operators.live_until_ledger - The ledger number at which the allowance
expires. If live_until_ledger is 0, the approval is revoked.NonFungibleTokenError::InvalidLiveUntilLedger] - If the ledger
number is less than the current ledger number.["approve_for_all", from: Address][operator: Address, live_until_ledger: u32]fn approve_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
live_until_ledger: u32,
)
Returns the account at the specified index for a given role.
A function to get all members of a role is not provided because that
would be unbounded. To enumerate all members of a role, use
[AccessControl::get_role_member_count()] to get the total number of
members and then use [AccessControl::get_role_member()] to retrieve
each member one by one.
e - Access to Soroban environment.role - The role to query.index - The index of the account to retrieve.AccessControlError::IndexOutOfBounds] - If the index is out of
bounds for the role's member list.fn get_role_member(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
index: u32,
) -> soroban_sdk::Address
fn set_token_royalty(
env: soroban_sdk::Env,
token_id: u32,
receiver: soroban_sdk::Address,
basis_points: u32,
operator: soroban_sdk::Address,
)
Returns a vector containing all existing roles. Defaults to empty vector if no roles exist.
e - Access to Soroban environment.This function returns all roles that currently have at least one member.
The maximum number of roles is limited by [MAX_ROLES].
fn get_existing_roles(env: soroban_sdk::Env) -> soroban_sdk::Vec
Returns whether the operator is allowed to manage all the assets of
owner.
e - Access to the Soroban environment.owner - Account of the token's owner.operator - Account to be checked.fn is_approved_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
) -> bool
fn set_default_royalty(
env: soroban_sdk::Env,
receiver: soroban_sdk::Address,
basis_points: u32,
operator: soroban_sdk::Address,
)
Initiates the admin role transfer. Admin privileges for the current admin are not revoked until the recipient accepts the transfer. Overrides the previous pending transfer if there is one.
e - Access to Soroban environment.new_admin - The account to transfer the admin privileges to.live_until_ledger - The ledger number at which the pending transfer
expires. If live_until_ledger is 0, the pending transfer is
cancelled. live_until_ledger argument is implicitly bounded by the
maximum allowed TTL extension for a temporary storage entry and
specifying a higher value will cause the code to panic.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
trying to cancel a transfer that doesn't exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] -
If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount] -
If the specified pending account is not the same as the provided new
address.fn transfer_admin_role(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
live_until_ledger: u32,
)
fn remove_token_royalty(
env: soroban_sdk::Env,
token_id: u32,
operator: soroban_sdk::Address,
)
Completes the 2-step admin transfer.
e - Access to Soroban environment.["admin_transfer_completed", new_admin: Address][previous_admin: Address]crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
there is no pending transfer to accept.AccessControlError::AdminNotSet] - If admin account is not set.fn accept_admin_transfer(env: soroban_sdk::Env)
Returns the total number of accounts that have the specified role. If the role does not exist, returns 0.
e - Access to Soroban environment.role - The role to get the count for.fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32