pub struct WalletDb<C, P> { /* private fields */ }
Expand description

A wrapper for the SQLite connection to the wallet database.

Implementations§

source§

impl<P: Parameters + Clone> WalletDb<Connection, P>

source

pub fn for_path<F: AsRef<Path>>(path: F, params: P) -> Result<Self, Error>

Construct a connection to the wallet database stored at the specified path.

source

pub fn transactionally<F, A, E: From<Error>>(&mut self, f: F) -> Result<A, E>where F: FnOnce(&mut WalletDb<SqlTransaction<'_>, P>) -> Result<A, E>,

Trait Implementations§

source§

impl<P: Parameters> WalletCommitmentTrees for WalletDb<Connection, P>

§

type Error = Error

§

type SaplingShardStore<'a> = SqliteShardStore<&'a Transaction<'a>, Node, SAPLING_SHARD_HEIGHT>

source§

fn with_sapling_tree_mut<F, A, E>(&mut self, callback: F) -> Result<A, E>where for<'a> F: FnMut(&'a mut ShardTree<Self::SaplingShardStore<'a>, { sapling::NOTE_COMMITMENT_TREE_DEPTH }, SAPLING_SHARD_HEIGHT>) -> Result<A, E>, E: From<ShardTreeError<Self::Error>>,

source§

fn put_sapling_subtree_roots( &mut self, start_index: u64, roots: &[CommitmentTreeRoot<Node>] ) -> Result<(), ShardTreeError<Self::Error>>

Adds a sequence of note commitment tree subtree roots to the data store.
source§

fn get_checkpoint_depth( &self, min_confirmations: NonZeroU32 ) -> Result<usize, ShardTreeError<Self::Error>>

Returns the depth of the checkpoint in the tree that can be used to create a witness at the anchor having the given number of confirmations. Read more
source§

impl<'conn, P: Parameters> WalletCommitmentTrees for WalletDb<SqlTransaction<'conn>, P>

§

type Error = Error

§

type SaplingShardStore<'a> = SqliteShardStore<&'a Transaction<'a>, Node, SAPLING_SHARD_HEIGHT>

source§

fn with_sapling_tree_mut<F, A, E>(&mut self, callback: F) -> Result<A, E>where for<'a> F: FnMut(&'a mut ShardTree<Self::SaplingShardStore<'a>, { sapling::NOTE_COMMITMENT_TREE_DEPTH }, SAPLING_SHARD_HEIGHT>) -> Result<A, E>, E: From<ShardTreeError<Error>>,

source§

fn put_sapling_subtree_roots( &mut self, start_index: u64, roots: &[CommitmentTreeRoot<Node>] ) -> Result<(), ShardTreeError<Self::Error>>

Adds a sequence of note commitment tree subtree roots to the data store.
source§

fn get_checkpoint_depth( &self, min_confirmations: NonZeroU32 ) -> Result<usize, ShardTreeError<Self::Error>>

Returns the depth of the checkpoint in the tree that can be used to create a witness at the anchor having the given number of confirmations. Read more
source§

impl<C: Borrow<Connection>, P: Parameters> WalletRead for WalletDb<C, P>

§

type Error = SqliteClientError

The type of errors produced by a wallet backend.
§

type NoteRef = ReceivedNoteId

Backend-specific note identifier. Read more
source§

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

Returns the height of the chain as known to the wallet as of the most recent call to WalletWrite::update_chain_tip. Read more
source§

fn block_metadata( &self, height: BlockHeight ) -> Result<Option<BlockMetadata>, Self::Error>

Returns the available block metadata for the block at the specified height, if any.
source§

fn block_fully_scanned(&self) -> Result<Option<BlockMetadata>, Self::Error>

Returns the metadata for the block at the height to which the wallet has been fully scanned. Read more
source§

fn block_max_scanned(&self) -> Result<Option<BlockMetadata>, Self::Error>

Returns block metadata for the maximum height that the wallet has scanned. Read more
source§

fn suggest_scan_ranges(&self) -> Result<Vec<ScanRange>, Self::Error>

Returns a vector of suggested scan ranges based upon the current wallet state. Read more
source§

fn get_target_and_anchor_heights( &self, min_confirmations: NonZeroU32 ) -> Result<Option<(BlockHeight, BlockHeight)>, Self::Error>

Returns the default target height (for the block in which a new transaction would be mined) and anchor height (to use for a new transaction), given the range of block heights that the backend knows about. Read more
source§

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

Returns the minimum block height corresponding to an unspent note in the wallet.
source§

fn get_block_hash( &self, block_height: BlockHeight ) -> Result<Option<BlockHash>, Self::Error>

Returns the block hash for the block at the given height, if the associated block data is available. Returns Ok(None) if the hash is not found in the database.
source§

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

Returns the block height and hash for the block at the maximum scanned block height. Read more
source§

fn get_tx_height(&self, txid: TxId) -> Result<Option<BlockHeight>, Self::Error>

Returns the block height in which the specified transaction was mined, or Ok(None) if the transaction is not in the main chain.
source§

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

Returns the birthday height for the wallet. Read more
source§

fn get_account_birthday( &self, account: AccountId ) -> Result<BlockHeight, Self::Error>

Returns the birthday height for the given account, or an error if the account is not known to the wallet.
source§

fn get_current_address( &self, account: AccountId ) -> Result<Option<UnifiedAddress>, Self::Error>

Returns the most recently generated unified address for the specified account, if the account identifier specified refers to a valid account for this wallet. Read more
source§

fn get_unified_full_viewing_keys( &self ) -> Result<HashMap<AccountId, UnifiedFullViewingKey>, Self::Error>

Returns all unified full viewing keys known to this wallet.
source§

fn get_account_for_ufvk( &self, ufvk: &UnifiedFullViewingKey ) -> Result<Option<AccountId>, Self::Error>

Returns the account id corresponding to a given [UnifiedFullViewingKey], if any.
source§

fn is_valid_account_extfvk( &self, account: AccountId, extfvk: &ExtendedFullViewingKey ) -> Result<bool, Self::Error>

Checks whether the specified extended full viewing key is associated with the account.
source§

fn get_wallet_summary( &self, min_confirmations: u32 ) -> Result<Option<WalletSummary>, Self::Error>

Returns the wallet balances and sync status for an account given the specified minimum number of confirmations, or Ok(None) if the wallet has no balance data available.
source§

fn get_memo(&self, note_id: NoteId) -> Result<Option<Memo>, Self::Error>

Returns the memo for a note. Read more
source§

fn get_transaction(&self, txid: TxId) -> Result<Transaction, Self::Error>

Returns a transaction.
source§

fn get_sapling_nullifiers( &self, query: NullifierQuery ) -> Result<Vec<(AccountId, Nullifier)>, Self::Error>

Returns the nullifiers for notes that the wallet is tracking, along with their associated account IDs, that are either unspent or have not yet been confirmed as spent (in that a spending transaction known to the wallet has not yet been included in a block).
source§

fn get_spendable_sapling_notes( &self, account: AccountId, anchor_height: BlockHeight, exclude: &[Self::NoteRef] ) -> Result<Vec<ReceivedSaplingNote<Self::NoteRef>>, Self::Error>

Return all unspent Sapling notes, excluding the specified note IDs.
source§

fn select_spendable_sapling_notes( &self, account: AccountId, target_value: Amount, anchor_height: BlockHeight, exclude: &[Self::NoteRef] ) -> Result<Vec<ReceivedSaplingNote<Self::NoteRef>>, Self::Error>

Returns a list of spendable Sapling notes sufficient to cover the specified target value, if possible.
source§

fn get_transparent_receivers( &self, _account: AccountId ) -> Result<HashMap<TransparentAddress, AddressMetadata>, Self::Error>

Returns the set of all transparent receivers associated with the given account. Read more
source§

fn get_unspent_transparent_outputs( &self, _address: &TransparentAddress, _max_height: BlockHeight, _exclude: &[OutPoint] ) -> Result<Vec<WalletTransparentOutput>, Self::Error>

Returns a list of unspent transparent UTXOs that appear in the chain at heights up to and including max_height.
source§

fn get_transparent_balances( &self, _account: AccountId, _max_height: BlockHeight ) -> Result<HashMap<TransparentAddress, Amount>, Self::Error>

Returns a mapping from transparent receiver to not-yet-shielded UTXO balance, for each address associated with a nonzero balance.
source§

impl<P: Parameters> WalletWrite for WalletDb<Connection, P>

§

type UtxoRef = UtxoId

The type of identifiers used to look up transparent UTXOs.
source§

fn create_account( &mut self, seed: &SecretVec<u8>, birthday: AccountBirthday ) -> Result<(AccountId, UnifiedSpendingKey), Self::Error>

Tells the wallet to track the next available account-level spend authority, given the current set of ZIP 316 account identifiers known to the wallet database. Read more
source§

fn get_next_available_address( &mut self, account: AccountId ) -> Result<Option<UnifiedAddress>, Self::Error>

Generates and persists the next available diversified address, given the current addresses known to the wallet. Read more
source§

fn put_blocks( &mut self, blocks: Vec<ScannedBlock<Nullifier>> ) -> Result<(), Self::Error>

Updates the state of the wallet database by persisting the provided block information, along with the note commitments that were detected when scanning the block for transactions pertaining to this wallet. Read more
source§

fn update_chain_tip( &mut self, tip_height: BlockHeight ) -> Result<(), Self::Error>

Updates the wallet’s view of the blockchain. Read more
source§

fn store_decrypted_tx( &mut self, d_tx: DecryptedTransaction<'_> ) -> Result<(), Self::Error>

Caches a decrypted transaction in the persistent wallet store.
source§

fn store_sent_tx( &mut self, sent_tx: &SentTransaction<'_> ) -> Result<(), Self::Error>

Saves information about a transaction that was constructed and sent by the wallet to the persistent wallet store.
source§

fn truncate_to_height( &mut self, block_height: BlockHeight ) -> Result<(), Self::Error>

Truncates the wallet database to the specified height. Read more
source§

fn put_received_transparent_utxo( &mut self, _output: &WalletTransparentOutput ) -> Result<Self::UtxoRef, Self::Error>

Adds a transparent UTXO received by the wallet to the data store.

Auto Trait Implementations§

§

impl<C, P> RefUnwindSafe for WalletDb<C, P>where C: RefUnwindSafe, P: RefUnwindSafe,

§

impl<C, P> Send for WalletDb<C, P>where C: Send, P: Send,

§

impl<C, P> Sync for WalletDb<C, P>where C: Sync, P: Sync,

§

impl<C, P> Unpin for WalletDb<C, P>where C: Unpin, P: Unpin,

§

impl<C, P> UnwindSafe for WalletDb<C, P>where C: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> Twhere Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pipe for Twhere T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> Rwhere Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more