From 4e4e2670d35c533c7ad9a0283136136ab6dd6f45 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 11 Sep 2024 14:22:01 +0000 Subject: [PATCH] Publish autogenerated nightly docs --- .../bdk_wallet/enum.FileStoreError.html | 6 +- .../fn.wallet_name_from_descriptor.html | 2 +- .../bdk/nightly/latest/bdk_wallet/index.html | 4 +- .../bdk_wallet/struct.PersistedWallet.html | 116 ++++++++-------- .../latest/bdk_wallet/struct.Wallet.html | 128 +++++++++--------- .../bdk_wallet/trait.WalletPersister.html | 4 +- .../latest/src/bdk_wallet/wallet/mod.rs.html | 6 + 7 files changed, 136 insertions(+), 130 deletions(-) diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/enum.FileStoreError.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/enum.FileStoreError.html index 7f23863ca6..acd758fa19 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/enum.FileStoreError.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/enum.FileStoreError.html @@ -1,8 +1,8 @@ FileStoreError in bdk_wallet - Rust

Enum bdk_wallet::FileStoreError

source ·
pub enum FileStoreError {
-    Load(AggregateChangesetsError<ChangeSet>),
+    Load(AggregateChangesetsError<ChangeSet>),
     Write(Error),
-}
Expand description

Error for [bdk_file_store]’s implementation of WalletPersister.

-

Variants§

§

Load(AggregateChangesetsError<ChangeSet>)

Error when loading from the store.

+}
Expand description

Error for bdk_file_store’s implementation of WalletPersister.

+

Variants§

§

Load(AggregateChangesetsError<ChangeSet>)

Error when loading from the store.

§

Write(Error)

Error when writing to the store.

Trait Implementations§

source§

impl Debug for FileStoreError

source§

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

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

impl Display for FileStoreError

source§

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

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

impl Error for FileStoreError

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more

Auto Trait Implementations§

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 diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/fn.wallet_name_from_descriptor.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/fn.wallet_name_from_descriptor.html index 34b9cda08e..dd7c7a62e1 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/fn.wallet_name_from_descriptor.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/fn.wallet_name_from_descriptor.html @@ -1,4 +1,4 @@ -wallet_name_from_descriptor in bdk_wallet - Rust

Function bdk_wallet::wallet_name_from_descriptor

