Enum bdk::blockchain::any::AnyBlockchainConfig
source · pub enum AnyBlockchainConfig {
Electrum(ElectrumBlockchainConfig),
Esplora(EsploraBlockchainConfig),
CompactFilters(CompactFiltersBlockchainConfig),
Rpc(RpcConfig),
}
Expand description
Type that can contain any of the blockchain configurations defined by the library
This allows storing a single configuration that can be loaded into an AnyBlockchain
instance. Wallets that plan to offer users the ability to switch blockchain backend at runtime
will find this particularly useful.
This type can be serialized from a JSON object like:
use bdk::blockchain::{electrum::ElectrumBlockchainConfig, AnyBlockchainConfig};
let config: AnyBlockchainConfig = serde_json::from_str(
r#"{
"type" : "electrum",
"url" : "ssl://electrum.blockstream.info:50002",
"retry": 2,
"stop_gap": 20,
"validate_domain": true
}"#,
)
.unwrap();
assert_eq!(
config,
AnyBlockchainConfig::Electrum(ElectrumBlockchainConfig {
url: "ssl://electrum.blockstream.info:50002".into(),
retry: 2,
socks5: None,
timeout: None,
stop_gap: 20,
validate_domain: true,
})
);
Variants§
Electrum(ElectrumBlockchainConfig)
Available on crate feature
electrum
only.Electrum client
Esplora(EsploraBlockchainConfig)
Available on crate feature
esplora
only.Esplora client
CompactFilters(CompactFiltersBlockchainConfig)
Available on crate feature
compact_filters
only.Compact filters client
Rpc(RpcConfig)
Available on crate feature
rpc
only.RPC client configuration
Trait Implementations§
source§impl Clone for AnyBlockchainConfig
impl Clone for AnyBlockchainConfig
source§fn clone(&self) -> AnyBlockchainConfig
fn clone(&self) -> AnyBlockchainConfig
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AnyBlockchainConfig
impl Debug for AnyBlockchainConfig
source§impl<'de> Deserialize<'de> for AnyBlockchainConfig
impl<'de> Deserialize<'de> for AnyBlockchainConfig
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<CompactFiltersBlockchainConfig> for AnyBlockchainConfig
impl From<CompactFiltersBlockchainConfig> for AnyBlockchainConfig
source§fn from(inner: CompactFiltersBlockchainConfig) -> Self
fn from(inner: CompactFiltersBlockchainConfig) -> Self
Converts to this type from the input type.
source§impl From<ElectrumBlockchainConfig> for AnyBlockchainConfig
impl From<ElectrumBlockchainConfig> for AnyBlockchainConfig
source§fn from(inner: ElectrumBlockchainConfig) -> Self
fn from(inner: ElectrumBlockchainConfig) -> Self
Converts to this type from the input type.
source§impl From<EsploraBlockchainConfig> for AnyBlockchainConfig
impl From<EsploraBlockchainConfig> for AnyBlockchainConfig
source§fn from(inner: EsploraBlockchainConfig) -> Self
fn from(inner: EsploraBlockchainConfig) -> Self
Converts to this type from the input type.
source§impl From<RpcConfig> for AnyBlockchainConfig
impl From<RpcConfig> for AnyBlockchainConfig
source§impl PartialEq for AnyBlockchainConfig
impl PartialEq for AnyBlockchainConfig
source§fn eq(&self, other: &AnyBlockchainConfig) -> bool
fn eq(&self, other: &AnyBlockchainConfig) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for AnyBlockchainConfig
impl Serialize for AnyBlockchainConfig
impl Eq for AnyBlockchainConfig
impl StructuralEq for AnyBlockchainConfig
impl StructuralPartialEq for AnyBlockchainConfig
Auto Trait Implementations§
impl RefUnwindSafe for AnyBlockchainConfig
impl Send for AnyBlockchainConfig
impl Sync for AnyBlockchainConfig
impl Unpin for AnyBlockchainConfig
impl UnwindSafe for AnyBlockchainConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more