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

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

fn check_descriptor_checksum<B: AsRef<[u8]>>(
    &mut self,
    script_type: ScriptType,
    bytes: B
) -> Result<(), Error>

Read and checks the descriptor checksum for a given script type

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.

fn iter_script_pubkeys(
    &self,
    script_type: Option<ScriptType>
) -> Result<Vec<Script>, Error>

Return the list of script_pubkeys

fn iter_utxos(&self) -> Result<Vec<UTXO>, Error>

Return the list of UTXOs

fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>

Return the list of raw transactions

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

Return the list of transactions metadata

fn get_script_pubkey_from_path(
    &self,
    script_type: ScriptType,
    child: u32
) -> Result<Option<Script>, Error>

Fetch a script_pubkey given the script type and child number

fn get_path_from_script_pubkey(
    &self,
    script: &Script
) -> Result<Option<(ScriptType, u32)>, Error>

Fetch the script type and child number of a given script_pubkey

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

Fetch a UTXO given its [OutPoint]

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

Fetch a raw transaction given its [Txid]

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

Fetch the transaction metadata and optionally also the raw transaction

fn get_last_index(&self, script_type: ScriptType) -> Result<Option<u32>, Error>

Return the last defivation index for a script type

fn increment_last_index(
    &mut self,
    script_type: ScriptType
) -> Result<u32, Error>

Increment the last derivation index for a script type and returns 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 MemoryDatabase[src]

Loading content...