Struct PersistedWallet

Source
pub struct PersistedWallet<P> { /* private fields */ }
Expand description

Represents a persisted wallet which persists into type P.

This is a light wrapper around Wallet that enforces some level of safety-checking when used with a WalletPersister or AsyncWalletPersister implementation. Safety checks assume that WalletPersister and/or AsyncWalletPersister are implemented correctly.

Checks include:

  • Ensure the persister is initialized before data is persisted.
  • Ensure there were no previously persisted wallet data before creating a fresh wallet and persisting it.
  • Only clear the staged changes of Wallet after persisting succeeds.
  • Ensure the wallet is persisted to the same P type as when created/loaded. Note that this is not completely fool-proof as you can have multiple instances of the same P type that are connected to different databases.

Implementations§

Source§

impl<P: WalletPersister> PersistedWallet<P>

Methods when P is a WalletPersister.

Source

pub fn create( persister: &mut P, params: CreateParams, ) -> Result<Self, CreateWithPersistError<P::Error>>

Create a new PersistedWallet with the given persister and params.

Source

pub fn load( persister: &mut P, params: LoadParams, ) -> Result<Option<Self>, LoadWithPersistError<P::Error>>

Load a previously PersistedWallet from the given persister and params.

Source

pub fn persist(&mut self, persister: &mut P) -> Result<bool, P::Error>

Persist staged changes of wallet into persister.

Returns whether any new changes were persisted.

If the persister errors, the staged changes will not be cleared.

Source§

impl<P: AsyncWalletPersister> PersistedWallet<P>

Methods when P is an AsyncWalletPersister.

Source

pub async fn create_async( persister: &mut P, params: CreateParams, ) -> Result<Self, CreateWithPersistError<P::Error>>

Create a new PersistedWallet with the given async persister and params.

Source

pub async fn load_async( persister: &mut P, params: LoadParams, ) -> Result<Option<Self>, LoadWithPersistError<P::Error>>

Load a previously PersistedWallet from the given async persister and params.

Source

pub async fn persist_async( &mut self, persister: &mut P, ) -> Result<bool, P::Error>

Persist staged changes of wallet into an async persister.

Returns whether any new changes were persisted.

If the persister errors, the staged changes will not be cleared.

Methods from Deref<Target = Wallet>§

Source

pub fn network(&self) -> Network

Get the Bitcoin network the wallet is using.

Source

pub fn keychains( &self, ) -> impl Iterator<Item = (KeychainKind, &ExtendedDescriptor)>

Iterator over all keychains in this wallet

Source

pub fn peek_address(&self, keychain: KeychainKind, index: u32) -> AddressInfo

Peek an address of the given keychain at index without revealing it.

For non-wildcard descriptors this returns the same address at every provided index.

§Panics

This panics when the caller requests for an address of derivation index greater than the BIP32 max index.

Source

pub fn reveal_next_address(&mut self, keychain: KeychainKind) -> AddressInfo

Attempt to reveal the next address of the given keychain.

This will increment the keychain’s derivation index. If the keychain’s descriptor doesn’t contain a wildcard or every address is already revealed up to the maximum derivation index defined in BIP32, then the last revealed address will be returned.

WARNING: To avoid address reuse you must persist the changes resulting from one or more calls to this method before closing the wallet. For example:

use bdk_chain::rusqlite::Connection;
let mut conn = Connection::open_in_memory().expect("must open connection");
let mut wallet = LoadParams::new()
    .load_wallet(&mut conn)
    .expect("database is okay")
    .expect("database has data");
let next_address = wallet.reveal_next_address(KeychainKind::External);
wallet.persist(&mut conn).expect("write is okay");

// Now it's safe to show the user their next address!
println!("Next address: {}", next_address.address);
Source

pub fn reveal_addresses_to( &mut self, keychain: KeychainKind, index: u32, ) -> impl Iterator<Item = AddressInfo> + '_

Reveal addresses up to and including the target index and return an iterator of newly revealed addresses.

If the target index is unreachable, we make a best effort to reveal up to the last possible index. If all addresses up to the given index are already revealed, then no new addresses are returned.

WARNING: To avoid address reuse you must persist the changes resulting from one or more calls to this method before closing the wallet. See Wallet::reveal_next_address.

Source

pub fn next_unused_address(&mut self, keychain: KeychainKind) -> AddressInfo

Get the next unused address for the given keychain, i.e. the address with the lowest derivation index that hasn’t been used in a transaction.

