pub trait TxPayment<Env>: Sizedwhere
Env: TxEnv,{
// Required methods
fn is_no_payment(&self, env: &Env) -> bool;
fn perform_transfer_execute_fallible(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
gas_limit: u64,
fc: FunctionCall<<Env as TxEnv>::Api>,
) -> Result<(), TransferExecuteFailed>;
fn perform_transfer_execute_legacy(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
gas_limit: u64,
fc: FunctionCall<<Env as TxEnv>::Api>,
);
fn with_normalized<From, To, F, R>(
self,
env: &Env,
from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> R
where From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R;
fn into_full_payment_data(
self,
env: &Env,
) -> FullPaymentData<<Env as TxEnv>::Api>;
// Provided method
fn perform_transfer_fallible(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
) -> Result<(), TransferExecuteFailed> { ... }
}Expand description
Describes a payment that is part of a transaction.
Required Methods§
Sourcefn is_no_payment(&self, env: &Env) -> bool
fn is_no_payment(&self, env: &Env) -> bool
Returns true if payment indicates transfer of either non-zero EGLD or ESDT amounts.
Sourcefn perform_transfer_execute_fallible(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
gas_limit: u64,
fc: FunctionCall<<Env as TxEnv>::Api>,
) -> Result<(), TransferExecuteFailed>
fn perform_transfer_execute_fallible( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
Transfer-execute calls have different APIs for different payments types. This method selects between them.
Sourcefn perform_transfer_execute_legacy(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
gas_limit: u64,
fc: FunctionCall<<Env as TxEnv>::Api>,
)
fn perform_transfer_execute_legacy( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, )
Allows transfer-execute without payment.
Sourcefn with_normalized<From, To, F, R>(
self,
env: &Env,
from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> Rwhere
From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,
fn with_normalized<From, To, F, R>(
self,
env: &Env,
from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> Rwhere
From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,
Converts an ESDT call to a built-in function call, if necessary.
Sourcefn into_full_payment_data(
self,
env: &Env,
) -> FullPaymentData<<Env as TxEnv>::Api>
fn into_full_payment_data( self, env: &Env, ) -> FullPaymentData<<Env as TxEnv>::Api>
Payment data to be used by the testing framework. Will be refactored.
Provided Methods§
Sourcefn perform_transfer_fallible(
self,
env: &Env,
to: &ManagedAddress<<Env as TxEnv>::Api>,
) -> Result<(), TransferExecuteFailed>
fn perform_transfer_fallible( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
Shortcut for doing direct transfers.
It is relevant with EGLD: it is simpler to perform direct EGLD transfers, instead of going via multi-transfer.
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.
Implementations on Foreign Types§
Source§impl<Env> TxPayment<Env> for (EsdtTokenIdentifier<<Env as TxEnv>::Api>, u64, BigUint<<Env as TxEnv>::Api>)where
Env: TxEnv,
impl<Env> TxPayment<Env> for (EsdtTokenIdentifier<<Env as TxEnv>::Api>, u64, BigUint<<Env as TxEnv>::Api>)where
Env: TxEnv,
fn is_no_payment(&self, _env: &Env) -> bool
fn perform_transfer_execute_fallible( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
fn perform_transfer_execute_legacy( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, )
fn with_normalized<From, To, F, R>(
self,
env: &Env,
from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> Rwhere
From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,
fn into_full_payment_data( self, env: &Env, ) -> FullPaymentData<<Env as TxEnv>::Api>
Source§impl<Env> TxPayment<Env> for ()where
Env: TxEnv,
impl<Env> TxPayment<Env> for ()where
Env: TxEnv,
fn is_no_payment(&self, _env: &Env) -> bool
fn perform_transfer_execute_fallible( self, _env: &Env, _to: &ManagedAddress<<Env as TxEnv>::Api>, _gas_limit: u64, _fc: FunctionCall<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
fn perform_transfer_fallible( self, _env: &Env, _to: &ManagedAddress<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>
fn perform_transfer_execute_legacy( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, )
fn with_normalized<From, To, F, R>(
self,
env: &Env,
_from: &From,
to: To,
fc: FunctionCall<<Env as TxEnv>::Api>,
f: F,
) -> Rwhere
From: TxFrom<Env>,
To: TxToSpecified<Env>,
F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,
fn into_full_payment_data( self, _env: &Env, ) -> FullPaymentData<<Env as TxEnv>::Api>
Source§impl<Env, P> TxPayment<Env> for Option<P>
TxPayment should work for any Option,
where for Some(payment) it behaves like payment,
and for None it behaves like no payment.
impl<Env, P> TxPayment<Env> for Option<P>
TxPayment should work for any Option, where for Some(payment) it behaves like payment, and for None it behaves like no payment.