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

fix(rpc): Move reqwest client into EthApiInner #160

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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