4141//! specific features, set `default-features` to `false` in your `Cargo.toml`
4242//! and specify the features you want. This will look like this:
4343//!
44- //! `esplora-client = { version = "*", default-features = false, features = ["blocking"] }`
44+ //! `esplora-client = { version = "*", default-features = false, features =
45+ //! ["blocking"] }`
4546//!
4647//! * `blocking` enables [`minreq`], the blocking client with proxy.
47- //! * `blocking-https` enables [`minreq`], the blocking client with proxy and TLS (SSL)
48- //! capabilities using the default [`minreq`] backend.
49- //! * `blocking-https-rustls` enables [`minreq`], the blocking client with proxy and TLS (SSL)
50- //! capabilities using the `rustls` backend.
51- //! * `blocking-https-native` enables [`minreq`], the blocking client with proxy and TLS (SSL)
52- //! capabilities using the platform's native TLS backend (likely OpenSSL).
53- //! * `blocking-https-bundled` enables [`minreq`], the blocking client with proxy and TLS (SSL)
54- //! capabilities using a bundled OpenSSL library backend.
55- //! * `async` enables [`reqwest`], the async client with proxy capabilities.
56- //! * `async-https` enables [`reqwest`], the async client with support for proxying and TLS (SSL)
57- //! using the default [`reqwest`] TLS backend.
58- //! * `async-https-native` enables [`reqwest`], the async client with support for proxying and TLS
59- //! (SSL) using the platform's native TLS backend (likely OpenSSL).
60- //! * `async-https-rustls` enables [`reqwest`], the async client with support for proxying and TLS
61- //! (SSL) using the `rustls` TLS backend.
62- //! * `async-https-rustls-manual-roots` enables [`reqwest`], the async client with support for
63- //! proxying and TLS (SSL) using the `rustls` TLS backend without using its the default root
64- //! certificates.
48+ //! * `blocking-https` enables [`minreq`], the blocking client with proxy and
49+ //! TLS (SSL) capabilities using the default [`minreq`] backend.
50+ //! * `blocking-https-rustls` enables [`minreq`], the blocking client with proxy
51+ //! and TLS (SSL) capabilities using the `rustls` backend.
52+ //! * `blocking-https-native` enables [`minreq`], the blocking client with proxy
53+ //! and TLS (SSL) capabilities using the platform's native TLS backend (likely
54+ //! OpenSSL).
55+ //! * `blocking-https-bundled` enables [`minreq`], the blocking client with
56+ //! proxy and TLS (SSL) capabilities using a bundled OpenSSL library backend.
6557//!
58+ //! * `async` enables [`reqwest`], the async client with proxy capabilities.
59+ //! * `async-https` enables [`reqwest`], the async client with support for
60+ //! proxying and TLS (SSL) using the default [`reqwest`] TLS backend.
61+ //! * `async-https-native` enables [`reqwest`], the async client with support
62+ //! for proxying and TLS (SSL) using the platform's native TLS backend (likely
63+ //! OpenSSL).
64+ //! * `async-https-rustls` enables [`reqwest`], the async client with support
65+ //! for proxying and TLS (SSL) using the `rustls` TLS backend.
66+ //! * `async-https-rustls-manual-roots` enables [`reqwest`], the async client
67+ //! with support for proxying and TLS (SSL) using the `rustls` TLS backend
68+ //! without using its the default root certificates.
6669//!
6770
6871#![ allow( clippy:: result_large_err) ]
@@ -71,8 +74,6 @@ use std::collections::HashMap;
7174use std:: fmt;
7275use std:: num:: TryFromIntError ;
7376
74- use bitcoin:: consensus;
75-
7677pub mod api;
7778
7879#[ cfg( feature = "async" ) ]
@@ -103,21 +104,24 @@ pub fn convert_fee_rate(target: usize, estimates: HashMap<u16, f64>) -> Result<f
103104
104105#[ derive( Debug , Clone ) ]
105106pub struct Builder {
107+ /// The URL of the Esplora server.
106108 pub base_url : String ,
107109 /// Optional URL of the proxy to use to make requests to the Esplora server
108110 ///
109- /// The string should be formatted as: `<protocol>://<user>:<password>@host:<port>`.
111+ /// The string should be formatted as:
112+ /// `<protocol>://<user>:<password>@host:<port>`.
110113 ///
111- /// Note that the format of this value and the supported protocols change slightly between the
112- /// blocking version of the client (using `minreq`) and the async version (using `reqwest`). For more
113- /// details check with the documentation of the two crates. Both of them are compiled with
114+ /// Note that the format of this value and the supported protocols change
115+ /// slightly between the blocking version of the client (using `minreq`)
116+ /// and the async version (using `reqwest`). For more details check with
117+ /// the documentation of the two crates. Both of them are compiled with
114118 /// the `socks` feature enabled.
115119 ///
116120 /// The proxy is ignored when targeting `wasm32`.
117121 pub proxy : Option < String > ,
118122 /// Socket timeout.
119123 pub timeout : Option < u64 > ,
120- /// HTTP headers to set on every request made to Esplora server
124+ /// HTTP headers to set on every request made to Esplora server.
121125 pub headers : HashMap < String , String > ,
122126}
123127
@@ -150,20 +154,20 @@ impl Builder {
150154 self
151155 }
152156
153- /// build a blocking client from builder
157+ /// Build a blocking client from builder
154158 #[ cfg( feature = "blocking" ) ]
155159 pub fn build_blocking ( self ) -> BlockingClient {
156160 BlockingClient :: from_builder ( self )
157161 }
158162
159- // build an asynchronous client from builder
163+ // Build an asynchronous client from builder
160164 #[ cfg( feature = "async" ) ]
161165 pub fn build_async ( self ) -> Result < AsyncClient , Error > {
162166 AsyncClient :: from_builder ( self )
163167 }
164168}
165169
166- /// Errors that can happen during a sync with `Esplora`
170+ /// Errors that can happen during a request to `Esplora` servers.
167171#[ derive( Debug ) ]
168172pub enum Error {
169173 /// Error during `minreq` HTTP request
@@ -186,9 +190,9 @@ pub enum Error {
186190 HexToBytes ( bitcoin:: hex:: HexToBytesError ) ,
187191 /// Transaction not found
188192 TransactionNotFound ( Txid ) ,
189- /// Header height not found
193+ /// Block Header height not found
190194 HeaderHeightNotFound ( u32 ) ,
191- /// Header hash not found
195+ /// Block Header hash not found
192196 HeaderHashNotFound ( BlockHash ) ,
193197 /// Invalid HTTP Header name specified
194198 InvalidHttpHeaderName ( String ) ,
@@ -221,7 +225,7 @@ impl_error!(::minreq::Error, Minreq, Error);
221225#[ cfg( feature = "async" ) ]
222226impl_error ! ( :: reqwest:: Error , Reqwest , Error ) ;
223227impl_error ! ( std:: num:: ParseIntError , Parsing , Error ) ;
224- impl_error ! ( consensus:: encode:: Error , BitcoinEncoding , Error ) ;
228+ impl_error ! ( bitcoin :: consensus:: encode:: Error , BitcoinEncoding , Error ) ;
225229impl_error ! ( bitcoin:: hex:: HexToArrayError , HexToArray , Error ) ;
226230impl_error ! ( bitcoin:: hex:: HexToBytesError , HexToBytes , Error ) ;
227231
@@ -592,8 +596,8 @@ mod test {
592596 #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
593597 #[ tokio:: test]
594598 async fn test_get_non_existing_block_status ( ) {
595- // Esplora returns the same status for orphaned blocks as for non-existing blocks:
596- // non-existing: https://blockstream.info/api/block/0000000000000000000000000000000000000000000000000000000000000000/status
599+ // Esplora returns the same status for orphaned blocks as for non-existing
600+ // blocks: non-existing: https://blockstream.info/api/block/0000000000000000000000000000000000000000000000000000000000000000/status
597601 // orphaned: https://blockstream.info/api/block/000000000000000000181b1a2354620f66868a723c0c4d5b24e4be8bdfc35a7f/status
598602 // (Here the block is cited as orphaned: https://bitcoinchain.com/block_explorer/block/000000000000000000181b1a2354620f66868a723c0c4d5b24e4be8bdfc35a7f/ )
599603 // For this reason, we only test for the non-existing case here.
0 commit comments