pub struct TransactionBuilder<const ADD_ENERGY: bool, Inner> { /* private fields */ }Expand description
A builder of transactions out of minimal data typically obtained by dry-running.
The concrete instances of this type, ContractInitBuilder and
ContractUpdateBuilder have more detailed information on usage.
The ADD_ENERGY constant is used to indicate whether the builder should
allow adding extra energy. This is only useful for transactions that have
dynamic cost, namely contract initializations and updates.
Implementations§
Source§impl<const ADD: bool, Inner> TransactionBuilder<ADD, Inner>
impl<const ADD: bool, Inner> TransactionBuilder<ADD, Inner>
Sourcepub fn expiry(self, expiry: TransactionTime) -> Self
pub fn expiry(self, expiry: TransactionTime) -> Self
Set the expiry time for the transaction. If not set the default is one hour from the time the transaction is signed.
Sourcepub fn nonce(self, nonce: Nonce) -> Self
pub fn nonce(self, nonce: Nonce) -> Self
Set the nonce for the transaction. If not set the default behaviour is
to get the nonce from the connected Client at the
time the transaction is sent.
Sourcepub fn current_energy(&self) -> Energy
pub fn current_energy(&self) -> Energy
Return the amount of Energy that will be allowed for the transaction
if the transaction was sent with the current parameters.
Sourcepub async fn send_inner<A>(
self,
signer: &impl ExactSizeTransactionSigner,
k: impl FnOnce(TransactionHash, Client) -> A,
) -> QueryResult<A>
pub async fn send_inner<A>( self, signer: &impl ExactSizeTransactionSigner, k: impl FnOnce(TransactionHash, Client) -> A, ) -> QueryResult<A>
Send the transaction and return a handle that can be queried for the status.
Source§impl<Inner> TransactionBuilder<true, Inner>
impl<Inner> TransactionBuilder<true, Inner>
Sourcepub fn extra_energy(self, energy: Energy) -> Self
pub fn extra_energy(self, energy: Energy) -> Self
Add extra energy to the call. The default amount is 10%, or at least 50. This should be sufficient in most cases, but for specific contracts no extra energy might be needed, or a greater safety margin could be desired.
Source§impl<Type> TransactionBuilder<true, ContractInitInner<Type>>
impl<Type> TransactionBuilder<true, ContractInitInner<Type>>
Sourcepub async fn dry_run_new_instance<P: Serial>(
client: Client,
sender: AccountAddress,
mod_ref: ModuleReference,
name: &str,
amount: Amount,
parameter: &P,
) -> Result<Self, DryRunNewInstanceError>
pub async fn dry_run_new_instance<P: Serial>( client: Client, sender: AccountAddress, mod_ref: ModuleReference, name: &str, amount: Amount, parameter: &P, ) -> Result<Self, DryRunNewInstanceError>
Attempt to dry run a smart contract initialization transaction.
In contrast to
dry_run_new_instance_raw this
automatically serializes the provided parameter.
Sourcepub async fn dry_run_new_instance_raw(
client: Client,
sender: AccountAddress,
mod_ref: ModuleReference,
name: &str,
amount: Amount,
parameter: OwnedParameter,
) -> Result<Self, DryRunNewInstanceError>
pub async fn dry_run_new_instance_raw( client: Client, sender: AccountAddress, mod_ref: ModuleReference, name: &str, amount: Amount, parameter: OwnedParameter, ) -> Result<Self, DryRunNewInstanceError>
Attempt to dry run a smart contract initialization transaction. In case of success the resulting value can be used to extract the generated events from the dry-run, and sign and send the transaction.
The arguments are
client- the client to connect to the nodesender- the account that will be sending the transactionmod_ref- the reference to the module on chain from which the instance is to be createdname- the name of the contract (NB: without theinit_prefix)amount- the amount of CCD to initialize the instance withparameter- the parameter to send to the initialization method of the contract.
Sourcepub fn event(&self) -> &ContractInitializedEvent
pub fn event(&self) -> &ContractInitializedEvent
Access to the generated events.
Note that these are events generated as part of a dry run. Since time passes between the dry run and the actual transaction the transaction might behave differently.
Sourcepub async fn send(
self,
signer: &impl ExactSizeTransactionSigner,
) -> QueryResult<ContractInitHandle<Type>>
pub async fn send( self, signer: &impl ExactSizeTransactionSigner, ) -> QueryResult<ContractInitHandle<Type>>
Send the transaction and return a handle that can be queried for the status.
Source§impl TransactionBuilder<false, HashBytes<ModuleReferenceMarker>>
impl TransactionBuilder<false, HashBytes<ModuleReferenceMarker>>
Sourcepub async fn dry_run_module_deploy(
client: Client,
sender: AccountAddress,
module: WasmModule,
) -> Result<Self, DryRunModuleDeployError>
pub async fn dry_run_module_deploy( client: Client, sender: AccountAddress, module: WasmModule, ) -> Result<Self, DryRunModuleDeployError>
Attempt to dry run a module deployment transaction.
In case of success the return value can be used to send the transaction to affect the module deployment.
Source§impl TransactionBuilder<false, HashBytes<ModuleReferenceMarker>>
impl TransactionBuilder<false, HashBytes<ModuleReferenceMarker>>
Sourcepub async fn send(
self,
signer: &impl ExactSizeTransactionSigner,
) -> QueryResult<ModuleDeployHandle>
pub async fn send( self, signer: &impl ExactSizeTransactionSigner, ) -> QueryResult<ModuleDeployHandle>
Send the transaction and return a handle that can be queried for the status.
Source§impl TransactionBuilder<true, ContractUpdateInner>
impl TransactionBuilder<true, ContractUpdateInner>
Sourcepub async fn send(
self,
signer: &impl ExactSizeTransactionSigner,
) -> QueryResult<ContractUpdateHandle>
pub async fn send( self, signer: &impl ExactSizeTransactionSigner, ) -> QueryResult<ContractUpdateHandle>
Send the transaction and return a handle that can be queried for the status.
Sourcepub fn return_value(&self) -> Option<&ReturnValue>
pub fn return_value(&self) -> Option<&ReturnValue>
Get the return value from dry-running.
Sourcepub fn events(&self) -> &[Upward<ContractTraceElement>]
pub fn events(&self) -> &[Upward<ContractTraceElement>]
Get the events generated from the dry-run.
Since newer versions of the Concordium Node API might introduce new
variants of ContractTraceElement the result might contain
Upward::Unknown.
Auto Trait Implementations§
impl<const ADD_ENERGY: bool, Inner> !Freeze for TransactionBuilder<ADD_ENERGY, Inner>
impl<const ADD_ENERGY: bool, Inner> !RefUnwindSafe for TransactionBuilder<ADD_ENERGY, Inner>
impl<const ADD_ENERGY: bool, Inner> Send for TransactionBuilder<ADD_ENERGY, Inner>where
Inner: Send,
impl<const ADD_ENERGY: bool, Inner> Sync for TransactionBuilder<ADD_ENERGY, Inner>where
Inner: Sync,
impl<const ADD_ENERGY: bool, Inner> Unpin for TransactionBuilder<ADD_ENERGY, Inner>where
Inner: Unpin,
impl<const ADD_ENERGY: bool, Inner> !UnwindSafe for TransactionBuilder<ADD_ENERGY, Inner>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.