esplora_api/
lib.rs

1//! # Blockstream Api Wrapper
2//! 
3//! This library provide a simple wrapper to use Blockstream API or self hosted [Esplora - Electrs API](https://github.com/Blockstream/electrs) based on reqwest framework.
4//! Wrapper can be used with custom configuration according to your needs.
5//! Liquid features not implemented for the moment.
6//! 
7//! ## Optionnal Features 
8//! - **blocking**: Provides the [blocking](blocking) client API.
9//! 
10//! ## Usage
11//! 
12//! Simple async usage : 
13//! 
14//! ````rust
15//! fn main(){
16//!    let client = esplora_api::blocking::ApiClient::new("https://blockstream.info/testnet/api/", None).unwrap();
17//!    let res = client.get_address("n1vgV8XmoggmRXzW3hGD8ZNTAgvhcwT4Gk").unwrap();
18//!    println!("{:?}",res);
19//! }
20//! ````
21//! 
22//! Custom reqwest client:
23//! 
24//! ````rust
25//! use reqwest;
26//! use reqwest::header;
27//! 
28//! #[tokio::main]
29//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
30//!    let mut headers = header::HeaderMap::new();
31//!    headers.insert(header::AUTHORIZATION,header::HeaderValue::from_static("secret"));
32//!    let reqwest_client = reqwest::Client::builder().default_headers(headers).build()?;
33//!    let client = esplora_api::async_impl::ApiClient::new_from_config("https://blockstream.info/testnet/api/",reqwest_client).unwrap();
34//!    let response = client.get_address("n1vgV8XmoggmRXzW3hGD8ZNTAgvhcwT4Gk").await?;
35//!    println!("{:?}", response);
36//!   Ok(())
37//! }
38//!````
39//! 
40//! 
41//! 
42pub mod async_impl;
43pub mod data;
44
45#[cfg(feature = "blocking")]
46pub mod blocking;