pub struct SendWrapper<A>where
    A: CallTypeApi + StorageReadApi + BlockchainApi,{ /* private fields */ }
Expand description

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

Implementations§

source§

impl<A> SendWrapper<A>where A: CallTypeApi + StorageReadApi + BlockchainApi,

source

pub fn esdt_system_sc_proxy(&self) -> ESDTSystemSmartContractProxy<A>

source

pub fn contract_call<R>( &self, to: ManagedAddress<A>, endpoint_name: ManagedBuffer<A> ) -> ContractCallNoPayment<A, R>

source

pub fn direct_egld(&self, to: &ManagedAddress<A>, amount: &BigUint<A>)

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

source

pub fn direct_non_zero_egld(&self, to: &ManagedAddress<A>, amount: &BigUint<A>)

source

pub fn direct( &self, to: &ManagedAddress<A>, token: &EgldOrEsdtTokenIdentifier<A>, nonce: u64, amount: &BigUint<A> )

Sends either EGLD, ESDT or NFT to the target address, depending on the token identifier and nonce

source

pub fn direct_esdt_with_gas_limit<D>( &self, to: &ManagedAddress<A>, token_identifier: &TokenIdentifier<A>, nonce: u64, amount: &BigUint<A>, gas: u64, endpoint_name: D, arguments: &[ManagedBuffer<A>] )where D: Into<ManagedBuffer<A>>,

source

pub fn direct_esdt( &self, to: &ManagedAddress<A>, token_identifier: &TokenIdentifier<A>, nonce: u64, amount: &BigUint<A> )

source

pub fn direct_non_zero_esdt_payment( &self, to: &ManagedAddress<A>, payment: &EsdtTokenPayment<A> )

source

pub fn direct_with_gas_limit<D>( &self, to: &ManagedAddress<A>, token: &EgldOrEsdtTokenIdentifier<A>, nonce: u64, amount: &BigUint<A>, gas: u64, endpoint_name: D, arguments: &[ManagedBuffer<A>] )where D: Into<ManagedBuffer<A>>,

source

pub fn direct_multi( &self, to: &ManagedAddress<A>, payments: &ManagedVec<A, EsdtTokenPayment<A>> )

source

pub fn transfer_esdt_via_async_call( &self, to: ManagedAddress<A>, token: TokenIdentifier<A>, nonce: u64, amount: BigUint<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.

source

pub fn transfer_multiple_esdt_via_async_call( &self, to: ManagedAddress<A>, payments: ManagedVec<A, EsdtTokenPayment<A>> ) -> !

source

pub fn claim_developer_rewards( &self, child_sc_address: ManagedAddress<A> ) -> ContractCallNoPayment<A, ()>

source

pub fn change_owner_address( &self, child_sc_address: ManagedAddress<A>, new_owner: &ManagedAddress<A> ) -> ContractCallNoPayment<A, ()>

Sends a synchronous call to change a smart contract address.

source

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.

source

pub fn esdt_local_mint( &self, token: &TokenIdentifier<A>, nonce: u64, amount: &BigUint<A> )

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.

source

pub fn esdt_local_burn( &self, token: &TokenIdentifier<A>, nonce: u64, amount: &BigUint<A> )

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”

source

pub fn esdt_local_burn_multi( &self, payments: &ManagedVec<A, EsdtTokenPayment<A>> )

Allows burning of multiple ESDT tokens at once.

Will execute a synchronous call to the appropriate burn builtin function for each.

source

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.

source

pub fn esdt_nft_create_compact<T: TopEncode>( &self, token: &TokenIdentifier<A>, amount: &BigUint<A>, attributes: &T ) -> u64

source

pub fn esdt_nft_create_compact_named<T: TopEncode>( &self, token: &TokenIdentifier<A>, amount: &BigUint<A>, name: &ManagedBuffer<A>, attributes: &T ) -> u64

source

pub fn sell_nft( &self, nft_id: &TokenIdentifier<A>, nft_nonce: u64, nft_amount: &BigUint<A>, buyer: &ManagedAddress<A>, payment_token: &EgldOrEsdtTokenIdentifier<A>, payment_nonce: u64, payment_amount: &BigUint<A> ) -> BigUint<A>

Sends the NFTs to the buyer address and calculates and sends the required royalties to the NFT creator. Returns the payment amount left after sending royalties.

source

pub fn nft_add_uri( &self, token_id: &TokenIdentifier<A>, nft_nonce: u64, new_uri: ManagedBuffer<A> )

source

pub fn nft_add_multiple_uri( &self, token_id: &TokenIdentifier<A>, nft_nonce: u64, new_uris: &ManagedVec<A, ManagedBuffer<A>> )

source

pub fn nft_update_attributes<T: TopEncode>( &self, token_id: &TokenIdentifier<A>, nft_nonce: u64, new_attributes: &T )

Trait Implementations§

source§

impl<A> Default for SendWrapper<A>where A: CallTypeApi + StorageReadApi + BlockchainApi + Default,

source§

fn default() -> SendWrapper<A>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<A> CodecFromSelf for SendWrapper<A>where A: CodecFromSelf,

§

impl<A> RefUnwindSafe for SendWrapper<A>where A: RefUnwindSafe,

§

impl<A> Send for SendWrapper<A>where A: Send,

§

impl<A> Sync for SendWrapper<A>where A: Sync,

§

impl<A> Unpin for SendWrapper<A>where A: Unpin,

§

impl<A> UnwindSafe for SendWrapper<A>where A: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.