multiversx_sc_snippets::imports

Trait ContractCall

Source
pub trait ContractCall<SA>: Sized + ContractCallBase<SA>
where SA: CallTypeApi + 'static,
{
Show 13 methods // Required method fn transfer_execute(self); // Provided methods fn argument<T>(self, arg: &T) -> Self where T: TopEncodeMulti { ... } fn push_raw_argument<RawArg>(&mut self, raw_arg: RawArg) where RawArg: Into<ManagedBuffer<SA>> { ... } fn with_raw_arguments( self, raw_argument_buffer: ManagedArgBuffer<SA>, ) -> Self { ... } fn with_gas_limit(self, gas_limit: u64) -> Self { ... } fn into_call_data_string(self) -> ManagedBuffer<SA> { ... } fn async_call( self, ) -> Tx<TxScEnv<SA>, (), ManagedAddress<SA>, Egld<BigUint<SA>>, (), FunctionCall<SA>, Option<CallbackClosure<SA>>> { ... } fn async_call_promise(self) -> AsyncCallPromises<SA> { ... } fn execute_on_dest_context<RequestedResult>(self) -> RequestedResult where RequestedResult: TopDecodeMulti { ... } fn execute_on_dest_context_with_back_transfers<RequestedResult>( self, ) -> (RequestedResult, BackTransfers<SA>) where RequestedResult: TopDecodeMulti { ... } fn execute_on_dest_context_ignore_result(self) { ... } fn execute_on_dest_context_readonly<RequestedResult>( self, ) -> RequestedResult where RequestedResult: TopDecodeMulti { ... } fn execute_on_same_context<RequestedResult>(self) -> RequestedResult where RequestedResult: TopDecodeMulti { ... }
}
Expand description

Defines a contract call object, which is the basis for all calls to other contracts.

Its implementations differ on the type of payment that gets sent with the call.

Required Methods§

Source

fn transfer_execute(self)

Immediately launches a transfer-execute call.

This is similar to an async call, but there is no callback and there can be more than one such call per transaction.

Provided Methods§

Source

fn argument<T>(self, arg: &T) -> Self
where T: TopEncodeMulti,

Serializes and pushes a value to the arguments buffer.

Accepts multi-values, so it might effectively be adding more than one raw argument.

Warning: this method serializes any serializable type, but does no type checking against the destination endpoint ABI. Only use for raw calls, built without a proxy.

Source

fn push_raw_argument<RawArg>(&mut self, raw_arg: RawArg)
where RawArg: Into<ManagedBuffer<SA>>,

For cases where we build the contract call by hand.

No serialization occurs, just direct conversion to ManagedBuffer.

Source

fn with_raw_arguments(self, raw_argument_buffer: ManagedArgBuffer<SA>) -> Self

For cases where we build the contract call by hand.

Source

fn with_gas_limit(self, gas_limit: u64) -> Self

Sets an explicit gas limit to the call.

Source

fn into_call_data_string(self) -> ManagedBuffer<SA>

Source

fn async_call( self, ) -> Tx<TxScEnv<SA>, (), ManagedAddress<SA>, Egld<BigUint<SA>>, (), FunctionCall<SA>, Option<CallbackClosure<SA>>>

Converts to a legacy async call.

Source

fn async_call_promise(self) -> AsyncCallPromises<SA>

Converts to an async promise.

Source

fn execute_on_dest_context<RequestedResult>(self) -> RequestedResult
where RequestedResult: TopDecodeMulti,

Executes immediately, synchronously, and returns contract call result. Only works if the target contract is in the same shard.

Source

fn execute_on_dest_context_with_back_transfers<RequestedResult>( self, ) -> (RequestedResult, BackTransfers<SA>)
where RequestedResult: TopDecodeMulti,

Executes immediately, synchronously, and returns contract call result. Only works if the target contract is in the same shard.

Source

fn execute_on_dest_context_ignore_result(self)

👎Deprecated since 0.36.1: Redundant method, use let _: IgnoreValue = contract_call.execute_on_dest_context(...) instead

Executes immediately, synchronously.

The result (if any) is ignored.

Deprecated and will be removed soon. Use execute_on_dest_context::<IgnoreValue>(...) instead.

Source

fn execute_on_dest_context_readonly<RequestedResult>(self) -> RequestedResult
where RequestedResult: TopDecodeMulti,

Executes immediately, synchronously, and returns contract call result.

Performs a readonly call.

Source

fn execute_on_same_context<RequestedResult>(self) -> RequestedResult
where RequestedResult: TopDecodeMulti,

Executes immediately, synchronously, and returns contract call result.

Performs call on the same context, i.e. the target contract will operate with the data from this contract.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<SA, OriginalResult> ContractCall<SA> for ContractCallNoPayment<SA, OriginalResult>
where SA: CallTypeApi + 'static, OriginalResult: TopEncodeMulti,

Source§

impl<SA, OriginalResult> ContractCall<SA> for ContractCallWithAnyPayment<SA, OriginalResult>
where SA: CallTypeApi + 'static, OriginalResult: TopEncodeMulti,

Source§

impl<SA, OriginalResult> ContractCall<SA> for ContractCallWithEgld<SA, OriginalResult>
where SA: CallTypeApi + 'static, OriginalResult: TopEncodeMulti,

Source§

impl<SA, OriginalResult> ContractCall<SA> for ContractCallWithEgldOrSingleEsdt<SA, OriginalResult>
where SA: CallTypeApi + 'static, OriginalResult: TopEncodeMulti,

Source§

impl<SA, OriginalResult> ContractCall<SA> for ContractCallWithMultiEsdt<SA, OriginalResult>
where SA: CallTypeApi + 'static, OriginalResult: TopEncodeMulti,