pub struct Tx<Env, From, To, Payment, Gas, Data, RH>{
pub env: Env,
pub from: From,
pub to: To,
pub payment: Payment,
pub gas: Gas,
pub data: Data,
pub result_handler: RH,
}
Expand description
Universal representation of a blockchain transaction.
Uses 7 generic type arguments to encode all aspects of the transaction.
It is future-like, does nothing by itself, it needs a specialized method call to actually run or send it.
Rationale: https://twitter.com/andreimmarinica/status/1777157322155966601
Fields§
§env: Env
§from: From
§to: To
§payment: Payment
§gas: Gas
§data: Data
§result_handler: RH
Implementations§
Source§impl<Api> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Egld<BigUint<Api>>, (), FunctionCall<Api>, Option<CallbackClosure<Api>>>where
Api: CallTypeApi,
impl<Api> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Egld<BigUint<Api>>, (), FunctionCall<Api>, Option<CallbackClosure<Api>>>where
Api: CallTypeApi,
pub fn with_callback(self, callback_call: CallbackClosure<Api>) -> Self
Source§impl<Api> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Egld<BigUint<Api>>, (), FunctionCall<Api>, Option<CallbackClosure<Api>>>where
Api: CallTypeApi + StorageWriteApi,
impl<Api> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Egld<BigUint<Api>>, (), FunctionCall<Api>, Option<CallbackClosure<Api>>>where
Api: CallTypeApi + StorageWriteApi,
pub fn call_and_exit_ignore_callback(self) -> !
Source§impl<Env, From, To, Payment, Gas, Data, RH> Tx<Env, From, To, Payment, Gas, Data, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPayment<Env>,
Gas: TxGas<Env>,
Data: TxDataFunctionCall<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, Data, RH> Tx<Env, From, To, Payment, Gas, Data, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPayment<Env>,
Gas: TxGas<Env>,
Data: TxDataFunctionCall<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn to_call_data_string(&self) -> ManagedBuffer<Env::Api>
pub fn to_call_data_string(&self) -> ManagedBuffer<Env::Api>
Converts object to a MultiversX transaction data field string.
Source§impl<Env> Tx<Env, (), (), (), (), (), ()>where
Env: TxEnv,
impl<Env> Tx<Env, (), (), (), (), (), ()>where
Env: TxEnv,
Sourcepub fn new_with_env(env: Env) -> Self
pub fn new_with_env(env: Env) -> Self
Constructor, needs to take an environment object.
Source§impl<Env, From, To, Gas, Data, RH> Tx<Env, From, To, (), Gas, Data, RH>
impl<Env, From, To, Gas, Data, RH> Tx<Env, From, To, (), Gas, Data, RH>
Sourcepub fn payment<Payment>(
self,
payment: Payment,
) -> Tx<Env, From, To, Payment, Gas, Data, RH>where
Payment: TxPayment<Env>,
pub fn payment<Payment>(
self,
payment: Payment,
) -> Tx<Env, From, To, Payment, Gas, Data, RH>where
Payment: TxPayment<Env>,
Adds any payment to a transaction, if no payment has been added before.
Sourcepub fn egld<EgldValue>(
self,
egld_value: EgldValue,
) -> Tx<Env, From, To, Egld<EgldValue>, Gas, Data, RH>where
EgldValue: TxEgldValue<Env>,
pub fn egld<EgldValue>(
self,
egld_value: EgldValue,
) -> Tx<Env, From, To, Egld<EgldValue>, Gas, Data, RH>where
EgldValue: TxEgldValue<Env>,
Adds EGLD value to a transaction.
Accepts any type that can represent and EGLD amount: BigUint, &BigUint, etc.
Sourcepub fn with_egld_transfer(
self,
egld_amount: BigUint<Env::Api>,
) -> Tx<Env, From, To, EgldPayment<Env::Api>, Gas, Data, RH>
pub fn with_egld_transfer( self, egld_amount: BigUint<Env::Api>, ) -> Tx<Env, From, To, EgldPayment<Env::Api>, Gas, Data, RH>
Backwards compatibility. Use method egld
instead.
Sourcepub fn esdt<P: Into<EsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, EsdtTokenPayment<Env::Api>, Gas, Data, RH>
pub fn esdt<P: Into<EsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, EsdtTokenPayment<Env::Api>, Gas, Data, RH>
Adds the first single, owned ESDT token payment to a transaction.
Since this is the first ESDT payment, a single payment tx is produced.
Can subsequently be called again for multiple payments.
Sourcepub fn single_esdt<'a>(
self,
token_identifier: &'a TokenIdentifier<Env::Api>,
token_nonce: u64,
amount: &'a BigUint<Env::Api>,
) -> Tx<Env, From, To, EsdtTokenPaymentRefs<'a, Env::Api>, Gas, Data, RH>
pub fn single_esdt<'a>( self, token_identifier: &'a TokenIdentifier<Env::Api>, token_nonce: u64, amount: &'a BigUint<Env::Api>, ) -> Tx<Env, From, To, EsdtTokenPaymentRefs<'a, Env::Api>, Gas, Data, RH>
Sets a single token payment, with the token identifier and amount kept as references.
This is handy whem we only want one ESDT transfer and we want to avoid unnecessary object clones.
Sourcepub fn egld_or_single_esdt<'a>(
self,
token_identifier: &'a EgldOrEsdtTokenIdentifier<Env::Api>,
token_nonce: u64,
amount: &'a BigUint<Env::Api>,
) -> Tx<Env, From, To, EgldOrEsdtTokenPaymentRefs<'a, Env::Api>, Gas, Data, RH>
pub fn egld_or_single_esdt<'a>( self, token_identifier: &'a EgldOrEsdtTokenIdentifier<Env::Api>, token_nonce: u64, amount: &'a BigUint<Env::Api>, ) -> Tx<Env, From, To, EgldOrEsdtTokenPaymentRefs<'a, Env::Api>, Gas, Data, RH>
Syntactic sugar for self.payment(EgldOrEsdtTokenPaymentRefs::new(...)
. Takes references.
Sourcepub fn multi_esdt<IntoMulti>(
self,
payments: IntoMulti,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn multi_esdt<IntoMulti>( self, payments: IntoMulti, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Sets a collection of ESDT transfers as the payment of the transaction.
Can be formed from single ESDT payments, but the result will always be a collection.
Always converts the argument into an owned collection of ESDT payments. For work with references, use .payment(&p)
instead.
Sourcepub fn with_esdt_transfer<P: Into<EsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn with_esdt_transfer<P: Into<EsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Backwards compatibility.
Sourcepub fn with_multi_token_transfer(
self,
payments: MultiEsdtPayment<Env::Api>,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn with_multi_token_transfer( self, payments: MultiEsdtPayment<Env::Api>, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Backwards compatibility.
Sourcepub fn with_egld_or_single_esdt_transfer<P: Into<EgldOrEsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, EgldOrEsdtTokenPayment<Env::Api>, Gas, Data, RH>
pub fn with_egld_or_single_esdt_transfer<P: Into<EgldOrEsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, EgldOrEsdtTokenPayment<Env::Api>, Gas, Data, RH>
Backwards compatibility.
Sourcepub fn egld_or_multi_esdt<P: Into<EgldOrMultiEsdtPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, EgldOrMultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn egld_or_multi_esdt<P: Into<EgldOrMultiEsdtPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, EgldOrMultiEsdtPayment<Env::Api>, Gas, Data, RH>
Converts argument to EgldOrMultiEsdtPayment
, then sets it as payment.
In most cases, payment
should be used instead.
Source§impl<Env, From, To, Gas, Data, RH> Tx<Env, From, To, EsdtTokenPayment<Env::Api>, Gas, Data, RH>
impl<Env, From, To, Gas, Data, RH> Tx<Env, From, To, EsdtTokenPayment<Env::Api>, Gas, Data, RH>
Sourcepub fn esdt<P: Into<EsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn esdt<P: Into<EsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Adds the second ESDT token transfer to a contract call.
Can be called multiple times on the same call.
When the Tx already contains a single (owned) ESDT payment, adding the second one will convert it to a list.
Source§impl<Env, From, To, Gas, Data, RH> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
impl<Env, From, To, Gas, Data, RH> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Sourcepub fn esdt<P: Into<EsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn esdt<P: Into<EsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Adds a single ESDT token transfer to a contract call.
Can be called multiple times on the same call.
Sourcepub fn multi_esdt<P: Into<EsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn multi_esdt<P: Into<EsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
When the Tx already contains an owned collection of ESDT payments,
calling multi_esdt
is equivalent to esdt
, it just adds another payment to the list.
Can be called multiple times.
Sourcepub fn with_esdt_transfer<P: Into<EsdtTokenPayment<Env::Api>>>(
self,
payment: P,
) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
pub fn with_esdt_transfer<P: Into<EsdtTokenPayment<Env::Api>>>( self, payment: P, ) -> Tx<Env, From, To, MultiEsdtPayment<Env::Api>, Gas, Data, RH>
Backwards compatibility.
Source§impl<Env, From, To, Payment, Data, RH> Tx<Env, From, To, Payment, (), Data, RH>
impl<Env, From, To, Payment, Data, RH> Tx<Env, From, To, Payment, (), Data, RH>
Sourcepub fn gas<GasValue>(
self,
gas_value: GasValue,
) -> Tx<Env, From, To, Payment, ExplicitGas<GasValue>, Data, RH>where
GasValue: TxGasValue<Env>,
pub fn gas<GasValue>(
self,
gas_value: GasValue,
) -> Tx<Env, From, To, Payment, ExplicitGas<GasValue>, Data, RH>where
GasValue: TxGasValue<Env>,
Sets an explicit gas limit to the call.
Sourcepub fn with_gas_limit(
self,
gas_limit: u64,
) -> Tx<Env, From, To, Payment, ExplicitGas<u64>, Data, RH>
pub fn with_gas_limit( self, gas_limit: u64, ) -> Tx<Env, From, To, Payment, ExplicitGas<u64>, Data, RH>
Backwards compatibility.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, (), RH>
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, (), RH>
Sourcepub fn raw_call<N: Into<ManagedBuffer<Env::Api>>>(
self,
function_name: N,
) -> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>
pub fn raw_call<N: Into<ManagedBuffer<Env::Api>>>( self, function_name: N, ) -> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>
Starts a contract call, serialized by hand.
Whenever possible, should use proxies instead, since manual serialization is not type-safe.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>
Sourcepub fn into_function_call(self) -> FunctionCall<Env::Api>
pub fn into_function_call(self) -> FunctionCall<Env::Api>
Converts tx to a simple FunctionCall, to be used as argument or data in contracts.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxToSpecified<Env>,
Payment: TxPayment<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxToSpecified<Env>,
Payment: TxPayment<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn normalize(
self,
) -> Tx<Env, From, ManagedAddress<Env::Api>, EgldPayment<Env::Api>, Gas, FunctionCall<Env::Api>, RH>
pub fn normalize( self, ) -> Tx<Env, From, ManagedAddress<Env::Api>, EgldPayment<Env::Api>, Gas, FunctionCall<Env::Api>, RH>
Produces the normalized function call, i.e. with builtin function calls for ESDT transfers.
The resulting transaction can differ from the input in several ways:
- the recipient is changed (some builtin functions are called with recipient = sender),
- the function call becomes a builtin function call.
§Important
Do not call this before sending transactions! Normalization is don automatically whenever necessary. Only use when you need the normalized data, e.g. for a multisig.
§Warning
To produce owned values, some clones are performed. It is not optimized for contracts, but can be used nonetheless.
Source§impl<Env, From, Payment, Gas> Tx<Env, From, (), Payment, Gas, (), ()>
impl<Env, From, Payment, Gas> Tx<Env, From, (), Payment, Gas, (), ()>
Sourcepub fn legacy_proxy_call<Env2, To, O>(
self,
call: Tx<Env2, (), To, (), (), FunctionCall<Env::Api>, OriginalResultMarker<O>>,
) -> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, OriginalResultMarker<O>>
pub fn legacy_proxy_call<Env2, To, O>( self, call: Tx<Env2, (), To, (), (), FunctionCall<Env::Api>, OriginalResultMarker<O>>, ) -> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, OriginalResultMarker<O>>
Merges the argument data into the current tx. Used for function calls originating in legacy proxies.
Different environment in the argument allowed because of compatibility with old proxies.
Method still subject to considerable change.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, FunctionCall<Env::Api>, RH>
Sourcepub fn argument<T: TopEncodeMulti>(self, arg: &T) -> Self
pub fn argument<T: TopEncodeMulti>(self, arg: &T) -> Self
Adds argument to function call.
Whenever possible, use proxies instead.
It serializes the value, but does not enforce type safety.
Sourcepub fn arguments_raw(self, raw: ManagedArgBuffer<Env::Api>) -> Self
pub fn arguments_raw(self, raw: ManagedArgBuffer<Env::Api>) -> Self
Adds serialized argument to function call.
Whenever possible, use proxies instead.
Doesa not serialize, does not enforce type safety.
Source§impl<Env, From, To, Payment, Gas, Data> Tx<Env, From, To, Payment, Gas, Data, ()>
impl<Env, From, To, Payment, Gas, Data> Tx<Env, From, To, Payment, Gas, Data, ()>
Sourcepub fn original_result<OriginalResult>(
self,
) -> Tx<Env, From, To, Payment, Gas, Data, OriginalResultMarker<OriginalResult>>
pub fn original_result<OriginalResult>( self, ) -> Tx<Env, From, To, Payment, Gas, Data, OriginalResultMarker<OriginalResult>>
Type marker to set the original contract or VM function return type.
Only the compile-time type annotation is given.
Source§impl<Env, From, To, Gas> Tx<Env, From, To, (), Gas, (), ()>
impl<Env, From, To, Gas> Tx<Env, From, To, (), Gas, (), ()>
Sourcepub fn typed<Proxy>(self, proxy: Proxy) -> Proxy::TxProxyMethodswhere
Proxy: TxProxyTrait<Env, From, To, Gas>,
pub fn typed<Proxy>(self, proxy: Proxy) -> Proxy::TxProxyMethodswhere
Proxy: TxProxyTrait<Env, From, To, Gas>,
Starts a proxy call, deploy, or upgrade.
The proxy object will be given, the subsequent call will be from a proxy context, containing all the contract endpoint names.
Source§impl<Env, From, To, Payment, Gas, Data, ResultList> Tx<Env, From, To, Payment, Gas, Data, ResultList>
impl<Env, From, To, Payment, Gas, Data, ResultList> Tx<Env, From, To, Payment, Gas, Data, ResultList>
Sourcepub fn with_result<ResultHandler>(
self,
result_handler: ResultHandler,
) -> Tx<Env, From, To, Payment, Gas, Data, ResultList::NoRetOutput>where
ResultHandler: RHListItem<Env, ResultList::OriginalResult, Returns = ()>,
ResultList: RHListAppendNoRet<Env, ResultHandler>,
pub fn with_result<ResultHandler>(
self,
result_handler: ResultHandler,
) -> Tx<Env, From, To, Payment, Gas, Data, ResultList::NoRetOutput>where
ResultHandler: RHListItem<Env, ResultList::OriginalResult, Returns = ()>,
ResultList: RHListAppendNoRet<Env, ResultHandler>,
Adds a result handler that doesn’t return anything.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, (), RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, (), RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn raw_deploy(
self,
) -> Tx<Env, From, To, Payment, Gas, DeployCall<Env, ()>, RH>
pub fn raw_deploy( self, ) -> Tx<Env, From, To, Payment, Gas, DeployCall<Env, ()>, RH>
Starts a contract deploy call, serialized by hand.
Whenever possible, should use proxies instead, since manual serialization is not type-safe.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, ()>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, ()>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn code<CodeValue>(
self,
code: CodeValue,
) -> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, Code<CodeValue>>, RH>where
CodeValue: TxCodeValue<Env>,
pub fn code<CodeValue>(
self,
code: CodeValue,
) -> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, Code<CodeValue>>, RH>where
CodeValue: TxCodeValue<Env>,
Sets upgrade code source as explicit code bytes.
Sourcepub fn from_source<FromSourceValue>(
self,
source_address: FromSourceValue,
) -> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, FromSource<FromSourceValue>>, RH>where
FromSourceValue: TxFromSourceValue<Env>,
pub fn from_source<FromSourceValue>(
self,
source_address: FromSourceValue,
) -> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, FromSource<FromSourceValue>>, RH>where
FromSourceValue: TxFromSourceValue<Env>,
Sets upgrade code source as another deployed contract code.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, DeployCall<Env, ()>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, DeployCall<Env, ()>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn code<CodeValue>(
self,
code: CodeValue,
) -> Tx<Env, From, To, Payment, Gas, DeployCall<Env, Code<CodeValue>>, RH>where
CodeValue: TxCodeValue<Env>,
pub fn code<CodeValue>(
self,
code: CodeValue,
) -> Tx<Env, From, To, Payment, Gas, DeployCall<Env, Code<CodeValue>>, RH>where
CodeValue: TxCodeValue<Env>,
Sets deploy code source as explicit code bytes.
Sourcepub fn from_source<FromSourceValue>(
self,
source_address: FromSourceValue,
) -> Tx<Env, From, To, Payment, Gas, DeployCall<Env, FromSource<FromSourceValue>>, RH>where
FromSourceValue: TxFromSourceValue<Env>,
pub fn from_source<FromSourceValue>(
self,
source_address: FromSourceValue,
) -> Tx<Env, From, To, Payment, Gas, DeployCall<Env, FromSource<FromSourceValue>>, RH>where
FromSourceValue: TxFromSourceValue<Env>,
Sets deploy code source as another deployed contract code.
Source§impl<Env, From, To, Payment, Gas, CodeSource, RH> Tx<Env, From, To, Payment, Gas, DeployCall<Env, CodeSource>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
CodeSource: TxCodeSource<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, CodeSource, RH> Tx<Env, From, To, Payment, Gas, DeployCall<Env, CodeSource>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
CodeSource: TxCodeSource<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn code_metadata(self, code_metadata: CodeMetadata) -> Self
pub fn code_metadata(self, code_metadata: CodeMetadata) -> Self
Sets code metadata to deploy.
Sourcepub fn argument<T: TopEncodeMulti>(self, arg: &T) -> Self
pub fn argument<T: TopEncodeMulti>(self, arg: &T) -> Self
Adds argument to a contract deploy.
Whenever possible, use proxies instead.
It serializes the value, but does not enforce type safety.
Sourcepub fn arguments_raw(self, raw: ManagedArgBuffer<Env::Api>) -> Self
pub fn arguments_raw(self, raw: ManagedArgBuffer<Env::Api>) -> Self
Adds serialized argument to a contract deploy.
Whenever possible, use proxies instead.
Does not serialize, does not enforce type safety.
Source§impl<Env, From, To, Payment, Gas, CodeSource, RH> Tx<Env, From, To, Payment, Gas, DeployCall<Env, CodeSource>, RH>where
Env: TxEnvMockDeployAddress,
From: TxFromSpecified<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
CodeSource: TxCodeSource<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, CodeSource, RH> Tx<Env, From, To, Payment, Gas, DeployCall<Env, CodeSource>, RH>where
Env: TxEnvMockDeployAddress,
From: TxFromSpecified<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
CodeSource: TxCodeSource<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn new_address<NA>(self, new_address: NA) -> Self
pub fn new_address<NA>(self, new_address: NA) -> Self
Sets the new mock address to be used for the newly deployed contract.
Only allowed in tests.
Source§impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, (), RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, RH> Tx<Env, From, To, Payment, Gas, (), RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
RH: TxResultHandler<Env>,
Sourcepub fn raw_upgrade(
self,
) -> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, ()>, RH>
pub fn raw_upgrade( self, ) -> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, ()>, RH>
Starts a contract deploy upgrade, serialized by hand.
Whenever possible, should use proxies instead, since manual serialization is not type-safe.
Source§impl<Env, From, To, Payment, Gas, CodeSource, RH> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, CodeSource>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
CodeSource: TxCodeSource<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, CodeSource, RH> Tx<Env, From, To, Payment, Gas, UpgradeCall<Env, CodeSource>, RH>where
Env: TxEnv,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPaymentEgldOnly<Env>,
Gas: TxGas<Env>,
CodeSource: TxCodeSource<Env>,
RH: TxResultHandler<Env>,
pub fn code_metadata(self, code_metadata: CodeMetadata) -> Self
Sourcepub fn argument<T: TopEncodeMulti>(self, arg: &T) -> Self
pub fn argument<T: TopEncodeMulti>(self, arg: &T) -> Self
Adds argument to upgrade call.
Whenever possible, use proxies instead.
It serializes the value, but does not enforce type safety.
Sourcepub fn arguments_raw(self, raw: ManagedArgBuffer<Env::Api>) -> Self
pub fn arguments_raw(self, raw: ManagedArgBuffer<Env::Api>) -> Self
Adds serialized argument to an upgrade call.
Whenever possible, use proxies instead.
Doesa not serialize, does not enforce type safety.
Source§impl<Env, From, To, Payment, Gas, Data, RH> Tx<Env, From, To, Payment, Gas, Data, RH>where
Env: TxEnvWithTxHash,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPayment<Env>,
Gas: TxGas<Env>,
Data: TxData<Env>,
RH: TxResultHandler<Env>,
impl<Env, From, To, Payment, Gas, Data, RH> Tx<Env, From, To, Payment, Gas, Data, RH>where
Env: TxEnvWithTxHash,
From: TxFrom<Env>,
To: TxTo<Env>,
Payment: TxPayment<Env>,
Gas: TxGas<Env>,
Data: TxData<Env>,
RH: TxResultHandler<Env>,
Source§impl<Api> Tx<TxScEnv<Api>, (), (), (), (), (), ()>where
Api: CallTypeApi,
impl<Api> Tx<TxScEnv<Api>, (), (), (), (), (), ()>where
Api: CallTypeApi,
pub fn new_tx_from_sc() -> Self
Source§impl<Api, To, Payment, Gas, Data, EmptyRH> Tx<TxScEnv<Api>, (), To, Payment, Gas, Data, EmptyRH>
impl<Api, To, Payment, Gas, Data, EmptyRH> Tx<TxScEnv<Api>, (), To, Payment, Gas, Data, EmptyRH>
Source§impl<Api, To, Payment, Gas, FC, EmptyRH> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, EmptyRH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
EmptyRH: TxEmptyResultHandler<TxScEnv<Api>>,
impl<Api, To, Payment, Gas, FC, EmptyRH> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, EmptyRH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
EmptyRH: TxEmptyResultHandler<TxScEnv<Api>>,
Sourcepub fn with_callback<RH>(
self,
callback: RH,
) -> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, RH>where
RH: TxAsyncCallCallback<Api>,
pub fn with_callback<RH>(
self,
callback: RH,
) -> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, RH>where
RH: TxAsyncCallCallback<Api>,
Backwards compatibility.
Source§impl<Api, To, Payment, FC, RH> Tx<TxScEnv<Api>, (), To, Payment, (), FC, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
RH: TxAsyncCallCallback<Api>,
impl<Api, To, Payment, FC, RH> Tx<TxScEnv<Api>, (), To, Payment, (), FC, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
RH: TxAsyncCallCallback<Api>,
pub fn async_call_and_exit(self) -> !
pub fn call_and_exit(self) -> !
Source§impl<Env, From, To, Payment, Gas, Data, RH> Tx<Env, From, To, Payment, Gas, Data, RH>
impl<Env, From, To, Payment, Gas, Data, RH> Tx<Env, From, To, Payment, Gas, Data, RH>
Sourcepub fn async_call(self) -> Tx<Env, From, To, Payment, Gas, Data, RH>
👎Deprecated since 0.50.2: Backwards compatibility only, does nothing. Just delete. Use async_call_and_exit
to launch asynchronous calls.
pub fn async_call(self) -> Tx<Env, From, To, Payment, Gas, Data, RH>
async_call_and_exit
to launch asynchronous calls.Backwards compatibility only.
Source§impl<Api, To, Payment, Gas> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, CallbackClosure<Api>>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
impl<Api, To, Payment, Gas> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, CallbackClosure<Api>>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
pub fn gas_for_callback( self, gas: u64, ) -> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, CallbackClosureWithGas<Api>>
Sourcepub fn with_extra_gas_for_callback(
self,
gas: u64,
) -> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, CallbackClosureWithGas<Api>>
pub fn with_extra_gas_for_callback( self, gas: u64, ) -> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, CallbackClosureWithGas<Api>>
Backwards compatibility.
Source§impl<Api, To, Payment, GasValue, Callback> Tx<TxScEnv<Api>, (), To, Payment, ExplicitGas<GasValue>, FunctionCall<Api>, Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
GasValue: TxGasValue<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
impl<Api, To, Payment, GasValue, Callback> Tx<TxScEnv<Api>, (), To, Payment, ExplicitGas<GasValue>, FunctionCall<Api>, Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
GasValue: TxGasValue<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
Sourcepub fn register_promise(self)
pub fn register_promise(self)
Launches a transaction as an asynchronous promise (async v2 mechanism).
Several such transactions can be launched from a single transaction.
Must set:
- to
- gas
- a function call, ideally via a proxy.
Value-only promises are not supported.
Optionally, can add:
- any payment
- a promise callback, which also needs explicit gas for callback.
Source§impl<Api, To, Payment, GasValue, Callback> Tx<TxScEnv<Api>, (), To, Payment, ExplicitGas<GasValue>, (), Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
GasValue: TxGasValue<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
impl<Api, To, Payment, GasValue, Callback> Tx<TxScEnv<Api>, (), To, Payment, ExplicitGas<GasValue>, (), Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
GasValue: TxGasValue<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
Sourcepub fn register_promise(self)
pub fn register_promise(self)
Launches a transaction as an asynchronous promise (async v2 mechanism), but without calling any function on the destination.
Such calls are useful for appending callbacks to simple transfers, mitigating edge cases such as non-payable SCs and frozen assets.
Source§impl<Api, To, Payment, Callback> Tx<TxScEnv<Api>, (), To, Payment, (), FunctionCall<Api>, Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
impl<Api, To, Payment, Callback> Tx<TxScEnv<Api>, (), To, Payment, (), FunctionCall<Api>, Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
Sourcepub unsafe fn register_promise(self)
pub unsafe fn register_promise(self)
Source§impl<Api, To, Payment, Callback> Tx<TxScEnv<Api>, (), To, Payment, (), (), Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
impl<Api, To, Payment, Callback> Tx<TxScEnv<Api>, (), To, Payment, (), (), Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
Sourcepub unsafe fn register_promise(self)
pub unsafe fn register_promise(self)
Source§impl<Api, To, Payment, Gas, Callback> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
impl<Api, To, Payment, Gas, Callback> Tx<TxScEnv<Api>, (), To, Payment, Gas, FunctionCall<Api>, Callback>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
Callback: TxPromisesCallback<Api>,
Sourcepub fn async_call_promise(self) -> Self
👎Deprecated since 0.50.2: Backwards compatibility only, does nothing. Just delete. Use register_promise
to launch asynchronous calls.
pub fn async_call_promise(self) -> Self
register_promise
to launch asynchronous calls.Backwards compatibility only.
Source§impl<Api, Payment, Gas, CodeValue, RH> Tx<TxScEnv<Api>, (), (), Payment, Gas, DeployCall<TxScEnv<Api>, Code<CodeValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
CodeValue: TxCodeValue<TxScEnv<Api>>,
RH: RHListExec<DeployRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
impl<Api, Payment, Gas, CodeValue, RH> Tx<TxScEnv<Api>, (), (), Payment, Gas, DeployCall<TxScEnv<Api>, Code<CodeValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
CodeValue: TxCodeValue<TxScEnv<Api>>,
RH: RHListExec<DeployRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
Sourcepub fn sync_call(self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
pub fn sync_call(self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
Synchronously deploys a contract.
Source§impl<Api, Payment, Gas, FromSourceValue, RH> Tx<TxScEnv<Api>, (), (), Payment, Gas, DeployCall<TxScEnv<Api>, FromSource<FromSourceValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FromSourceValue: TxFromSourceValue<TxScEnv<Api>>,
RH: RHListExec<DeployRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
impl<Api, Payment, Gas, FromSourceValue, RH> Tx<TxScEnv<Api>, (), (), Payment, Gas, DeployCall<TxScEnv<Api>, FromSource<FromSourceValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FromSourceValue: TxFromSourceValue<TxScEnv<Api>>,
RH: RHListExec<DeployRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
Sourcepub fn sync_call(self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
pub fn sync_call(self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
Synchronously deploys a contract from source.
Source§impl<Api, Payment, Gas, OriginalResult> Tx<TxScEnv<Api>, (), (), Payment, Gas, DeployCall<TxScEnv<Api>, ()>, OriginalResultMarker<OriginalResult>>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
OriginalResult: TopEncodeMulti,
impl<Api, Payment, Gas, OriginalResult> Tx<TxScEnv<Api>, (), (), Payment, Gas, DeployCall<TxScEnv<Api>, ()>, OriginalResultMarker<OriginalResult>>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
OriginalResult: TopEncodeMulti,
Sourcepub fn deploy_contract<RequestedResult>(
self,
code: &ManagedBuffer<Api>,
code_metadata: CodeMetadata,
) -> (ManagedAddress<Api>, RequestedResult)where
RequestedResult: TopDecodeMulti + TypeAbiFrom<OriginalResult>,
pub fn deploy_contract<RequestedResult>(
self,
code: &ManagedBuffer<Api>,
code_metadata: CodeMetadata,
) -> (ManagedAddress<Api>, RequestedResult)where
RequestedResult: TopDecodeMulti + TypeAbiFrom<OriginalResult>,
Backwards compatibility, immitates the old API.
Note that the data type (the DeployCall
) doesn’t have the code set.
This is because the old API was passing it as paramter, so we use it from the code
argument.
Also note that the code metadata is taken from the code_metadata
argument.
If another one was previously set in the Tx
object, that one will be ignored.
Sourcepub fn deploy_from_source<RequestedResult>(
self,
source_address: &ManagedAddress<Api>,
code_metadata: CodeMetadata,
) -> (ManagedAddress<Api>, RequestedResult)where
RequestedResult: TopDecodeMulti + TypeAbiFrom<OriginalResult>,
pub fn deploy_from_source<RequestedResult>(
self,
source_address: &ManagedAddress<Api>,
code_metadata: CodeMetadata,
) -> (ManagedAddress<Api>, RequestedResult)where
RequestedResult: TopDecodeMulti + TypeAbiFrom<OriginalResult>,
Backwards compatibility, immitates the old API.
Note that the data type (the DeployCall
) doesn’t have the code set.
This is because the old API was passing it as paramter, so we use it from the code
argument.
Also note that the code metadata is taken from the code_metadata
argument.
If another one was previously set in the Tx
object, that one will be ignored.
Source§impl<Api, Payment, Gas, OriginalResult> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Payment, Gas, DeployCall<TxScEnv<Api>, ()>, OriginalResultMarker<OriginalResult>>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
OriginalResult: TopEncodeMulti,
impl<Api, Payment, Gas, OriginalResult> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Payment, Gas, DeployCall<TxScEnv<Api>, ()>, OriginalResultMarker<OriginalResult>>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
OriginalResult: TopEncodeMulti,
Sourcepub fn upgrade_contract(
self,
code: &ManagedBuffer<Api>,
code_metadata: CodeMetadata,
)
👎Deprecated since 0.49.0: The legacy upgrade method does not correctly take the upgrade constructor into account. Please switch to the new syntax.
pub fn upgrade_contract( self, code: &ManagedBuffer<Api>, code_metadata: CodeMetadata, )
Backwards compatibility, immitates the old API.
Should no longer be used, which is why unlike all the rest of the old syntax, was deprecated.
Uses a DeployCall
instead of the correct UpgradeCall
, because the old syntax did not know about upgrades.
Note that the data type (the DeployCall
) doesn’t have the code set.
This is because the old API was passing it as paramter, so we use it from the code
argument.
Also note that the code metadata is taken from the code_metadata
argument.
If another one was previously set in the Tx
object, that one will be ignored.
Sourcepub fn upgrade_from_source(
self,
source_address: &ManagedAddress<Api>,
code_metadata: CodeMetadata,
)
👎Deprecated since 0.49.0: The legacy upgrade method does not correctly take the upgrade constructor into account. Please switch to the new syntax.
pub fn upgrade_from_source( self, source_address: &ManagedAddress<Api>, code_metadata: CodeMetadata, )
Backwards compatibility, immitates the old API.
Should no longer be used, which is why unlike all the rest of the old syntax, was deprecated.
Uses a DeployCall
instead of the correct UpgradeCall
, because the old syntax did not know about upgrades.
Note that the data type (the DeployCall
) doesn’t have the code set.
This is because the old API was passing it as paramter, so we use it from the code
argument.
Also note that the code metadata is taken from the code_metadata
argument.
If another one was previously set in the Tx
object, that one will be ignored.
Source§impl<Api, To, Payment, Gas, FC, RH> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
RH: RHListExec<SyncCallRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
impl<Api, To, Payment, Gas, FC, RH> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
RH: RHListExec<SyncCallRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
Sourcepub fn sync_call(self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
pub fn sync_call(self) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
Executes transaction synchronously.
Only works with contracts from the same shard.
Sourcepub fn sync_call_same_context(
self,
) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
pub fn sync_call_same_context( self, ) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
Executes transaction synchronously, in the same context (performed in the name of the caller).
Only works with contracts from the same shard.
Source§impl<Api, To, Payment, Gas, FC, RH> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxNoPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
RH: RHListExec<SyncCallRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
impl<Api, To, Payment, Gas, FC, RH> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxNoPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
RH: RHListExec<SyncCallRawResult<Api>, TxScEnv<Api>>,
RH::ListReturns: NestedTupleFlatten,
Sourcepub fn sync_call_readonly(
self,
) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
pub fn sync_call_readonly( self, ) -> <RH::ListReturns as NestedTupleFlatten>::Unpacked
Executes transaction synchronously, in readonly mode (target contract cannot have its state altered).
Only works with contracts from the same shard.
Source§impl<Api, To, Payment, Gas, FC, OriginalResult> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, OriginalResultMarker<OriginalResult>>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
impl<Api, To, Payment, Gas, FC, OriginalResult> Tx<TxScEnv<Api>, (), To, Payment, Gas, FC, OriginalResultMarker<OriginalResult>>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxDataFunctionCall<TxScEnv<Api>>,
Sourcepub fn execute_on_dest_context<RequestedResult>(self) -> RequestedResultwhere
RequestedResult: TopDecodeMulti,
pub fn execute_on_dest_context<RequestedResult>(self) -> RequestedResultwhere
RequestedResult: TopDecodeMulti,
Backwards compatibility.
Sourcepub fn execute_on_dest_context_with_back_transfers<RequestedResult>(
self,
) -> (RequestedResult, BackTransfers<Api>)where
RequestedResult: TopDecodeMulti,
pub fn execute_on_dest_context_with_back_transfers<RequestedResult>(
self,
) -> (RequestedResult, BackTransfers<Api>)where
RequestedResult: TopDecodeMulti,
Backwards compatibility.
Source§impl<Api, From, To, Payment, Gas, FC, RH> Tx<TxScEnv<Api>, From, To, Payment, Gas, FC, RH>where
Api: CallTypeApi,
From: TxFrom<TxScEnv<Api>>,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxData<TxScEnv<Api>> + Into<FunctionCall<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
impl<Api, From, To, Payment, Gas, FC, RH> Tx<TxScEnv<Api>, From, To, Payment, Gas, FC, RH>where
Api: CallTypeApi,
From: TxFrom<TxScEnv<Api>>,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FC: TxData<TxScEnv<Api>> + Into<FunctionCall<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
Sourcepub fn transfer_execute(self)
pub fn transfer_execute(self)
Sends transaction asynchronously, and doesn’t wait for callback (“fire and forget”.)
Source§impl<Api, From, To, Payment> Tx<TxScEnv<Api>, From, To, Payment, (), (), ()>where
Api: CallTypeApi,
From: TxFrom<TxScEnv<Api>>,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
impl<Api, From, To, Payment> Tx<TxScEnv<Api>, From, To, Payment, (), (), ()>where
Api: CallTypeApi,
From: TxFrom<TxScEnv<Api>>,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPayment<TxScEnv<Api>>,
Sourcepub fn transfer_if_not_empty(self)
pub fn transfer_if_not_empty(self)
Transfers funds, if amount is greater than zero. Does nothing otherwise.
Can only used for simple transfers.
Source§impl<Api, Payment, Gas, CodeValue, RH> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Payment, Gas, UpgradeCall<TxScEnv<Api>, Code<CodeValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
CodeValue: TxCodeValue<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
impl<Api, Payment, Gas, CodeValue, RH> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Payment, Gas, UpgradeCall<TxScEnv<Api>, Code<CodeValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
CodeValue: TxCodeValue<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
Sourcepub fn upgrade_async_call_and_exit(self)
pub fn upgrade_async_call_and_exit(self)
Launches the upgrade async call.
TODO: change return type to !
.
Source§impl<Api, Payment, Gas, FromSourceValue, RH> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Payment, Gas, UpgradeCall<TxScEnv<Api>, FromSource<FromSourceValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FromSourceValue: TxFromSourceValue<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
impl<Api, Payment, Gas, FromSourceValue, RH> Tx<TxScEnv<Api>, (), ManagedAddress<Api>, Payment, Gas, UpgradeCall<TxScEnv<Api>, FromSource<FromSourceValue>>, RH>where
Api: CallTypeApi,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
FromSourceValue: TxFromSourceValue<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
Sourcepub fn upgrade_async_call_and_exit(self)
pub fn upgrade_async_call_and_exit(self)
Launches the upgrade from source async call.
TODO: change return type to !
.
Source§impl<Api, To, Payment, Gas, RH> Tx<TxScEnv<Api>, (), To, Payment, Gas, UpgradeCall<TxScEnv<Api>, ()>, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
impl<Api, To, Payment, Gas, RH> Tx<TxScEnv<Api>, (), To, Payment, Gas, UpgradeCall<TxScEnv<Api>, ()>, RH>where
Api: CallTypeApi,
To: TxToSpecified<TxScEnv<Api>>,
Payment: TxPaymentEgldOnly<TxScEnv<Api>>,
Gas: TxGas<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
Sourcepub fn upgrade_contract(
self,
code: &ManagedBuffer<Api>,
code_metadata: CodeMetadata,
)
👎Deprecated since 0.49.0: This is a transition syntax, it would not have been reachable before 0.49.0. Use [upgrade_async_call_and_exit] instead.
pub fn upgrade_contract( self, code: &ManagedBuffer<Api>, code_metadata: CodeMetadata, )
Transition syntax, immitates the old API.
Note that the data type (the UpgradeCall
) doesn’t have the code set.
This is because the old API was passing it as paramter, so we use it from the code
argument.
Also note that the code metadata is taken from the code_metadata
argument.
If another one was previously set in the Tx
object, that one will be ignored.
Sourcepub fn upgrade_from_source(
self,
source_address: &ManagedAddress<Api>,
code_metadata: CodeMetadata,
)
👎Deprecated since 0.49.0: This is a transition syntax, it would not have been reachable before 0.49.0. Use [upgrade_async_call_and_exit] instead.
pub fn upgrade_from_source( self, source_address: &ManagedAddress<Api>, code_metadata: CodeMetadata, )
Transition syntax, immitates the old API.
Note that the data type (the UpgradeCall
) doesn’t have the code set.
This is because the old API was passing it as paramter, so we use it from the code
argument.
Also note that the code metadata is taken from the code_metadata
argument.
If another one was previously set in the Tx
object, that one will be ignored.