From 30854de78174885e989302ad079c9cafc9f164b8 Mon Sep 17 00:00:00 2001
From: Steve Myers
Date: Tue, 6 Feb 2024 08:56:31 -0600
Subject: [PATCH] chore: rename bdk crate to bdk_wallet
---
.github/workflows/cont_integration.yml | 8 +-
.github/workflows/nightly_docs.yml | 6 +-
Cargo.toml | 2 +-
README.md | 2 +-
crates/hwi/Cargo.toml | 2 +-
crates/hwi/src/lib.rs | 8 +-
crates/hwi/src/signer.rs | 20 ++---
crates/{bdk => wallet}/Cargo.toml | 2 +-
crates/{bdk => wallet}/README.md | 64 ++++++-------
crates/{bdk => wallet}/examples/compiler.rs | 4 +-
.../examples/mnemonic_to_descriptors.rs | 16 ++--
crates/{bdk => wallet}/examples/policy.rs | 14 +--
.../src/descriptor/checksum.rs | 0
crates/{bdk => wallet}/src/descriptor/dsl.rs | 17 ++--
.../{bdk => wallet}/src/descriptor/error.rs | 0
crates/{bdk => wallet}/src/descriptor/mod.rs | 0
.../{bdk => wallet}/src/descriptor/policy.rs | 8 +-
.../src/descriptor/template.rs | 90 +++++++++----------
crates/{bdk => wallet}/src/keys/bip39.rs | 0
crates/{bdk => wallet}/src/keys/mod.rs | 61 +++++++------
crates/{bdk => wallet}/src/lib.rs | 0
crates/{bdk => wallet}/src/psbt/mod.rs | 0
crates/{bdk => wallet}/src/types.rs | 0
.../src/wallet/coin_selection.rs | 8 +-
crates/{bdk => wallet}/src/wallet/error.rs | 0
crates/{bdk => wallet}/src/wallet/export.rs | 8 +-
.../src/wallet/hardwaresigner.rs | 10 +--
crates/{bdk => wallet}/src/wallet/mod.rs | 36 ++++----
crates/{bdk => wallet}/src/wallet/signer.rs | 4 +-
.../{bdk => wallet}/src/wallet/tx_builder.rs | 26 +++---
crates/{bdk => wallet}/src/wallet/utils.rs | 0
crates/{bdk => wallet}/tests/common.rs | 2 +-
crates/{bdk => wallet}/tests/psbt.rs | 8 +-
crates/{bdk => wallet}/tests/wallet.rs | 38 ++++----
example-crates/wallet_electrum/Cargo.toml | 2 +-
example-crates/wallet_electrum/src/main.rs | 11 +--
.../wallet_esplora_async/Cargo.toml | 2 +-
.../wallet_esplora_async/src/main.rs | 9 +-
.../wallet_esplora_blocking/Cargo.toml | 2 +-
.../wallet_esplora_blocking/src/main.rs | 9 +-
example-crates/wallet_rpc/Cargo.toml | 2 +-
example-crates/wallet_rpc/README.md | 2 +-
example-crates/wallet_rpc/src/main.rs | 15 ++--
43 files changed, 264 insertions(+), 254 deletions(-)
rename crates/{bdk => wallet}/Cargo.toml (99%)
rename crates/{bdk => wallet}/README.md (83%)
rename crates/{bdk => wallet}/examples/compiler.rs (97%)
rename crates/{bdk => wallet}/examples/mnemonic_to_descriptors.rs (85%)
rename crates/{bdk => wallet}/examples/policy.rs (84%)
rename crates/{bdk => wallet}/src/descriptor/checksum.rs (100%)
rename crates/{bdk => wallet}/src/descriptor/dsl.rs (98%)
rename crates/{bdk => wallet}/src/descriptor/error.rs (100%)
rename crates/{bdk => wallet}/src/descriptor/mod.rs (100%)
rename crates/{bdk => wallet}/src/descriptor/policy.rs (99%)
rename crates/{bdk => wallet}/src/descriptor/template.rs (94%)
rename crates/{bdk => wallet}/src/keys/bip39.rs (100%)
rename crates/{bdk => wallet}/src/keys/mod.rs (94%)
rename crates/{bdk => wallet}/src/lib.rs (100%)
rename crates/{bdk => wallet}/src/psbt/mod.rs (100%)
rename crates/{bdk => wallet}/src/types.rs (100%)
rename crates/{bdk => wallet}/src/wallet/coin_selection.rs (99%)
rename crates/{bdk => wallet}/src/wallet/error.rs (100%)
rename crates/{bdk => wallet}/src/wallet/export.rs (99%)
rename crates/{bdk => wallet}/src/wallet/hardwaresigner.rs (91%)
rename crates/{bdk => wallet}/src/wallet/mod.rs (99%)
rename crates/{bdk => wallet}/src/wallet/signer.rs (99%)
rename crates/{bdk => wallet}/src/wallet/tx_builder.rs (98%)
rename crates/{bdk => wallet}/src/wallet/utils.rs (100%)
rename crates/{bdk => wallet}/tests/common.rs (99%)
rename crates/{bdk => wallet}/tests/psbt.rs (97%)
rename crates/{bdk => wallet}/tests/wallet.rs (99%)
diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml
index 6a4df0a81c..38393808a7 100644
--- a/.github/workflows/cont_integration.yml
+++ b/.github/workflows/cont_integration.yml
@@ -58,8 +58,8 @@ jobs:
working-directory: ./crates/chain
# TODO "--target thumbv6m-none-eabi" should work but currently does not
run: cargo check --no-default-features --features bitcoin/no-std,miniscript/no-std,hashbrown
- - name: Check bdk
- working-directory: ./crates/bdk
+ - name: Check bdk wallet
+ working-directory: ./crates/wallet
# TODO "--target thumbv6m-none-eabi" should work but currently does not
run: cargo check --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown
- name: Check esplora
@@ -89,8 +89,8 @@ jobs:
target: "wasm32-unknown-unknown"
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.1
- - name: Check bdk
- working-directory: ./crates/bdk
+ - name: Check bdk wallet
+ working-directory: ./crates/wallet
run: cargo check --target wasm32-unknown-unknown --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,dev-getrandom-wasm
- name: Check esplora
working-directory: ./crates/esplora
diff --git a/.github/workflows/nightly_docs.yml b/.github/workflows/nightly_docs.yml
index f9840fe3f6..794ca528c5 100644
--- a/.github/workflows/nightly_docs.yml
+++ b/.github/workflows/nightly_docs.yml
@@ -42,14 +42,14 @@ jobs:
repository: bitcoindevkit/bitcoindevkit.org
ref: master
- name: Create directories
- run: mkdir -p ./docs/.vuepress/public/docs-rs/bdk/nightly
+ run: mkdir -p ./docs/.vuepress/public/docs-rs/wallet/nightly
- name: Remove old latest
- run: rm -rf ./docs/.vuepress/public/docs-rs/bdk/nightly/latest
+ run: rm -rf ./docs/.vuepress/public/docs-rs/wallet/nightly/latest
- name: Download built docs
uses: actions/download-artifact@v1
with:
name: built-docs
- path: ./docs/.vuepress/public/docs-rs/bdk/nightly/latest
+ path: ./docs/.vuepress/public/docs-rs/wallet/nightly/latest
- name: Configure git
run: git config user.email "github-actions@github.com" && git config user.name "github-actions"
- name: Commit
diff --git a/Cargo.toml b/Cargo.toml
index 53ceb7cd47..f9dbbf8853 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"
members = [
- "crates/bdk",
+ "crates/wallet",
"crates/chain",
"crates/file_store",
"crates/electrum",
diff --git a/README.md b/README.md
index d322243085..0cdc862b52 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ It is built upon the excellent [`rust-bitcoin`] and [`rust-miniscript`] crates.
The project is split up into several crates in the `/crates` directory:
-- [`bdk`](./crates/bdk): Contains the central high level `Wallet` type that is built from the low-level mechanisms provided by the other components
+- [`wallet`](./crates/wallet): Contains the central high level `Wallet` type that is built from the low-level mechanisms provided by the other components
- [`chain`](./crates/chain): Tools for storing and indexing chain data
- [`file_store`](./crates/file_store): A (experimental) persistence backend for storing chain data in a single file.
- [`esplora`](./crates/esplora): Extends the [`esplora-client`] crate with methods to fetch chain data from an esplora HTTP server in the form that [`bdk_chain`] and `Wallet` can consume.
diff --git a/crates/hwi/Cargo.toml b/crates/hwi/Cargo.toml
index 711a2f9485..972569c7ed 100644
--- a/crates/hwi/Cargo.toml
+++ b/crates/hwi/Cargo.toml
@@ -9,5 +9,5 @@ license = "MIT OR Apache-2.0"
readme = "README.md"
[dependencies]
-bdk = { path = "../bdk" }
+bdk_wallet = { path = "../wallet" }
hwi = { version = "0.8.0", features = [ "miniscript"] }
diff --git a/crates/hwi/src/lib.rs b/crates/hwi/src/lib.rs
index ab87e8a871..129ceac248 100644
--- a/crates/hwi/src/lib.rs
+++ b/crates/hwi/src/lib.rs
@@ -3,10 +3,10 @@
//! This crate contains HWISigner, an implementation of a [`TransactionSigner`] to be
//! used with hardware wallets.
//! ```no_run
-//! # use bdk::bitcoin::Network;
-//! # use bdk::signer::SignerOrdering;
+//! # use bdk_wallet::bitcoin::Network;
+//! # use bdk_wallet::signer::SignerOrdering;
//! # use bdk_hwi::HWISigner;
-//! # use bdk::{KeychainKind, SignOptions, Wallet};
+//! # use bdk_wallet::{KeychainKind, SignOptions, Wallet};
//! # use hwi::HWIClient;
//! # use std::sync::Arc;
//! #
@@ -35,7 +35,7 @@
//! # }
//! ```
//!
-//! [`TransactionSigner`]: bdk::wallet::signer::TransactionSigner
+//! [`TransactionSigner`]: bdk_wallet::wallet::signer::TransactionSigner
mod signer;
pub use signer::*;
diff --git a/crates/hwi/src/signer.rs b/crates/hwi/src/signer.rs
index a297291ce2..bbb6266196 100644
--- a/crates/hwi/src/signer.rs
+++ b/crates/hwi/src/signer.rs
@@ -1,12 +1,12 @@
-use bdk::bitcoin::bip32::Fingerprint;
-use bdk::bitcoin::secp256k1::{All, Secp256k1};
-use bdk::bitcoin::Psbt;
+use bdk_wallet::bitcoin::bip32::Fingerprint;
+use bdk_wallet::bitcoin::secp256k1::{All, Secp256k1};
+use bdk_wallet::bitcoin::Psbt;
use hwi::error::Error;
use hwi::types::{HWIChain, HWIDevice};
use hwi::HWIClient;
-use bdk::signer::{SignerCommon, SignerError, SignerId, TransactionSigner};
+use bdk_wallet::signer::{SignerCommon, SignerError, SignerId, TransactionSigner};
#[derive(Debug)]
/// Custom signer for Hardware Wallets
@@ -38,7 +38,7 @@ impl TransactionSigner for HWISigner {
fn sign_transaction(
&self,
psbt: &mut Psbt,
- _sign_options: &bdk::SignOptions,
+ _sign_options: &bdk_wallet::SignOptions,
_secp: &Secp256k1,
) -> Result<(), SignerError> {
psbt.combine(
@@ -61,9 +61,9 @@ impl TransactionSigner for HWISigner {
// fn test_hardware_signer() {
// use std::sync::Arc;
//
-// use bdk::tests::get_funded_wallet;
-// use bdk::signer::SignerOrdering;
-// use bdk::bitcoin::Network;
+// use bdk_wallet::tests::get_funded_wallet;
+// use bdk_wallet::signer::SignerOrdering;
+// use bdk_wallet::bitcoin::Network;
// use crate::HWISigner;
// use hwi::HWIClient;
//
@@ -78,12 +78,12 @@ impl TransactionSigner for HWISigner {
//
// let (mut wallet, _) = get_funded_wallet(&descriptors.internal[0]);
// wallet.add_signer(
-// bdk::KeychainKind::External,
+// bdk_wallet::KeychainKind::External,
// SignerOrdering(200),
// Arc::new(custom_signer),
// );
//
-// let addr = wallet.get_address(bdk::wallet::AddressIndex::LastUnused);
+// let addr = wallet.get_address(bdk_wallet::wallet::AddressIndex::LastUnused);
// let mut builder = wallet.build_tx();
// builder.drain_to(addr.script_pubkey()).drain_wallet();
// let (mut psbt, _) = builder.finish().unwrap();
diff --git a/crates/bdk/Cargo.toml b/crates/wallet/Cargo.toml
similarity index 99%
rename from crates/bdk/Cargo.toml
rename to crates/wallet/Cargo.toml
index 425199e101..e2d403e192 100644
--- a/crates/bdk/Cargo.toml
+++ b/crates/wallet/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "bdk"
+name = "bdk_wallet"
homepage = "https://bitcoindevkit.org"
version = "1.0.0-alpha.9"
repository = "https://github.com/bitcoindevkit/bdk"
diff --git a/crates/bdk/README.md b/crates/wallet/README.md
similarity index 83%
rename from crates/bdk/README.md
rename to crates/wallet/README.md
index a3d53f2950..37e16186a8 100644
--- a/crates/bdk/README.md
+++ b/crates/wallet/README.md
@@ -8,11 +8,11 @@
-
+
-
+
@@ -20,13 +20,13 @@
-## `bdk`
+# BDK Wallet
-The `bdk` crate provides the [`Wallet`] type which is a simple, high-level
+The `bdk_wallet` crate provides the [`Wallet`] type which is a simple, high-level
interface built from the low-level components of [`bdk_chain`]. `Wallet` is a good starting point
for many simple applications as well as a good demonstration of how to use the other mechanisms to
construct a wallet. It has two keychains (external and internal) which are defined by
@@ -36,7 +36,7 @@ can create and sign transactions.
For details about the API of `Wallet` see the [module-level documentation][`Wallet`].
-### Blockchain data
+## Blockchain data
In order to get blockchain data for `Wallet` to consume, you should configure a client from
an available chain source. Typically you make a request to the chain source and get a response
@@ -55,7 +55,7 @@ that the `Wallet` can use to update its view of the chain.
* [`example-crates/wallet_electrum`](https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_electrum)
* [`example-crates/wallet_rpc`](https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_rpc)
-### Persistence
+## Persistence
To persist the `Wallet` on disk, it must be constructed with a [`PersistBackend`] implementation.
@@ -67,7 +67,7 @@ To persist the `Wallet` on disk, it must be constructed with a [`PersistBackend`
```rust,compile_fail
-use bdk::{bitcoin::Network, wallet::{ChangeSet, Wallet}};
+use bdk_wallet::{bitcoin::Network, wallet::{ChangeSet, Wallet}};
fn main() {
// Create a new file `Store`.
@@ -85,13 +85,13 @@ fn main() {
-
-
-
-
-
+
+
+
+
+
-
+
@@ -109,11 +109,11 @@ fn main() {
-
-
-
+
+
+
-
+
@@ -131,17 +131,17 @@ fn main() {
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -172,13 +172,13 @@ fn main() {
-
+
-
-
+
+
-
+
@@ -202,7 +202,7 @@ fn main() {
cargo test
```
-## License
+# License
Licensed under either of
@@ -211,14 +211,14 @@ Licensed under either of
at your option.
-### Contribution
+# Contribution
Unless you explicitly state otherwise, any contribution intentionally
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.
-[`Wallet`]: https://docs.rs/bdk/1.0.0-alpha.7/bdk/wallet/struct.Wallet.html
+[`Wallet`]: https://docs.rs/bdk_wallet/latest/bdk_wallet/wallet/struct.Wallet.html
[`PersistBackend`]: https://docs.rs/bdk_chain/latest/bdk_chain/trait.PersistBackend.html
[`bdk_chain`]: https://docs.rs/bdk_chain/latest
[`bdk_file_store`]: https://docs.rs/bdk_file_store/latest
diff --git a/crates/bdk/examples/compiler.rs b/crates/wallet/examples/compiler.rs
similarity index 97%
rename from crates/bdk/examples/compiler.rs
rename to crates/wallet/examples/compiler.rs
index 0dbe1dd23a..116df4733a 100644
--- a/crates/bdk/examples/compiler.rs
+++ b/crates/wallet/examples/compiler.rs
@@ -9,7 +9,7 @@
// You may not use this file except in accordance with one or both of these
// licenses.
-extern crate bdk;
+extern crate bdk_wallet;
extern crate bitcoin;
extern crate miniscript;
extern crate serde_json;
@@ -21,7 +21,7 @@ use bitcoin::Network;
use miniscript::policy::Concrete;
use miniscript::Descriptor;
-use bdk::{KeychainKind, Wallet};
+use bdk_wallet::{KeychainKind, Wallet};
/// Miniscript policy is a high level abstraction of spending conditions. Defined in the
/// rust-miniscript library here https://docs.rs/miniscript/7.0.0/miniscript/policy/index.html
diff --git a/crates/bdk/examples/mnemonic_to_descriptors.rs b/crates/wallet/examples/mnemonic_to_descriptors.rs
similarity index 85%
rename from crates/bdk/examples/mnemonic_to_descriptors.rs
rename to crates/wallet/examples/mnemonic_to_descriptors.rs
index d2e59fe51a..76c53cf292 100644
--- a/crates/bdk/examples/mnemonic_to_descriptors.rs
+++ b/crates/wallet/examples/mnemonic_to_descriptors.rs
@@ -7,14 +7,14 @@
// licenses.
use anyhow::anyhow;
-use bdk::bitcoin::bip32::DerivationPath;
-use bdk::bitcoin::secp256k1::Secp256k1;
-use bdk::bitcoin::Network;
-use bdk::descriptor;
-use bdk::descriptor::IntoWalletDescriptor;
-use bdk::keys::bip39::{Language, Mnemonic, WordCount};
-use bdk::keys::{GeneratableKey, GeneratedKey};
-use bdk::miniscript::Tap;
+use bdk_wallet::bitcoin::bip32::DerivationPath;
+use bdk_wallet::bitcoin::secp256k1::Secp256k1;
+use bdk_wallet::bitcoin::Network;
+use bdk_wallet::descriptor;
+use bdk_wallet::descriptor::IntoWalletDescriptor;
+use bdk_wallet::keys::bip39::{Language, Mnemonic, WordCount};
+use bdk_wallet::keys::{GeneratableKey, GeneratedKey};
+use bdk_wallet::miniscript::Tap;
use std::str::FromStr;
/// This example demonstrates how to generate a mnemonic phrase
diff --git a/crates/bdk/examples/policy.rs b/crates/wallet/examples/policy.rs
similarity index 84%
rename from crates/bdk/examples/policy.rs
rename to crates/wallet/examples/policy.rs
index 0f31cccdee..e748c3fd42 100644
--- a/crates/bdk/examples/policy.rs
+++ b/crates/wallet/examples/policy.rs
@@ -9,14 +9,14 @@
// You may not use this file except in accordance with one or both of these
// licenses.
-extern crate bdk;
+extern crate bdk_wallet;
use std::error::Error;
-use bdk::bitcoin::Network;
-use bdk::descriptor::{policy::BuildSatisfaction, ExtractPolicy, IntoWalletDescriptor};
-use bdk::wallet::signer::SignersContainer;
+use bdk_wallet::bitcoin::Network;
+use bdk_wallet::descriptor::{policy::BuildSatisfaction, ExtractPolicy, IntoWalletDescriptor};
+use bdk_wallet::wallet::signer::SignersContainer;
-/// This example describes the use of the BDK's [`bdk::descriptor::policy`] module.
+/// This example describes the use of the BDK's [`bdk_wallet::descriptor::policy`] module.
///
/// Policy is higher abstraction representation of the wallet descriptor spending condition.
/// This is useful to express complex miniscript spending conditions into more human readable form.
@@ -34,11 +34,11 @@ fn main() -> Result<(), Box> {
let desc = "wsh(multi(2,tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcLNfjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/*,tpubD6NzVbkrYhZ4XHndKkuB8FifXm8r5FQHwrN6oZuWCz13qb93rtgKvD4PQsqC4HP4yhV3tA2fqr2RbY5mNXfM7RxXUoeABoDtsFUq2zJq6YK/1/*))";
// Use the descriptor string to derive the full descriptor and a keymap.
- // The wallet descriptor can be used to create a new bdk::wallet.
+ // The wallet descriptor can be used to create a new bdk_wallet::wallet.
// While the `keymap` can be used to create a `SignerContainer`.
//
// The `SignerContainer` can sign for `PSBT`s.
- // a bdk::wallet internally uses these to handle transaction signing.
+ // a bdk_wallet::wallet internally uses these to handle transaction signing.
// But they can be used as independent tools also.
let (wallet_desc, keymap) = desc.into_wallet_descriptor(&secp, Network::Testnet)?;
diff --git a/crates/bdk/src/descriptor/checksum.rs b/crates/wallet/src/descriptor/checksum.rs
similarity index 100%
rename from crates/bdk/src/descriptor/checksum.rs
rename to crates/wallet/src/descriptor/checksum.rs
diff --git a/crates/bdk/src/descriptor/dsl.rs b/crates/wallet/src/descriptor/dsl.rs
similarity index 98%
rename from crates/bdk/src/descriptor/dsl.rs
rename to crates/wallet/src/descriptor/dsl.rs
index aa52ff279d..0d7e7c8e9c 100644
--- a/crates/bdk/src/descriptor/dsl.rs
+++ b/crates/wallet/src/descriptor/dsl.rs
@@ -423,7 +423,7 @@ macro_rules! apply_modifier {
///
/// ```
/// # use std::str::FromStr;
-/// let (my_descriptor, my_keys_map, networks) = bdk::descriptor!(sh(wsh(and_v(v:pk("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy"),older(50)))))?;
+/// let (my_descriptor, my_keys_map, networks) = bdk_wallet::descriptor!(sh(wsh(and_v(v:pk("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy"),older(50)))))?;
/// # Ok::<(), Box>(())
/// ```
///
@@ -444,7 +444,7 @@ macro_rules! apply_modifier {
/// bitcoin::PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy")?;
/// let my_timelock = 50;
///
-/// let (descriptor_a, key_map_a, networks) = bdk::descriptor! {
+/// let (descriptor_a, key_map_a, networks) = bdk_wallet::descriptor! {
/// wsh (
/// thresh(2, pk(my_key_1), s:pk(my_key_2), s:n:d:v:older(my_timelock))
/// )
@@ -452,11 +452,12 @@ macro_rules! apply_modifier {
///
/// #[rustfmt::skip]
/// let b_items = vec![
-/// bdk::fragment!(pk(my_key_1))?,
-/// bdk::fragment!(s:pk(my_key_2))?,
-/// bdk::fragment!(s:n:d:v:older(my_timelock))?,
+/// bdk_wallet::fragment!(pk(my_key_1))?,
+/// bdk_wallet::fragment!(s:pk(my_key_2))?,
+/// bdk_wallet::fragment!(s:n:d:v:older(my_timelock))?,
/// ];
-/// let (descriptor_b, mut key_map_b, networks) = bdk::descriptor!(wsh(thresh_vec(2, b_items)))?;
+/// let (descriptor_b, mut key_map_b, networks) =
+/// bdk_wallet::descriptor!(wsh(thresh_vec(2, b_items)))?;
///
/// assert_eq!(descriptor_a, descriptor_b);
/// assert_eq!(key_map_a.len(), key_map_b.len());
@@ -475,7 +476,7 @@ macro_rules! apply_modifier {
/// let my_key_2 =
/// bitcoin::PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy")?;
///
-/// let (descriptor, key_map, networks) = bdk::descriptor! {
+/// let (descriptor, key_map, networks) = bdk_wallet::descriptor! {
/// wsh (
/// multi(2, my_key_1, my_key_2)
/// )
@@ -491,7 +492,7 @@ macro_rules! apply_modifier {
/// let my_key =
/// bitcoin::PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy")?;
///
-/// let (descriptor, key_map, networks) = bdk::descriptor!(wpkh(my_key))?;
+/// let (descriptor, key_map, networks) = bdk_wallet::descriptor!(wpkh(my_key))?;
/// # Ok::<(), Box>(())
/// ```
///
diff --git a/crates/bdk/src/descriptor/error.rs b/crates/wallet/src/descriptor/error.rs
similarity index 100%
rename from crates/bdk/src/descriptor/error.rs
rename to crates/wallet/src/descriptor/error.rs
diff --git a/crates/bdk/src/descriptor/mod.rs b/crates/wallet/src/descriptor/mod.rs
similarity index 100%
rename from crates/bdk/src/descriptor/mod.rs
rename to crates/wallet/src/descriptor/mod.rs
diff --git a/crates/bdk/src/descriptor/policy.rs b/crates/wallet/src/descriptor/policy.rs
similarity index 99%
rename from crates/bdk/src/descriptor/policy.rs
rename to crates/wallet/src/descriptor/policy.rs
index 820bf2d2d3..bf8a661ea4 100644
--- a/crates/bdk/src/descriptor/policy.rs
+++ b/crates/wallet/src/descriptor/policy.rs
@@ -20,10 +20,10 @@
//!
//! ```
//! # use std::sync::Arc;
-//! # use bdk::descriptor::*;
-//! # use bdk::wallet::signer::*;
-//! # use bdk::bitcoin::secp256k1::Secp256k1;
-//! use bdk::descriptor::policy::BuildSatisfaction;
+//! # use bdk_wallet::descriptor::*;
+//! # use bdk_wallet::wallet::signer::*;
+//! # use bdk_wallet::bitcoin::secp256k1::Secp256k1;
+//! use bdk_wallet::descriptor::policy::BuildSatisfaction;
//! let secp = Secp256k1::new();
//! let desc = "wsh(and_v(v:pk(cV3oCth6zxZ1UVsHLnGothsWNsaoxRhC6aeNi5VbSdFpwUkgkEci),or_d(pk(cVMTy7uebJgvFaSBwcgvwk8qn8xSLc97dKow4MBetjrrahZoimm2),older(12960))))";
//!
diff --git a/crates/bdk/src/descriptor/template.rs b/crates/wallet/src/descriptor/template.rs
similarity index 94%
rename from crates/bdk/src/descriptor/template.rs
rename to crates/wallet/src/descriptor/template.rs
index 61f9c4f218..528be1f3b6 100644
--- a/crates/bdk/src/descriptor/template.rs
+++ b/crates/wallet/src/descriptor/template.rs
@@ -36,17 +36,17 @@ pub type DescriptorTemplateOut = (ExtendedDescriptor, KeyMap, ValidNetworks);
/// ## Example
///
/// ```
-/// use bdk::descriptor::error::Error as DescriptorError;
-/// use bdk::keys::{IntoDescriptorKey, KeyError};
-/// use bdk::miniscript::Legacy;
-/// use bdk::template::{DescriptorTemplate, DescriptorTemplateOut};
+/// use bdk_wallet::descriptor::error::Error as DescriptorError;
+/// use bdk_wallet::keys::{IntoDescriptorKey, KeyError};
+/// use bdk_wallet::miniscript::Legacy;
+/// use bdk_wallet::template::{DescriptorTemplate, DescriptorTemplateOut};
/// use bitcoin::Network;
///
/// struct MyP2PKH>(K);
///
/// impl> DescriptorTemplate for MyP2PKH {
/// fn build(self, network: Network) -> Result {
-/// Ok(bdk::descriptor!(pkh(self.0))?)
+/// Ok(bdk_wallet::descriptor!(pkh(self.0))?)
/// }
/// }
/// ```
@@ -72,10 +72,10 @@ impl IntoWalletDescriptor for T {
/// ## Example
///
/// ```
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::Wallet;
-/// # use bdk::KeychainKind;
-/// use bdk::template::P2Pkh;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::Wallet;
+/// # use bdk_wallet::KeychainKind;
+/// use bdk_wallet::template::P2Pkh;
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
@@ -102,10 +102,10 @@ impl> DescriptorTemplate for P2Pkh {
/// ## Example
///
/// ```
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::Wallet;
-/// # use bdk::KeychainKind;
-/// use bdk::template::P2Wpkh_P2Sh;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::Wallet;
+/// # use bdk_wallet::KeychainKind;
+/// use bdk_wallet::template::P2Wpkh_P2Sh;
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
@@ -133,10 +133,10 @@ impl> DescriptorTemplate for P2Wpkh_P2Sh {
/// ## Example
///
/// ```
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet};
-/// # use bdk::KeychainKind;
-/// use bdk::template::P2Wpkh;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet};
+/// # use bdk_wallet::KeychainKind;
+/// use bdk_wallet::template::P2Wpkh;
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
@@ -163,10 +163,10 @@ impl> DescriptorTemplate for P2Wpkh {
/// ## Example
///
/// ```
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::Wallet;
-/// # use bdk::KeychainKind;
-/// use bdk::template::P2TR;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::Wallet;
+/// # use bdk_wallet::KeychainKind;
+/// use bdk_wallet::template::P2TR;
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
@@ -198,9 +198,9 @@ impl> DescriptorTemplate for P2TR {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip44;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip44;
///
/// let key = bitcoin::bip32::Xpriv::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
@@ -234,9 +234,9 @@ impl> DescriptorTemplate for Bip44 {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip44Public;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip44Public;
///
/// let key = bitcoin::bip32::Xpub::from_str("tpubDDDzQ31JkZB7VxUr9bjvBivDdqoFLrDPyLWtLapArAi51ftfmCb2DPxwLQzX65iNcXz1DGaVvyvo6JQ6rTU73r2gqdEo8uov9QKRb7nKCSU")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
@@ -271,9 +271,9 @@ impl> DescriptorTemplate for Bip44Public {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip49;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip49;
///
/// let key = bitcoin::bip32::Xpriv::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
@@ -307,9 +307,9 @@ impl> DescriptorTemplate for Bip49 {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip49Public;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip49Public;
///
/// let key = bitcoin::bip32::Xpub::from_str("tpubDC49r947KGK52X5rBWS4BLs5m9SRY3pYHnvRrm7HcybZ3BfdEsGFyzCMzayi1u58eT82ZeyFZwH7DD6Q83E3fM9CpfMtmnTygnLfP59jL9L")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
@@ -344,9 +344,9 @@ impl> DescriptorTemplate for Bip49Public {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip84;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip84;
///
/// let key = bitcoin::bip32::Xpriv::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
@@ -380,9 +380,9 @@ impl> DescriptorTemplate for Bip84 {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip84Public;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip84Public;
///
/// let key = bitcoin::bip32::Xpub::from_str("tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
@@ -417,9 +417,9 @@ impl> DescriptorTemplate for Bip84Public {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip86;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip86;
///
/// let key = bitcoin::bip32::Xpriv::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
@@ -453,9 +453,9 @@ impl> DescriptorTemplate for Bip86 {
///
/// ```
/// # use std::str::FromStr;
-/// # use bdk::bitcoin::{PrivateKey, Network};
-/// # use bdk::{Wallet, KeychainKind};
-/// use bdk::template::Bip86Public;
+/// # use bdk_wallet::bitcoin::{PrivateKey, Network};
+/// # use bdk_wallet::{Wallet, KeychainKind};
+/// use bdk_wallet::template::Bip86Public;
///
/// let key = bitcoin::bip32::Xpub::from_str("tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
diff --git a/crates/bdk/src/keys/bip39.rs b/crates/wallet/src/keys/bip39.rs
similarity index 100%
rename from crates/bdk/src/keys/bip39.rs
rename to crates/wallet/src/keys/bip39.rs
diff --git a/crates/bdk/src/keys/mod.rs b/crates/wallet/src/keys/mod.rs
similarity index 94%
rename from crates/bdk/src/keys/mod.rs
rename to crates/wallet/src/keys/mod.rs
index 75abb3aa67..4649b08b7e 100644
--- a/crates/bdk/src/keys/mod.rs
+++ b/crates/wallet/src/keys/mod.rs
@@ -97,7 +97,7 @@ impl DescriptorKey {
}
}
- // This method is used internally by `bdk::fragment!` and `bdk::descriptor!`. It has to be
+ // This method is used internally by `bdk_wallet::fragment!` and `bdk_wallet::descriptor!`. It has to be
// public because it is effectively called by external crates once the macros are expanded,
// but since it is not meant to be part of the public api we hide it from the docs.
#[doc(hidden)]
@@ -206,9 +206,9 @@ impl ExtScriptContext for Ctx {
/// Key type valid in any context:
///
/// ```
-/// use bdk::bitcoin::PublicKey;
+/// use bdk_wallet::bitcoin::PublicKey;
///
-/// use bdk::keys::{DescriptorKey, IntoDescriptorKey, KeyError, ScriptContext};
+/// use bdk_wallet::keys::{DescriptorKey, IntoDescriptorKey, KeyError, ScriptContext};
///
/// pub struct MyKeyType {
/// pubkey: PublicKey,
@@ -224,9 +224,9 @@ impl ExtScriptContext for Ctx {
/// Key type that is only valid on mainnet:
///
/// ```
-/// use bdk::bitcoin::PublicKey;
+/// use bdk_wallet::bitcoin::PublicKey;
///
-/// use bdk::keys::{
+/// use bdk_wallet::keys::{
/// mainnet_network, DescriptorKey, DescriptorPublicKey, IntoDescriptorKey, KeyError,
/// ScriptContext, SinglePub, SinglePubKey,
/// };
@@ -251,9 +251,11 @@ impl ExtScriptContext for Ctx {
/// Key type that internally encodes in which context it's valid. The context is checked at runtime:
///
/// ```
-/// use bdk::bitcoin::PublicKey;
+/// use bdk_wallet::bitcoin::PublicKey;
///
-/// use bdk::keys::{DescriptorKey, ExtScriptContext, IntoDescriptorKey, KeyError, ScriptContext};
+/// use bdk_wallet::keys::{
+/// DescriptorKey, ExtScriptContext, IntoDescriptorKey, KeyError, ScriptContext,
+/// };
///
/// pub struct MyKeyType {
/// is_legacy: bool,
@@ -278,27 +280,28 @@ impl ExtScriptContext for Ctx {
/// are misused. In this case, the "segwit-only" key is used to build a `pkh()` descriptor, which
/// makes the compiler (correctly) fail.
///
-/// ```compile_fail
-/// use bdk::bitcoin::PublicKey;
+/// ```rust
+/// use bdk_wallet::bitcoin::PublicKey;
/// use core::str::FromStr;
///
-/// use bdk::keys::{DescriptorKey, IntoDescriptorKey, KeyError};
+/// use bdk_wallet::keys::{DescriptorKey, IntoDescriptorKey, KeyError};
///
/// pub struct MySegwitOnlyKeyType {
/// pubkey: PublicKey,
/// }
///
-/// impl IntoDescriptorKey for MySegwitOnlyKeyType {
-/// fn into_descriptor_key(self) -> Result, KeyError> {
+/// impl IntoDescriptorKey for MySegwitOnlyKeyType {
+/// fn into_descriptor_key(self) -> Result, KeyError> {
/// self.pubkey.into_descriptor_key()
/// }
/// }
///
/// let key = MySegwitOnlyKeyType {
-/// pubkey: PublicKey::from_str("...")?,
+/// pubkey: PublicKey::from_str(
+/// "032e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af",
+/// )?,
/// };
-/// let (descriptor, _, _) = bdk::descriptor!(pkh(key))?;
-/// // ^^^^^ changing this to `wpkh` would make it compile
+/// let (descriptor, _, _) = bdk_wallet::descriptor!(wpkh(key))?;
///
/// # Ok::<_, Box>(())
/// ```
@@ -387,9 +390,9 @@ impl From for ExtendedKey {
/// an [`Xpub`] can implement only the required `into_extended_key()` method.
///
/// ```
-/// use bdk::bitcoin;
-/// use bdk::bitcoin::bip32;
-/// use bdk::keys::{DerivableKey, ExtendedKey, KeyError, ScriptContext};
+/// use bdk_wallet::bitcoin;
+/// use bdk_wallet::bitcoin::bip32;
+/// use bdk_wallet::keys::{DerivableKey, ExtendedKey, KeyError, ScriptContext};
///
/// struct MyCustomKeyType {
/// key_data: bitcoin::PrivateKey,
@@ -418,9 +421,9 @@ impl From for ExtendedKey {
/// [`Xpriv`] or [`Xpub`] will be considered valid.
///
/// ```
-/// use bdk::bitcoin;
-/// use bdk::bitcoin::bip32;
-/// use bdk::keys::{
+/// use bdk_wallet::bitcoin;
+/// use bdk_wallet::bitcoin::bip32;
+/// use bdk_wallet::keys::{
/// any_network, DerivableKey, DescriptorKey, ExtendedKey, KeyError, ScriptContext,
/// };
///
@@ -469,9 +472,9 @@ pub trait DerivableKey: Sized {
This can be used to get direct access to `xprv`s and `xpub`s for types that implement this trait,
like [`Mnemonic`](bip39::Mnemonic) when the `keys-bip39` feature is enabled.
```rust
-use bdk::bitcoin::Network;
-use bdk::keys::{DerivableKey, ExtendedKey};
-use bdk::keys::bip39::{Mnemonic, Language};
+use bdk_wallet::bitcoin::Network;
+use bdk_wallet::keys::{DerivableKey, ExtendedKey};
+use bdk_wallet::keys::bip39::{Mnemonic, Language};
# fn main() -> Result<(), Box> {
let xkey: ExtendedKey =
@@ -764,7 +767,7 @@ fn expand_multi_keys, Ctx: ScriptContext>(
Ok((pks, key_map, valid_networks))
}
-// Used internally by `bdk::fragment!` to build `pk_k()` fragments
+// Used internally by `bdk_wallet::fragment!` to build `pk_k()` fragments
#[doc(hidden)]
pub fn make_pk, Ctx: ScriptContext>(
descriptor_key: Pk,
@@ -778,7 +781,7 @@ pub fn make_pk, Ctx: ScriptContext>(
Ok((minisc, key_map, valid_networks))
}
-// Used internally by `bdk::fragment!` to build `pk_h()` fragments
+// Used internally by `bdk_wallet::fragment!` to build `pk_h()` fragments
#[doc(hidden)]
pub fn make_pkh, Ctx: ScriptContext>(
descriptor_key: Pk,
@@ -792,7 +795,7 @@ pub fn make_pkh, Ctx: ScriptContext>(
Ok((minisc, key_map, valid_networks))
}
-// Used internally by `bdk::fragment!` to build `multi()` fragments
+// Used internally by `bdk_wallet::fragment!` to build `multi()` fragments
#[doc(hidden)]
pub fn make_multi<
Pk: IntoDescriptorKey,
@@ -812,7 +815,7 @@ pub fn make_multi<
Ok((minisc, key_map, valid_networks))
}
-// Used internally by `bdk::descriptor!` to build `sortedmulti()` fragments
+// Used internally by `bdk_wallet::descriptor!` to build `sortedmulti()` fragments
#[doc(hidden)]
pub fn make_sortedmulti(
thresh: usize,
@@ -834,7 +837,7 @@ where
Ok((descriptor, key_map, valid_networks))
}
-/// The "identity" conversion is used internally by some `bdk::fragment`s
+/// The "identity" conversion is used internally by some `bdk_wallet::fragment`s
impl IntoDescriptorKey for DescriptorKey {
fn into_descriptor_key(self) -> Result, KeyError> {
Ok(self)
diff --git a/crates/bdk/src/lib.rs b/crates/wallet/src/lib.rs
similarity index 100%
rename from crates/bdk/src/lib.rs
rename to crates/wallet/src/lib.rs
diff --git a/crates/bdk/src/psbt/mod.rs b/crates/wallet/src/psbt/mod.rs
similarity index 100%
rename from crates/bdk/src/psbt/mod.rs
rename to crates/wallet/src/psbt/mod.rs
diff --git a/crates/bdk/src/types.rs b/crates/wallet/src/types.rs
similarity index 100%
rename from crates/bdk/src/types.rs
rename to crates/wallet/src/types.rs
diff --git a/crates/bdk/src/wallet/coin_selection.rs b/crates/wallet/src/wallet/coin_selection.rs
similarity index 99%
rename from crates/bdk/src/wallet/coin_selection.rs
rename to crates/wallet/src/wallet/coin_selection.rs
index 49cb56c0cb..cce5f38d41 100644
--- a/crates/bdk/src/wallet/coin_selection.rs
+++ b/crates/wallet/src/wallet/coin_selection.rs
@@ -26,11 +26,11 @@
//! ```
//! # use std::str::FromStr;
//! # use bitcoin::*;
-//! # use bdk::wallet::{self, ChangeSet, coin_selection::*, coin_selection};
-//! # use bdk::wallet::error::CreateTxError;
+//! # use bdk_wallet::wallet::{self, ChangeSet, coin_selection::*, coin_selection};
+//! # use bdk_wallet::wallet::error::CreateTxError;
//! # use bdk_chain::PersistBackend;
-//! # use bdk::*;
-//! # use bdk::wallet::coin_selection::decide_change;
+//! # use bdk_wallet::*;
+//! # use bdk_wallet::wallet::coin_selection::decide_change;
//! # use anyhow::Error;
//! #[derive(Debug)]
//! struct AlwaysSpendEverything;
diff --git a/crates/bdk/src/wallet/error.rs b/crates/wallet/src/wallet/error.rs
similarity index 100%
rename from crates/bdk/src/wallet/error.rs
rename to crates/wallet/src/wallet/error.rs
diff --git a/crates/bdk/src/wallet/export.rs b/crates/wallet/src/wallet/export.rs
similarity index 99%
rename from crates/bdk/src/wallet/export.rs
rename to crates/wallet/src/wallet/export.rs
index 95252a01dd..21d180ad92 100644
--- a/crates/bdk/src/wallet/export.rs
+++ b/crates/wallet/src/wallet/export.rs
@@ -20,8 +20,8 @@
//! ```
//! # use std::str::FromStr;
//! # use bitcoin::*;
-//! # use bdk::wallet::export::*;
-//! # use bdk::*;
+//! # use bdk_wallet::wallet::export::*;
+//! # use bdk_wallet::*;
//! let import = r#"{
//! "descriptor": "wpkh([c258d2e4\/84h\/1h\/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe\/0\/*)",
//! "blockheight":1782088,
@@ -40,8 +40,8 @@
//! ### Export a `Wallet`
//! ```
//! # use bitcoin::*;
-//! # use bdk::wallet::export::*;
-//! # use bdk::*;
+//! # use bdk_wallet::wallet::export::*;
+//! # use bdk_wallet::*;
//! let wallet = Wallet::new_no_persist(
//! "wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/0/*)",
//! Some("wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/1/*)"),
diff --git a/crates/bdk/src/wallet/hardwaresigner.rs b/crates/wallet/src/wallet/hardwaresigner.rs
similarity index 91%
rename from crates/bdk/src/wallet/hardwaresigner.rs
rename to crates/wallet/src/wallet/hardwaresigner.rs
index 5a210f64ca..b9bff5ad50 100644
--- a/crates/bdk/src/wallet/hardwaresigner.rs
+++ b/crates/wallet/src/wallet/hardwaresigner.rs
@@ -14,11 +14,11 @@
//! This module contains HWISigner, an implementation of a [TransactionSigner] to be
//! used with hardware wallets.
//! ```no_run
-//! # use bdk::bitcoin::Network;
-//! # use bdk::signer::SignerOrdering;
-//! # use bdk::wallet::hardwaresigner::HWISigner;
-//! # use bdk::wallet::AddressIndex::New;
-//! # use bdk::{KeychainKind, SignOptions, Wallet};
+//! # use bdk_wallet::bitcoin::Network;
+//! # use bdk_wallet::signer::SignerOrdering;
+//! # use bdk_wallet::wallet::hardwaresigner::HWISigner;
+//! # use bdk_wallet::wallet::AddressIndex::New;
+//! # use bdk_wallet::{KeychainKind, SignOptions, Wallet};
//! # use hwi::HWIClient;
//! # use std::sync::Arc;
//! #
diff --git a/crates/bdk/src/wallet/mod.rs b/crates/wallet/src/wallet/mod.rs
similarity index 99%
rename from crates/bdk/src/wallet/mod.rs
rename to crates/wallet/src/wallet/mod.rs
index 1e24dd50e4..b67cc954bf 100644
--- a/crates/bdk/src/wallet/mod.rs
+++ b/crates/wallet/src/wallet/mod.rs
@@ -879,7 +879,7 @@ impl Wallet {
///
/// ```rust, no_run
/// # use bitcoin::Txid;
- /// # use bdk::Wallet;
+ /// # use bdk_wallet::Wallet;
/// # let mut wallet: Wallet = todo!();
/// # let txid:Txid = todo!();
/// let tx = wallet.get_tx(txid).expect("transaction").tx_node.tx;
@@ -888,7 +888,7 @@ impl Wallet {
///
/// ```rust, no_run
/// # use bitcoin::Psbt;
- /// # use bdk::Wallet;
+ /// # use bdk_wallet::Wallet;
/// # let mut wallet: Wallet = todo!();
/// # let mut psbt: Psbt = todo!();
/// let tx = &psbt.clone().extract_tx().expect("tx");
@@ -910,7 +910,7 @@ impl Wallet {
///
/// ```rust, no_run
/// # use bitcoin::Txid;
- /// # use bdk::Wallet;
+ /// # use bdk_wallet::Wallet;
/// # let mut wallet: Wallet = todo!();
/// # let txid:Txid = todo!();
/// let tx = wallet.get_tx(txid).expect("transaction").tx_node.tx;
@@ -919,7 +919,7 @@ impl Wallet {
///
/// ```rust, no_run
/// # use bitcoin::Psbt;
- /// # use bdk::Wallet;
+ /// # use bdk_wallet::Wallet;
/// # let mut wallet: Wallet = todo!();
/// # let mut psbt: Psbt = todo!();
/// let tx = &psbt.clone().extract_tx().expect("tx");
@@ -941,7 +941,7 @@ impl Wallet {
///
/// ```rust, no_run
/// # use bitcoin::Txid;
- /// # use bdk::Wallet;
+ /// # use bdk_wallet::Wallet;
/// # let mut wallet: Wallet = todo!();
/// # let txid:Txid = todo!();
/// let tx = wallet.get_tx(txid).expect("tx exists").tx_node.tx;
@@ -950,7 +950,7 @@ impl Wallet {
///
/// ```rust, no_run
/// # use bitcoin::Psbt;
- /// # use bdk::Wallet;
+ /// # use bdk_wallet::Wallet;
/// # let mut wallet: Wallet = todo!();
/// # let mut psbt: Psbt = todo!();
/// let tx = &psbt.clone().extract_tx().expect("tx");
@@ -971,8 +971,8 @@ impl Wallet {
/// the transaction was last seen in the mempool is provided.
///
/// ```rust, no_run
- /// use bdk::{chain::ChainPosition, Wallet};
/// use bdk_chain::Anchor;
+ /// use bdk_wallet::{chain::ChainPosition, Wallet};
/// # let wallet: Wallet = todo!();
/// # let my_txid: bitcoin::Txid = todo!();
///
@@ -1138,8 +1138,8 @@ impl Wallet {
/// ## Example
///
/// ```
- /// # use bdk::{Wallet, KeychainKind};
- /// # use bdk::bitcoin::Network;
+ /// # use bdk_wallet::{Wallet, KeychainKind};
+ /// # use bdk_wallet::bitcoin::Network;
/// let wallet = Wallet::new_no_persist("wpkh(tprv8ZgxMBicQKsPe73PBRSmNbTfbcsZnwWhz5eVmhHpi31HW29Z7mc9B4cWGRQzopNUzZUT391DeDJxL2PefNunWyLgqCKRMDkU1s2s8bAfoSk/84'/0'/0'/0/*)", None, Network::Testnet)?;
/// 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/*
@@ -1164,9 +1164,9 @@ impl Wallet {
/// ```
/// # use std::str::FromStr;
/// # use bitcoin::*;
- /// # use bdk::*;
- /// # use bdk::wallet::ChangeSet;
- /// # use bdk::wallet::error::CreateTxError;
+ /// # use bdk_wallet::*;
+ /// # use bdk_wallet::wallet::ChangeSet;
+ /// # use bdk_wallet::wallet::error::CreateTxError;
/// # use bdk_chain::PersistBackend;
/// # use anyhow::Error;
/// # let descriptor = "wpkh(tpubD6NzVbkrYhZ4Xferm7Pz4VnjdcDPFyjVu5K4iZXQ4pVN8Cks4pHVowTBXBKRhX64pkRyJZJN5xAKj4UDNnLPb5p2sSKXhewoYx5GbTdUFWq/*)";
@@ -1546,9 +1546,9 @@ impl Wallet {
/// # // TODO: remove norun -- bumping fee seems to need the tx in the wallet database first.
/// # use std::str::FromStr;
/// # use bitcoin::*;
- /// # use bdk::*;
- /// # use bdk::wallet::ChangeSet;
- /// # use bdk::wallet::error::CreateTxError;
+ /// # use bdk_wallet::*;
+ /// # use bdk_wallet::wallet::ChangeSet;
+ /// # use bdk_wallet::wallet::error::CreateTxError;
/// # use bdk_chain::PersistBackend;
/// # use anyhow::Error;
/// # let descriptor = "wpkh(tpubD6NzVbkrYhZ4Xferm7Pz4VnjdcDPFyjVu5K4iZXQ4pVN8Cks4pHVowTBXBKRhX64pkRyJZJN5xAKj4UDNnLPb5p2sSKXhewoYx5GbTdUFWq/*)";
@@ -1721,9 +1721,9 @@ impl Wallet {
/// ```
/// # use std::str::FromStr;
/// # use bitcoin::*;
- /// # use bdk::*;
- /// # use bdk::wallet::ChangeSet;
- /// # use bdk::wallet::error::CreateTxError;
+ /// # use bdk_wallet::*;
+ /// # use bdk_wallet::wallet::ChangeSet;
+ /// # use bdk_wallet::wallet::error::CreateTxError;
/// # use bdk_chain::PersistBackend;
/// # let descriptor = "wpkh(tpubD6NzVbkrYhZ4Xferm7Pz4VnjdcDPFyjVu5K4iZXQ4pVN8Cks4pHVowTBXBKRhX64pkRyJZJN5xAKj4UDNnLPb5p2sSKXhewoYx5GbTdUFWq/*)";
/// # let mut wallet = doctest_wallet!();
diff --git a/crates/bdk/src/wallet/signer.rs b/crates/wallet/src/wallet/signer.rs
similarity index 99%
rename from crates/bdk/src/wallet/signer.rs
rename to crates/wallet/src/wallet/signer.rs
index 4610657e2f..51420caa3e 100644
--- a/crates/bdk/src/wallet/signer.rs
+++ b/crates/wallet/src/wallet/signer.rs
@@ -19,8 +19,8 @@
//! # use core::str::FromStr;
//! # use bitcoin::secp256k1::{Secp256k1, All};
//! # use bitcoin::*;
-//! # use bdk::signer::*;
-//! # use bdk::*;
+//! # use bdk_wallet::signer::*;
+//! # use bdk_wallet::*;
//! # #[derive(Debug)]
//! # struct CustomHSM;
//! # impl CustomHSM {
diff --git a/crates/bdk/src/wallet/tx_builder.rs b/crates/wallet/src/wallet/tx_builder.rs
similarity index 98%
rename from crates/bdk/src/wallet/tx_builder.rs
rename to crates/wallet/src/wallet/tx_builder.rs
index e7df86678d..3e724e2da5 100644
--- a/crates/bdk/src/wallet/tx_builder.rs
+++ b/crates/wallet/src/wallet/tx_builder.rs
@@ -16,10 +16,10 @@
//! ```
//! # use std::str::FromStr;
//! # use bitcoin::*;
-//! # use bdk::*;
-//! # use bdk::wallet::ChangeSet;
-//! # use bdk::wallet::error::CreateTxError;
-//! # use bdk::wallet::tx_builder::CreateTx;
+//! # use bdk_wallet::*;
+//! # use bdk_wallet::wallet::ChangeSet;
+//! # use bdk_wallet::wallet::error::CreateTxError;
+//! # use bdk_wallet::wallet::tx_builder::CreateTx;
//! # use bdk_chain::PersistBackend;
//! # use anyhow::Error;
//! # let to_address = Address::from_str("2N4eQYCbKUHCCTUjBJeHcJp9ok6J2GZsTDt").unwrap().assume_checked();
@@ -78,12 +78,12 @@ impl TxBuilderContext for BumpFee {}
/// as in the following example:
///
/// ```
-/// # use bdk::*;
-/// # use bdk::wallet::tx_builder::*;
+/// # use bdk_wallet::*;
+/// # use bdk_wallet::wallet::tx_builder::*;
/// # use bitcoin::*;
/// # use core::str::FromStr;
-/// # use bdk::wallet::ChangeSet;
-/// # use bdk::wallet::error::CreateTxError;
+/// # use bdk_wallet::wallet::ChangeSet;
+/// # use bdk_wallet::wallet::error::CreateTxError;
/// # use bdk_chain::PersistBackend;
/// # use anyhow::Error;
/// # let mut wallet = doctest_wallet!();
@@ -263,7 +263,7 @@ impl<'a, Cs, Ctx> TxBuilder<'a, Cs, Ctx> {
/// # use std::str::FromStr;
/// # use std::collections::BTreeMap;
/// # use bitcoin::*;
- /// # use bdk::*;
+ /// # use bdk_wallet::*;
/// # let to_address =
/// Address::from_str("2N4eQYCbKUHCCTUjBJeHcJp9ok6J2GZsTDt")
/// .unwrap()
@@ -754,10 +754,10 @@ impl<'a, Cs: CoinSelectionAlgorithm> TxBuilder<'a, Cs, CreateTx> {
/// ```
/// # use std::str::FromStr;
/// # use bitcoin::*;
- /// # use bdk::*;
- /// # use bdk::wallet::ChangeSet;
- /// # use bdk::wallet::error::CreateTxError;
- /// # use bdk::wallet::tx_builder::CreateTx;
+ /// # use bdk_wallet::*;
+ /// # use bdk_wallet::wallet::ChangeSet;
+ /// # use bdk_wallet::wallet::error::CreateTxError;
+ /// # use bdk_wallet::wallet::tx_builder::CreateTx;
/// # use bdk_chain::PersistBackend;
/// # use anyhow::Error;
/// # let to_address =
diff --git a/crates/bdk/src/wallet/utils.rs b/crates/wallet/src/wallet/utils.rs
similarity index 100%
rename from crates/bdk/src/wallet/utils.rs
rename to crates/wallet/src/wallet/utils.rs
diff --git a/crates/bdk/tests/common.rs b/crates/wallet/tests/common.rs
similarity index 99%
rename from crates/bdk/tests/common.rs
rename to crates/wallet/tests/common.rs
index ec421551fd..a51dcafb3a 100644
--- a/crates/bdk/tests/common.rs
+++ b/crates/wallet/tests/common.rs
@@ -1,8 +1,8 @@
#![allow(unused)]
-use bdk::{KeychainKind, LocalOutput, Wallet};
use bdk_chain::indexed_tx_graph::Indexer;
use bdk_chain::{BlockId, ConfirmationTime};
+use bdk_wallet::{KeychainKind, LocalOutput, Wallet};
use bitcoin::hashes::Hash;
use bitcoin::{
transaction, Address, Amount, BlockHash, FeeRate, Network, OutPoint, Transaction, TxIn, TxOut,
diff --git a/crates/bdk/tests/psbt.rs b/crates/wallet/tests/psbt.rs
similarity index 97%
rename from crates/bdk/tests/psbt.rs
rename to crates/wallet/tests/psbt.rs
index ed7a88ad2b..5bb9f17d54 100644
--- a/crates/bdk/tests/psbt.rs
+++ b/crates/wallet/tests/psbt.rs
@@ -1,5 +1,5 @@
-use bdk::bitcoin::{Amount, FeeRate, Psbt, TxIn};
-use bdk::{psbt, KeychainKind, SignOptions};
+use bdk_wallet::bitcoin::{Amount, FeeRate, Psbt, TxIn};
+use bdk_wallet::{psbt, KeychainKind, SignOptions};
use core::str::FromStr;
mod common;
use common::*;
@@ -156,8 +156,8 @@ fn test_psbt_fee_rate_with_missing_txout() {
#[test]
fn test_psbt_multiple_internalkey_signers() {
- use bdk::signer::{SignerContext, SignerOrdering, SignerWrapper};
- use bdk::KeychainKind;
+ use bdk_wallet::signer::{SignerContext, SignerOrdering, SignerWrapper};
+ use bdk_wallet::KeychainKind;
use bitcoin::key::TapTweak;
use bitcoin::secp256k1::{schnorr, Keypair, Message, Secp256k1, XOnlyPublicKey};
use bitcoin::sighash::{Prevouts, SighashCache, TapSighashType};
diff --git a/crates/bdk/tests/wallet.rs b/crates/wallet/tests/wallet.rs
similarity index 99%
rename from crates/bdk/tests/wallet.rs
rename to crates/wallet/tests/wallet.rs
index 9a0dd3bfc3..16a6bd9c74 100644
--- a/crates/bdk/tests/wallet.rs
+++ b/crates/wallet/tests/wallet.rs
@@ -1,17 +1,17 @@
use std::str::FromStr;
use assert_matches::assert_matches;
-use bdk::descriptor::calc_checksum;
-use bdk::psbt::PsbtUtils;
-use bdk::signer::{SignOptions, SignerError};
-use bdk::wallet::coin_selection::{self, LargestFirstCoinSelection};
-use bdk::wallet::error::CreateTxError;
-use bdk::wallet::tx_builder::AddForeignUtxoError;
-use bdk::wallet::NewError;
-use bdk::wallet::{AddressInfo, Balance, Wallet};
-use bdk::KeychainKind;
use bdk_chain::COINBASE_MATURITY;
use bdk_chain::{BlockId, ConfirmationTime};
+use bdk_wallet::descriptor::calc_checksum;
+use bdk_wallet::psbt::PsbtUtils;
+use bdk_wallet::signer::{SignOptions, SignerError};
+use bdk_wallet::wallet::coin_selection::{self, LargestFirstCoinSelection};
+use bdk_wallet::wallet::error::CreateTxError;
+use bdk_wallet::wallet::tx_builder::AddForeignUtxoError;
+use bdk_wallet::wallet::NewError;
+use bdk_wallet::wallet::{AddressInfo, Balance, Wallet};
+use bdk_wallet::KeychainKind;
use bitcoin::hashes::Hash;
use bitcoin::psbt;
use bitcoin::script::PushBytesBuf;
@@ -125,7 +125,7 @@ fn new_or_load() {
assert!(
matches!(
err,
- bdk::wallet::NewOrLoadError::LoadedNetworkDoesNotMatch {
+ bdk_wallet::wallet::NewOrLoadError::LoadedNetworkDoesNotMatch {
got: Some(Network::Testnet),
expected: Network::Bitcoin
}
@@ -154,7 +154,7 @@ fn new_or_load() {
assert!(
matches!(
err,
- bdk::wallet::NewOrLoadError::LoadedGenesisDoesNotMatch { got, expected }
+ bdk_wallet::wallet::NewOrLoadError::LoadedGenesisDoesNotMatch { got, expected }
if got == Some(got_blockhash) && expected == exp_blockhash
),
"err: {}",
@@ -734,7 +734,7 @@ fn test_create_tx_absolute_high_fee() {
#[test]
fn test_create_tx_add_change() {
- use bdk::wallet::tx_builder::TxOrdering;
+ use bdk_wallet::wallet::tx_builder::TxOrdering;
let (mut wallet, _) = get_funded_wallet(get_test_wpkh());
let addr = wallet.next_unused_address(KeychainKind::External).unwrap();
@@ -789,7 +789,7 @@ fn test_create_tx_ordering_respected() {
builder
.add_recipient(addr.script_pubkey(), 30_000)
.add_recipient(addr.script_pubkey(), 10_000)
- .ordering(bdk::wallet::tx_builder::TxOrdering::Bip69Lexicographic);
+ .ordering(bdk_wallet::wallet::tx_builder::TxOrdering::Bip69Lexicographic);
let psbt = builder.finish().unwrap();
let fee = check_fee!(wallet, psbt);
@@ -2866,7 +2866,7 @@ fn test_sending_to_bip350_bech32m_address() {
#[test]
fn test_get_address() {
- use bdk::descriptor::template::Bip84;
+ use bdk_wallet::descriptor::template::Bip84;
let key = bitcoin::bip32::Xpriv::from_str("tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy").unwrap();
let wallet = Wallet::new_no_persist(
Bip84(key, KeychainKind::External),
@@ -2937,7 +2937,7 @@ fn test_reveal_addresses() {
#[test]
fn test_get_address_no_reuse_single_descriptor() {
- use bdk::descriptor::template::Bip84;
+ use bdk_wallet::descriptor::template::Bip84;
use std::collections::HashSet;
let key = bitcoin::bip32::Xpriv::from_str("tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy").unwrap();
@@ -3299,7 +3299,7 @@ fn test_taproot_script_spend() {
#[test]
fn test_taproot_script_spend_sign_all_leaves() {
- use bdk::signer::TapLeavesOptions;
+ use bdk_wallet::signer::TapLeavesOptions;
let (mut wallet, _) = get_funded_wallet(get_test_tr_with_taptree_both_priv());
let addr = wallet.next_unused_address(KeychainKind::External).unwrap();
@@ -3328,7 +3328,7 @@ fn test_taproot_script_spend_sign_all_leaves() {
#[test]
fn test_taproot_script_spend_sign_include_some_leaves() {
- use bdk::signer::TapLeavesOptions;
+ use bdk_wallet::signer::TapLeavesOptions;
use bitcoin::taproot::TapLeafHash;
let (mut wallet, _) = get_funded_wallet(get_test_tr_with_taptree_both_priv());
@@ -3368,7 +3368,7 @@ fn test_taproot_script_spend_sign_include_some_leaves() {
#[test]
fn test_taproot_script_spend_sign_exclude_some_leaves() {
- use bdk::signer::TapLeavesOptions;
+ use bdk_wallet::signer::TapLeavesOptions;
use bitcoin::taproot::TapLeafHash;
let (mut wallet, _) = get_funded_wallet(get_test_tr_with_taptree_both_priv());
@@ -3408,7 +3408,7 @@ fn test_taproot_script_spend_sign_exclude_some_leaves() {
#[test]
fn test_taproot_script_spend_sign_no_leaves() {
- use bdk::signer::TapLeavesOptions;
+ use bdk_wallet::signer::TapLeavesOptions;
let (mut wallet, _) = get_funded_wallet(get_test_tr_with_taptree_both_priv());
let addr = wallet.next_unused_address(KeychainKind::External).unwrap();
diff --git a/example-crates/wallet_electrum/Cargo.toml b/example-crates/wallet_electrum/Cargo.toml
index 847cd90d63..2f562837fe 100644
--- a/example-crates/wallet_electrum/Cargo.toml
+++ b/example-crates/wallet_electrum/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.2.0"
edition = "2021"
[dependencies]
-bdk = { path = "../../crates/bdk" }
+bdk_wallet = { path = "../../crates/wallet" }
bdk_electrum = { path = "../../crates/electrum" }
bdk_file_store = { path = "../../crates/file_store" }
anyhow = "1"
diff --git a/example-crates/wallet_electrum/src/main.rs b/example-crates/wallet_electrum/src/main.rs
index 4af9e71dec..7ec466b3bd 100644
--- a/example-crates/wallet_electrum/src/main.rs
+++ b/example-crates/wallet_electrum/src/main.rs
@@ -6,19 +6,20 @@ const BATCH_SIZE: usize = 5;
use std::io::Write;
use std::str::FromStr;
-use bdk::bitcoin::Address;
-use bdk::wallet::Update;
-use bdk::{bitcoin::Network, Wallet};
-use bdk::{KeychainKind, SignOptions};
use bdk_electrum::{
electrum_client::{self, ElectrumApi},
ElectrumExt, ElectrumUpdate,
};
use bdk_file_store::Store;
+use bdk_wallet::bitcoin::Address;
+use bdk_wallet::wallet::Update;
+use bdk_wallet::{bitcoin::Network, Wallet};
+use bdk_wallet::{KeychainKind, SignOptions};
fn main() -> Result<(), anyhow::Error> {
let db_path = std::env::temp_dir().join("bdk-electrum-example");
- let db = Store::::open_or_create_new(DB_MAGIC.as_bytes(), db_path)?;
+ let db =
+ Store::::open_or_create_new(DB_MAGIC.as_bytes(), db_path)?;
let external_descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/1'/0'/0/*)";
let internal_descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/1'/0'/1/*)";
diff --git a/example-crates/wallet_esplora_async/Cargo.toml b/example-crates/wallet_esplora_async/Cargo.toml
index c588a87aa6..803c0fd3f5 100644
--- a/example-crates/wallet_esplora_async/Cargo.toml
+++ b/example-crates/wallet_esplora_async/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-bdk = { path = "../../crates/bdk" }
+bdk_wallet = { path = "../../crates/wallet" }
bdk_esplora = { path = "../../crates/esplora", features = ["async-https"] }
bdk_file_store = { path = "../../crates/file_store" }
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
diff --git a/example-crates/wallet_esplora_async/src/main.rs b/example-crates/wallet_esplora_async/src/main.rs
index c37b6e6650..4b85ab6cb9 100644
--- a/example-crates/wallet_esplora_async/src/main.rs
+++ b/example-crates/wallet_esplora_async/src/main.rs
@@ -1,12 +1,12 @@
use std::{io::Write, str::FromStr};
-use bdk::{
+use bdk_esplora::{esplora_client, EsploraAsyncExt};
+use bdk_file_store::Store;
+use bdk_wallet::{
bitcoin::{Address, Network},
wallet::Update,
KeychainKind, SignOptions, Wallet,
};
-use bdk_esplora::{esplora_client, EsploraAsyncExt};
-use bdk_file_store::Store;
const DB_MAGIC: &str = "bdk_wallet_esplora_async_example";
const SEND_AMOUNT: u64 = 5000;
@@ -16,7 +16,8 @@ const PARALLEL_REQUESTS: usize = 5;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let db_path = std::env::temp_dir().join("bdk-esplora-async-example");
- let db = Store::::open_or_create_new(DB_MAGIC.as_bytes(), db_path)?;
+ let db =
+ Store::::open_or_create_new(DB_MAGIC.as_bytes(), db_path)?;
let external_descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/1'/0'/0/*)";
let internal_descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/1'/0'/1/*)";
diff --git a/example-crates/wallet_esplora_blocking/Cargo.toml b/example-crates/wallet_esplora_blocking/Cargo.toml
index 0679bd8f38..857660acfb 100644
--- a/example-crates/wallet_esplora_blocking/Cargo.toml
+++ b/example-crates/wallet_esplora_blocking/Cargo.toml
@@ -7,7 +7,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-bdk = { path = "../../crates/bdk" }
+bdk_wallet = { path = "../../crates/wallet" }
bdk_esplora = { path = "../../crates/esplora", features = ["blocking"] }
bdk_file_store = { path = "../../crates/file_store" }
anyhow = "1"
diff --git a/example-crates/wallet_esplora_blocking/src/main.rs b/example-crates/wallet_esplora_blocking/src/main.rs
index 979e272f56..39969e9b6a 100644
--- a/example-crates/wallet_esplora_blocking/src/main.rs
+++ b/example-crates/wallet_esplora_blocking/src/main.rs
@@ -5,17 +5,18 @@ const PARALLEL_REQUESTS: usize = 1;
use std::{io::Write, str::FromStr};
-use bdk::{
+use bdk_esplora::{esplora_client, EsploraExt};
+use bdk_file_store::Store;
+use bdk_wallet::{
bitcoin::{Address, Network},
wallet::Update,
KeychainKind, SignOptions, Wallet,
};
-use bdk_esplora::{esplora_client, EsploraExt};
-use bdk_file_store::Store;
fn main() -> Result<(), anyhow::Error> {
let db_path = std::env::temp_dir().join("bdk-esplora-example");
- let db = Store::::open_or_create_new(DB_MAGIC.as_bytes(), db_path)?;
+ let db =
+ Store::::open_or_create_new(DB_MAGIC.as_bytes(), db_path)?;
let external_descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/1'/0'/0/*)";
let internal_descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/1'/0'/1/*)";
diff --git a/example-crates/wallet_rpc/Cargo.toml b/example-crates/wallet_rpc/Cargo.toml
index 174144e9bb..b7a9a9e472 100644
--- a/example-crates/wallet_rpc/Cargo.toml
+++ b/example-crates/wallet_rpc/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-bdk = { path = "../../crates/bdk" }
+bdk_wallet = { path = "../../crates/wallet" }
bdk_file_store = { path = "../../crates/file_store" }
bdk_bitcoind_rpc = { path = "../../crates/bitcoind_rpc" }
diff --git a/example-crates/wallet_rpc/README.md b/example-crates/wallet_rpc/README.md
index 03c1b0f567..28eb07b1fe 100644
--- a/example-crates/wallet_rpc/README.md
+++ b/example-crates/wallet_rpc/README.md
@@ -4,7 +4,7 @@
$ cargo run --bin wallet_rpc -- --help
wallet_rpc 0.1.0
-Bitcoind RPC example using `bdk::Wallet`
+Bitcoind RPC example using `bdk_wallet::Wallet`
USAGE:
wallet_rpc [OPTIONS] [CHANGE_DESCRIPTOR]
diff --git a/example-crates/wallet_rpc/src/main.rs b/example-crates/wallet_rpc/src/main.rs
index 264204a71a..3bdd515c31 100644
--- a/example-crates/wallet_rpc/src/main.rs
+++ b/example-crates/wallet_rpc/src/main.rs
@@ -1,18 +1,18 @@
-use bdk::{
- bitcoin::{Block, Network, Transaction},
- wallet::Wallet,
-};
use bdk_bitcoind_rpc::{
bitcoincore_rpc::{Auth, Client, RpcApi},
Emitter,
};
use bdk_file_store::Store;
+use bdk_wallet::{
+ bitcoin::{Block, Network, Transaction},
+ wallet::Wallet,
+};
use clap::{self, Parser};
use std::{path::PathBuf, sync::mpsc::sync_channel, thread::spawn, time::Instant};
const DB_MAGIC: &str = "bdk-rpc-wallet-example";
-/// Bitcoind RPC example using `bdk::Wallet`.
+/// Bitcoind RPC example using `bdk_wallet::Wallet`.
///
/// This syncs the chain block-by-block and prints the current balance, transaction count and UTXO
/// count.
@@ -89,7 +89,10 @@ fn main() -> anyhow::Result<()> {
let mut wallet = Wallet::new_or_load(
&args.descriptor,
args.change_descriptor.as_ref(),
- Store::::open_or_create_new(DB_MAGIC.as_bytes(), args.db_path)?,
+ Store::::open_or_create_new(
+ DB_MAGIC.as_bytes(),
+ args.db_path,
+ )?,
args.network,
)?;
println!(