From 37e143ba323096e5c4e1c6d9f648349a1b567699 Mon Sep 17 00:00:00 2001 From: Matthew <84196639+mteam88@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:54:09 -0400 Subject: [PATCH 1/2] feat: add customizable mev-share relay --- .../src/executors/mev_share_executor.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/artemis-core/src/executors/mev_share_executor.rs b/crates/artemis-core/src/executors/mev_share_executor.rs index c7a5448..de0b0ee 100644 --- a/crates/artemis-core/src/executors/mev_share_executor.rs +++ b/crates/artemis-core/src/executors/mev_share_executor.rs @@ -30,6 +30,20 @@ impl MevshareExecutor { mev_share_client: Box::new(http), } } + pub fn new_with_relay(signer: impl Signer + Clone + 'static, relay: &str) -> Self { + // Set up flashbots-style auth middleware + let http = HttpClientBuilder::default() + .set_middleware( + tower::ServiceBuilder::new() + .map_err(transport::Error::Http) + .layer(FlashbotsSignerLayer::new(signer)), + ) + .build(relay) + .expect("failed to build HTTP client"); + Self { + mev_share_client: Box::new(http), + } + } } #[async_trait] From 7a7c999079d1314b77f7046c0bcafb0778a50674 Mon Sep 17 00:00:00 2001 From: Matthew <84196639+mteam88@users.noreply.github.com> Date: Wed, 13 Sep 2023 21:18:23 -0400 Subject: [PATCH 2/2] add some docs --- crates/artemis-core/src/executors/mev_share_executor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/artemis-core/src/executors/mev_share_executor.rs b/crates/artemis-core/src/executors/mev_share_executor.rs index de0b0ee..ea2cd9b 100644 --- a/crates/artemis-core/src/executors/mev_share_executor.rs +++ b/crates/artemis-core/src/executors/mev_share_executor.rs @@ -16,6 +16,7 @@ pub struct MevshareExecutor { } impl MevshareExecutor { + /// Create a new executor with the Flashbots mev-share relay pub fn new(signer: impl Signer + Clone + 'static) -> Self { // Set up flashbots-style auth middleware let http = HttpClientBuilder::default() @@ -30,6 +31,7 @@ impl MevshareExecutor { mev_share_client: Box::new(http), } } + /// Create a new executor and specify a relay url pub fn new_with_relay(signer: impl Signer + Clone + 'static, relay: &str) -> Self { // Set up flashbots-style auth middleware let http = HttpClientBuilder::default()