reth_basic_payload_builder

Trait PayloadBuilder

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

Source

type Attributes: PayloadBuilderAttributes

The payload attributes type to accept for building.

Source

type BuiltPayload: BuiltPayload

The type of the built payload.

Required Methods§

Source

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.

Source

fn build_empty_payload( &self, client: &Client, config: PayloadConfig<Self::Attributes>, ) -> Result<Self::BuiltPayload, PayloadBuilderError>

Builds an empty payload without any transaction.

Provided Methods§

Source

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.

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§

Source§

impl<L, R, Pool, Client> PayloadBuilder<Pool, Client> for PayloadBuilderStack<L, R>
where L: PayloadBuilder<Pool, Client> + Unpin + 'static, R: PayloadBuilder<Pool, Client> + Unpin + 'static, Client: Clone, Pool: Clone, L::Attributes: Unpin + Clone, R::Attributes: Unpin + Clone, L::BuiltPayload: Unpin + Clone, R::BuiltPayload: Unpin + Clone, <<L as PayloadBuilder<Pool, Client>>::Attributes as PayloadBuilderAttributes>::Error: 'static, <<R as PayloadBuilder<Pool, Client>>::Attributes as PayloadBuilderAttributes>::Error: 'static,

Source§

type Attributes = Either<<L as PayloadBuilder<Pool, Client>>::Attributes, <R as PayloadBuilder<Pool, Client>>::Attributes>

Source§

type BuiltPayload = Either<<L as PayloadBuilder<Pool, Client>>::BuiltPayload, <R as PayloadBuilder<Pool, Client>>::BuiltPayload>