Burn an NFT owned by the caller.
Requires the "burner" role on the from address.
from - Owner of the NFT (must have burner role)token_id - ID of the token to burnfn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, token_id: u32)
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
env: soroban_sdk::Env,
approver: soroban_sdk::Address,
approved: soroban_sdk::Address,
token_id: u32,
live_until_ledger: u32,
)
fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> u32
fn has_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
) -> Option
fn owner_of(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::Address
fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
Burn an NFT from another address.
Requires the "burner" role on the spender address and
approval from the token owner.
spender - Address initiating the burn (must have burner role and approval)from - Owner of the NFTtoken_id - ID of the token to burnfn burn_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
token_id: u32,
)
fn get_admin(env: soroban_sdk::Env) -> Option
fn token_uri(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::String
fn grant_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
fn revoke_role(
env: soroban_sdk::Env,
account: soroban_sdk::Address,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
fn get_approved(env: soroban_sdk::Env, token_id: u32) -> Option
Get the custom metadata for a specific token.
token_id - ID of the token to queryThe metadata if found, None otherwise
fn get_metadata(env: soroban_sdk::Env, token_id: u32) -> Option
Get the total number of NFTs that have been minted.
Note: This is the total minted count, not the current supply. Burned tokens are still counted in this total.
The total number of tokens minted
fn total_supply(env: soroban_sdk::Env) -> u32
Initialize the KindFi NFT contract.
admin - Address that will have admin privileges and can grant rolesname - Collection name (e.g., "KindFi NFT")symbol - Collection symbol (e.g., "KFNFT")base_uri - Base URI for token metadata (e.g., "https://api.kindfi.org/nft/")Error::AlreadyInitialized - If the contract has already been initializedfn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
name: soroban_sdk::String,
symbol: soroban_sdk::String,
base_uri: soroban_sdk::String,
)
fn renounce_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
fn get_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
) -> Option
fn renounce_admin(env: soroban_sdk::Env)
fn set_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
admin_role: soroban_sdk::Symbol,
)
fn approve_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
live_until_ledger: u32,
)
fn get_role_member(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
index: u32,
) -> soroban_sdk::Address
Update the metadata for an existing NFT.
Requires the "metadata_manager" role.
caller - Address initiating the update (must have metadata_manager role)token_id - ID of the token to updatenft_metadata - New metadata for the NFTError::Unauthorized - If caller doesn't have metadata_manager rolefn update_metadata(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token_id: u32,
nft_metadata: NFTMetadata,
)
Mint a new NFT with custom metadata.
Requires the "minter" role.
caller - Address initiating the mint (must have minter role)to - Address to receive the NFTnft_metadata - Custom metadata for this NFTThe token ID of the newly minted NFT (sequential, starting from 0)
fn mint_with_metadata(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
to: soroban_sdk::Address,
nft_metadata: NFTMetadata,
) -> u32
fn is_approved_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
) -> bool
fn transfer_admin_role(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
live_until_ledger: u32,
)
fn accept_admin_transfer(env: soroban_sdk::Env)
fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32
Get the metadata_manager role symbol. Helper function since the role name exceeds symbol_short! limit.
fn metadata_manager_role(env: soroban_sdk::Env) -> soroban_sdk::Symbol