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§
Sourcetype AccountId: Copy + Eq + Hash
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.
Sourcetype AccountRef: Copy + Eq + Hash
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.
Required Methods§
Sourcefn block_fully_scanned_height(&self) -> Result<Option<BlockHeight>, Self::Error>
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.
Sourcefn select_receiving_address(
&self,
account: Self::AccountId,
receiver: &Receiver,
) -> Result<Option<ZcashAddress>, Self::Error>
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.
Sourcefn find_account_for_transparent_address(
&self,
address: &TransparentAddress,
) -> Result<Option<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>
Available on crate feature transparent-inputs only.
fn find_account_for_transparent_address( &self, address: &TransparentAddress, ) -> Result<Option<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>
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.).
Sourcefn 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.
fn find_involved_accounts( &self, tx_refs: impl IntoIterator<Item = Self::TxRef>, ) -> Result<HashSet<(Self::AccountId, Option<TransparentKeyScope>)>, Self::Error>
transparent-inputs only.Finds the set of accounts that either provide inputs to or receive outputs from any of the provided transactions.
Sourcefn detect_accounts_transparent<'a>(
&self,
spends: impl Iterator<Item = &'a OutPoint>,
) -> Result<HashSet<Self::AccountId>, Self::Error>
Available on crate feature transparent-inputs only.
fn detect_accounts_transparent<'a>( &self, spends: impl Iterator<Item = &'a OutPoint>, ) -> Result<HashSet<Self::AccountId>, Self::Error>
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.
Sourcefn detect_accounts_sapling<'a>(
&self,
spends: impl Iterator<Item = &'a Nullifier>,
) -> Result<HashSet<Self::AccountId>, Self::Error>
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.
Sourcefn detect_accounts_orchard<'a>(
&self,
spends: impl Iterator<Item = &'a Nullifier>,
) -> Result<HashSet<Self::AccountId>, Self::Error>
Available on crate feature orchard only.
fn detect_accounts_orchard<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>
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.
Sourcefn detect_accounts_ironwood<'a>(
&self,
spends: impl Iterator<Item = &'a Nullifier>,
) -> Result<HashSet<Self::AccountId>, Self::Error>
Available on crate feature orchard only.
fn detect_accounts_ironwood<'a>( &self, spends: impl Iterator<Item = &'a Nullifier>, ) -> Result<HashSet<Self::AccountId>, Self::Error>
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.
Sourcefn 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.
fn get_wallet_transparent_output( &self, outpoint: &OutPoint, target_height: Option<TargetHeight>, ) -> Result<Option<WalletTransparentOutput<Self::AccountId>>, Self::Error>
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 isNone, no spendability checks are performed.
Sourcefn get_unknown_fee_spenders_of(
&self,
tx_ref: Self::TxRef,
) -> Result<Vec<(Self::TxRef, Transaction)>, Self::Error>
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.
Sourcefn detect_sapling_spend(
&self,
nf: &Nullifier,
) -> Result<Option<Self::TxRef>, Self::Error>
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.
Sourcefn detect_orchard_spend(
&self,
nf: &Nullifier,
) -> Result<Option<Self::TxRef>, Self::Error>
Available on crate feature orchard only.
fn detect_orchard_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>
orchard only.Finds the reference to the transaction that reveals the given Orchard nullifier in the backing data store, if known.
Sourcefn detect_ironwood_spend(
&self,
nf: &Nullifier,
) -> Result<Option<Self::TxRef>, Self::Error>
Available on crate feature orchard only.
fn detect_ironwood_spend( &self, nf: &Nullifier, ) -> Result<Option<Self::TxRef>, Self::Error>
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.
Sourcefn get_account_ref(
&self,
account_uuid: Self::AccountId,
) -> Result<Self::AccountRef, Self::Error>
Available on crate feature transparent-inputs only.
fn get_account_ref( &self, account_uuid: Self::AccountId, ) -> Result<Self::AccountRef, Self::Error>
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.
Sourcefn get_account_internal(
&self,
account_id: Self::AccountRef,
) -> Result<Option<Self::Account>, Self::Error>
Available on crate feature transparent-inputs only.
fn get_account_internal( &self, account_id: Self::AccountRef, ) -> Result<Option<Self::Account>, Self::Error>
transparent-inputs only.Returns the full account record for the given wallet-internal account reference.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".