fix(examples): deprecated gas oracle
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::<LocalWallet>().unwrap();
let address = signer.address();
let escalator = GeometricGasPrice::new(1.125, 60_u64, None::<u64>);
- let gas_oracle = EthGasStation::new(None);
+ let gas_oracle = GasNow::new();
let provider = Provider::<Http>::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 {
