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.