[][src]Trait bdk::database::Database

pub trait Database: BatchOperations {
    pub fn check_descriptor_checksum<B: AsRef<[u8]>>(
        &mut self,
        keychain: KeychainKind,
        bytes: B
    ) -> Result<(), Error>;
pub fn iter_script_pubkeys(
        &self,
        keychain: Option<KeychainKind>
    ) -> Result<Vec<Script>, Error>;
pub fn iter_utxos(&self) -> Result<Vec<UTXO>, Error>;
pub fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>;
pub fn iter_txs(
        &self,
        include_raw: bool
    ) -> Result<Vec<TransactionDetails>, Error>;
pub fn get_script_pubkey_from_path(
        &self,
        keychain: KeychainKind,
        child: u32
    ) -> Result<Option<Script>, Error>;
pub fn get_path_from_script_pubkey(
        &self,
        script: &Script
    ) -> Result<Option<(KeychainKind, u32)>, Error>;
pub fn get_utxo(&self, outpoint: &OutPoint) -> Result<Option<UTXO>, Error>;
pub fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>;
pub fn get_tx(
        &self,
        txid: &Txid,
        include_raw: bool
    ) -> Result<Option<TransactionDetails>, Error>;
pub fn get_last_index(
        &self,
        keychain: KeychainKind
    ) -> Result<Option<u32>, Error>;
pub fn increment_last_index(
        &mut self,
        keychain: KeychainKind
    ) -> Result<u32, Error>; }

Trait for reading data from a database

This traits defines the operations that can be used to read data out of a database

Required methods

pub fn check_descriptor_checksum<B: AsRef<[u8]>>(
    &mut self,
    keychain: KeychainKind,
    bytes: B
) -> Result<(), Error>
[src]

Read and checks the descriptor checksum for a given keychain.

Should return Error::ChecksumMismatch if the checksum doesn't match. If there's no checksum in the database, simply store it for the next time.

pub fn iter_script_pubkeys(
    &self,
    keychain: Option<KeychainKind>
) -> Result<Vec<Script>, Error>
[src]

Return the list of script_pubkeys

pub fn iter_utxos(&self) -> Result<Vec<UTXO>, Error>[src]

Return the list of UTXOs

pub fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>[src]

Return the list of raw transactions

pub fn iter_txs(
    &self,
    include_raw: bool
) -> Result<Vec<TransactionDetails>, Error>
[src]

Return the list of transactions metadata

pub fn get_script_pubkey_from_path(
    &self,
    keychain: KeychainKind,
    child: u32
) -> Result<Option<Script>, Error>
[src]

Fetch a script_pubkey given the child number of a keychain.

pub fn get_path_from_script_pubkey(
    &self,
    script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
[src]

Fetch the keychain and child number of a given script_pubkey

pub fn get_utxo(&self, outpoint: &OutPoint) -> Result<Option<UTXO>, Error>[src]

Fetch a UTXO given its [OutPoint]

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

Fetch a raw transaction given its [Txid]

pub fn get_tx(
    &self,
    txid: &Txid,
    include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
[src]

Fetch the transaction metadata and optionally also the raw transaction

pub fn get_last_index(
    &self,
    keychain: KeychainKind
) -> Result<Option<u32>, Error>
[src]

Return the last defivation index for a keychain.

pub fn increment_last_index(
    &mut self,
    keychain: KeychainKind
) -> Result<u32, Error>
[src]

Increment the last derivation index for a keychain and return it

It should insert and return 0 if not present in the database

Loading content...

Implementations on Foreign Types

impl Database for Tree[src]

Loading content...

Implementors

impl Database for AnyDatabase[src]

impl Database for MemoryDatabase[src]

Loading content...