pub struct ERC1155 { /* private fields */ }Expand description
A highly optimized ERC1155 implementation in Rust for WebAssembly (WASM).
Implementations§
Source§impl ERC1155
 
impl ERC1155
Sourcepub fn new(owner: &str) -> ERC1155
 
pub fn new(owner: &str) -> ERC1155
Initializes a new ERC1155 contract with the owner.
§Parameters
- owner: The initial owner of the contract.
Sourcepub fn mint(
    &mut self,
    caller: &str,
    token_id: u32,
    amount: u64,
) -> Result<(), String>
 
pub fn mint( &mut self, caller: &str, token_id: u32, amount: u64, ) -> Result<(), String>
Mints new tokens for a given token_id (only admins can mint).
§Parameters
- caller: The address calling the function (must be an admin).
- token_id: The ID of the token to mint.
- amount: The number of tokens to mint.
Sourcepub fn transfer(
    &mut self,
    caller: &str,
    to: &str,
    token_id: u32,
    amount: u64,
) -> Result<(), String>
 
pub fn transfer( &mut self, caller: &str, to: &str, token_id: u32, amount: u64, ) -> Result<(), String>
Transfers tokens to another user.
§Parameters
- caller: The address initiating the transfer (must be owner or approved).
- to: The recipient of the tokens.
- token_id: The ID of the token being transferred.
- amount: The number of tokens to transfer.
Sourcepub fn approve(
    &mut self,
    caller: &str,
    approved: &str,
    token_id: u32,
) -> Result<(), String>
 
pub fn approve( &mut self, caller: &str, approved: &str, token_id: u32, ) -> Result<(), String>
Approves another user to transfer tokens on behalf of the caller.
Sourcepub fn balance_of(&self, owner: &str, token_id: u32) -> u64
 
pub fn balance_of(&self, owner: &str, token_id: u32) -> u64
Returns the balance of tokens for a specific user and token ID.
Trait Implementations§
Source§impl FromWasmAbi for ERC1155
 
impl FromWasmAbi for ERC1155
Source§impl IntoWasmAbi for ERC1155
 
impl IntoWasmAbi for ERC1155
Source§impl LongRefFromWasmAbi for ERC1155
 
impl LongRefFromWasmAbi for ERC1155
Source§impl OptionFromWasmAbi for ERC1155
 
impl OptionFromWasmAbi for ERC1155
Source§impl OptionIntoWasmAbi for ERC1155
 
impl OptionIntoWasmAbi for ERC1155
Source§impl RefFromWasmAbi for ERC1155
 
impl RefFromWasmAbi for ERC1155
Source§impl RefMutFromWasmAbi for ERC1155
 
impl RefMutFromWasmAbi for ERC1155
Source§impl TryFromJsValue for ERC1155
 
impl TryFromJsValue for ERC1155
Source§impl VectorFromWasmAbi for ERC1155
 
impl VectorFromWasmAbi for ERC1155
Source§impl VectorIntoWasmAbi for ERC1155
 
impl VectorIntoWasmAbi for ERC1155
impl SupportsConstructor for ERC1155
impl SupportsInstanceProperty for ERC1155
impl SupportsStaticProperty for ERC1155
Auto Trait Implementations§
impl Freeze for ERC1155
impl RefUnwindSafe for ERC1155
impl Send for ERC1155
impl Sync for ERC1155
impl Unpin for ERC1155
impl UnwindSafe for ERC1155
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.