Trait elrond_wasm::api::SendApi[][src]

pub trait SendApi: ErrorApi + Clone + Sized {
    type AmountType: BigUintApi + 'static;
    type ProxyBigInt: BigIntApi + 'static;
    type ProxyStorage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static;
Show methods fn get_sc_address(&self) -> Address;
fn direct_egld(&self, to: &Address, amount: &Self::AmountType, data: &[u8]);
fn direct_egld_execute(
        &self,
        to: &Address,
        amount: &Self::AmountType,
        gas_limit: u64,
        function: &[u8],
        arg_buffer: &ArgBuffer
    ) -> Result<(), &'static [u8]>;
fn direct_esdt_execute(
        &self,
        to: &Address,
        token: &[u8],
        amount: &Self::AmountType,
        gas_limit: u64,
        function: &[u8],
        arg_buffer: &ArgBuffer
    ) -> Result<(), &'static [u8]>;
fn direct_esdt_nft_execute(
        &self,
        to: &Address,
        token: &[u8],
        nonce: u64,
        amount: &Self::AmountType,
        gas_limit: u64,
        function: &[u8],
        arg_buffer: &ArgBuffer
    ) -> Result<(), &'static [u8]>;
fn async_call_raw(
        &self,
        to: &Address,
        amount: &Self::AmountType,
        data: &[u8]
    ) -> !;
fn deploy_contract(
        &self,
        gas: u64,
        amount: &Self::AmountType,
        code: &BoxedBytes,
        code_metadata: CodeMetadata,
        arg_buffer: &ArgBuffer
    ) -> Address;
fn execute_on_dest_context_raw(
        &self,
        gas: u64,
        address: &Address,
        value: &Self::AmountType,
        function: &[u8],
        arg_buffer: &ArgBuffer
    ) -> Vec<BoxedBytes>;
fn execute_on_dest_context_raw_custom_result_range<F>(
        &self,
        gas: u64,
        address: &Address,
        value: &Self::AmountType,
        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: &Self::AmountType,
        function: &[u8],
        arg_buffer: &ArgBuffer
    ) -> Vec<BoxedBytes>;
fn execute_on_same_context_raw(
        &self,
        gas: u64,
        address: &Address,
        value: &Self::AmountType,
        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_esdt_built_in_function(
        &self,
        gas: u64,
        function: &[u8],
        arg_buffer: &ArgBuffer
    ); fn direct_esdt_via_transf_exec(
        &self,
        to: &Address,
        token: &[u8],
        amount: &Self::AmountType,
        data: &[u8]
    ) -> Result<(), &'static [u8]> { ... }
fn direct(
        &self,
        to: &Address,
        token: &TokenIdentifier,
        amount: &Self::AmountType,
        data: &[u8]
    ) { ... }
fn transfer_tokens(
        &self,
        token: &TokenIdentifier,
        nonce: u64,
        amount: &Self::AmountType,
        to: &Address
    ) { ... }
fn direct_esdt_via_async_call(
        &self,
        to: &Address,
        esdt_token_name: &[u8],
        amount: &Self::AmountType,
        data: &[u8]
    ) -> ! { ... }
fn direct_via_async_call(
        &self,
        to: &Address,
        token: &TokenIdentifier,
        amount: &Self::AmountType,
        data: &[u8]
    ) { ... }
fn async_call(&self, async_call: AsyncCall<Self>) -> ! { ... }
fn esdt_local_mint(&self, gas: u64, token: &[u8], amount: &Self::AmountType) { ... }
fn esdt_local_burn(&self, gas: u64, token: &[u8], amount: &Self::AmountType) { ... }
fn esdt_nft_create<T: TopEncode>(
        &self,
        gas: u64,
        token: &[u8],
        amount: &Self::AmountType,
        name: &BoxedBytes,
        royalties: &Self::AmountType,
        hash: &BoxedBytes,
        attributes: &T,
        uris: &[BoxedBytes]
    ) { ... }
fn esdt_nft_add_quantity(
        &self,
        gas: u64,
        token: &[u8],
        nonce: u64,
        amount: &Self::AmountType
    ) { ... }
fn esdt_nft_burn(
        &self,
        gas: u64,
        token: &[u8],
        nonce: u64,
        amount: &Self::AmountType
    ) { ... }
fn burn_tokens(
        &self,
        token: &TokenIdentifier,
        nonce: u64,
        amount: &Self::AmountType,
        gas: u64
    ) { ... }
fn direct_esdt_nft_via_async_call(
        &self,
        from: &Address,
        to: &Address,
        token: &[u8],
        nonce: u64,
        amount: &Self::AmountType,
        data: &[u8]
    ) { ... }
fn direct_esdt_nft_via_transfer_exec(
        &self,
        to: &Address,
        token: &[u8],
        nonce: u64,
        amount: &Self::AmountType,
        data: &[u8]
    ) -> Result<(), &'static [u8]> { ... }
}
Expand description

API that groups methods that either send EGLD or ESDT, or that call other contracts.

Associated Types

type AmountType: BigUintApi + 'static[src]

Expand description

The type of the payment arguments. Not named BigUint to avoid name collisions in types that implement multiple API traits.

type ProxyBigInt: BigIntApi + 'static[src]

Expand description

Not used by SendApi, but forwarded to the proxy traits.

type ProxyStorage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static[src]

Expand description

Not used by SendApi, but forwarded to the proxy traits.

Required methods

fn get_sc_address(&self) -> Address[src]

Expand description

Required for ESDTNFTTransfer. Same as the implementation from BlockchainApi.

fn direct_egld(&self, to: &Address, amount: &Self::AmountType, data: &[u8])[src]

Expand description

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

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

Expand description

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

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

Expand description

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

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

Expand description

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

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

Expand description

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.

fn deploy_contract(
    &self,
    gas: u64,
    amount: &Self::AmountType,
    code: &BoxedBytes,
    code_metadata: CodeMetadata,
    arg_buffer: &ArgBuffer
) -> Address
[src]

Expand description

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

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

Expand description

Same shard, in-line execution of another contract.

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

Expand description

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).

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

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

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

