forked from leruaa/alloy-mev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovider_ext.rs
More file actions
55 lines (50 loc) · 1.66 KB
/
Copy pathprovider_ext.rs
File metadata and controls
55 lines (50 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use alloy::{
network::Network,
providers::Provider,
rpc::types::mev::{
BundleItem, MevSendBundle, EthBundleHash, SimBundleOverrides, SimBundleResponse,
},
signers::Signer,
transports::{http::Http, Transport, TransportResult},
};
use async_trait::async_trait;
use crate::MevShareBundle;
/// Extension trait for sending and simulate MEV-Share bundles.
#[async_trait]
pub trait MevShareProviderExt<C, N>: Provider<N> + Sized
where
C: Clone,
N: Network,
Http<C>: Transport,
{
/// Builds a bundle item from a transaction request.
async fn build_bundle_item(
&self,
tx: N::TransactionRequest,
can_revert: bool,
) -> TransportResult<BundleItem>;
/// Returns a builder-style [`MevShareBundle`] that can be sent or simulated.
fn build_bundle<S>(&self, bundle_signer: S) -> MevShareBundle<'_, Self, C, N, S>
where
S: Signer + Send + Sync + 'static;
/// Submits a bundle to the MEV-Share matchmaker. It takes in a bundle and
/// provides a bundle hash as a return value.
async fn send_mev_bundle<S>(
&self,
bundle: MevSendBundle,
signer: S,
) -> TransportResult<EthBundleHash>
where
S: Signer + Clone + Send + Sync + 'static;
/// Similar to `send_bundle` but instead of submitting a bundle to the
/// matchmaker, it returns a simulation result. Only fully matched bundles
/// can be simulated.
async fn sim_mev_bundle<S>(
&self,
bundle: MevSendBundle,
sim_overrides: SimBundleOverrides,
signer: S,
) -> TransportResult<SimBundleResponse>
where
S: Signer + Clone + Send + Sync + 'static;
}