pub trait SendApi<BigUint>: ErrorApi + Clone + Sized
where BigUint: BigUintApi + 'static,
{
Show 25 methods // Required methods fn direct_moax(&self, to: &Address, amount: &BigUint, data: &[u8]); fn direct_moax_execute( &self, to: &Address, amount: &BigUint, gas_limit: u64, function: &[u8], arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>; fn direct_dct_execute( &self, to: &Address, token: &[u8], amount: &BigUint, gas_limit: u64, function: &[u8], arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>; fn direct_dct_nft_execute( &self, to: &Address, token: &[u8], nonce: u64, amount: &BigUint, gas_limit: u64, function: &[u8], arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>; fn async_call_raw(&self, to: &Address, amount: &BigUint, data: &[u8]) -> !; fn deploy_contract( &self, gas: u64, amount: &BigUint, code: &BoxedBytes, code_metadata: CodeMetadata, arg_buffer: &ArgBuffer ) -> Address; fn execute_on_dest_context_raw( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>; fn execute_on_dest_context_raw_custom_result_range<F>( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer, range_closure: F ) -> Vec<BoxedBytes> where F: FnOnce(usize, usize) -> (usize, usize); fn execute_on_dest_context_by_caller_raw( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>; fn execute_on_same_context_raw( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer ); fn storage_store_tx_hash_key(&self, data: &[u8]); fn storage_load_tx_hash_key(&self) -> BoxedBytes; fn call_local_dct_built_in_function( &self, gas: u64, function: &[u8], arg_buffer: &ArgBuffer ); // Provided methods fn direct_dct_via_transf_exec( &self, to: &Address, token: &[u8], amount: &BigUint, data: &[u8] ) -> Result<(), &'static [u8]> { ... } fn direct( &self, to: &Address, token: &TokenIdentifier, amount: &BigUint, data: &[u8] ) { ... } fn direct_dct_via_async_call( &self, to: &Address, dct_token_name: &[u8], amount: &BigUint, data: &[u8] ) -> ! { ... } fn direct_via_async_call( &self, to: &Address, token: &TokenIdentifier, amount: &BigUint, data: &[u8] ) { ... } fn async_call(&self, async_call: AsyncCall<BigUint>) -> ! { ... } fn dct_local_mint(&self, gas: u64, token: &[u8], amount: &BigUint) { ... } fn dct_local_burn(&self, gas: u64, token: &[u8], amount: &BigUint) { ... } fn dct_nft_create<T: TopEncode>( &self, gas: u64, token: &[u8], amount: &BigUint, name: &BoxedBytes, royalties: &BigUint, hash: &H256, attributes: &T, uris: &[BoxedBytes] ) { ... } fn dct_nft_add_quantity( &self, gas: u64, token: &[u8], nonce: u64, amount: &BigUint ) { ... } fn dct_nft_burn(&self, gas: u64, token: &[u8], nonce: u64, amount: &BigUint) { ... } fn direct_dct_nft_via_async_call( &self, from: &Address, to: &Address, token: &[u8], nonce: u64, amount: &BigUint, data: &[u8] ) { ... } fn direct_dct_nft_via_transfer_exec( &self, to: &Address, token: &[u8], nonce: u64, amount: &BigUint, data: &[u8] ) -> Result<(), &'static [u8]> { ... }
}
Expand description

API that groups methods that either send MOAX or DCT, or that call other contracts.

Required Methods§

source

fn direct_moax(&self, to: &Address, amount: &BigUint, data: &[u8])

Sends MOAX to a given address, directly. Used especially for sending MOAX to regular accounts.

source

