Struct ethers_flashbots::BundleRequest
source · pub struct BundleRequest { /* private fields */ }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:
- At least one transaction (
BundleRequest::push_transaction) - A target block (
BundleRequest::set_block)
Implementations§
source§impl BundleRequest
impl BundleRequest
sourcepub fn push_transaction<T: Into<BundleTransaction>>(self, tx: T) -> Self
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.
sourcepub fn push_revertible_transaction<T: Into<BundleTransaction>>(
self,
tx: T
) -> Self
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.
sourcepub fn transactions(&self) -> &Vec<BundleTransaction> ⓘ
pub fn transactions(&self) -> &Vec<BundleTransaction> ⓘ
Get a reference to the transactions currently in the bundle request.
sourcepub fn transaction_hashes(&self) -> Vec<TxHash> ⓘ
pub fn transaction_hashes(&self) -> Vec<TxHash> ⓘ
Get a list of transaction hashes in the bundle request.
sourcepub fn simulation_block(&self) -> Option<U64>
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.
sourcepub fn set_simulation_block(self, block: U64) -> Self
pub fn set_simulation_block(self, block: U64) -> Self
Set the block that determines the state for bundle simulation.
sourcepub fn simulation_timestamp(&self) -> Option<u64>
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.
sourcepub fn set_simulation_timestamp(self, timestamp: u64) -> Self
pub fn set_simulation_timestamp(self, timestamp: u64) -> Self
Set the UNIX timestamp used for bundle simulation.
sourcepub fn simulation_basefee(&self) -> Option<u64>
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.
sourcepub fn set_simulation_basefee(self, basefee: u64) -> Self
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.
sourcepub fn min_timestamp(&self) -> Option<u64>
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.
sourcepub fn set_min_timestamp(self, timestamp: u64) -> Self
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.
sourcepub fn max_timestamp(&self) -> Option<u64>
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.
sourcepub fn set_max_timestamp(self, timestamp: u64) -> Self
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
impl Clone for BundleRequest
source§fn clone(&self) -> BundleRequest
fn clone(&self) -> BundleRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more