[−][src]Trait ethers_middleware::gas_oracle::GasOracle
GasOracle is a trait that an underlying gas oracle needs to implement.
Example
use ethers::middleware::{ gas_oracle::{EthGasStation, Etherscan, GasCategory, GasOracle}, }; let eth_gas_station_oracle = EthGasStation::new(Some("my-api-key")); let etherscan_oracle = EthGasStation::new(None).category(GasCategory::SafeLow); let data_1 = eth_gas_station_oracle.fetch().await?; let data_2 = etherscan_oracle.fetch().await?;
Required methods
#[must_use]pub fn fetch<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Makes an asynchronous HTTP query to the underlying GasOracle
Example
use ethers::middleware::{ gas_oracle::{Etherchain, GasCategory, GasOracle}, }; let etherchain_oracle = Etherchain::new().category(GasCategory::Fastest); let data = etherchain_oracle.fetch().await?;
Implementors
impl GasOracle for EthGasStation[src]
pub fn fetch<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl GasOracle for Etherchain[src]
pub fn fetch<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl GasOracle for Etherscan[src]
pub fn fetch<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<U256, GasOracleError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,