[][src]Trait testutils::ElectrumApi

pub trait ElectrumApi {
    pub fn batch_call(&self, batch: &Batch) -> Result<Vec<Value, Global>, Error>;
pub fn block_headers_subscribe_raw(
        &self
    ) -> Result<RawHeaderNotification, Error>;
pub fn block_headers_pop_raw(
        &self
    ) -> Result<Option<RawHeaderNotification>, Error>;
pub fn block_header_raw(
        &self,
        height: usize
    ) -> Result<Vec<u8, Global>, Error>;
pub fn block_headers(
        &self,
        start_height: usize,
        count: usize
    ) -> Result<GetHeadersRes, Error>;
pub fn estimate_fee(&self, number: usize) -> Result<f64, Error>;
pub fn relay_fee(&self) -> Result<f64, Error>;
pub fn script_subscribe(
        &self,
        script: &Script
    ) -> Result<Option<Hex32Bytes>, Error>;
pub fn script_unsubscribe(&self, script: &Script) -> Result<bool, Error>;
pub fn script_pop(
        &self,
        script: &Script
    ) -> Result<Option<Hex32Bytes>, Error>;
pub fn script_get_balance(
        &self,
        script: &Script
    ) -> Result<GetBalanceRes, Error>;
pub fn batch_script_get_balance<'s, I>(
        &self,
        scripts: I
    ) -> Result<Vec<GetBalanceRes, Global>, Error>
    where
        I: IntoIterator<Item = &'s Script> + Clone
;
pub fn script_get_history(
        &self,
        script: &Script
    ) -> Result<Vec<GetHistoryRes, Global>, Error>;
pub fn batch_script_get_history<'s, I>(
        &self,
        scripts: I
    ) -> Result<Vec<Vec<GetHistoryRes, Global>, Global>, Error>
    where
        I: IntoIterator<Item = &'s Script> + Clone
;
pub fn script_list_unspent(
        &self,
        script: &Script
    ) -> Result<Vec<ListUnspentRes, Global>, Error>;
pub fn batch_script_list_unspent<'s, I>(
        &self,
        scripts: I
    ) -> Result<Vec<Vec<ListUnspentRes, Global>, Global>, Error>
    where
        I: IntoIterator<Item = &'s Script> + Clone
;
pub fn transaction_get_raw(
        &self,
        txid: &Txid
    ) -> Result<Vec<u8, Global>, Error>;
pub fn batch_transaction_get_raw<'t, I>(
        &self,
        txids: I
    ) -> Result<Vec<Vec<u8, Global>, Global>, Error>
    where
        I: IntoIterator<Item = &'t Txid> + Clone
;
pub fn batch_block_header_raw<I>(
        &self,
        heights: I
    ) -> Result<Vec<Vec<u8, Global>, Global>, Error>
    where
        I: IntoIterator<Item = u32> + Clone
;
pub fn batch_estimate_fee<I>(
        &self,
        numbers: I
    ) -> Result<Vec<f64, Global>, Error>
    where
        I: IntoIterator<Item = usize> + Clone
;
pub fn transaction_broadcast_raw(
        &self,
        raw_tx: &[u8]
    ) -> Result<Txid, Error>;
pub fn transaction_get_merkle(
        &self,
        txid: &Txid,
        height: usize
    ) -> Result<GetMerkleRes, Error>;
pub fn server_features(&self) -> Result<ServerFeaturesRes, Error>;
pub fn ping(&self) -> Result<(), Error>; pub fn block_header(&self, height: usize) -> Result<BlockHeader, Error> { ... }
pub fn block_headers_subscribe(&self) -> Result<HeaderNotification, Error> { ... }
pub fn block_headers_pop(&self) -> Result<Option<HeaderNotification>, Error> { ... }
pub fn transaction_get(&self, txid: &Txid) -> Result<Transaction, Error> { ... }
pub fn batch_transaction_get<'t, I>(
        &self,
        txids: I
    ) -> Result<Vec<Transaction, Global>, Error>
    where
        I: IntoIterator<Item = &'t Txid> + Clone
, { ... }
pub fn batch_block_header<I>(
        &self,
        heights: I
    ) -> Result<Vec<BlockHeader, Global>, Error>
    where
        I: IntoIterator<Item = u32> + Clone
, { ... }
pub fn transaction_broadcast(&self, tx: &Transaction) -> Result<Txid, Error> { ... } }

API calls exposed by an Electrum client

Required methods

pub fn batch_call(&self, batch: &Batch) -> Result<Vec<Value, Global>, Error>[src]

Execute a queue of calls stored in a Batch struct. Returns Ok() only if all of the calls are successful. The order of the JSON Values returned reflects the order in which the calls were made on the Batch struct.

pub fn block_headers_subscribe_raw(
    &self
) -> Result<RawHeaderNotification, Error>
[src]

Subscribes to notifications for new block headers, by sending a blockchain.headers.subscribe call and returns the current tip as raw bytes instead of deserializing them.

pub fn block_headers_pop_raw(
    &self
) -> Result<Option<RawHeaderNotification>, Error>
[src]

Tries to pop one queued notification for a new block header that we might have received. Returns a the header in raw bytes if a notification is found in the queue, None otherwise.

pub fn block_header_raw(&self, height: usize) -> Result<Vec<u8, Global>, Error>[src]

Gets the raw bytes of block header for height height.

pub fn block_headers(
    &self,
    start_height: usize,
    count: usize
) -> Result<GetHeadersRes, Error>
[src]

Tries to fetch count block headers starting from start_height.

pub fn estimate_fee(&self, number: usize) -> Result<f64, Error>[src]

Estimates the fee required in Satoshis per kilobyte to confirm a transaction in number blocks.

pub fn relay_fee(&self) -> Result<f64, Error>[src]