This will attempt to reveal a new address if all previously revealed addresses have been used, in which case the returned address will be the same as calling Wallet::reveal_next_address.

WARNING: To avoid address reuse you must persist the changes resulting from one or more calls to this method before closing the wallet. See Wallet::reveal_next_address.

Source

pub fn mark_used(&mut self, keychain: KeychainKind, index: u32) -> bool

Marks an address used of the given keychain at index.

Returns whether the given index was present and then removed from the unused set.

Source

pub fn unmark_used(&mut self, keychain: KeychainKind, index: u32) -> bool

Undoes the effect of mark_used and returns whether the index was inserted back into the unused set.

Since this is only a superficial marker, it will have no effect if the address at the given index was actually used, i.e. the wallet has previously indexed a tx output for the derived spk.

Source

pub fn list_unused_addresses( &self, keychain: KeychainKind, ) -> impl DoubleEndedIterator<Item = AddressInfo> + '_

List addresses that are revealed but unused.

Note if the returned iterator is empty you can reveal more addresses by using reveal_next_address or reveal_addresses_to.

Source

pub fn is_mine(&self, script: ScriptBuf) -> bool

Return whether or not a script is part of this wallet (either internal or external)

Source

pub fn derivation_of_spk(&self, spk: ScriptBuf) -> Option<(KeychainKind, u32)>

Finds how the wallet derived the script pubkey spk.

Will only return Some(_) if the wallet has given out the spk.

Source

pub fn list_unspent(&self) -> impl Iterator<Item = LocalOutput> + '_

Return the list of unspent outputs of this wallet

Source

pub fn tx_details(&self, txid: Txid) -> Option<TxDetails>

Get the TxDetails of a wallet transaction.

If the transaction with txid Txid cannot be found in the wallet’s transactions, None is returned.

Source

pub fn list_output(&self) -> impl Iterator<Item = LocalOutput> + '_

List all relevant outputs (includes both spent and unspent, confirmed and unconfirmed).

To list only unspent outputs (UTXOs), use Wallet::list_unspent instead.

Source

pub fn checkpoints(&self) -> CheckPointIter

Get all the checkpoints the wallet is currently storing indexed by height.

Source

pub fn latest_checkpoint(&self) -> CheckPoint

Returns the latest checkpoint.

Source

pub fn all_unbounded_spk_iters( &self, ) -> BTreeMap<KeychainKind, impl Iterator<Item = Indexed<ScriptBuf>> + Clone>

Get unbounded script pubkey iterators for both Internal and External keychains.

This is intended to be used when doing a full scan of your addresses (e.g. after restoring from seed words). You pass the BTreeMap of iterators to a blockchain data source (e.g. electrum server) which will go through each address until it reaches a stop gap.

Note carefully that iterators go over all script pubkeys on the keychains (not what script pubkeys the wallet is storing internally).

Source

pub fn unbounded_spk_iter( &self, keychain: KeychainKind, ) -> impl Iterator<Item = Indexed<ScriptBuf>> + Clone

Get an unbounded script pubkey iterator for the given keychain.

See all_unbounded_spk_iters for more documentation

Source

pub fn get_utxo(&self, op: OutPoint) -> Option<LocalOutput>

Returns the utxo owned by this wallet corresponding to outpoint if it exists in the wallet’s database.

Source

pub fn insert_txout(&mut self, outpoint: OutPoint, txout: TxOut)

Inserts a TxOut at OutPoint into the wallet’s transaction graph.

This is used for providing a previous output’s value so that we can use calculate_fee or calculate_fee_rate on a given transaction. Outputs inserted with this method will not be returned in list_unspent or list_output.

WARNINGS: This should only be used to add TxOuts that the wallet does not own. Only insert TxOuts that you trust the values for!

You must persist the changes resulting from one or more calls to this method if you need the inserted TxOut data to be reloaded after closing the wallet. See Wallet::reveal_next_address.

Source

pub fn calculate_fee( &self, tx: &Transaction, ) -> Result<Amount, CalculateFeeError>

Calculates the fee of a given transaction. Returns Amount::ZERO if tx is a coinbase transaction.

To calculate the fee for a Transaction with inputs not owned by this wallet you must manually insert the TxOut(s) into the tx graph using the insert_txout function.

Note tx does not have to be in the graph for this to work.

§Examples
let tx = wallet.get_tx(txid).expect("transaction").tx_node.tx;
let fee = wallet.calculate_fee(&tx).expect("fee");
let tx = &psbt.clone().extract_tx().expect("tx");
let fee = wallet.calculate_fee(tx).expect("fee");
Source

