pub trait CEP95Interface {
Show 13 methods
// Required methods
fn name(&self) -> String;
fn symbol(&self) -> String;
fn balance_of(&self, owner: Address) -> U256;
fn owner_of(&self, token_id: U256) -> Option<Address>;
fn safe_transfer_from(
&mut self,
from: Address,
to: Address,
token_id: U256,
data: Option<Bytes>,
);
fn transfer_from(&mut self, from: Address, to: Address, token_id: U256);
fn approve(&mut self, spender: Address, token_id: U256);
fn revoke_approval(&mut self, token_id: U256);
fn approved_for(&self, token_id: U256) -> Option<Address>;
fn approve_for_all(&mut self, operator: Address);
fn revoke_approval_for_all(&mut self, operator: Address);
fn is_approved_for_all(&self, owner: Address, operator: Address) -> bool;
fn token_metadata(&self, token_id: U256) -> Vec<(String, String)>;
}Expand description
Casper-compatible NFT interface
Required Methods§
Sourcefn symbol(&self) -> String
fn symbol(&self) -> String
Returns a short symbol or abbreviation for the NFT token/collection.
Sourcefn balance_of(&self, owner: Address) -> U256
fn balance_of(&self, owner: Address) -> U256
Sourcefn safe_transfer_from(
&mut self,
from: Address,
to: Address,
token_id: U256,
data: Option<Bytes>,
)
fn safe_transfer_from( &mut self, from: Address, to: Address, token_id: U256, data: Option<Bytes>, )
Performs a recipient check and transfers the ownership of an NFT.
Reverts unless the contract caller is the current owner, an authorized
operator, or the approved spender for this NFT. Reverts if from is not
the current owner, or if token_id does not reference a valid NFT.
Once ownership is updated and a Transfer event is emitted, the function
checks whether to is a contract hash. If it is, the contract MUST call
on_cep95_received on to and revert the entire transfer if that call
is absent or returns any value other than true.
§Arguments
from - The current owner of the NFT. to - The new owner. token_id - The NFT ID. data - Optional payload to pass to a receiving contract.
Sourcefn transfer_from(&mut self, from: Address, to: Address, token_id: U256)
fn transfer_from(&mut self, from: Address, to: Address, token_id: U256)
Transfers the ownership of an NFT without checking the recipient contract.
§Arguments
from - The current owner of the NFT. to - The new owner. token_id - The NFT ID.
Sourcefn approve(&mut self, spender: Address, token_id: U256)
fn approve(&mut self, spender: Address, token_id: U256)
Approves another account or contract to transfer a specific NFT.
§Arguments
spender - The account or contract that will be granted approval. token_id - The NFT ID.
Sourcefn revoke_approval(&mut self, token_id: U256)
fn revoke_approval(&mut self, token_id: U256)
Sourcefn approved_for(&self, token_id: U256) -> Option<Address>
fn approved_for(&self, token_id: U256) -> Option<Address>
Sourcefn approve_for_all(&mut self, operator: Address)
fn approve_for_all(&mut self, operator: Address)
Enables operator approval for all of the caller’s NFTs.
§Arguments
operator - The operator address to be approved.
Sourcefn revoke_approval_for_all(&mut self, operator: Address)
fn revoke_approval_for_all(&mut self, operator: Address)
Revokes operator approval for all of the caller’s NFTs.
§Arguments
operator - The operator address to be revoked.