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

chore: make ethers-ethercan optional in ethers-middleware #2672

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ethers-core/src/types/serde_helpers.rs
Original file line number Diff line number Diff line change
@@ -76,8 +76,7 @@ impl TryFrom<StringifiedNumeric> for U64 {
let value = U256::try_from(value)?;
let mut be_bytes = [0u8; 32];
value.to_big_endian(&mut be_bytes);
U64::try_from(&be_bytes[value.leading_zeros() as usize / 8..])
.map_err(|err| err.to_string())
Ok(U64::from(&be_bytes[value.leading_zeros() as usize / 8..]))
}
}

6 changes: 4 additions & 2 deletions ethers-middleware/Cargo.toml
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@ all-features = true
[dependencies]
ethers-contract = { workspace = true, features = ["abigen", "providers"] }
ethers-core.workspace = true
ethers-etherscan.workspace = true
ethers-providers.workspace = true
ethers-signers.workspace = true

@@ -46,6 +45,8 @@ url.workspace = true

serde_json.workspace = true

ethers-etherscan = { workspace = true, optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio.workspace = true

@@ -62,8 +63,9 @@ reqwest = { workspace = true, features = ["json", "rustls"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "time"] }

[features]
default = ["rustls"]
default = ["rustls", "etherscan"]
celo = ["ethers-core/celo", "ethers-providers/celo", "ethers-signers/celo", "ethers-contract/celo"]
etherscan = ["dep:ethers-etherscan"]
optimism = ["ethers-core/optimism", "ethers-providers/optimism", "ethers-contract/optimism"]
rustls = ["reqwest/rustls-tls"]
openssl = ["reqwest/native-tls"]
3 changes: 3 additions & 0 deletions ethers-middleware/src/gas_oracle/mod.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,9 @@ pub use eth_gas_station::EthGasStation;
pub mod etherchain;
pub use etherchain::Etherchain;

#[cfg(feature = "etherscan")]
pub mod etherscan;
#[cfg(feature = "etherscan")]
pub use etherscan::Etherscan;

pub mod middleware;
@@ -70,6 +72,7 @@ pub enum GasOracleError {
/// An internal error in the Etherscan client request made from the underlying
/// gas oracle
#[error(transparent)]
#[cfg(feature = "etherscan")]
EtherscanError(#[from] ethers_etherscan::errors::EtherscanError),

/// An internal error thrown when the required gas category is not
2 changes: 1 addition & 1 deletion ethers/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! # ethers-rs
//!
//! A complete Ethereum and Celo Rust library.
//!
//!
//! <div class="warning">
//! This crate is in the process of being deprecated.
//! See <a href="https://github.com/gakonst/ethers-rs/issues/2667">#2667</a> for more information.