Skip to content

Commit d26b973

Browse files
Merge pull request #44 from etherspot/fix-provider
fix: relayer_getFeeData, replace on_hyper_http client to on_http client
2 parents 625c0b3 + d76e0dd commit d26b973

7 files changed

Lines changed: 12 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
alloy = { version = "0.6", default-features = false, features = ["json-abi", "network", "provider-http", "rpc-types-eth", "signer-local", "serde", "hyper"] }
7+
alloy = { version = "0.6", default-features = false, features = ["json-abi", "network", "provider-http", "rpc-types-eth", "signer-local", "serde", "hyper", "reqwest-rustls-tls"] }
88
alloy-eip7702 = { version = "0.4", features = ["k256", "serde"] }
99
alloy-rlp = "0.3"
1010
anyhow = "1.0"

src/methods/fee_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ pub async fn build_fee_data_response(
150150
.ok_or_else(unsupported_chain_error)?;
151151

152152
async fn eth_call_bytes(rpc_url: &str, to_address: &str, calldata: &[u8]) -> Option<Vec<u8>> {
153-
let provider = ProviderBuilder::new().on_hyper_http(Url::parse(rpc_url).ok()?);
154-
let to: Address = to_address.parse().ok()?;
153+
let provider = ProviderBuilder::new().on_http(Url::parse(rpc_url).unwrap());
154+
let to: Address = to_address.parse().unwrap();
155155
let tx = TransactionRequest::default()
156156
.to(to)
157157
.input(Bytes::from(calldata.to_vec()).into());

src/methods/send_tx/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub async fn process_single_transaction(
149149

150150
if let Some(rpc_url) = cfg.rpc_url_for_chain(&chain_id.to_string()) {
151151
if let Ok(endpoint) = Url::parse(&rpc_url) {
152-
let provider = ProviderBuilder::new().on_hyper_http(endpoint);
152+
let provider = ProviderBuilder::new().on_http(endpoint);
153153
if let Ok(balance) = provider.get_balance(wallet_address).await {
154154
if balance < required {
155155
return Err(insufficient_balance_error());

src/provider/fetch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub async fn fetch_receipt_for_status(
1717
}
1818

1919
let rpc_url = cfg.rpc_url_for_chain(&chain_id.to_string())?;
20-
let provider = ProviderBuilder::new().on_hyper_http(Url::parse(&rpc_url).ok()?);
20+
let provider = ProviderBuilder::new().on_http(Url::parse(&rpc_url).ok()?);
2121

2222
let hash_hex = tx_hash.strip_prefix("0x").unwrap_or(tx_hash);
2323
let hash_bytes = hex::decode(hash_hex).ok()?;
@@ -70,7 +70,7 @@ pub async fn fetch_gas_fees(chain_id: u64, cfg: &Config) -> Result<GasFees, Stri
7070
.ok_or_else(|| format!("No RPC URL configured for chain {}", chain_id))?;
7171

7272
let rpc_endpoint = Url::parse(&rpc_url).map_err(|e| format!("Invalid RPC URL: {}", e))?;
73-
let provider = ProviderBuilder::new().on_hyper_http(rpc_endpoint);
73+
let provider = ProviderBuilder::new().on_http(rpc_endpoint);
7474

7575
let gas_price = match provider.get_gas_price().await {
7676
Ok(p) => format!("0x{:x}", p),
@@ -115,7 +115,7 @@ pub async fn fetch_and_store_receipt(
115115
}
116116

117117
let rpc_url = cfg.rpc_url_for_chain(&req.chain_id.to_string())?;
118-
let provider = ProviderBuilder::new().on_hyper_http(Url::parse(&rpc_url).ok()?);
118+
let provider = ProviderBuilder::new().on_http(Url::parse(&rpc_url).ok()?);
119119

120120
let hash_hex = tx_hash.strip_prefix("0x").unwrap_or(tx_hash);
121121
let hash_bytes = hex::decode(hash_hex).ok()?;

src/provider/simulate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub async fn simulate_transaction(
6060
}
6161

6262
let rpc_endpoint = Url::parse(&rpc_url).map_err(|e| format!("Invalid RPC URL: {}", e))?;
63-
let provider = ProviderBuilder::new().on_hyper_http(rpc_endpoint);
63+
let provider = ProviderBuilder::new().on_http(rpc_endpoint);
6464

6565
let tx = TransactionRequest::default()
6666
.to(wallet_addr)

src/provider/tx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub async fn send_relay_transaction(
4747
let provider = ProviderBuilder::new()
4848
.with_recommended_fillers()
4949
.wallet(wallet)
50-
.on_hyper_http(rpc_endpoint);
50+
.on_http(rpc_endpoint);
5151

5252
let to_address: Address = wallet_address
5353
.parse()

0 commit comments

Comments
 (0)