loom_broadcast_flashbots::client

Struct BundleRequest

Source
pub struct BundleRequest {
    transactions: Vec<BundleTransaction>,
    revertible_transaction_hashes: Vec<TxHash>,
    access_list_hashes: Option<Vec<TxHash>>,
    target_block: Option<U64>,
    min_timestamp: Option<u64>,
    max_timestamp: Option<u64>,
    simulation_block: Option<U64>,
    simulation_timestamp: Option<u64>,
    simulation_basefee: Option<u64>,
}
Expand description

A bundle that can be submitted to a Flashbots relay.

The bundle can include your own transactions and transactions from the mempool.

Additionally, this bundle can be simulated through a relay if simulation parameters are provided using BundleRequest::set_simulation_block and BundleRequest::set_simulation_timestamp.

Please note that some parameters are required, and submitting a bundle without them will get it rejected pre-flight. The required parameters include:

Fields§

§transactions: Vec<BundleTransaction>§revertible_transaction_hashes: Vec<TxHash>§access_list_hashes: Option<Vec<TxHash>>§target_block: Option<U64>§min_timestamp: Option<u64>§max_timestamp: Option<u64>§simulation_block: Option<U64>§simulation_timestamp: Option<u64>§simulation_basefee: Option<u64>

Implementations§

Source§

impl BundleRequest

Source

pub fn new() -> Self

Creates an empty bundle request.

Source

pub fn push_transaction<T: Into<BundleTransaction>>(self, tx: T) -> Self

Adds a transaction to the bundle request.

Transactions added to the bundle can either be novel transactions, i.e. transactions that you have crafted, or they can be from one of the mempool APIs.

Source

pub fn add_transaction<T: Into<BundleTransaction>>(&mut self, tx: T)

Adds a transaction to the bundle request.

This function takes a mutable reference to self and adds the specified transaction to the transactions vector. The added transaction can either be a novel transaction that you have crafted, or it can be from one of the mempool APIs.

Source

pub fn push_revertible_transaction<T: Into<BundleTransaction>>( self, tx: T, ) -> Self

Adds a revertible transaction to the bundle request.

This differs from BundleRequest::push_transaction in that the bundle will still be considered valid if the transaction reverts.

Source

pub fn add_revertible_transaction<T: Into<BundleTransaction>>(&mut self, tx: T)

Adds a revertible transaction to the bundle request.

This function takes a mutable reference to self and adds the specified revertible transaction to the transactions vector. The added transaction can either be a novel transaction that you have crafted, or it can be from one of the mempool APIs. Unlike the push_transaction method, the bundle will still be considered valid even if the added transaction reverts.

Source

pub fn transactions(&self) -> &Vec<BundleTransaction>

Get a reference to the transactions currently in the bundle request.

Source

pub fn target_block(&self) -> Option<U64>

Get the target block (if any).

Source

pub fn set_target_block(self, target_block: U64) -> Self

Set the target block of the bundle.

Source

pub fn simulation_block(&self) -> Option<U64>

Get the block that determines the state for bundle simulation (if any).

See eth_callBundle in the Flashbots documentation for more information on bundle simulations.

Source

pub fn set_simulation_block(self, block: U64) -> Self

Set the block that determines the state for bundle simulation.

Source

pub fn set_access_list_hashes(self, hashes: Option<Vec<TxHash>>) -> Self

Source

pub fn simulation_timestamp(&self) -> Option<u64>

Get the UNIX timestamp used for bundle simulation (if any).

See eth_callBundle in the Flashbots documentation for more information on bundle simulations.

Source

pub fn set_simulation_timestamp(self, timestamp: u64) -> Self

Set the UNIX timestamp used for bundle simulation.

Source

pub fn simulation_basefee(&self) -> Option<u64>

Get the base gas fee for bundle simulation (if any).

See eth_callBundle in the Flashbots documentation for more information on bundle simulations.

Source

pub fn set_simulation_basefee(self, basefee: u64) -> Self

Set the base gas fee for bundle simulation (if any). Optional: will default to a value chosen by the node if not specified.

Source

pub fn min_timestamp(&self) -> Option<u64>

Get the minimum timestamp for which this bundle is valid (if any), in seconds since the UNIX epoch.

Source

pub fn set_min_timestamp(self, timestamp: u64) -> Self

Set the minimum timestamp for which this bundle is valid (if any), in seconds since the UNIX epoch.

Source

pub fn max_timestamp(&self) -> Option<u64>

Get the maximum timestamp for which this bundle is valid (if any), in seconds since the UNIX epoch.

Source

pub fn set_max_timestamp(self, timestamp: u64) -> Self

Set the maximum timestamp for which this bundle is valid (if any), in seconds since the UNIX epoch.

Trait Implementations§

Source§

impl Clone for BundleRequest

Source§

fn clone(&self) -> BundleRequest

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BundleRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BundleRequest

Source§

fn default() -> BundleRequest

Returns the “default value” for a type. Read more
Source§

impl Serialize for BundleRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryClone for T
where T: Clone,

§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
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

§

impl<T> RpcParam for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 168 bytes