pub fn calculate_fee_rate( &self, tx: &Transaction, ) -> Result<FeeRate, CalculateFeeError>

Calculate the FeeRate for a given transaction.

To calculate the fee rate for a Transaction with inputs not owned by this wallet you must manually insert the TxOut(s) into the tx graph using the insert_txout function.

Note tx does not have to be in the graph for this to work.

§Examples
let tx = wallet.get_tx(txid).expect("transaction").tx_node.tx;
let fee_rate = wallet.calculate_fee_rate(&tx).expect("fee rate");
let tx = &psbt.clone().extract_tx().expect("tx");
let fee_rate = wallet.calculate_fee_rate(tx).expect("fee rate");
Source

pub fn sent_and_received(&self, tx: &Transaction) -> (Amount, Amount)

Compute the tx’s sent and received Amounts.

This method returns a tuple (sent, received). Sent is the sum of the txin amounts that spend from previous txouts tracked by this wallet. Received is the summation of this tx’s outputs that send to script pubkeys tracked by this wallet.

§Examples
let tx = wallet.get_tx(txid).expect("tx exists").tx_node.tx;
let (sent, received) = wallet.sent_and_received(&tx);
let tx = &psbt.clone().extract_tx().expect("tx");
let (sent, received) = wallet.sent_and_received(tx);
Source

pub fn get_tx(&self, txid: Txid) -> Option<WalletTx<'_>>

Get a single transaction from the wallet as a WalletTx (if the transaction exists).

WalletTx contains the full transaction alongside meta-data such as:

  • Blocks that the transaction is Anchored in. These may or may not be blocks that exist in the best chain.
  • The ChainPosition of the transaction in the best chain - whether the transaction is confirmed or unconfirmed. If the transaction is confirmed, the anchor which proves the confirmation is provided. If the transaction is unconfirmed, the unix timestamp of when the transaction was last seen in the mempool is provided.
use bdk_chain::Anchor;
use bdk_wallet::{chain::ChainPosition, Wallet};

let wallet_tx = wallet.get_tx(my_txid).expect("panic if tx does not exist");

// get reference to full transaction
println!("my tx: {:#?}", wallet_tx.tx_node.tx);

// list all transaction anchors
for anchor in wallet_tx.tx_node.anchors {
    println!(
        "tx is anchored by block of hash {}",
        anchor.anchor_block().hash
    );
}

// get confirmation status of transaction
match wallet_tx.chain_position {
    ChainPosition::Confirmed {
        anchor,
        transitively: None,
    } => println!(
        "tx is confirmed at height {}, we know this since {}:{} is in the best chain",
        anchor.block_id.height, anchor.block_id.height, anchor.block_id.hash,
    ),
    ChainPosition::Confirmed {
        anchor,
        transitively: Some(_),
    } => println!(
        "tx is an ancestor of a tx anchored in {}:{}",
        anchor.block_id.height, anchor.block_id.hash,
    ),
    ChainPosition::Unconfirmed { first_seen, last_seen } => println!(
        "tx is first seen at {:?}, last seen at {:?}, it is unconfirmed as it is not anchored in the best chain",
        first_seen, last_seen
    ),
}
Source

pub fn transactions(&self) -> impl Iterator<Item = WalletTx<'_>> + '_

Iterate over relevant and canonical transactions in the wallet.

A transaction is relevant when it spends from or spends to at least one tracked output. A transaction is canonical when it is confirmed in the best chain, or does not conflict with any transaction confirmed in the best chain.

To iterate over all transactions, including those that are irrelevant and not canonical, use TxGraph::full_txs.

To iterate over all canonical transactions, including those that are irrelevant, use TxGraph::list_canonical_txs.

Source

pub fn transactions_sort_by<F>(&self, compare: F) -> Vec<WalletTx<'_>>
where F: FnMut(&WalletTx<'_>, &WalletTx<'_>) -> Ordering,

Array of relevant and canonical transactions in the wallet sorted with a comparator function.

This is a helper method equivalent to collecting the result of Wallet::transactions into a Vec and then sorting it.

§Example
// Transactions by chain position: first unconfirmed then descending by confirmed height.
let sorted_txs: Vec<WalletTx> =
    wallet.transactions_sort_by(|tx1, tx2| tx2.chain_position.cmp(&tx1.chain_position));
Source

pub fn balance(&self) -> Balance

Return the balance, separated into available, trusted-pending, untrusted-pending and immature values.

