diff --git a/crates/electrum/src/bdk_electrum_client.rs b/crates/electrum/src/bdk_electrum_client.rs index 05b501871..8988ae629 100644 --- a/crates/electrum/src/bdk_electrum_client.rs +++ b/crates/electrum/src/bdk_electrum_client.rs @@ -603,6 +603,20 @@ impl BdkElectrumClient { } } +/// Creates a new BDK Electrum client from a URL with custom configuration. +/// can be used as a convenience method for creating an Electrum client with custom settings +/// such as JWT authorization providers, timeouts, or proxy settings. +impl BdkElectrumClient { + /// [`electrum_client::ConfigBuilder`]: crate::electrum_client::ConfigBuilder + pub fn from_config( + url: &str, + config: electrum_client::Config, + ) -> Result { + let client = electrum_client::Client::from_config(url, config)?; + Ok(Self::new(client)) + } +} + /// Return a [`CheckPoint`] of the latest tip, that connects with `prev_tip`. The latest blocks are /// fetched to construct checkpoint updates with the proper [`BlockHash`] in case of re-org. fn fetch_tip_and_latest_blocks( diff --git a/crates/electrum/src/lib.rs b/crates/electrum/src/lib.rs index 9c1d9f452..61401c95d 100644 --- a/crates/electrum/src/lib.rs +++ b/crates/electrum/src/lib.rs @@ -16,6 +16,7 @@ //! [`example_electrum`]: https://github.com/bitcoindevkit/bdk/tree/master/examples/example_electrum //! [`SyncResponse`]: bdk_core::spk_client::SyncResponse //! [`FullScanResponse`]: bdk_core::spk_client::FullScanResponse +//! [`AuthProvider`]: electrum_client::config::AuthProvider #![cfg_attr(coverage_nightly, feature(coverage_attribute))] #![warn(missing_docs)] @@ -24,3 +25,5 @@ pub use bdk_electrum_client::*; pub use bdk_core; pub use electrum_client; + +pub use electrum_client::{Config, ConfigBuilder};