Expand description

Used to store data between async call and callback.

fn storage_load_tx_hash_key(&self) -> BoxedBytes[src]

Expand description

Used to store data between async call and callback.

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

Expand description

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

fn direct_esdt_via_transf_exec(
    &self,
    to: &Address,
    token: &[u8],
    amount: &Self::AmountType,
    data: &[u8]
) -> Result<(), &'static [u8]>
[src]

Expand description

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

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

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

Expand description

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

fn transfer_tokens(
    &self,
    token: &TokenIdentifier,
    nonce: u64,
    amount: &Self::AmountType,
    to: &Address
)
[src]

Expand description

Sends ESDT tokens to the target address. Handles any type of ESDT. Note: this does not work with EGLD, use only with ESDT.

fn direct_esdt_via_async_call(
    &self,
    to: &Address,
    esdt_token_name: &[u8],
    amount: &Self::AmountType,
    data: &[u8]
) -> !
[src]

Expand description

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

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

Expand description

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

fn async_call(&self, async_call: AsyncCall<Self>) -> ![src]

Expand description

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

fn esdt_local_mint(&self, gas: u64, token: &[u8], amount: &Self::AmountType)[src]

Expand description

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

fn esdt_local_burn(&self, gas: u64, token: &[u8], amount: &Self::AmountType)[src]

Expand description

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

fn esdt_nft_create<T: TopEncode>(
    &self,
    gas: u64,
    token: &[u8],
    amount: &Self::AmountType,
    name: &BoxedBytes,
    royalties: &Self::AmountType,
    hash: &BoxedBytes,
    attributes: &T,
    uris: &[BoxedBytes]
)
[src]

Expand description

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.

fn esdt_nft_add_quantity(
    &self,
    gas: u64,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType
)
[src]

Expand description

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.

fn esdt_nft_burn(
    &self,
    gas: u64,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType
)
[src]

Expand description

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

fn burn_tokens(
    &self,
    token: &TokenIdentifier,
    nonce: u64,
    amount: &Self::AmountType,
    gas: u64
)
[src]

Expand description

Burns ESDT tokens. Handles any type of ESDT. Note: this does not work with EGLD, use only with ESDT.

fn direct_esdt_nft_via_async_call(
    &self,
    from: &Address,
    to: &Address,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType,
    data: &[u8]
)
[src]

Expand description

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

fn direct_esdt_nft_via_transfer_exec(
    &self,
    to: &Address,
    token: &[u8],
    nonce: u64,
    amount: &Self::AmountType,
    data: &[u8]
) -> Result<(), &'static [u8]>
[src]

Expand description

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

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

Implementors

impl SendApi for UncallableApi[src]

type AmountType = BigUintUncallable

type ProxyBigInt = BigIntUncallable

type ProxyStorage = Self

fn get_sc_address(&self) -> Address[src]

fn direct_egld(&self, _to: &Address, _amount: &BigUintUncallable, _data: &[u8])[src]

fn direct_egld_execute(
    &self,
    _to: &Address,
    _amount: &BigUintUncallable,
    _gas_limit: u64,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]

fn direct_esdt_execute(
    &self,
    _to: &Address,
    _token: &[u8],
    _amount: &BigUintUncallable,
    _gas: u64,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]

fn direct_esdt_nft_execute(
    &self,
    _to: &Address,
    _token: &[u8],
    _nonce: u64,
    _amount: &BigUintUncallable,
    _gas_limit: u64,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]

fn async_call_raw(
    &self,
    _to: &Address,
    _amount: &BigUintUncallable,
    _data: &[u8]
) -> !
[src]

fn deploy_contract(
    &self,
    _gas: u64,
    _amount: &BigUintUncallable,
    _code: &BoxedBytes,
    _code_metadata: CodeMetadata,
    _arg_buffer: &ArgBuffer
) -> Address
[src]

fn execute_on_dest_context_raw(
    &self,
    _gas: u64,
    _address: &Address,
    _value: &BigUintUncallable,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]

fn execute_on_dest_context_raw_custom_result_range<F>(
    &self,
    _gas: u64,
    _address: &Address,
    _value: &BigUintUncallable,
    _function: &[u8],
    _arg_buffer: &ArgBuffer,
    _range_closure: F
) -> Vec<BoxedBytes> where
    F: FnOnce(usize, usize) -> (usize, usize), 
[src]

fn execute_on_dest_context_by_caller_raw(
    &self,
    _gas: u64,
    _address: &Address,
    _value: &BigUintUncallable,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]

fn execute_on_same_context_raw(
    &self,
    _gas: u64,
    _address: &Address,
    _value: &BigUintUncallable,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
)
[src]

fn storage_store_tx_hash_key(&self, _data: &[u8])[src]

fn storage_load_tx_hash_key(&self) -> BoxedBytes[src]

fn call_local_esdt_built_in_function(
    &self,
    _gas: u64,
    _function: &[u8],
    _arg_buffer: &ArgBuffer
)
[src]