Trait alloy_provider::fillers::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:
- Missing: The filler is missing a required property to fill in the transaction request.
TxFiller::status
should returnFillerControlFlow::Missing
. with a list of the missing properties. - Ready: The filler is ready to fill in the transaction request.
TxFiller::status
should returnFillerControlFlow::Ready
. - Finished: The filler has filled in all properties that it can fill.
TxFiller::status
should returnFillerControlFlow::Finished
.
Required Associated Types§
Required Methods§
sourcefn status(&self, tx: &N::TransactionRequest) -> FillerControlFlow
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.
sourcefn fill_sync(&self, tx: &mut SendableTx<N>)
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.
sourcefn prepare<P, T>(
&self,
provider: &P,
tx: &N::TransactionRequest,
) -> impl Send + Future<Output = TransportResult<Self::Fillable>>
fn prepare<P, T>( &self, provider: &P, tx: &N::TransactionRequest, ) -> impl Send + Future<Output = TransportResult<Self::Fillable>>
Prepares fillable properties, potentially by making an RPC request.
Provided Methods§
sourcefn join_with<T>(self, other: T) -> JoinFill<Self, T>where
T: TxFiller<N>,
fn join_with<T>(self, other: T) -> JoinFill<Self, T>where
T: TxFiller<N>,
Joins this filler with another filler to compose multiple fillers.
sourcefn continue_filling(&self, tx: &SendableTx<N>) -> bool
fn continue_filling(&self, tx: &SendableTx<N>) -> bool
Returns true
if the filler is should continue filling.
sourcefn ready(&self, tx: &N::TransactionRequest) -> bool
fn ready(&self, tx: &N::TransactionRequest) -> bool
Returns true
if the filler is ready to fill in the transaction request.
sourcefn finished(&self, tx: &N::TransactionRequest) -> bool
fn finished(&self, tx: &N::TransactionRequest) -> bool
Returns true
if the filler is finished filling in the transaction request.
sourcefn prepare_and_fill<P, T>(
&self,
provider: &P,
tx: SendableTx<N>,
) -> impl Send + Future<Output = TransportResult<SendableTx<N>>>
fn prepare_and_fill<P, T>( &self, provider: &P, tx: SendableTx<N>, ) -> impl Send + Future<Output = TransportResult<SendableTx<N>>>
Prepares and fills the transaction request with the fillable properties.