Crates.io | esplora-api |
lib.rs | esplora-api |
version | 0.1.0 |
source | src |
created_at | 2020-10-30 12:49:36.055385 |
updated_at | 2020-10-30 12:49:36.055385 |
description | Simple wrapper to use Blockstream API or self hosted Esplora API |
homepage | |
repository | https://github.com/vivienbcr/Blockstream-api-wrapper |
max_upload_size | |
id | 306964 |
size | 107,300 |
This library provide a simple wrapper to use Blockstream API or self hosted Esplora - Electrs API.
sudo apt install libssl-dev
// Cargo.toml
[dependencies]
esplora-api = { path ="./../Elecrts-wrapper" }
tokio = { version = "0.2", features = ["macros"] }
// Main.rs
use esplora_api;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>>{
let client = esplora_api::async_impl::ApiClient::new("https://blockstream.info/testnet/api/", None).unwrap();
let res = client.get_address("n1vgV8XmoggmRXzW3hGD8ZNTAgvhcwT4Gk").await?;
println!("{:?}",res);
Ok(())
}
// Cargo.toml
[dependencies]
esplora-api = { path ="./../Elecrts-wrapper", features=["blocking"] }
// Main.rs
pub use esplora_api;
fn main(){
let client = esplora_api::blocking::client::ApiClient::new("https://blockstream.info/testnet/api/", None).unwrap();
let res = client.get_address("n1vgV8XmoggmRXzW3hGD8ZNTAgvhcwT4Gk").unwrap();
println!("{:?}",res);
}