alloy_provider::fillers

Trait TxFiller

source
pub trait TxFiller<N: Network = Ethereum>:
    Clone
    + Send
    + Sync
    + Debug {
    type Fillable: Send + Sync + 'static;

    // Required methods
    fn status(&self, tx: &N::TransactionRequest) -> FillerControlFlow;
    fn fill_sync(&self, tx: &mut SendableTx<N>);
    fn prepare<P, T>(
        &self,
        provider: &P,
        tx: &N::TransactionRequest,
    ) -> impl Send + Future<Output = TransportResult<Self::Fillable>>
       where P: Provider<T, N>,
             T: Transport + Clone;
    fn fill(
        &self,
        fillable: Self::Fillable,
        tx: SendableTx<N>,
    ) -> impl Send + Future<Output = TransportResult<SendableTx<N>>>;

    // Provided methods
    fn join_with<T>(self, other: T) -> JoinFill<Self, T>
       where T: TxFiller<N> { ... }
    fn continue_filling(&self, tx: &SendableTx<N>) -> bool { ... }
    fn ready(&self, tx: &N::TransactionRequest) -> bool { ... }
    fn finished(&self, tx: &N::TransactionRequest) -> bool { ... }
    fn prepare_and_fill<P, T>(
        &self,
        provider: &P,
        tx: SendableTx<N>,
    ) -> impl Send + Future<Output = TransportResult<SendableTx<N>>>
       where P: Provider<T, N>,
             T: Transport + Clone { ... }
}
Expand description

A layer that can fill in a TransactionRequest with additional information.

§Lifecycle Notes

The FillerControlFlow determines the lifecycle of a filler. Fillers may be in one of three states:

Required Associated Types§

source

type Fillable: Send + Sync + 'static

The properties that this filler retrieves from the RPC. to fill in the TransactionRequest.

Required Methods§

source

fn status(&self, tx: &N::TransactionRequest) -> FillerControlFlow

Return a control-flow enum indicating whether the filler is ready to fill in the transaction request, or if it is missing required properties.

source

fn fill_sync(&self, tx: &mut SendableTx<N>)

Performs any synchronous filling. This should be called before TxFiller::prepare and TxFiller::fill to fill in any properties that can be filled synchronously.

source

fn prepare<P, T>( &self, provider: &P, tx: &N::TransactionRequest, ) -> impl Send + Future<Output = TransportResult<Self::Fillable>>
where P: Provider<T, N>, T: Transport + Clone,

Prepares fillable properties, potentially by making an RPC request.

source

fn fill( &self, fillable: Self::Fillable, tx: SendableTx<N>, ) -> impl Send + Future<Output = TransportResult<SendableTx<N>>>

Fills in the transaction request with the fillable properties.

Provided Methods§

source

fn join_with<T>(self, other: T) -> JoinFill<Self, T>
where T: TxFiller<N>,

Joins this filler with another filler to compose multiple fillers.

source

fn continue_filling(&self, tx: &SendableTx<N>) -> bool

Returns true if the filler is should continue filling.

source

fn ready(&self, tx: &N::TransactionRequest) -> bool

Returns true if the filler is ready to fill in the transaction request.

source

fn finished(&self, tx: &N::TransactionRequest) -> bool

Returns true if the filler is finished filling in the transaction request.

source

fn prepare_and_fill<P, T>( &self, provider: &P, tx: SendableTx<N>, ) -> impl Send + Future<Output = TransportResult<SendableTx<N>>>
where P: Provider<T, N>, T: Transport + Clone,

Prepares and fills the transaction request with the fillable properties.

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.

Implementors§