pub trait PayloadBuilder<Pool, Client>:
Send
+ Sync
+ Clone {
type Attributes: PayloadBuilderAttributes;
type BuiltPayload: BuiltPayload;
// Required methods
fn try_build(
&self,
args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>,
) -> Result<BuildOutcome<Self::BuiltPayload>, PayloadBuilderError>;
fn build_empty_payload(
&self,
client: &Client,
config: PayloadConfig<Self::Attributes>,
) -> Result<Self::BuiltPayload, PayloadBuilderError>;
// Provided method
fn on_missing_payload(
&self,
_args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>,
) -> MissingPayloadBehaviour<Self::BuiltPayload> { ... }
}
Expand description
A trait for building payloads that encapsulate Ethereum transactions.
This trait provides the try_build
method to construct a transaction payload
using BuildArguments
. It returns a Result
indicating success or a
PayloadBuilderError
if building fails.
Generic parameters Pool
and Client
represent the transaction pool and
Ethereum client types.
Required Associated Types§
sourcetype Attributes: PayloadBuilderAttributes
type Attributes: PayloadBuilderAttributes
The payload attributes type to accept for building.
sourcetype BuiltPayload: BuiltPayload
type BuiltPayload: BuiltPayload
The type of the built payload.
Required Methods§
sourcefn try_build(
&self,
args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>,
) -> Result<BuildOutcome<Self::BuiltPayload>, PayloadBuilderError>
fn try_build( &self, args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>, ) -> Result<BuildOutcome<Self::BuiltPayload>, PayloadBuilderError>
Tries to build a transaction payload using provided arguments.
Constructs a transaction payload based on the given arguments,
returning a Result
indicating success or an error if building fails.
§Arguments
args
: Build arguments containing necessary components.
§Returns
A Result
indicating the build outcome or an error.
sourcefn build_empty_payload(
&self,
client: &Client,
config: PayloadConfig<Self::Attributes>,
) -> Result<Self::BuiltPayload, PayloadBuilderError>
fn build_empty_payload( &self, client: &Client, config: PayloadConfig<Self::Attributes>, ) -> Result<Self::BuiltPayload, PayloadBuilderError>
Builds an empty payload without any transaction.
Provided Methods§
sourcefn on_missing_payload(
&self,
_args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>,
) -> MissingPayloadBehaviour<Self::BuiltPayload>
fn on_missing_payload( &self, _args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>, ) -> MissingPayloadBehaviour<Self::BuiltPayload>
Invoked when the payload job is being resolved and there is no payload yet.
This can happen if the CL requests a payload before the first payload has been built.