pub struct ContractCall<SA, R>
where SA: CallTypeApi + 'static,
{ /* private fields */ }
Expand description

Represents metadata for calling another contract. Can transform into either an async call, transfer call or other types of calls.

Implementations§

source§

impl<SA, R> ContractCall<SA, R>
where SA: CallTypeApi + 'static,

source

pub fn new(to: ManagedAddress<SA>, endpoint_name: ManagedBuffer<SA>) -> Self

source

pub fn new_with_dct_payment( to: ManagedAddress<SA>, endpoint_name: ManagedBuffer<SA>, payments: ManagedVec<SA, DctTokenPayment<SA>> ) -> Self

source

pub fn add_token_transfer( self, payment_token: TokenIdentifier<SA>, payment_nonce: u64, payment_amount: BigUint<SA> ) -> Self

source

pub fn with_moax_transfer(self, moax_amount: BigUint<SA>) -> Self

source

pub fn with_multi_token_transfer( self, payments: ManagedVec<SA, DctTokenPayment<SA>> ) -> Self

source

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

source

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

source

pub fn push_arg_managed_buffer(&mut self, m_buffer: ManagedBuffer<SA>)

Provided for cases where we build the contract call by hand.

source

pub fn push_argument_raw_bytes(&mut self, bytes: &[u8])

Provided for cases where we build the contract call by hand. Convenience method, also creates the new managed buffer from bytes.

source

pub fn push_endpoint_arg<D: ContractCallArg>(&mut self, endpoint_arg: D)

source

pub fn async_call(self) -> AsyncCall<SA>

source§

impl<SA, R> ContractCall<SA, R>
where SA: CallTypeApi + 'static, R: DynArg,

source

pub fn execute_on_dest_context(self) -> R

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

source

pub fn execute_on_dest_context_custom_range<F>(self, range_closure: F) -> R
where F: FnOnce(usize, usize) -> (usize, usize),

Executes immediately, synchronously, and returns contract call result. Only works if the target contract is in the same shard. 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

pub fn execute_on_dest_context_readonly(self) -> R

source§

impl<SA, R> ContractCall<SA, R>
where SA: CallTypeApi + 'static,

source

pub fn execute_on_dest_context_ignore_result(self)

Executes immediately, synchronously. The result (if any) is ignored. Only works if the target contract is in the same shard.

source

pub fn execute_on_same_context(self)

source

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

Auto Trait Implementations§

§

impl<SA, R> RefUnwindSafe for ContractCall<SA, R>

§

impl<SA, R> Send for ContractCall<SA, R>
where R: Send, SA: Send,

§

impl<SA, R> Sync for ContractCall<SA, R>
where R: Sync, SA: Sync,

§

impl<SA, R> Unpin for ContractCall<SA, R>
where R: Unpin, SA: Unpin,

§

impl<SA, R> UnwindSafe for ContractCall<SA, R>
where R: UnwindSafe, SA: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.