From 4274a27531b73d142470114f4fe14612e4225477 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 30 Dec 2022 13:43:49 +0100 Subject: [PATCH] fix(examples): deprecated gas oracle (#1986) --- examples/middleware/examples/builder.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/middleware/examples/builder.rs b/examples/middleware/examples/builder.rs index f8c54ad4..c9fb058a 100644 --- a/examples/middleware/examples/builder.rs +++ b/examples/middleware/examples/builder.rs @@ -1,6 +1,10 @@ use ethers::{ core::types::BlockNumber, - middleware::{gas_escalator::*, gas_oracle::*, *}, + middleware::{ + gas_escalator::{Frequency, GasEscalatorMiddleware, GeometricGasPrice}, + gas_oracle::{GasNow, GasOracleMiddleware}, + MiddlewareBuilder, NonceManagerMiddleware, SignerMiddleware, + }, providers::{Http, Middleware, Provider}, signers::{LocalWallet, Signer}, }; @@ -24,7 +28,7 @@ async fn builder_example() { let signer = SIGNING_KEY.parse::().unwrap(); let address = signer.address(); let escalator = GeometricGasPrice::new(1.125, 60_u64, None::); - let gas_oracle = EthGasStation::new(None); + let gas_oracle = GasNow::new(); let provider = Provider::::try_from(RPC_URL) .unwrap() @@ -48,7 +52,7 @@ async fn builder_example_raw_wrap() { .unwrap() .wrap_into(|p| GasEscalatorMiddleware::new(p, escalator, Frequency::PerBlock)) .wrap_into(|p| SignerMiddleware::new(p, signer)) - .wrap_into(|p| GasOracleMiddleware::new(p, EthGasStation::new(None))) + .wrap_into(|p| GasOracleMiddleware::new(p, GasNow::new())) .wrap_into(|p| NonceManagerMiddleware::new(p, address)); // Outermost layer match provider.get_block(BlockNumber::Latest).await {