Struct Client

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn new(electrum_server_address: &str) -> Self

Examples found in repository?
examples/example.rs (line 8)
6fn main() {
7    let address = "127.0.0.1:50001";
8    let client = Client::new(address);
9
10    let relay_fee = get_relay_fee(&client);
11    println!("relay fee result: {}", relay_fee);
12    // let relay_fee_method = "blockchain.relayfee";
13    //let relay_fee_response = client.raw_call(relay_fee_method, vec![]).unwrap();
14    // let response = BlockchainRelayFeeCommand::new().call(&client).unwrap();
15    // println!("relay fee result: {:?}", response);
16
17    let p2pkh_address = "mv7RvNNQ7HpQf2diQai5hgpeuzkFoAQP9G".to_string();
18    let address_balance = get_balance_for_address(&p2pkh_address, &client);
19    println!("balance: {:#?}", address_balance);
20    let address_utxos = get_utxos_for_address(&p2pkh_address, &client);
21    println!("utxos: {:#?}", address_utxos);
22    let address_historical_transactions =
23        get_historical_transactions_for_address(&p2pkh_address, &client);
24    println!(
25        "historical transactions: {:#?}",
26        address_historical_transactions
27    );
28
29    let p2sh_address = "2MzBNKyJjx44BDJfwEevVzS3Q9Z5kSEYUZB".to_string();
30    let address_balance = get_balance_for_address(&p2sh_address, &client);
31    println!("balance: {:#?}", address_balance);
32    let address_utxos = get_utxos_for_address(&p2pkh_address, &client);
33    println!("utxos: {:#?}", address_utxos);
34
35    let p2wpkh_address = "tb1qphdqqxupe6dzkz3z58twy5l4s0v24mle5gkp99".to_string();
36    let address_balance = get_balance_for_address(&p2wpkh_address, &client);
37    println!("balance: {:#?}", address_balance);
38    let address_utxos = get_utxos_for_address(&p2pkh_address, &client);
39    println!("utxos: {:#?}", address_utxos);
40}

Auto Trait Implementations§

§

impl !Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.