Source

pub fn add_signer( &mut self, keychain: KeychainKind, ordering: SignerOrdering, signer: Arc<dyn TransactionSigner>, )

Add an external signer

See the signer module for an example.

Source

pub fn set_keymap(&mut self, keychain: KeychainKind, keymap: KeyMap)

Set the keymap for a given keychain.

Note this does nothing if the given keychain has no descriptor because we won’t know the context (segwit, taproot, etc) in which to create signatures.

Source

pub fn set_keymaps( &mut self, keymaps: impl IntoIterator<Item = (KeychainKind, KeyMap)>, )

Set the keymap for each keychain.

Source

pub fn get_signers(&self, keychain: KeychainKind) -> Arc<SignersContainer>

Get the signers

§Example
let descriptor = "wpkh(tprv8ZgxMBicQKsPe73PBRSmNbTfbcsZnwWhz5eVmhHpi31HW29Z7mc9B4cWGRQzopNUzZUT391DeDJxL2PefNunWyLgqCKRMDkU1s2s8bAfoSk/84'/1'/0'/0/*)";
let change_descriptor = "wpkh(tprv8ZgxMBicQKsPe73PBRSmNbTfbcsZnwWhz5eVmhHpi31HW29Z7mc9B4cWGRQzopNUzZUT391DeDJxL2PefNunWyLgqCKRMDkU1s2s8bAfoSk/84'/1'/0'/1/*)";
let wallet = Wallet::create(descriptor, change_descriptor)
    .network(Network::Testnet)
    .create_wallet_no_persist()?;
for secret_key in wallet.get_signers(KeychainKind::External).signers().iter().filter_map(|s| s.descriptor_secret_key()) {
    // secret_key: tprv8ZgxMBicQKsPe73PBRSmNbTfbcsZnwWhz5eVmhHpi31HW29Z7mc9B4cWGRQzopNUzZUT391DeDJxL2PefNunWyLgqCKRMDkU1s2s8bAfoSk/84'/0'/0'/0/*
    println!("secret_key: {}", secret_key);
}

Ok::<(), Box<dyn std::error::Error>>(())
Source

pub fn build_tx(&mut self) -> TxBuilder<'_, DefaultCoinSelectionAlgorithm>

Start building a transaction.

This returns a blank TxBuilder from which you can specify the parameters for the transaction.

§Example
let psbt = {
   let mut builder =  wallet.build_tx();
   builder
       .add_recipient(to_address.script_pubkey(), Amount::from_sat(50_000));
   builder.finish()?
};

// sign and broadcast ...
Source

pub fn build_fee_bump( &mut self, txid: Txid, ) -> Result<TxBuilder<'_, DefaultCoinSelectionAlgorithm>, BuildFeeBumpError>

Bump the fee of a transaction previously created with this wallet.

Returns an error if the transaction is already confirmed or doesn’t explicitly signal replace by fee (RBF). If the transaction can be fee bumped then it returns a TxBuilder pre-populated with the inputs and outputs of the original transaction.

§Example
let mut psbt = {
    let mut builder = wallet.build_tx();
    builder
        .add_recipient(to_address.script_pubkey(), Amount::from_sat(50_000));
    builder.finish()?
};
let _ = wallet.sign(&mut psbt, SignOptions::default())?;
let tx = psbt.clone().extract_tx().expect("tx");
// broadcast tx but it's taking too long to confirm so we want to bump the fee
let mut psbt =  {
    let mut builder = wallet.build_fee_bump(tx.compute_txid())?;
    builder
        .fee_rate(FeeRate::from_sat_per_vb(5).expect("valid feerate"));
    builder.finish()?
};

let _ = wallet.sign(&mut psbt, SignOptions::default())?;
let fee_bumped_tx = psbt.extract_tx();
// broadcast fee_bumped_tx to replace original
Source

pub fn sign( &self, psbt: &mut Psbt, sign_options: SignOptions, ) -> Result<bool, SignerError>

Sign a transaction with all the wallet’s signers, in the order specified by every signer’s SignerOrdering. This function returns the Result type with an encapsulated bool that has the value true if the PSBT was finalized, or false otherwise.

The SignOptions can be used to tweak the behavior of the software signers, and the way the transaction is finalized at the end. Note that it can’t be guaranteed that every signers will follow the options, but the “software signers” (WIF keys and xprv) defined in this library will.

