Add a ureq version of esplora module
The `Blockchain` implementation for connecting to an Esplora instance is currently based on `reqwest`. Some users may not wish to use reqwest. `ureq` is a simple HTTP client (no async) that is useful when `reqwest` is not suitable. - Move `esplora.rs` -> `esplora/reqwest.rs` - Add an implementation based on the `reqwest` esplora code but using `ureq` - Add feature flags and conditional includes to re-export everything to the `esplora` module so we don't effect the rest of the code base. - Remove the forced dependency on `tokio`. - Make esplora independent of async-interface - Depend on local version of macros crate
This commit is contained in:
19
src/lib.rs
19
src/lib.rs
@@ -205,11 +205,27 @@ extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
|
||||
#[cfg(all(feature = "reqwest", feature = "ureq"))]
|
||||
compile_error!("Features reqwest and ureq are mutually exclusive and cannot be enabled together");
|
||||
|
||||
#[cfg(all(feature = "async-interface", feature = "electrum"))]
|
||||
compile_error!(
|
||||
"Features async-interface and electrum are mutually exclusive and cannot be enabled together"
|
||||
);
|
||||
|
||||
#[cfg(all(feature = "async-interface", feature = "ureq"))]
|
||||
compile_error!(
|
||||
"Features async-interface and ureq are mutually exclusive and cannot be enabled together"
|
||||
);
|
||||
|
||||
#[cfg(all(feature = "async-interface", feature = "compact_filters"))]
|
||||
compile_error!(
|
||||
"Features async-interface and compact_filters are mutually exclusive and cannot be enabled together"
|
||||
);
|
||||
|
||||
#[cfg(all(feature = "esplora", not(feature = "ureq"), not(feature = "reqwest")))]
|
||||
compile_error!("Feature missing: esplora requires either ureq or reqwest to be enabled");
|
||||
|
||||
#[cfg(feature = "keys-bip39")]
|
||||
extern crate bip39;
|
||||
|
||||
@@ -228,9 +244,6 @@ pub extern crate bitcoincore_rpc;
|
||||
#[cfg(feature = "electrum")]
|
||||
pub extern crate electrum_client;
|
||||
|
||||
#[cfg(feature = "esplora")]
|
||||
pub extern crate reqwest;
|
||||
|
||||
#[cfg(feature = "key-value-db")]
|
||||
pub extern crate sled;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user