Skip to main content

LowLevelWalletRead

Trait LowLevelWalletRead 

Source
pub trait LowLevelWalletRead {
    type Error;
    type AccountId: Copy + Eq + Hash;
    type AccountRef: Copy + Eq + Hash;
    type Account: Account;
    type TxRef: Copy + Eq + Hash;

Show 16 methods // Required methods fn block_fully_scanned_height( &self, ) -> Result<Option<BlockHeight>, Self::Error>; fn select_receiving_address( &self, account: Self::AccountId, receiver: &Receiver, ) -> Result<Option<ZcashAddress>, Self::Error>; fn find_account_for_transparent_address( &self, address: &TransparentAddress, ) -> Result<Option<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>; fn find_involved_accounts( &self, tx_refs: impl IntoIterator<Item = Self::TxRef>, ) -> Result<HashSet<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>; fn detect_accounts_transparent<'a>( &self, spends: impl Iterator<Item = &'a OutPoint>, ) -> Result<HashSet<Self::AccountId>, Self::Error>; fn detect_accounts_sapling<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>; fn detect_accounts_orchard<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>; fn detect_accounts_ironwood<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>; fn get_wallet_transparent_output( &self, outpoint: &OutPoint, target_height: Option<TargetHeight>, ) -> Result<Option<WalletTransparentOutput<Self::AccountId>>, Self::Error>; fn get_unknown_fee_spenders_of( &self, tx_ref: Self::TxRef, ) -> Result<Vec<(Self::TxRef, Transaction)>, Self::Error>; fn detect_sapling_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>; fn detect_orchard_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>; fn detect_ironwood_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>; fn get_account_ref( &self, account_uuid: Self::AccountId, ) -> Result<Self::AccountRef, Self::Error>; fn get_account_internal( &self, account_id: Self::AccountRef, ) -> Result<Option<Self::Account>, Self::Error>; // Provided method fn get_funding_accounts<T: TxMeta>( &self, tx: &T, ) -> Result<HashSet<Self::AccountId>, Self::Error> { ... }
}
Expand description

A capability trait that provides low-level wallet database read operations. These operations are used to provide standard implementations for certain WalletWrite trait methods.

Required Associated Types§

Source

type Error

The type of errors that may be generated when querying a wallet data store.

Source

type AccountId: Copy + Eq + Hash

The type of the account identifier.

An account identifier corresponds to at most a single unified spending key’s worth of spend authority, such that both received notes and change spendable by that spending authority will be interpreted as belonging to that account.

Source

type AccountRef: Copy + Eq + Hash

A wallet-internal account identifier, used for efficient lookups within the data store.

Unlike AccountId, this type is not intended for use in external contexts; it is an ephemeral handle that may change across database migrations or backend implementations.

Source

type Account: Account

The type of account records returned by the wallet backend, providing access to the account’s viewing keys and capabilities.

Source

type TxRef: Copy + Eq + Hash

A wallet-internal transaction identifier.

Required Methods§

Source

fn block_fully_scanned_height(&self) -> Result<Option<BlockHeight>, Self::Error>

Returns the height to which the wallet has been fully scanned: the greatest height for which the wallet has trial-decrypted this and all preceding blocks above the wallet’s birthday height, or Ok(None) if no such height exists.

Source

fn select_receiving_address( &self, account: Self::AccountId, receiver: &Receiver, ) -> Result<Option<ZcashAddress>, Self::Error>

Returns the most likely wallet address that corresponds to the protocol-level receiver of a note or UTXO.

If the wallet database has stored a wallet address that contains the given receiver, then that address is returned; otherwise, the most likely address containing that receiver will be returned. The “most likely” address should be produced by generating the “standard” address (a transparent address if the receiver is transparent, or the default Unified address for the account) derived at the receiver’s diviersifier index if the receiver is for a shielded pool.

Returns Ok(None) if the receiver cannot be determined to belong to an address produced by this account.

Source

fn find_account_for_transparent_address( &self, address: &TransparentAddress, ) -> Result<Option<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>

