Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
feats
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Nov 8, 2023
1 parent 9b4501b commit 77bc08d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
15 changes: 8 additions & 7 deletions ethers-middleware/tests/it/gas_oracle.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use async_trait::async_trait;
use ethers_core::{
types::*,
utils::{parse_ether, Anvil},
};
use ethers_etherscan::Client;
use ethers_core::{types::*, utils::Anvil};
use ethers_middleware::gas_oracle::{
BlockNative, Etherchain, Etherscan, GasCategory, GasNow, GasOracle, GasOracleError,
GasOracleMiddleware, Polygon, ProviderOracle, Result,
BlockNative, Etherchain, GasNow, GasOracle, GasOracleError, GasOracleMiddleware, Polygon,
ProviderOracle, Result,
};
use ethers_providers::{Http, Middleware, Provider};

Expand Down Expand Up @@ -89,8 +85,13 @@ async fn etherchain() {
assert!(gas_price > U256::zero());
}

#[cfg(feature = "etherscan")]
#[tokio::test]
async fn etherscan() {
use ethers_core::utils::parse_ether;
use ethers_etherscan::Client;
use ethers_middleware::gas_oracle::{Etherscan, GasCategory};

let chain = Chain::Mainnet;
let etherscan_client = Client::new_from_opt_env(chain).unwrap();

Expand Down
14 changes: 9 additions & 5 deletions ethers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rustdoc-args = ["--cfg", "docsrs"]
all-features = true

[features]
default = ["abigen", "rustls"]
default = ["abigen", "rustls", "etherscan"]

# workspace-wide features
legacy = ["ethers-core/legacy", "ethers-contract/legacy"]
Expand All @@ -46,14 +46,14 @@ optimism = [

rustls = [
"ethers-contract/rustls",
"ethers-etherscan/rustls",
"ethers-etherscan?/rustls",
"ethers-middleware/rustls",
"ethers-providers/rustls",
"ethers-solc?/rustls",
]
openssl = [
"ethers-contract/openssl",
"ethers-etherscan/openssl",
"ethers-etherscan?/openssl",
"ethers-middleware/openssl",
"ethers-providers/openssl",
"ethers-solc?/openssl",
Expand All @@ -75,23 +75,27 @@ yubi = ["ethers-signers/yubi"]
abigen = ["ethers-contract/abigen"]
abigen-online = ["ethers-contract/abigen-online"]

# ethers-etherscan
etherscan = ["dep:ethers-etherscan", "ethers-middleware/etherscan"]

# ethers-solc
ethers-solc = ["dep:ethers-solc", "ethers-etherscan/ethers-solc"]
solc = ["dep:ethers-solc", "ethers-etherscan/ethers-solc"]
solc-full = ["ethers-solc?/full"]
solc-tests = ["ethers-solc?/tests"]

# Deprecated
abigen-offline = ["abigen"]
eip712 = []
ethers-solc = ["solc"]
solc-sha2-asm = []

[dependencies]
ethers-addressbook.workspace = true
ethers-contract = { workspace = true, features = ["providers"] }
ethers-core.workspace = true
ethers-etherscan.workspace = true
ethers-middleware.workspace = true
ethers-providers.workspace = true
ethers-signers.workspace = true

ethers-etherscan = { workspace = true, optional = true }
ethers-solc = { workspace = true, optional = true }
16 changes: 10 additions & 6 deletions ethers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,17 @@ pub use ethers_contract as contract;
#[doc(inline)]
pub use ethers_core as core;
#[doc(inline)]
pub use ethers_etherscan as etherscan;
#[doc(inline)]
pub use ethers_middleware as middleware;
#[doc(inline)]
pub use ethers_providers as providers;
#[doc(inline)]
pub use ethers_signers as signers;
#[cfg(feature = "ethers-solc")]

#[cfg(feature = "etherscan")]
#[doc(inline)]
pub use ethers_etherscan as etherscan;

#[cfg(feature = "solc")]
#[doc(inline)]
pub use ethers_solc as solc;

Expand All @@ -120,15 +123,16 @@ pub mod prelude {

pub use super::core::{types::*, *};

pub use super::etherscan::*;

pub use super::middleware::*;

pub use super::providers::*;

pub use super::signers::*;

#[cfg(feature = "ethers-solc")]
#[cfg(feature = "etherscan")]
pub use super::etherscan::*;

#[cfg(feature = "solc")]
pub use super::solc::*;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rust-version.workspace = true
edition.workspace = true

[dev-dependencies]
ethers = { workspace = true, features = ["rustls"] }
ethers = { workspace = true, features = ["rustls", "etherscan"] }
serde.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
Expand Down

0 comments on commit 77bc08d

Please sign in to comment.