Struct elrond_wasm::contract_base::SendWrapper [−][src]
pub struct SendWrapper<A> where
A: SendApi + ManagedTypeApi + StorageReadApi + BlockchainApi, { /* fields omitted */ }
Expand description
API that groups methods that either send EGLD or ESDT, or that call other contracts.
Implementations
pub fn contract_call<R>(
&self,
to: ManagedAddress<A>,
endpoint_name: ManagedBuffer<A>
) -> ContractCall<A, R>
pub fn direct_egld<D>(
&self,
to: &ManagedAddress<A>,
amount: &BigUint<A>,
data: D
) where
D: Into<ManagedBuffer<A>>,
pub fn direct_egld<D>(
&self,
to: &ManagedAddress<A>,
amount: &BigUint<A>,
data: D
) where
D: Into<ManagedBuffer<A>>,
Sends EGLD to a given address, directly. Used especially for sending EGLD to regular accounts.
pub fn direct<D>(
&self,
to: &ManagedAddress<A>,
token: &TokenIdentifier<A>,
nonce: u64,
amount: &BigUint<A>,
data: D
) where
D: Into<ManagedBuffer<A>>,
pub fn direct<D>(
&self,
to: &ManagedAddress<A>,
token: &TokenIdentifier<A>,
nonce: u64,
amount: &BigUint<A>,
data: D
) where
D: Into<ManagedBuffer<A>>,
Sends either EGLD, ESDT or NFT to the target address, depending on the token identifier and nonce
pub fn transfer_esdt_via_async_call<D>(
&self,
to: &ManagedAddress<A>,
token: &TokenIdentifier<A>,
nonce: u64,
amount: &BigUint<A>,
data: D
) -> ! where
D: Into<ManagedBuffer<A>>,
pub fn transfer_esdt_via_async_call<D>(
&self,
to: &ManagedAddress<A>,
token: &TokenIdentifier<A>,
nonce: u64,
amount: &BigUint<A>,
data: D
) -> ! where
D: Into<ManagedBuffer<A>>,
Performs a simple ESDT/NFT transfer, but via async call.
As with any async call, this immediately terminates the execution of the current call.
So only use as the last call in your endpoint.
If you want to perform multiple transfers, use self.send().transfer_multiple_esdt_via_async_call()
instead.
Note that EGLD can NOT be transfered with this function.
pub fn transfer_multiple_esdt_via_async_call<D>(
&self,
to: &ManagedAddress<A>,
payments: &ManagedVec<A, EsdtTokenPayment<A>>,
data: D
) -> ! where
D: Into<ManagedBuffer<A>>,
pub fn change_owner_address(
&self,
child_sc_address: ManagedAddress<A>,
new_owner: &ManagedAddress<A>
) -> ContractCall<A, ()>
pub fn change_owner_address(
&self,
child_sc_address: ManagedAddress<A>,
new_owner: &ManagedAddress<A>
) -> ContractCall<A, ()>
Sends a synchronous call to change a smart contract address.
pub fn call_local_esdt_built_in_function(
&self,
gas: u64,
endpoint_name: &ManagedBuffer<A>,
arg_buffer: &ManagedArgBuffer<A>
) -> ManagedVec<A, ManagedBuffer<A>>
pub fn call_local_esdt_built_in_function(
&self,
gas: u64,
endpoint_name: &ManagedBuffer<A>,
arg_buffer: &ManagedArgBuffer<A>
) -> ManagedVec<A, ManagedBuffer<A>>
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.
Allows synchronous minting of ESDT/SFT (depending on nonce). Execution is resumed afterwards.
Note that the SC must have the ESDTLocalMint or ESDTNftAddQuantity roles set,
or this will fail with “action is not allowed”
For SFTs, you must use self.send().esdt_nft_create()
before adding additional quantity.
This function cannot be used for NFTs.
Allows synchronous burning of ESDT/SFT/NFT (depending on nonce). Execution is resumed afterwards. Note that the SC must have the ESDTLocalBurn or ESDTNftBurn roles set, or this will fail with “action is not allowed”
pub fn esdt_nft_create<T: TopEncode>(
&self,
token: &TokenIdentifier<A>,
amount: &BigUint<A>,
name: &ManagedBuffer<A>,
royalties: &BigUint<A>,
hash: &ManagedBuffer<A>,
attributes: &T,
uris: &ManagedVec<A, ManagedBuffer<A>>
) -> u64
pub fn esdt_nft_create<T: TopEncode>(
&self,
token: &TokenIdentifier<A>,
amount: &BigUint<A>,
name: &ManagedBuffer<A>,
royalties: &BigUint<A>,
hash: &ManagedBuffer<A>,
attributes: &T,
uris: &ManagedVec<A, ManagedBuffer<A>>
) -> u64
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.
Must have ESDTNftCreate role set, or this will fail with “action is not allowed”.
Returns the nonce of the newly created NFT.
pub fn esdt_nft_create_as_caller<T: TopEncode>(
&self,
token: &TokenIdentifier<A>,
amount: &BigUint<A>,
name: &ManagedBuffer<A>,
royalties: &BigUint<A>,
hash: &ManagedBuffer<A>,
attributes: &T,
uris: &ManagedVec<A, ManagedBuffer<A>>
) -> u64
pub fn sell_nft(
&self,
nft_id: &TokenIdentifier<A>,
nft_nonce: u64,
nft_amount: &BigUint<A>,
buyer: &ManagedAddress<A>,
payment_token: &TokenIdentifier<A>,
payment_nonce: u64,
payment_amount: &BigUint<A>
) -> BigUint<A>
pub fn sell_nft(
&self,
nft_id: &TokenIdentifier<A>,
nft_nonce: u64,
nft_amount: &BigUint<A>,
buyer: &ManagedAddress<A>,
payment_token: &TokenIdentifier<A>,
payment_nonce: u64,
payment_amount: &BigUint<A>
) -> BigUint<A>
Sends thr NFTs to the buyer address and calculates and sends the required royalties to the NFT creator. Returns the payment amount left after sending royalties.