Available on crate feature transparent-inputs only.

Detects and returns the identifier for the account to which the address belongs, if any.

In addition, for HD-derived addresses, the change-level key scope used to derive the address is returned, so that the caller is able to determine whether any special handling rules apply to the address for the purposes of preserving user privacy (by limiting address linking, etc.).

Source

fn find_involved_accounts( &self, tx_refs: impl IntoIterator<Item = Self::TxRef>, ) -> Result<HashSet<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>

Available on crate feature transparent-inputs only.

Finds the set of accounts that either provide inputs to or receive outputs from any of the provided transactions.

Source

fn detect_accounts_transparent<'a>( &self, spends: impl Iterator<Item = &'a OutPoint>, ) -> Result<HashSet<Self::AccountId>, Self::Error>

Available on crate feature transparent-inputs only.

Detects the set of accounts that received transparent outputs corresponding to the provided OutPoints. This is used to determine which account(s) funded a given transaction.

Source

fn detect_accounts_sapling<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>

Detects the set of accounts that received Sapling outputs that, when spent, reveal(ed) the given Nullifiers. This is used to determine which account(s) funded a given transaction.

Source

fn detect_accounts_orchard<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>

Available on crate feature orchard only.

Detects the set of accounts that received Orchard outputs that, when spent, reveal(ed) the given Nullifiers. This is used to determine which account(s) funded a given transaction.

Source

fn detect_accounts_ironwood<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>

Available on crate feature orchard only.

Detects the set of accounts that received Ironwood outputs that, when spent, reveal(ed) the given Nullifiers. This is used to determine which account(s) funded a given transaction.

Ironwood notes share the Orchard nullifier type but are tracked separately, so this is distinct from LowLevelWalletRead::detect_accounts_orchard.

Source

fn get_wallet_transparent_output( &self, outpoint: &OutPoint, target_height: Option<TargetHeight>, ) -> Result<Option<WalletTransparentOutput<Self::AccountId>>, Self::Error>

Available on crate feature transparent-inputs only.

Get information about a transparent output controlled by the wallet.

§Parameters
  • outpoint: The identifier for the output to be retrieved.
  • target_height: The target height of a transaction under construction that will spend the returned output. If this is None, no spendability checks are performed.
Source

fn get_unknown_fee_spenders_of( &self, tx_ref: Self::TxRef, ) -> Result<Vec<(Self::TxRef, Transaction)>, Self::Error>

Returns the transactions that spend a transparent output of the referenced transaction, for which the fee is unknown and the raw transaction data is available.

Conflicted transactions, and transactions that expired without being mined, are included. wallet::store_decrypted_tx uses this to set the fees of these transactions once the values of all their inputs are known.

Source

fn detect_sapling_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>

Finds the reference to the transaction that reveals the given Sapling nullifier in the backing data store, if known.

Source

fn detect_orchard_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>

Available on crate feature orchard only.

Finds the reference to the transaction that reveals the given Orchard nullifier in the backing data store, if known.

Source

fn detect_ironwood_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>

Available on crate feature orchard only.

Finds the reference to the transaction that reveals the given Ironwood nullifier in the backing data store, if known. Ironwood nullifiers are Orchard-shaped but are tracked as a separate pool.

Source

fn get_account_ref( &self, account_uuid: Self::AccountId, ) -> Result<Self::AccountRef, Self::Error>

Available on crate feature transparent-inputs only.

Returns the wallet-internal account reference for the given external account identifier.

This is used to translate between the stable external AccountId and the ephemeral internal AccountRef used for efficient lookups.

Source

fn get_account_internal( &self, account_id: Self::AccountRef, ) -> Result<Option<Self::Account>, Self::Error>

Available on crate feature transparent-inputs only.

Returns the full account record for the given wallet-internal account reference.

Provided Methods§

Source

fn get_funding_accounts<T: TxMeta>( &self, tx: &T, ) -> Result<HashSet<Self::AccountId>, Self::Error>

Returns the set of account identifiers for accounts that spent notes and/or UTXOs in the construction of the given transaction.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§