source ·
pub fn wallet_name_from_descriptor<T>(
+wallet_name_from_descriptor in bdk_wallet - Rust

Function bdk_wallet::wallet_name_from_descriptor

source ·
pub fn wallet_name_from_descriptor<T>(
     descriptor: T,
     change_descriptor: Option<T>,
     network: Network,
diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/index.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/index.html
index 745faa20df..d87474ebc6 100644
--- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/index.html
+++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/index.html
@@ -184,7 +184,7 @@ that the Wallet can use to update its view of the chain.

submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

-

Re-exports§

  • pub extern crate bitcoin;
  • pub extern crate bdk_chain as chain;
  • pub extern crate bdk_file_store as file_store;
  • pub extern crate miniscript;
  • pub extern crate serde;
  • pub extern crate serde_json;
  • pub use descriptor::template;
  • pub use descriptor::HdKeyPaths;
  • pub use signer;
  • pub use bdk_chain::rusqlite;

Modules§

Macros§

  • Macro to write full descriptors with code
  • Macro to write descriptor fragments with code

Structs§

Enums§

Traits§

\ No newline at end of file diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.PersistedWallet.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.PersistedWallet.html index b44d06a02a..9625d63615 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.PersistedWallet.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.PersistedWallet.html @@ -39,16 +39,16 @@ connected to different databases. ) -> 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( +

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.

+
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.

+
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, @@ -67,7 +67,7 @@ wallet.persist(&mut conn).expect(// Now it's safe to show the user their next address! println!("Next address: {}", next_address.address);

-
source

pub fn reveal_addresses_to( +

source

pub fn reveal_addresses_to( &mut self, keychain: KeychainKind, index: u32 @@ -78,35 +78,35 @@ possible index. If all addresses up to the given index are already 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 +

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.

This will attempt to derive and reveal a new address if no newly revealed addresses are available. See also 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.

+
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 +

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( +

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.

+
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 list_output(&self) -> impl Iterator<Item = LocalOutput> + '_

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

+
source

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

Return the list of unspent outputs of this wallet

+
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( +

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 @@ -114,14 +114,14 @@ from seed words). You pass the BTreeMap of iterators to a blockchai 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( +

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 +

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.

+
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.

@@ -130,7 +130,7 @@ 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( +

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.

@@ -143,7 +143,7 @@ manually insert the TxOut(s) into the tx graph using the
let tx = &psbt.clone().extract_tx().expect("tx");
 let fee = wallet.calculate_fee(tx).expect("fee");
-
source

pub fn calculate_fee_rate( +

source

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

Calculate the [FeeRate] for a given transaction.

@@ -156,7 +156,7 @@ manually insert the TxOut(s) into the tx graph using the
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 [Amount]s.

+
source

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

Compute the tx’s sent and received [Amount]s.

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.

@@ -166,7 +166,7 @@ of this tx’s outputs that send to script pubkeys tracked by this wallet.

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).

+
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 @@ -204,7 +204,7 @@ the transaction was last seen in the mempool is provided.
  • last_seen, ), }
-
source

pub fn insert_checkpoint( +

source

pub fn insert_checkpoint( &mut self, block_id: BlockId ) -> Result<bool, AlterCheckPointError>

Add a new checkpoint to the wallet’s internal view of the chain.

@@ -213,7 +213,7 @@ there).

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

-
source

pub fn insert_tx<T: Into<Arc<Transaction>>>(&mut self, tx: T) -> bool

Add a transaction to the wallet’s internal view of the chain. This stages the change, +

source

pub fn insert_tx<T: Into<Arc<Transaction>>>(&mut self, tx: T) -> bool

Add a transaction to the wallet’s internal view of the chain. This stages the change, you must persist it later.

This method inserts the given tx and returns whether anything changed after insertion, which will be false if the same transaction already exists in the wallet’s transaction @@ -222,30 +222,30 @@ graph. Any changes are staged but not committed.

By default the inserted tx won’t be considered “canonical” because it’s not known whether the transaction exists in the best chain. To know whether it exists, the tx must be broadcast to the network and the wallet synced via a chain source.

-
source

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

Iterate over the transactions in the wallet.

-
source

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

source

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

Iterate over the transactions in the wallet.

+
source

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

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

§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 +

source

pub fn balance(&self) -> Balance

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

-
source

pub fn add_signer( +

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.

+
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( +

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

+
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/*)";
@@ -258,7 +258,7 @@ know the context (segwit, taproot, etc) in which to create signatures.

} Ok::<(), Box<dyn std::error::Error>>(())
-
source

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

Start building a transaction.

+
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 = {
@@ -269,7 +269,7 @@ know the context (segwit, taproot, etc) in which to create signatures.

}; // sign and broadcast ...
-
source

pub fn build_fee_bump( +

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.

@@ -297,7 +297,7 @@ pre-populated with the inputs and outputs of the original transaction.

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( +

source

pub fn sign( &self, psbt: &mut Psbt, sign_options: SignOptions @@ -315,15 +315,15 @@ in this library will.

}; let finalized = wallet.sign(&mut psbt, SignOptions::default())?; assert!(finalized, "we should have signed all the inputs"); -

source

pub fn policies( +

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.

+
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( +

source

pub fn finalize_psbt( &self, psbt: &mut Psbt, sign_options: SignOptions @@ -334,21 +334,21 @@ and BIP 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. +

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.

+
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( +

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

+
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( +

source

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

Available on crate feature std only.

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

@@ -356,7 +356,7 @@ Otherwise, it will return the index of the highest address it has derived.

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 apply_update_at( +

source

pub fn apply_update_at( &mut self, update: impl Into<Update>, seen_at: Option<u64> @@ -370,17 +370,17 @@ canonical history).

not be part of the canonical history of transactions.

Use apply_update to have the seen_at value automatically set to the current time.

-

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 unbroadcast_transactions( +

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 unbroadcast_transactions( &self ) -> impl Iterator<Item = TxNode<'_, Arc<Transaction>, ConfirmationBlockTime>>

Iterate over transactions in the wallet that are unseen and unanchored likely because they haven’t been broadcast.

-
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( +

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 @@ -388,7 +388,7 @@ because they haven’t been broadcast.

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( +

source

pub fn apply_block_connected_to( &mut self, block: &Block, height: u32, @@ -401,7 +401,7 @@ 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>>>( +

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.

@@ -413,13 +413,13 @@ when there is conflicting unconfirmed transactions. The transaction with the lat

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 start_sync_with_revealed_spks( +

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.

-
source

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

Create a [`FullScanRequest] for this wallet.

+
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.

diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.Wallet.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.Wallet.html index 5edfef73fa..9976d70e7e 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.Wallet.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/struct.Wallet.html @@ -10,7 +10,7 @@ Its main components are:

on when Wallet state needs to be persisted.

The Wallet descriptor (external) and change descriptor (internal) must not derive the same script pubkeys. See [KeychainTxOutIndex::insert_descriptor()] for more details.

-

Implementations§

source§

impl Wallet

source

pub fn create_single<D>(descriptor: D) -> CreateParams
where +

Implementations§

source§

impl Wallet

source

pub fn create_single<D>(descriptor: D) -> CreateParams
where D: IntoWalletDescriptor + Send + Clone + 'static,

Build a new single descriptor Wallet.

If you have previously created a wallet, use load instead.

§Note
@@ -47,9 +47,9 @@ equivalent of let wallet = Wallet::create(EXTERNAL_DESC, INTERNAL_DESC) .network(Network::Testnet) .create_wallet(&mut conn)?;
-
source

pub fn create_with_params(params: CreateParams) -> Result<Self, DescriptorError>

Create a new Wallet with given params.

+
source

pub fn create_with_params(params: CreateParams) -> Result<Self, DescriptorError>

Create a new Wallet with given params.

Refer to Wallet::create for more.

-
source

pub fn load() -> LoadParams

Build Wallet by loading from persistence or ChangeSet.

+
source

pub fn load() -> LoadParams

Build Wallet by loading from persistence or ChangeSet.

Note that the descriptor secret keys are not persisted to the db. You can add signers after-the-fact with Wallet::add_signer or Wallet::set_keymap. You can also add keys when building the wallet by using LoadParams::keymap. Finally @@ -77,21 +77,21 @@ which will try to populate signers if 101) .load_wallet(&mut conn)? .expect("must have data to load wallet");

-
source

pub fn load_with_params( +

source

pub fn load_with_params( changeset: ChangeSet, params: LoadParams ) -> Result<Option<Self>, LoadError>

Load Wallet from the given previously persisted ChangeSet and params.

Refer to Wallet::load for more.

-
source

pub fn network(&self) -> Network

Get the Bitcoin network the wallet is using.

-
source

pub fn keychains( +

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.

+
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.

+
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, @@ -110,7 +110,7 @@ wallet.persist(&mut conn).expect(// Now it's safe to show the user their next address! println!("Next address: {}", next_address.address);

-
source

pub fn reveal_addresses_to( +

source

pub fn reveal_addresses_to( &mut self, keychain: KeychainKind, index: u32 @@ -121,35 +121,35 @@ possible index. If all addresses up to the given index are already 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 +

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.

This will attempt to derive and reveal a new address if no newly revealed addresses are available. See also 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.

+
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 +

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( +

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.

+
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 list_output(&self) -> impl Iterator<Item = LocalOutput> + '_

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

+
source

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

Return the list of unspent outputs of this wallet

+
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( +

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 @@ -157,14 +157,14 @@ from seed words). You pass the BTreeMap of iterators to a blockchai 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( +

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 +

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.

+
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.

@@ -173,7 +173,7 @@ 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( +

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.

@@ -186,7 +186,7 @@ manually insert the TxOut(s) into the tx graph using the
let tx = &psbt.clone().extract_tx().expect("tx");
 let fee = wallet.calculate_fee(tx).expect("fee");
-
source

pub fn calculate_fee_rate( +

source

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

Calculate the [FeeRate] for a given transaction.

@@ -199,7 +199,7 @@ manually insert the TxOut(s) into the tx graph using the
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 [Amount]s.

+
source

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

Compute the tx’s sent and received [Amount]s.

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.

@@ -209,7 +209,7 @@ of this tx’s outputs that send to script pubkeys tracked by this wallet.

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).

+
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 @@ -247,7 +247,7 @@ the transaction was last seen in the mempool is provided.
  • last_seen, ), }
-
source

pub fn insert_checkpoint( +

source

pub fn insert_checkpoint( &mut self, block_id: BlockId ) -> Result<bool, AlterCheckPointError>

Add a new checkpoint to the wallet’s internal view of the chain.

@@ -256,7 +256,7 @@ there).

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

-
source

pub fn insert_tx<T: Into<Arc<Transaction>>>(&mut self, tx: T) -> bool

Add a transaction to the wallet’s internal view of the chain. This stages the change, +

source

pub fn insert_tx<T: Into<Arc<Transaction>>>(&mut self, tx: T) -> bool

Add a transaction to the wallet’s internal view of the chain. This stages the change, you must persist it later.

This method inserts the given tx and returns whether anything changed after insertion, which will be false if the same transaction already exists in the wallet’s transaction @@ -265,30 +265,30 @@ graph. Any changes are staged but not committed.

By default the inserted tx won’t be considered “canonical” because it’s not known whether the transaction exists in the best chain. To know whether it exists, the tx must be broadcast to the network and the wallet synced via a chain source.

-
source

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

Iterate over the transactions in the wallet.

-
source

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

source

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

Iterate over the transactions in the wallet.

+
source

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

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

§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 +

source

pub fn balance(&self) -> Balance

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

-
source

pub fn add_signer( +

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.

+
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( +

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

+
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/*)";
@@ -301,7 +301,7 @@ know the context (segwit, taproot, etc) in which to create signatures.

} Ok::<(), Box<dyn std::error::Error>>(())
-
source

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

Start building a transaction.

+
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 = {
@@ -312,7 +312,7 @@ know the context (segwit, taproot, etc) in which to create signatures.

}; // sign and broadcast ...
-
source

pub fn build_fee_bump( +

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.

@@ -340,7 +340,7 @@ pre-populated with the inputs and outputs of the original transaction.

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( +

source

pub fn sign( &self, psbt: &mut Psbt, sign_options: SignOptions @@ -358,15 +358,15 @@ in this library will.

}; let finalized = wallet.sign(&mut psbt, SignOptions::default())?; assert!(finalized, "we should have signed all the inputs"); -

source

pub fn policies( +

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.

+
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( +

source

pub fn finalize_psbt( &self, psbt: &mut Psbt, sign_options: SignOptions @@ -377,21 +377,21 @@ and BIP 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. +

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.

+
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( +

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

+
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( +

source

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

Available on crate feature std only.

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

@@ -399,7 +399,7 @@ Otherwise, it will return the index of the highest address it has derived.

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 apply_update_at( +

source

pub fn apply_update_at( &mut self, update: impl Into<Update>, seen_at: Option<u64> @@ -413,17 +413,17 @@ canonical history).

not be part of the canonical history of transactions.

Use apply_update to have the seen_at value automatically set to the current time.

-

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 unbroadcast_transactions( +

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 unbroadcast_transactions( &self ) -> impl Iterator<Item = TxNode<'_, Arc<Transaction>, ConfirmationBlockTime>>

Iterate over transactions in the wallet that are unseen and unanchored likely because they haven’t been broadcast.

-
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( +

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 @@ -431,7 +431,7 @@ because they haven’t been broadcast.

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( +

source

pub fn apply_block_connected_to( &mut self, block: &Block, height: u32, @@ -444,7 +444,7 @@ 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>>>( +

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.

@@ -456,20 +456,20 @@ when there is conflicting unconfirmed transactions. The transaction with the lat

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§

impl Wallet

Methods to construct sync/full-scan requests for spk-based chain sources.

-
source§

impl Wallet

Methods to construct sync/full-scan requests for spk-based chain sources.

+
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.

-
source

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

Create a [`FullScanRequest] for this wallet.

+
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.

-

Trait Implementations§

source§

impl AsRef<TxGraph<ConfirmationBlockTime>> for Wallet

source§

fn as_ref(&self) -> &TxGraph<ConfirmationBlockTime>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Debug for Wallet

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Wallet

§

impl !RefUnwindSafe for Wallet

§

impl Send for Wallet

§

impl Sync for Wallet

§

impl Unpin for Wallet

§

impl !UnwindSafe for Wallet

Blanket Implementations§

source§

impl<T> Any for T
where +

Trait Implementations§

source§

impl AsRef<TxGraph<ConfirmationBlockTime>> for Wallet

source§

fn as_ref(&self) -> &TxGraph<ConfirmationBlockTime>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Debug for Wallet

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Wallet

§

impl !RefUnwindSafe for Wallet

§

impl Send for Wallet

§

impl Sync for Wallet

§

impl Unpin for Wallet

§

impl !UnwindSafe for Wallet

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.

diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/trait.WalletPersister.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/trait.WalletPersister.html index b44825f969..9058276df4 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/trait.WalletPersister.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/bdk_wallet/trait.WalletPersister.html @@ -30,10 +30,10 @@ persister implementations may NOT require initialization at all (and not error). changeset: &ChangeSet ) -> Result<(), Self::Error>

Persist the given changeset to the persister.

This method can fail if the persister is not initialized.

-

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl WalletPersister for Connection

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl WalletPersister for Store<ChangeSet>

§

type Error = FileStoreError

source§

fn initialize(persister: &mut Self) -> Result<ChangeSet, Self::Error>

source§

fn persist( persister: &mut Self, changeset: &ChangeSet -) -> Result<(), Self::Error>

source§

impl WalletPersister for Store<ChangeSet>

source§

impl WalletPersister for Connection

§

type Error = Error

source§

fn initialize(persister: &mut Self) -> Result<ChangeSet, Self::Error>

source§

fn persist( persister: &mut Self, changeset: &ChangeSet ) -> Result<(), Self::Error>

source§

impl<'c> WalletPersister for Transaction<'c>

§

type Error = Error

source§

fn initialize(persister: &mut Self) -> Result<ChangeSet, Self::Error>

source§

fn persist( diff --git a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk_wallet/wallet/mod.rs.html b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk_wallet/wallet/mod.rs.html index 632ce1f852..31982e2683 100644 --- a/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk_wallet/wallet/mod.rs.html +++ b/docs/.vuepress/public/docs-rs/bdk/nightly/latest/src/bdk_wallet/wallet/mod.rs.html @@ -2677,6 +2677,9 @@ 2677 2678 2679 +2680 +2681 +2682

// Bitcoin Dev Kit
 // Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
 //
@@ -3069,6 +3072,7 @@
         let (chain, chain_changeset) = LocalChain::from_genesis_hash(genesis_hash);
 
         let (descriptor, mut descriptor_keymap) = (params.descriptor)(&secp, network)?;
+        check_wallet_descriptor(&descriptor)?;
         descriptor_keymap.extend(params.descriptor_keymap);
 
         let signers = Arc::new(SignersContainer::build(
@@ -3080,6 +3084,7 @@
         let (change_descriptor, change_signers) = match params.change_descriptor {
             Some(make_desc) => {
                 let (change_descriptor, mut internal_keymap) = make_desc(&secp, network)?;
+                check_wallet_descriptor(&change_descriptor)?;
                 internal_keymap.extend(params.change_descriptor_keymap);
                 let change_signers = Arc::new(SignersContainer::build(
                     internal_keymap,
@@ -3261,6 +3266,7 @@
                 }
                 // parameters must match
                 Some(make_desc) => {
+                    check_wallet_descriptor(&desc).map_err(LoadError::Descriptor)?;
                     let (exp_desc, keymap) =
                         make_desc(&secp, network).map_err(LoadError::Descriptor)?;
                     if desc.descriptor_id() != exp_desc.descriptor_id() {
-- 
2.49.0