Request information from an Electrs Server
This library provides helpful functions to query common information about an Electrs server.
⚠️ This is experimental. Please use at your own risk.⚠️
Add package to Cargo.toml file
rust [dependencies] electrs-query = "0.1.0"
```rust use electrsquery::{getbalanceforaddress, getrelayfee, getutxosfor_address, Client};
// setup let address = "127.0.0.1:50001"; let client = Client::new(address);
// get realy fee let relayfee = getrelayfee(&client); println!("relay fee result: {}", relayfee);
let p2pkhaddress = "mv7RvNNQ7HpQf2diQai5hgpeuzkFoAQP9G".tostring(); // get balance for p2pkh address let addressbalance = getbalanceforaddress(&p2pkhaddress, &client); println!("balance: {:#?}", addressbalance); // get utxo for p2pkh address let addressutxos = getutxosforaddress(&p2pkhaddress, &client); println!("utxos: {:#?}", addressutxos);
let p2shaddress = "2MzBNKyJjx44BDJfwEevVzS3Q9Z5kSEYUZB".tostring(); // get balance for p2sh address let addressbalance = getbalanceforaddress(&p2shaddress, &client); println!("balance: {:#?}", addressbalance); // get utxos for p2sh address let addressutxos = getutxosforaddress(&p2pkhaddress, &client); println!("utxos: {:#?}", addressutxos);
let p2wpkhaddress = "tb1qphdqqxupe6dzkz3z58twy5l4s0v24mle5gkp99".tostring(); // get balance for p2wpkh address let addressbalance = getbalanceforaddress(&p2wpkhaddress, &client); println!("balance: {:#?}", addressbalance); // get utxos for p2wpkh address let addressutxos = getutxosforaddress(&p2pkhaddress, &client); println!("utxos: {:#?}", addressutxos); ```
Find a list of all the functions available in the documentation
MIT © Joe Gesualdo