Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
move the reqwest client into the eth api inner
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Nov 5, 2023
1 parent af6d37b commit 05ca268
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions crates/rpc/rpc/src/eth/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ where
task_spawner,
pending_block: Default::default(),
blocking_task_pool,
#[cfg(feature = "optimism")]
http_client: reqwest::Client::new(),
};
Self { inner: Arc::new(inner) }
}
Expand Down Expand Up @@ -446,4 +448,7 @@ struct EthApiInner<Provider, Pool, Network> {
pending_block: Mutex<Option<PendingBlock>>,
/// A pool dedicated to blocking tasks.
blocking_task_pool: BlockingTaskPool,
/// An http client for communicating with sequencers.
#[cfg(feature = "optimism")]
http_client: reqwest::Client,
}
5 changes: 2 additions & 3 deletions crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,9 +982,8 @@ where
EthApiError::InternalEthError
})?;

let client = reqwest::Client::new();

client
self.inner
.http_client
.post(endpoint)
.header(http::header::CONTENT_TYPE, "application/json")
.body(body)
Expand Down

0 comments on commit 05ca268

Please sign in to comment.