diff --git a/ethers-providers/src/provider.rs b/ethers-providers/src/provider.rs index 4709e89f..a8b4f22f 100644 --- a/ethers-providers/src/provider.rs +++ b/ethers-providers/src/provider.rs @@ -8,7 +8,7 @@ use crate::{ }; #[cfg(not(target_arch = "wasm32"))] -use crate::transports::{HttpRateLimitRetryPolicy, RetryClient}; +use crate::transports::{Authorization, HttpRateLimitRetryPolicy, RetryClient}; #[cfg(feature = "celo")] use crate::CeloMiddleware; @@ -1286,6 +1286,15 @@ impl Provider { Ok(Self::new(ws)) } + #[cfg(not(target_arch = "wasm32"))] + pub async fn connect_with_auth( + url: impl tokio_tungstenite::tungstenite::client::IntoClientRequest + Unpin, + auth: Authorization, + ) -> Result { + let ws = crate::Ws::connect_with_auth(url, auth).await?; + Ok(Self::new(ws)) + } + /// Direct connection to a websocket endpoint #[cfg(target_arch = "wasm32")] pub async fn connect(url: &str) -> Result {