Struct TxBuilder

pub struct TxBuilder<'a> {
Show 16 fields pub querier: &'a QueryClient, pub signer: &'a dyn TxSigner, pub sender: Option<Address>, pub tx_timeout_blocks: Option<u64>, pub sequence_strategy: Option<SequenceStrategy>, pub account_number: Option<u64>, pub memo: Option<String>, pub gas_coin: Option<Coin>, pub gas_units_or_simulate: Option<u64>, pub gas_simulate_multiplier: Option<f32>, pub broadcast_mode: Option<BroadcastMode>, pub broadcast_poll: bool, pub broadcast_poll_sleep_duration: Option<Duration>, pub broadcast_poll_timeout_duration: Option<Duration>, pub middleware_map_body: Option<Arc<Vec<SigningMiddlewareMapBody>>>, pub middleware_map_resp: Option<Arc<Vec<SigningMiddlewareMapResp>>>,
}

Fields§

§querier: &'a QueryClient§signer: &'a dyn TxSigner§sender: Option<Address>

Must be set if not providing a sequence or account_number

§tx_timeout_blocks: Option<u64>

how many blocks until a tx is considered invalid if not set, the default is 10 blocks

§sequence_strategy: Option<SequenceStrategy>

for manually overriding the sequence number, e.g. parallel transactions (multiple messages in a tx do not need this)

§account_number: Option<u64>

The account number of the sender. If not set, it will be derived from the sender’s account

§memo: Option<String>§gas_coin: Option<Coin>

The gas coin to use. Gas price (in gas_coin.denom) = gas_coin.amount * gas_units If not set, it will be derived from querier.chain_config (without hitting the network)

§gas_units_or_simulate: Option<u64>

The maximum gas units. Gas price (in gas_coin.denom) = gas_coin.amount * gas_units If not set, it will be derived from running an on-chain simulation multiplied by gas_multiplier

§gas_simulate_multiplier: Option<f32>

A multiplier to use for simulated gas units. If not set, a default of 1.5 will be used.

§broadcast_mode: Option<BroadcastMode>

The broadcast mode to use. If not set, the default is Sync

§broadcast_poll: bool

Whether broadcasting should poll for the tx landing on chain before returning default is true

§broadcast_poll_sleep_duration: Option<Duration>

The duration to sleep between polling for the tx landing on chain If not set, the default is 1 second

§broadcast_poll_timeout_duration: Option<Duration>

The duration to wait before giving up on polling for the tx landing on chain If not set, the default is 30 seconds

§middleware_map_body: Option<Arc<Vec<SigningMiddlewareMapBody>>>

Middleware to run before the tx is broadcast

§middleware_map_resp: Option<Arc<Vec<SigningMiddlewareMapResp>>>

Middleware to run after the tx is broadcast

Implementations§

§

impl<'a> TxBuilder<'a>

pub fn new(querier: &'a QueryClient, signer: &'a dyn TxSigner) -> TxBuilder<'a>

pub fn set_tx_timeout_blocks( &mut self, tx_timeout_blocks: u64, ) -> &mut TxBuilder<'a>

pub fn set_memo(&mut self, memo: impl Into<String>) -> &mut TxBuilder<'a>

pub fn set_sequence_strategy( &mut self, sequence_strategy: SequenceStrategy, ) -> &mut TxBuilder<'a>

pub fn set_sender(&mut self, sender: Address) -> &mut TxBuilder<'a>

pub fn set_gas_coin(&mut self, gas_coin: Coin) -> &mut TxBuilder<'a>

pub fn set_gas_units_or_simulate( &mut self, gas_units: Option<u64>, ) -> &mut TxBuilder<'a>

pub fn set_gas_simulate_multiplier( &mut self, gas_multiplier: f32, ) -> &mut TxBuilder<'a>

pub fn set_account_number(&mut self, account_number: u64) -> &mut TxBuilder<'a>

pub fn set_broadcast_mode( &mut self, broadcast_mode: BroadcastMode, ) -> &mut TxBuilder<'a>

pub fn set_broadcast_poll(&mut self, broadcast_poll: bool) -> &mut TxBuilder<'a>

pub fn set_broadcast_poll_sleep_duration( &mut self, broadcast_poll_sleep_duration: Duration, ) -> &mut TxBuilder<'a>

pub fn set_broadcast_poll_timeout_duration( &mut self, broadcast_poll_timeout_duration: Duration, ) -> &mut TxBuilder<'a>

pub fn set_middleware_map_body( &mut self, middleware_map_body: Arc<Vec<SigningMiddlewareMapBody>>, ) -> &mut TxBuilder<'a>

pub fn set_middleware_map_resp( &mut self, middleware_map_resp: Arc<Vec<SigningMiddlewareMapResp>>, ) -> &mut TxBuilder<'a>

pub async fn broadcast( self, messages: impl IntoIterator<Item = Any>, ) -> Result<TxResponse, Error>

pub async fn simulate_gas( &self, signer_info: SignerInfo, account_number: u64, tx_body: &TxBody, ) -> Result<GasInfo, Error>

pub async fn broadcast_raw( self, messages: Vec<Any>, ) -> Result<AnyTxResponse, Error>

Typically do not want to do this directly, use broadcast instead however, in a case where you do not want to wait for the tx to be committed, you can use this (and if the original tx response is AnyTxResponse::Rpc, it will stay that way)

Auto Trait Implementations§

§

impl<'a> Freeze for TxBuilder<'a>

§

impl<'a> !RefUnwindSafe for TxBuilder<'a>

§

impl<'a> Send for TxBuilder<'a>

§

impl<'a> Sync for TxBuilder<'a>

§

impl<'a> Unpin for TxBuilder<'a>

§

impl<'a> !UnwindSafe for TxBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

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].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T