pub struct NFTManager { /* private fields */ }Expand description
A highly optimized library for managing NFTs (Non-Fungible Tokens) in Ethereum-compatible WebAssembly (WASM).
Implementations§
Source§impl NFTManager
impl NFTManager
Sourcepub fn new(owner: &str) -> NFTManager
pub fn new(owner: &str) -> NFTManager
Initialize a new NFTManager
Sourcepub fn create_class(
&mut self,
class_id: &str,
metadata: &str,
caller: &str,
) -> Result<(), String>
pub fn create_class( &mut self, class_id: &str, metadata: &str, caller: &str, ) -> Result<(), String>
Create a new NFT class. Only the contract owner can create classes.
Sourcepub fn mint(
&mut self,
class_id: &str,
token_id: &str,
metadata: &str,
caller: &str,
) -> Result<(), String>
pub fn mint( &mut self, class_id: &str, token_id: &str, metadata: &str, caller: &str, ) -> Result<(), String>
Mint a new token within an NFT class. Only the owner of the class can mint.
Sourcepub fn transfer(
&mut self,
token_id: &str,
new_owner: &str,
caller: &str,
) -> Result<(), String>
pub fn transfer( &mut self, token_id: &str, new_owner: &str, caller: &str, ) -> Result<(), String>
Transfer a token to another owner. Must be the token owner or approved operator.
Sourcepub fn approve(
&mut self,
token_id: &str,
approved: &str,
caller: &str,
) -> Result<(), String>
pub fn approve( &mut self, token_id: &str, approved: &str, caller: &str, ) -> Result<(), String>
Approve another account to transfer the given token.
Sourcepub fn burn(&mut self, token_id: &str, caller: &str) -> Result<(), String>
pub fn burn(&mut self, token_id: &str, caller: &str) -> Result<(), String>
Burn a token (remove it from circulation). Only the token owner can burn the token.
Sourcepub fn is_approved(&self, token_id: &str, operator: &str) -> bool
pub fn is_approved(&self, token_id: &str, operator: &str) -> bool
Check if an address is approved for the given token.
Trait Implementations§
Source§impl From<NFTManager> for JsValue
impl From<NFTManager> for JsValue
Source§fn from(value: NFTManager) -> Self
fn from(value: NFTManager) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for NFTManager
impl FromWasmAbi for NFTManager
Source§impl IntoWasmAbi for NFTManager
impl IntoWasmAbi for NFTManager
Source§impl LongRefFromWasmAbi for NFTManager
impl LongRefFromWasmAbi for NFTManager
Source§impl OptionFromWasmAbi for NFTManager
impl OptionFromWasmAbi for NFTManager
Source§impl OptionIntoWasmAbi for NFTManager
impl OptionIntoWasmAbi for NFTManager
Source§impl RefFromWasmAbi for NFTManager
impl RefFromWasmAbi for NFTManager
Source§type Anchor = RcRef<NFTManager>
type Anchor = RcRef<NFTManager>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for NFTManager
impl RefMutFromWasmAbi for NFTManager
Source§impl TryFromJsValue for NFTManager
impl TryFromJsValue for NFTManager
Source§impl VectorFromWasmAbi for NFTManager
impl VectorFromWasmAbi for NFTManager
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[NFTManager]>
Source§impl VectorIntoWasmAbi for NFTManager
impl VectorIntoWasmAbi for NFTManager
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[NFTManager]>) -> Self::Abi
Source§impl WasmDescribeVector for NFTManager
impl WasmDescribeVector for NFTManager
impl SupportsConstructor for NFTManager
impl SupportsInstanceProperty for NFTManager
impl SupportsStaticProperty for NFTManager
Auto Trait Implementations§
impl Freeze for NFTManager
impl RefUnwindSafe for NFTManager
impl Send for NFTManager
impl Sync for NFTManager
impl Unpin for NFTManager
impl UnwindSafe for NFTManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.