Returns the minimum accepted fee by the server's node in Bitcoin, not Satoshi.

pub fn script_subscribe(
    &self,
    script: &Script
) -> Result<Option<Hex32Bytes>, Error>
[src]

Subscribes to notifications for activity on a specific scriptPubKey.

Returns a ScriptStatus when successful that represents the current status for the requested script.

Returns Error::AlreadySubscribed if already subscribed to the script.

pub fn script_unsubscribe(&self, script: &Script) -> Result<bool, Error>[src]

Subscribes to notifications for activity on a specific scriptPubKey.

Returns a bool with the server response when successful.

Returns Error::NotSubscribed if not subscribed to the script.

pub fn script_pop(&self, script: &Script) -> Result<Option<Hex32Bytes>, Error>[src]

Tries to pop one queued notification for a the requested script. Returns None if there are no items in the queue.

pub fn script_get_balance(
    &self,
    script: &Script
) -> Result<GetBalanceRes, Error>
[src]

Returns the balance for a scriptPubKey.

pub fn batch_script_get_balance<'s, I>(
    &self,
    scripts: I
) -> Result<Vec<GetBalanceRes, Global>, Error> where
    I: IntoIterator<Item = &'s Script> + Clone
[src]

Batch version of script_get_balance.

Takes a list of scripts and returns a list of balance responses.

pub fn script_get_history(
    &self,
    script: &Script
) -> Result<Vec<GetHistoryRes, Global>, Error>
[src]

Returns the history for a scriptPubKey

pub fn batch_script_get_history<'s, I>(
    &self,
    scripts: I
) -> Result<Vec<Vec<GetHistoryRes, Global>, Global>, Error> where
    I: IntoIterator<Item = &'s Script> + Clone
[src]

Batch version of script_get_history.

Takes a list of scripts and returns a list of history responses.

pub fn script_list_unspent(
    &self,
    script: &Script
) -> Result<Vec<ListUnspentRes, Global>, Error>
[src]

Returns the list of unspent outputs for a scriptPubKey

pub fn batch_script_list_unspent<'s, I>(
    &self,
    scripts: I
) -> Result<Vec<Vec<ListUnspentRes, Global>, Global>, Error> where
    I: IntoIterator<Item = &'s Script> + Clone
[src]

Batch version of script_list_unspent.

Takes a list of scripts and returns a list of a list of utxos.

pub fn transaction_get_raw(&self, txid: &Txid) -> Result<Vec<u8, Global>, Error>[src]

Gets the raw bytes of a transaction with txid. Returns an error if not found.

pub fn batch_transaction_get_raw<'t, I>(
    &self,
    txids: I
) -> Result<Vec<Vec<u8, Global>, Global>, Error> where
    I: IntoIterator<Item = &'t Txid> + Clone
[src]

Batch version of transaction_get_raw.

Takes a list of txids and returns a list of transactions raw bytes.

pub fn batch_block_header_raw<I>(
    &self,
    heights: I
) -> Result<Vec<Vec<u8, Global>, Global>, Error> where
    I: IntoIterator<Item = u32> + Clone
[src]

Batch version of block_header_raw.

Takes a list of heights of blocks and returns a list of block header raw bytes.

pub fn batch_estimate_fee<I>(
    &self,
    numbers: I
) -> Result<Vec<f64, Global>, Error> where
    I: IntoIterator<Item = usize> + Clone
[src]

Batch version of estimate_fee.

Takes a list of numbers of blocks and returns a list of fee required in Satoshis per kilobyte to confirm a transaction in the given number of blocks.

pub fn transaction_broadcast_raw(&self, raw_tx: &[u8]) -> Result<Txid, Error>[src]

Broadcasts the raw bytes of a transaction to the network.

pub fn transaction_get_merkle(
    &self,
    txid: &Txid,
    height: usize
) -> Result<GetMerkleRes, Error>
[src]

Returns the merkle path for the transaction txid confirmed in the block at height.

pub fn server_features(&self) -> Result<ServerFeaturesRes, Error>[src]

Returns the capabilities of the server.

pub fn ping(&self) -> Result<(), Error>[src]

Pings the server. This method can also be used as a "dummy" call to trigger the processing of incoming block header or script notifications.

Loading content...

Provided methods

pub fn block_header(&self, height: usize) -> Result<BlockHeader, Error>[src]

Gets the block header for height height.

pub fn block_headers_subscribe(&self) -> Result<HeaderNotification, Error>[src]

Subscribes to notifications for new block headers, by sending a blockchain.headers.subscribe call.

pub fn block_headers_pop(&self) -> Result<Option<HeaderNotification>, Error>[src]

Tries to pop one queued notification for a new block header that we might have received. Returns None if there are no items in the queue.

pub fn transaction_get(&self, txid: &Txid) -> Result<Transaction, Error>[src]

Gets the transaction with txid. Returns an error if not found.

pub fn batch_transaction_get<'t, I>(
    &self,
    txids: I
) -> Result<Vec<Transaction, Global>, Error> where
    I: IntoIterator<Item = &'t Txid> + Clone
[src]

Batch version of transaction_get.

Takes a list of txids and returns a list of transactions.

pub fn batch_block_header<I>(
    &self,
    heights: I
) -> Result<Vec<BlockHeader, Global>, Error> where
    I: IntoIterator<Item = u32> + Clone
[src]

Batch version of block_header.

Takes a list of heights of blocks and returns a list of headers.

pub fn transaction_broadcast(&self, tx: &Transaction) -> Result<Txid, Error>[src]

Broadcasts a transaction to the network.

Loading content...

Implementations on Foreign Types

impl<T> ElectrumApi for RawClient<T> where
    T: Read + Write
[src]

Loading content...

Implementors

impl ElectrumApi for Client[src]

Loading content...