§Example
let mut psbt = {
    let mut builder = wallet.build_tx();
    builder.add_recipient(to_address.script_pubkey(), Amount::from_sat(50_000));
    builder.finish()?
};
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;
assert!(finalized, "we should have signed all the inputs");
Source

pub fn policies( &self, keychain: KeychainKind, ) -> Result<Option<Policy>, DescriptorError>

Return the spending policies for the wallet’s descriptor

Source

pub fn public_descriptor(&self, keychain: KeychainKind) -> &ExtendedDescriptor

Returns the descriptor used to create addresses for a particular keychain.

It’s the “public” version of the wallet’s descriptor, meaning a new descriptor that has the same structure but with the all secret keys replaced by their corresponding public key. This can be used to build a watch-only version of a wallet.

Source

pub fn finalize_psbt( &self, psbt: &mut Psbt, sign_options: SignOptions, ) -> Result<bool, SignerError>

Finalize a PSBT, i.e., for each input determine if sufficient data is available to pass validation and construct the respective scriptSig or scriptWitness. Please refer to BIP174, and BIP371 for further information.

Returns true if the PSBT could be finalized, and false otherwise.

The SignOptions can be used to tweak the behavior of the finalizer.

Source

pub fn secp_ctx(&self) -> &Secp256k1<All>

Return the secp256k1 context used for all signing operations

Source

pub fn derivation_index(&self, keychain: KeychainKind) -> Option<u32>

The derivation index of this wallet. It will return None if it has not derived any addresses. Otherwise, it will return the index of the highest address it has derived.

Source

pub fn next_derivation_index(&self, keychain: KeychainKind) -> u32

The index of the next address that you would get if you were to ask the wallet for a new address

Source

pub fn cancel_tx(&mut self, tx: &Transaction)

Informs the wallet that you no longer intend to broadcast a tx that was built from it.

This frees up the change address used when creating the tx for use in future transactions.

Source

pub fn get_psbt_input( &self, utxo: LocalOutput, sighash_type: Option<PsbtSighashType>, only_witness_utxo: bool, ) -> Result<Input, CreateTxError>

get the corresponding PSBT Input for a LocalUtxo

Source

pub fn descriptor_checksum(&self, keychain: KeychainKind) -> String

Return the checksum of the public descriptor associated to keychain

Internally calls Self::public_descriptor to fetch the right descriptor

Source

pub fn apply_update( &mut self, update: impl Into<Update>, ) -> Result<(), CannotConnectError>

Applies an update to the wallet and stages the changes (but does not persist them).

Usually you create an update by interacting with some blockchain data source and inserting transactions related to your wallet into it.

After applying updates you should persist the staged wallet changes. For an example of how to persist staged wallet changes see Wallet::reveal_next_address.

Source

pub fn staged(&self) -> Option<&ChangeSet>

Get a reference of the staged ChangeSet that is yet to be committed (if any).

Source

pub fn staged_mut(&mut self) -> Option<&mut ChangeSet>

Get a mutable reference of the staged ChangeSet that is yet to be committed (if any).

Source

pub fn take_staged(&mut self) -> Option<ChangeSet>

Take the staged ChangeSet to be persisted now (if any).

Source

pub fn tx_graph(&self) -> &TxGraph<ConfirmationBlockTime>

Get a reference to the inner TxGraph.

Source

pub fn spk_index(&self) -> &KeychainTxOutIndex<KeychainKind>

Get a reference to the inner KeychainTxOutIndex.

Source

pub fn local_chain(&self) -> &LocalChain

Get a reference to the inner LocalChain.

Source

pub fn apply_block( &mut self, block: &Block, height: u32, ) -> Result<(), CannotConnectError>

Introduces a block of height to the wallet, and tries to connect it to the prev_blockhash of the block’s header.

This is a convenience method that is equivalent to calling apply_block_connected_to with prev_blockhash and height-1 as the connected_to parameter.

Source

pub fn apply_block_connected_to( &mut self, block: &Block, height: u32, connected_to: BlockId, ) -> Result<(), ApplyHeaderError>

Applies relevant transactions from block of height to the wallet, and connects the block to the internal chain.

The connected_to parameter informs the wallet how this block connects to the internal LocalChain. Relevant transactions are filtered from the block and inserted into the internal TxGraph.

WARNING: You must persist the changes resulting from one or more calls to this method if you need the inserted block data to be reloaded after closing the wallet. See Wallet::reveal_next_address.

Source

pub fn apply_unconfirmed_txs<T: Into<Arc<Transaction>>>( &mut self, unconfirmed_txs: impl IntoIterator<Item = (T, u64)>, )

