Skip to content

Simple rust wrapper for Blockstream API or self hosted Esplora - Electrs API

License

Notifications You must be signed in to change notification settings

vivienbcr/Blockstream-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust wrapper for Blockstream Esplora API

Crates.io DocRs codecov Actions Status

Description

This library provide a simple wrapper to use Blockstream API or self hosted Esplora - Electrs API.

Requirements

sudo apt install libssl-dev

Dependencies

Use

Async implementation

// 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(())
}

Blocking implementation

// 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);
}

About

Simple rust wrapper for Blockstream API or self hosted Esplora - Electrs API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages