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

Commit

Permalink
chore(provider): make websockets optional (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst authored Jul 2, 2020
1 parent 1cbd86d commit da20a04
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 42 deletions.
52 changes: 15 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions ethers-providers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,35 @@ url = { version = "2.1.1", default-features = false }
# required for implementing stream on the filters
futures-core = { version = "0.3.5", default-features = false }
futures-util = { version = "0.3.5", default-features = false }
futures-timer = { version = "3.0.2", default-features = false }
pin-project = { version = "0.4.20", default-features = false }
async-tungstenite = { version = "0.6.0", default-features = false }

# ws support async-std and tokio runtimes for the convenience methods
async-tungstenite = { version = "0.6.0", default-features = false, optional = true }
async-std = { version = "1.6.2", default-features = false, optional = true }
tokio = { version = "0.2.21", default-features = false, optional = true }

# needed for tls
real-tokio-native-tls = { package = "tokio-native-tls", version = "0.1.0", optional = true }
async-tls = { version = "0.7.0", optional = true }
futures-timer = "3.0.2"

[dev-dependencies]
ethers = { version = "0.1.3", path = "../ethers" }

rustc-hex = "2.1.0"
tokio = { version = "0.2.21", default-features = false, features = ["rt-core", "macros"] }
async-std = { version = "1.6.2", default-features = false, features = ["attributes"] }
async-tungstenite = { version = "0.6.0", features = ["tokio-runtime"] }
async-tungstenite = { version = "0.6.0", default-features = false, features = ["tokio-runtime"] }

[features]
# slightly opinionated, but for convenience we default to tokio-tls
# to allow websockets w/ TLS support
default = ["tokio-tls"]
celo = ["ethers-core/celo"]
ws = ["async-tungstenite"]

tokio-runtime = [
"ws",
"tokio",
"async-tungstenite/tokio-runtime"
]
Expand All @@ -63,6 +65,7 @@ tokio-tls = [
]

async-std-runtime = [
"ws",
"async-std",
"async-tungstenite/async-std-runtime"
]
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
//! # }
//! ```
mod transports;
pub use transports::{Http, Ws};
pub use transports::*;

mod provider;

Expand Down
2 changes: 2 additions & 0 deletions ethers-providers/src/transports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ mod common;
mod http;
pub use http::Provider as Http;

#[cfg(feature = "ws")]
mod ws;
#[cfg(feature = "ws")]
pub use ws::Provider as Ws;
2 changes: 1 addition & 1 deletion ethers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ethers-signers = { version = "0.1.3", path = "../ethers-signers", optional = tru

[dev-dependencies]
ethers-contract = { version = "0.1.3", path = "../ethers-contract", features = ["abigen"] }
ethers-providers = { version = "0.1.3", path = "../ethers-providers", features = ["tokio-runtime"] }
ethers-providers = { version = "0.1.3", path = "../ethers-providers" }

anyhow = "1.0.31"
rand = "0.7"
Expand Down

0 comments on commit da20a04

Please sign in to comment.