Apply relevant unconfirmed transactions to the wallet.

Transactions that are not relevant are filtered out.

This method takes in an iterator of (tx, last_seen) where last_seen is the timestamp of when the transaction was last seen in the mempool. This is used for conflict resolution when there is conflicting unconfirmed transactions. The transaction with the later last_seen is prioritized.

WARNING: You must persist the changes resulting from one or more calls to this method if you need the applied unconfirmed transactions to be reloaded after closing the wallet. See Wallet::reveal_next_address.

Source

pub fn apply_evicted_txs( &mut self, evicted_txs: impl IntoIterator<Item = (Txid, u64)>, )

Apply evictions of the given transaction IDs with their associated timestamps.

This function is used to mark specific unconfirmed transactions as evicted from the mempool. Eviction means that these transactions are not considered canonical by default, and will no longer be part of the wallet’s transactions set. This can happen for example when a transaction is dropped from the mempool due to low fees or conflicts with another transaction.

Only transactions that are currently unconfirmed and canonical are considered for eviction. Transactions that are not relevant to the wallet are ignored. Note that an evicted transaction can become canonical again if it is later observed on-chain or seen in the mempool with a higher priority (e.g., due to a fee bump).

§Parameters

evicted_txs: An iterator of (Txid, u64) tuples, where:

  • Txid: The transaction ID of the transaction to be evicted.
  • u64: The timestamp indicating when the transaction was evicted from the mempool. This will usually correspond to the time of the latest chain sync. See docs for start_sync_with_revealed_spks.
§Notes
  • Not all blockchain backends support automatic mempool eviction handling - this method may be used in such cases. It can also be used to negate the effect of apply_unconfirmed_txs for a particular transaction without the need for an additional sync.
  • The changes are staged in the wallet’s internal state and must be persisted to ensure they are retained across wallet restarts. Use Wallet::take_staged to retrieve the staged changes and persist them to your database of choice.
  • Evicted transactions are removed from the wallet’s canonical transaction set, but the data remains in the wallet’s internal transaction graph for historical purposes.
  • Ensure that the timestamps provided are accurate and monotonically increasing, as they influence the wallet’s canonicalization logic.
Source

pub fn start_sync_with_revealed_spks_at( &self, start_time: u64, ) -> SyncRequestBuilder<(KeychainKind, u32)>

Create a partial SyncRequest for all revealed spks at start_time.

The start_time is used to record the time that a mempool transaction was last seen (or evicted). See Wallet::start_sync_with_revealed_spks for more.

Source

pub fn start_sync_with_revealed_spks( &self, ) -> SyncRequestBuilder<(KeychainKind, u32)>

Create a partial SyncRequest for this wallet for all revealed spks.

This is the first step when performing a spk-based wallet partial sync, the returned SyncRequest collects all revealed script pubkeys from the wallet keychain needed to start a blockchain sync with a spk based blockchain client.

The time of the sync is the current system time and is used to record the tx last-seen for mempool transactions. Or if an expected transaction is missing or evicted, it is the time of the eviction. Note that timestamps may only increase to be counted by the tx graph. To supply your own start time see Wallet::start_sync_with_revealed_spks_at.

Source

pub fn start_full_scan(&self) -> FullScanRequestBuilder<KeychainKind>

Create a `FullScanRequest for this wallet.

This is the first step when performing a spk-based wallet full scan, the returned `FullScanRequest collects iterators for the wallet’s keychain script pub keys needed to start a blockchain full scan with a spk based blockchain client.

This operation is generally only used when importing or restoring a previously used wallet in which the list of used scripts is not known.

The time of the scan is the current system time and is used to record the tx last-seen for mempool transactions. To supply your own start time see Wallet::start_full_scan_at.

Source

pub fn start_full_scan_at( &self, start_time: u64, ) -> FullScanRequestBuilder<KeychainKind>

Create a FullScanRequest builder at start_time.

Trait Implementations§

Source§

impl<P: Debug> Debug for PersistedWallet<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Deref for PersistedWallet<P>

Source§

type Target = Wallet

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<P> DerefMut for PersistedWallet<P>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<P> !Freeze for PersistedWallet<P>

§

impl<P> !RefUnwindSafe for PersistedWallet<P>

§

impl<P> Send for PersistedWallet<P>

§

impl<P> Sync for PersistedWallet<P>

§

impl<P> Unpin for PersistedWallet<P>

§

impl<P> !UnwindSafe for PersistedWallet<P>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V