alloy_provider/ext/mev/
mod.rs1mod with_auth;
2
3pub use self::with_auth::{sign_flashbots_payload, MevBuilder};
4use crate::Provider;
5use alloy_network::Network;
6use alloy_rpc_types_mev::{EthBundleHash, EthSendBundle};
7
8pub const FLASHBOTS_SIGNATURE_HEADER: &str = "x-flashbots-signature";
10
11#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))]
13#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)]
14pub trait MevApi<N>: Send + Sync {
15 fn send_bundle(
18 &self,
19 bundle: EthSendBundle,
20 ) -> MevBuilder<(EthSendBundle,), Option<EthBundleHash>>;
21}
22
23#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))]
24#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)]
25impl<N, P> MevApi<N> for P
26where
27 N: Network,
28 P: Provider<N>,
29{
30 fn send_bundle(
31 &self,
32 bundle: EthSendBundle,
33 ) -> MevBuilder<(EthSendBundle,), Option<EthBundleHash>> {
34 MevBuilder::new_rpc(self.client().request("eth_sendBundle", (bundle,)))
35 }
36}