electrum_client/lib.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3#![warn(missing_docs)]
4
5//! This library provides an extendable Bitcoin-Electrum client that supports batch calls,
6//! notifications and multiple transport methods.
7//!
8//! By default this library is compiled with support for SSL servers using [`rustls`](https://docs.rs/rustls) and support for
9//! plaintext connections over a socks proxy, useful for Onion servers. Using different features,
10//! the SSL implementation can be removed or replaced with [`openssl`](https://docs.rs/openssl).
11//!
12//! For a minimal configuration the library can be built with `--no-default-features`, which only includes the plaintext TCP client.
13//!
14//! # Example
15//!
16//! ```no_run
17//! use electrum_client::{Client, ElectrumApi};
18//!
19//! let mut client = Client::new("tcp://electrum.blockstream.info:50001")?;
20//! let response = client.server_features()?;
21//! # Ok::<(), electrum_client::Error>(())
22//! ```
23
24pub extern crate bitcoin;
25extern crate core;
26extern crate log;
27#[cfg(feature = "openssl")]
28extern crate openssl;
29#[cfg(any(feature = "rustls", feature = "rustls-ring"))]
30extern crate rustls;
31extern crate serde;
32extern crate serde_json;
33
34#[cfg(any(feature = "rustls", feature = "rustls-ring"))]
35extern crate webpki_roots;
36
37#[cfg(feature = "proxy")]
38extern crate byteorder;
39
40#[cfg(all(unix, feature = "proxy"))]
41extern crate libc;
42#[cfg(all(windows, feature = "proxy"))]
43extern crate winapi;
44
45#[cfg(feature = "proxy")]
46pub mod socks;
47
48mod api;
49mod batch;
50
51pub mod client;
52
53mod config;
54
55pub mod raw_client;
56mod stream;
57mod types;
58pub mod utils;
59
60pub use api::ElectrumApi;
61pub use batch::Batch;
62pub use client::*;
63pub use config::{AuthProvider, Config, ConfigBuilder, Socks5Config};
64pub use types::*;