1414//! You can create a blocking client as follows:
1515//!
1616//! ```no_run
17+ //! # #[cfg(feature = "blocking")]
18+ //! # {
1719//! use esplora_client::Builder;
1820//! let builder = Builder::new("https://blockstream.info/testnet/api");
1921//! let blocking_client = builder.build_blocking();
2022//! # Ok::<(), esplora_client::Error>(());
23+ //! # }
2124//! ```
2225//!
2326//! Here is an example of how to create an asynchronous client.
2427//!
2528//! ```no_run
29+ //! # #[cfg(feature = "async")]
30+ //! # {
2631//! use esplora_client::Builder;
2732//! let builder = Builder::new("https://blockstream.info/testnet/api");
2833//! let async_client = builder.build_async();
2934//! # Ok::<(), esplora_client::Error>(());
35+ //! # }
3036//! ```
3137//!
3238//! ## Features
@@ -54,15 +60,15 @@ use bitcoin::{BlockHash, Txid};
5460
5561pub mod api;
5662
57- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
63+ #[ cfg( feature = "async" ) ]
5864pub mod r#async;
5965#[ cfg( feature = "blocking" ) ]
6066pub mod blocking;
6167
6268pub use api:: * ;
6369#[ cfg( feature = "blocking" ) ]
6470pub use blocking:: BlockingClient ;
65- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
71+ #[ cfg( feature = "async" ) ]
6672pub use r#async:: AsyncClient ;
6773
6874/// Get a fee value in sats/vbytes from the estimates
@@ -146,7 +152,7 @@ pub enum Error {
146152 #[ cfg( feature = "blocking" ) ]
147153 UreqTransport ( :: ureq:: Transport ) ,
148154 /// Error during reqwest HTTP request
149- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
155+ #[ cfg( feature = "async" ) ]
150156 Reqwest ( :: reqwest:: Error ) ,
151157 /// HTTP response error
152158 HttpResponse ( u16 ) ,
@@ -191,7 +197,7 @@ macro_rules! impl_error {
191197impl std:: error:: Error for Error { }
192198#[ cfg( feature = "blocking" ) ]
193199impl_error ! ( :: ureq:: Transport , UreqTransport , Error ) ;
194- #[ cfg( any ( feature = "async" , feature = "async-https" ) ) ]
200+ #[ cfg( feature = "async" ) ]
195201impl_error ! ( :: reqwest:: Error , Reqwest , Error ) ;
196202impl_error ! ( io:: Error , Io , Error ) ;
197203impl_error ! ( std:: num:: ParseIntError , Parsing , Error ) ;
@@ -205,7 +211,7 @@ mod test {
205211 use lazy_static:: lazy_static;
206212 use std:: env;
207213 use tokio:: sync:: Mutex ;
208- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
214+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
209215 use {
210216 bitcoin:: hashes:: Hash ,
211217 bitcoin:: Amount ,
@@ -243,10 +249,10 @@ mod test {
243249 static ref MINER : Mutex <( ) > = Mutex :: new( ( ) ) ;
244250 }
245251
246- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
252+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
247253 static PREMINE : OnceCell < ( ) > = OnceCell :: const_new ( ) ;
248254
249- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
255+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
250256 async fn setup_clients ( ) -> ( BlockingClient , AsyncClient ) {
251257 PREMINE
252258 . get_or_init ( || async {
@@ -266,14 +272,14 @@ mod test {
266272 ( blocking_client, async_client)
267273 }
268274
269- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
275+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
270276 fn generate_blocks_and_wait ( num : usize ) {
271277 let cur_height = BITCOIND . client . get_block_count ( ) . unwrap ( ) ;
272278 generate_blocks ( num) ;
273279 wait_for_block ( cur_height as usize + num) ;
274280 }
275281
276- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
282+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
277283 fn generate_blocks ( num : usize ) {
278284 let address = BITCOIND
279285 . client
@@ -285,7 +291,7 @@ mod test {
285291 . unwrap ( ) ;
286292 }
287293
288- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
294+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
289295 fn wait_for_block ( min_height : usize ) {
290296 let mut header = ELECTRSD . client . block_headers_subscribe ( ) . unwrap ( ) ;
291297 loop {
@@ -300,7 +306,7 @@ mod test {
300306 }
301307 }
302308
303- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
309+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
304310 fn exponential_backoff_poll < T , F > ( mut poll : F ) -> T
305311 where
306312 F : FnMut ( ) -> Option < T > ,
@@ -361,7 +367,7 @@ mod test {
361367 ) ;
362368 }
363369
364- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
370+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
365371 #[ tokio:: test]
366372 async fn test_get_tx ( ) {
367373 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -391,7 +397,7 @@ mod test {
391397 assert_eq ! ( tx, tx_async) ;
392398 }
393399
394- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
400+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
395401 #[ tokio:: test]
396402 async fn test_get_tx_no_opt ( ) {
397403 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -421,7 +427,7 @@ mod test {
421427 assert_eq ! ( tx_no_opt, tx_no_opt_async) ;
422428 }
423429
424- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
430+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
425431 #[ tokio:: test]
426432 async fn test_get_tx_status ( ) {
427433 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -452,7 +458,7 @@ mod test {
452458 assert ! ( tx_status. confirmed) ;
453459 }
454460
455- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
461+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
456462 #[ tokio:: test]
457463 async fn test_get_header_by_hash ( ) {
458464 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -464,7 +470,7 @@ mod test {
464470 assert_eq ! ( block_header, block_header_async) ;
465471 }
466472
467- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
473+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
468474 #[ tokio:: test]
469475 async fn test_get_block_status ( ) {
470476 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -484,7 +490,7 @@ mod test {
484490 assert_eq ! ( expected, block_status_async) ;
485491 }
486492
487- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
493+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
488494 #[ tokio:: test]
489495 async fn test_get_non_existing_block_status ( ) {
490496 // Esplora returns the same status for orphaned blocks as for non-existing blocks:
@@ -509,7 +515,7 @@ mod test {
509515 assert_eq ! ( expected, block_status_async) ;
510516 }
511517
512- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
518+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
513519 #[ tokio:: test]
514520 async fn test_get_block_by_hash ( ) {
515521 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -524,7 +530,7 @@ mod test {
524530 assert_eq ! ( expected, block_async) ;
525531 }
526532
527- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
533+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
528534 #[ tokio:: test]
529535 async fn test_get_block_by_hash_not_existing ( ) {
530536 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -540,7 +546,7 @@ mod test {
540546 assert ! ( block_async. is_none( ) ) ;
541547 }
542548
543- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
549+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
544550 #[ tokio:: test]
545551 async fn test_get_merkle_proof ( ) {
546552 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -571,7 +577,7 @@ mod test {
571577 assert ! ( merkle_proof. pos > 0 ) ;
572578 }
573579
574- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
580+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
575581 #[ tokio:: test]
576582 async fn test_get_merkle_block ( ) {
577583 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -611,7 +617,7 @@ mod test {
611617 assert ! ( indexes[ 0 ] > 0 ) ;
612618 }
613619
614- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
620+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
615621 #[ tokio:: test]
616622 async fn test_get_output_status ( ) {
617623 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -649,7 +655,7 @@ mod test {
649655 assert_eq ! ( output_status, output_status_async) ;
650656 }
651657
652- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
658+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
653659 #[ tokio:: test]
654660 async fn test_get_height ( ) {
655661 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -659,7 +665,7 @@ mod test {
659665 assert_eq ! ( block_height, block_height_async) ;
660666 }
661667
662- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
668+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
663669 #[ tokio:: test]
664670 async fn test_get_tip_hash ( ) {
665671 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -668,7 +674,7 @@ mod test {
668674 assert_eq ! ( tip_hash, tip_hash_async) ;
669675 }
670676
671- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
677+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
672678 #[ tokio:: test]
673679 async fn test_get_block_hash ( ) {
674680 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -681,7 +687,7 @@ mod test {
681687 assert_eq ! ( block_hash, block_hash_async) ;
682688 }
683689
684- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
690+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
685691 #[ tokio:: test]
686692 async fn test_get_txid_at_block_index ( ) {
687693 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -700,7 +706,7 @@ mod test {
700706 assert_eq ! ( txid_at_block_index, txid_at_block_index_async) ;
701707 }
702708
703- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
709+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
704710 #[ tokio:: test]
705711 async fn test_get_fee_estimates ( ) {
706712 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -709,7 +715,7 @@ mod test {
709715 assert_eq ! ( fee_estimates. len( ) , fee_estimates_async. len( ) ) ;
710716 }
711717
712- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
718+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
713719 #[ tokio:: test]
714720 async fn test_scripthash_txs ( ) {
715721 let ( blocking_client, async_client) = setup_clients ( ) . await ;
@@ -757,7 +763,7 @@ mod test {
757763 assert_eq ! ( scripthash_txs_txids, scripthash_txs_txids_async) ;
758764 }
759765
760- #[ cfg( all( feature = "blocking" , any ( feature = "async" , feature = "async-https" ) ) ) ]
766+ #[ cfg( all( feature = "blocking" , feature = "async" ) ) ]
761767 #[ tokio:: test]
762768 async fn test_get_blocks ( ) {
763769 let ( blocking_client, async_client) = setup_clients ( ) . await ;
0 commit comments