Enum bdk::blockchain::any::AnyBlockchainConfig [−][src]
pub enum AnyBlockchainConfig {
Electrum(ElectrumBlockchainConfig),
Esplora(EsploraBlockchainConfig),
CompactFilters(CompactFiltersBlockchainConfig),
Rpc(RpcConfig),
}
This is supported on crate features
electrum
or esplora
or compact_filters
or rpc
only.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
}"#,
)
.unwrap();
assert_eq!(
config,
AnyBlockchainConfig::Electrum(ElectrumBlockchainConfig {
url: "ssl://electrum.blockstream.info:50002".into(),
retry: 2,
socks5: None,
timeout: None,
stop_gap: 20,
})
);
Variants
Electrum(ElectrumBlockchainConfig)
This is supported on crate feature
electrum
only.Electrum client
Tuple Fields of Electrum
Esplora(EsploraBlockchainConfig)
This is supported on crate feature
esplora
only.Esplora client
Tuple Fields of Esplora
CompactFilters(CompactFiltersBlockchainConfig)
This is supported on crate feature
compact_filters
only.Compact filters client
Tuple Fields of CompactFilters
Rpc(RpcConfig)
This is supported on crate feature
rpc
only.RPC client configuration
Tuple Fields of Rpc
0: RpcConfig
Trait Implementations
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
impl From<CompactFiltersBlockchainConfig> for AnyBlockchainConfig
This is supported on crate feature compact_filters
only.
impl From<CompactFiltersBlockchainConfig> for AnyBlockchainConfig
This is supported on crate feature
compact_filters
only.Performs the conversion.
impl From<ElectrumBlockchainConfig> for AnyBlockchainConfig
This is supported on crate feature electrum
only.
impl From<ElectrumBlockchainConfig> for AnyBlockchainConfig
This is supported on crate feature
electrum
only.Performs the conversion.
impl From<EsploraBlockchainConfig> for AnyBlockchainConfig
This is supported on crate feature esplora
only.
impl From<EsploraBlockchainConfig> for AnyBlockchainConfig
This is supported on crate feature
esplora
only.Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
Mutably borrows from an owned value. Read more