fn direct_moax_execute( &self, to: &Address, amount: &BigUint, gas_limit: u64, function: &[u8], arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>

Sends MOAX to an address (optionally) and executes like an async call, but without callback.

source

fn direct_dct_execute( &self, to: &Address, token: &[u8], amount: &BigUint, gas_limit: u64, function: &[u8], arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>

Sends DCT to an address and executes like an async call, but without callback.

source

fn direct_dct_nft_execute( &self, to: &Address, token: &[u8], nonce: u64, amount: &BigUint, gas_limit: u64, function: &[u8], arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>

Sends DCT NFT to an address and executes like an async call, but without callback.

source

fn async_call_raw(&self, to: &Address, amount: &BigUint, data: &[u8]) -> !

Sends an asynchronous call to another contract. Calling this method immediately terminates tx execution. Using it directly is generally discouraged.

The data is expected to be of the form functionName@<arg1-hex>@<arg2-hex>@.... Use a HexCallDataSerializer to prepare this field.

source

fn deploy_contract( &self, gas: u64, amount: &BigUint, code: &BoxedBytes, code_metadata: CodeMetadata, arg_buffer: &ArgBuffer ) -> Address

Deploys a new contract in the same shard. Unlike async_call_raw, the deployment is synchronous and tx execution continues afterwards. Also unlike async_call_raw, it uses an argument buffer to pass arguments

source

fn execute_on_dest_context_raw( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>

Same shard, in-line execution of another contract.

source

fn execute_on_dest_context_raw_custom_result_range<F>( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer, range_closure: F ) -> Vec<BoxedBytes>
where F: FnOnce(usize, usize) -> (usize, usize),

Same shard, in-line execution of another contract. Allows the contract to specify which result range to extract as sync call result. This is a workaround to handle nested sync calls. Please do not use this method unless there is absolutely no other option. Will be eliminated after some future Arwen hook redesign. range_closure takes the number of results before, the number of results after, and is expected to return the start index (inclusive) and end index (exclusive).

source

fn execute_on_dest_context_by_caller_raw( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>

source

fn execute_on_same_context_raw( &self, gas: u64, address: &Address, value: &BigUint, function: &[u8], arg_buffer: &ArgBuffer )

source

fn storage_store_tx_hash_key(&self, data: &[u8])

Used to store data between async call and callback.

source

fn storage_load_tx_hash_key(&self) -> BoxedBytes

Used to store data between async call and callback.

source

fn call_local_dct_built_in_function( &self, gas: u64, function: &[u8], arg_buffer: &ArgBuffer )

Allows synchronously calling a local function by name. Execution is resumed afterwards. You should never have to call this function directly. Use the other specific methods instead.

Provided Methods§

source

fn direct_dct_via_transf_exec( &self, to: &Address, token: &[u8], amount: &BigUint, data: &[u8] ) -> Result<(), &'static [u8]>

Sends an DCT token to a given address, directly. Used especially for sending DCT to regular accounts.

Unlike sending DCT via async call, this method can be called multiple times per transaction.

source

fn direct( &self, to: &Address, token: &TokenIdentifier, amount: &BigUint, data: &[u8] )

Sends either MOAX or an DCT token to the target address, depending on what token identifier was specified.

source

fn direct_dct_via_async_call( &self, to: &Address, dct_token_name: &[u8], amount: &BigUint, data: &[u8] ) -> !

Performs a simple DCT transfer, but via async call. This is the preferred way to send DCT.

source

fn direct_via_async_call( &self, to: &Address, token: &TokenIdentifier, amount: &BigUint, data: &[u8] )

Sends either MOAX or an DCT token to the target address, depending on what token identifier was specified. In case of DCT it performs an async call.

source

fn async_call(&self, async_call: AsyncCall<BigUint>) -> !

Sends an asynchronous call to another contract, with either MOAX or DCT value. The token argument decides which one it will be. Calling this method immediately terminates tx execution.

source

fn dct_local_mint(&self, gas: u64, token: &[u8], amount: &BigUint)

Allows synchronous minting of DCT tokens. Execution is resumed afterwards.

source

fn dct_local_burn(&self, gas: u64, token: &[u8], amount: &BigUint)

Allows synchronous burning of DCT tokens. Execution is resumed afterwards.

source

fn dct_nft_create<T: TopEncode>( &self, gas: u64, token: &[u8], amount: &BigUint, name: &BoxedBytes, royalties: &BigUint, hash: &H256, attributes: &T, uris: &[BoxedBytes] )

Creates a new NFT token of a certain type (determined by token_identifier).
attributes can be any serializable custom struct.
This is a built-in function, so the smart contract execution is resumed after.

source

fn dct_nft_add_quantity( &self, gas: u64, token: &[u8], nonce: u64, amount: &BigUint )

Adds quantity for an Non-Fungible Token. (which makes it a Semi-Fungible Token by definition)
This is a built-in function, so the smart contract execution is resumed after.

source

fn dct_nft_burn(&self, gas: u64, token: &[u8], nonce: u64, amount: &BigUint)

The reverse operation of dct_nft_add_quantity, this locally decreases This is a built-in function, so the smart contract execution is resumed after.

source

fn direct_dct_nft_via_async_call( &self, from: &Address, to: &Address, token: &[u8], nonce: u64, amount: &BigUint, data: &[u8] )

Performs a simple DCT NFT transfer, but via async call. This is the preferred way to send DCT. Note: call is done to the SC itself, so from should be the SCs own address

source

fn direct_dct_nft_via_transfer_exec( &self, to: &Address, token: &[u8], nonce: u64, amount: &BigUint, data: &[u8] ) -> Result<(), &'static [u8]>

Sends an DCT NFT to a given address, directly. Used especially for sending DCT to regular accounts.

Unlike sending DCT via async call, this method can be called multiple times per transaction.

Object Safety§

This trait is not object safe.

Implementors§