pub struct TxBuilder { /* private fields */ }Expand description
Transaction builder.
Handles fee calculation, transaction construction, and signing.
Implementations§
Source§impl TxBuilder
impl TxBuilder
Sourcepub fn calculate_fee(&self, gas_used: Option<u64>) -> Result<Fee, Error>
pub fn calculate_fee(&self, gas_used: Option<u64>) -> Result<Fee, Error>
Estimate a transaction fee.
See also What Are Crypto Gas Fees?.
§Errors
Returns an error if fee calculation fails.
Sourcepub fn build_transaction(
&self,
account: &Account,
msgs: impl IntoIterator<Item = Any>,
fee: Option<Fee>,
authenticator_ids: Option<&[u64]>,
) -> Result<Raw, Error>
pub fn build_transaction( &self, account: &Account, msgs: impl IntoIterator<Item = Any>, fee: Option<Fee>, authenticator_ids: Option<&[u64]>, ) -> Result<Raw, Error>
Build a transaction for given messages.
When authenticator_ids is provided, the transaction will include a TxExtension
for permissioned key trading, allowing sub-accounts to trade using delegated keys.
§Errors
Returns an error if transaction building or signing fails.
Sourcepub fn build_for_simulation(
&self,
account: &Account,
msgs: impl IntoIterator<Item = Any>,
) -> Result<Vec<u8>, Error>
pub fn build_for_simulation( &self, account: &Account, msgs: impl IntoIterator<Item = Any>, ) -> Result<Vec<u8>, Error>
Build and simulate a transaction to estimate gas.
Returns the raw transaction bytes suitable for simulation.
§Errors
Returns an error if transaction building fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TxBuilder
impl RefUnwindSafe for TxBuilder
impl Send for TxBuilder
impl Sync for TxBuilder
impl Unpin for TxBuilder
impl UnwindSafe for TxBuilder
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].