diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 9db71a9d01..d6dd53e4ce 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/walet 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 0321cc5337..6f1dc98528 100644 --- a/.github/workflows/nightly_docs.yml +++ b/.github/workflows/nightly_docs.yml @@ -40,14 +40,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 b190ba88fb..8b375b5a02 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 a8c18d1aa6..7925d8ddf8 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 660b9deff5..6a9b9127f6 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.7.0", features = [ "miniscript"] } diff --git a/crates/hwi/src/lib.rs b/crates/hwi/src/lib.rs index 0790668784..62443c8d47 100644 --- a/crates/hwi/src/lib.rs +++ b/crates/hwi/src/lib.rs @@ -3,11 +3,11 @@ //! 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::wallet::AddressIndex::New; -//! # use bdk::{FeeRate, KeychainKind, SignOptions, Wallet}; +//! # use bdk_wallet::wallet::AddressIndex::New; +//! # use bdk_wallet::{FeeRate, KeychainKind, SignOptions, Wallet}; //! # use hwi::HWIClient; //! # use std::sync::Arc; //! # @@ -36,7 +36,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 b16b60c54f..1f36f59983 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::psbt::PartiallySignedTransaction; -use bdk::bitcoin::secp256k1::{All, Secp256k1}; +use bdk_wallet::bitcoin::bip32::Fingerprint; +use bdk_wallet::bitcoin::psbt::PartiallySignedTransaction; +use bdk_wallet::bitcoin::secp256k1::{All, Secp256k1}; 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 PartiallySignedTransaction, - _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 98% rename from crates/bdk/Cargo.toml rename to crates/wallet/Cargo.toml index c51af75d85..03bbb7bf32 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.5" repository = "https://github.com/bitcoindevkit/bdk" diff --git a/crates/bdk/README.md b/crates/wallet/README.md similarity index 87% rename from crates/bdk/README.md rename to crates/wallet/README.md index fa23f20a23..b4a47d98d9 100644 --- a/crates/bdk/README.md +++ b/crates/wallet/README.md @@ -26,7 +26,7 @@ ## `bdk` -The `bdk` crate provides the [`Wallet`](`crate::Wallet`) type which is a simple, high-level +The `bdk_wallet` crate provides the [`Wallet`](`crate::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 @@ -65,7 +65,7 @@ To persist the `Wallet` on disk, `Wallet` needs to be constructed with a **Example** ```rust -use bdk::{bitcoin::Network, wallet::{AddressIndex, Wallet}}; +use bdk_wallet::{bitcoin::Network, wallet::{AddressIndex, Wallet}}; fn main() { // a type that implements `Persist` @@ -85,13 +85,13 @@ fn main() { - - - - - + + + + + - + @@ -109,11 +109,11 @@ fn main() { - - - + + + - + @@ -131,17 +131,17 @@ fn main() { - - + + - - + + - - + + - + @@ -172,13 +172,13 @@ fn main() { - + - - + + - + diff --git a/crates/bdk/examples/compiler.rs b/crates/wallet/examples/compiler.rs similarity index 95% rename from crates/bdk/examples/compiler.rs rename to crates/wallet/examples/compiler.rs index e22ccadc76..59b2e4fb63 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,13 +21,13 @@ use bitcoin::Network; use miniscript::policy::Concrete; use miniscript::Descriptor; -use bdk::wallet::AddressIndex::New; -use bdk::{KeychainKind, Wallet}; +use bdk_wallet::wallet::AddressIndex::New; +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 /// rust-miniscript provides a `compile()` function that can be used to compile any miniscript policy -/// into a descriptor. This descriptor then in turn can be used in bdk a fully functioning wallet +/// into a descriptor. This descriptor then in turn can be used in bdk wallet a fully functioning wallet /// can be derived from the policy. /// /// This example demonstrates the interaction between a bdk wallet and miniscript policy. 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 50cd978f7d..2136eb31be 100644 --- a/crates/bdk/src/descriptor/dsl.rs +++ b/crates/wallet/src/descriptor/dsl.rs @@ -424,7 +424,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>(()) /// ``` /// @@ -445,7 +445,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)) /// ) @@ -453,11 +453,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()); @@ -476,7 +477,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) /// ) @@ -492,7 +493,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 523e94b408..e5f25be583 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 93% rename from crates/bdk/src/descriptor/template.rs rename to crates/wallet/src/descriptor/template.rs index 2773795a83..0d12442813 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::wallet::AddressIndex::New; -/// use bdk::template::P2Pkh; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::Wallet; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::P2Pkh; /// /// let key = /// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?; @@ -100,10 +100,10 @@ impl> DescriptorTemplate for P2Pkh { /// ## Example /// /// ``` -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::Wallet; -/// use bdk::template::P2Wpkh_P2Sh; -/// use bdk::wallet::AddressIndex; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::Wallet; +/// use bdk_wallet::template::P2Wpkh_P2Sh; +/// use bdk_wallet::wallet::AddressIndex; /// /// let key = /// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?; @@ -129,10 +129,10 @@ impl> DescriptorTemplate for P2Wpkh_P2Sh { /// ## Example /// /// ``` -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet}; -/// use bdk::template::P2Wpkh; -/// use bdk::wallet::AddressIndex::New; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet}; +/// use bdk_wallet::template::P2Wpkh; +/// use bdk_wallet::wallet::AddressIndex::New; /// /// let key = /// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?; @@ -157,10 +157,10 @@ impl> DescriptorTemplate for P2Wpkh { /// ## Example /// /// ``` -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::Wallet; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::P2TR; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::Wallet; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::P2TR; /// /// let key = /// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?; @@ -190,10 +190,10 @@ impl> DescriptorTemplate for P2TR { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip44; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip44; /// /// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?; /// let mut wallet = Wallet::new_no_persist( @@ -227,10 +227,10 @@ impl> DescriptorTemplate for Bip44 { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip44Public; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip44Public; /// /// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDDDzQ31JkZB7VxUr9bjvBivDdqoFLrDPyLWtLapArAi51ftfmCb2DPxwLQzX65iNcXz1DGaVvyvo6JQ6rTU73r2gqdEo8uov9QKRb7nKCSU")?; /// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?; @@ -265,10 +265,10 @@ impl> DescriptorTemplate for Bip44Public { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip49; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip49; /// /// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?; /// let mut wallet = Wallet::new_no_persist( @@ -302,10 +302,10 @@ impl> DescriptorTemplate for Bip49 { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip49Public; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip49Public; /// /// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDC49r947KGK52X5rBWS4BLs5m9SRY3pYHnvRrm7HcybZ3BfdEsGFyzCMzayi1u58eT82ZeyFZwH7DD6Q83E3fM9CpfMtmnTygnLfP59jL9L")?; /// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?; @@ -340,10 +340,10 @@ impl> DescriptorTemplate for Bip49Public { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip84; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip84; /// /// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?; /// let mut wallet = Wallet::new_no_persist( @@ -377,10 +377,10 @@ impl> DescriptorTemplate for Bip84 { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip84Public; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip84Public; /// /// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q")?; /// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?; @@ -415,10 +415,10 @@ impl> DescriptorTemplate for Bip84Public { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip86; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip86; /// /// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?; /// let mut wallet = Wallet::new_no_persist( @@ -452,10 +452,10 @@ impl> DescriptorTemplate for Bip86 { /// /// ``` /// # use std::str::FromStr; -/// # use bdk::bitcoin::{PrivateKey, Network}; -/// # use bdk::{Wallet, KeychainKind}; -/// # use bdk::wallet::AddressIndex::New; -/// use bdk::template::Bip86Public; +/// # use bdk_wallet::bitcoin::{PrivateKey, Network}; +/// # use bdk_wallet::{Wallet, KeychainKind}; +/// # use bdk_wallet::wallet::AddressIndex::New; +/// use bdk_wallet::template::Bip86Public; /// /// let key = bitcoin::bip32::ExtendedPubKey::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 95% rename from crates/bdk/src/keys/mod.rs rename to crates/wallet/src/keys/mod.rs index 541d439a62..04d7e39f1b 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, @@ -279,17 +281,17 @@ impl ExtScriptContext for Ctx { /// makes the compiler (correctly) fail. /// /// ```compile_fail -/// use bdk::bitcoin::PublicKey; +/// 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() /// } /// } @@ -297,7 +299,7 @@ impl ExtScriptContext for Ctx { /// let key = MySegwitOnlyKeyType { /// pubkey: PublicKey::from_str("...")?, /// }; -/// let (descriptor, _, _) = bdk::descriptor!(pkh(key))?; +/// let (descriptor, _, _) = bdk_wallet::descriptor!(pkh(key))?; /// // ^^^^^ changing this to `wpkh` would make it compile /// /// # Ok::<_, Box>(()) @@ -387,9 +389,9 @@ impl From for ExtendedKey { /// an [`ExtendedPubKey`] 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 +420,9 @@ impl From for ExtendedKey { /// [`ExtendedPrivKey`] or [`ExtendedPubKey`] 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 +471,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 +766,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 +780,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 +794,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 +814,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 +836,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 ac6084cfc4..dff851165a 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; //! # const TXIN_BASE_WEIGHT: usize = (32 + 4 + 4) * 4; //! #[derive(Debug)] @@ -41,7 +41,7 @@ //! &self, //! required_utxos: Vec, //! optional_utxos: Vec, -//! fee_rate: bdk::FeeRate, +//! fee_rate: bdk_wallet::FeeRate, //! target_amount: u64, //! drain_script: &Script, //! ) -> Result { 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 f2d656891e..b5c0504c8e 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 aec49297c2..f98bd558f0 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::{FeeRate, 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::{FeeRate, 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 4db035fb6c..4050bb45f2 100644 --- a/crates/bdk/src/wallet/mod.rs +++ b/crates/wallet/src/wallet/mod.rs @@ -938,7 +938,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; @@ -947,7 +947,7 @@ impl Wallet { /// /// ```rust, no_run /// # use bitcoin::psbt::PartiallySignedTransaction; - /// # use bdk::Wallet; + /// # use bdk_wallet::Wallet; /// # let mut wallet: Wallet<()> = todo!(); /// # let mut psbt: PartiallySignedTransaction = todo!(); /// let tx = &psbt.clone().extract_tx(); @@ -969,7 +969,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; @@ -978,7 +978,7 @@ impl Wallet { /// /// ```rust, no_run /// # use bitcoin::psbt::PartiallySignedTransaction; - /// # use bdk::Wallet; + /// # use bdk_wallet::Wallet; /// # let mut wallet: Wallet<()> = todo!(); /// # let mut psbt: PartiallySignedTransaction = todo!(); /// let tx = &psbt.clone().extract_tx(); @@ -1002,7 +1002,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; @@ -1011,7 +1011,7 @@ impl Wallet { /// /// ```rust, no_run /// # use bitcoin::psbt::PartiallySignedTransaction; - /// # use bdk::Wallet; + /// # use bdk_wallet::Wallet; /// # let mut wallet: Wallet<()> = todo!(); /// # let mut psbt: PartiallySignedTransaction = todo!(); /// let tx = &psbt.clone().extract_tx(); @@ -1032,8 +1032,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!(); /// @@ -1208,8 +1208,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/* @@ -1234,9 +1234,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/*)"; @@ -1631,9 +1631,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/*)"; @@ -1652,7 +1652,7 @@ impl Wallet { /// let mut psbt = { /// let mut builder = wallet.build_fee_bump(tx.txid())?; /// builder - /// .fee_rate(bdk::FeeRate::from_sat_per_vb(5.0)); + /// .fee_rate(bdk_wallet::FeeRate::from_sat_per_vb(5.0)); /// builder.finish()? /// }; /// @@ -1806,9 +1806,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 63784a3fd9..95faaf95f7 100644 --- a/crates/bdk/src/wallet/signer.rs +++ b/crates/wallet/src/wallet/signer.rs @@ -20,8 +20,8 @@ //! # use bitcoin::secp256k1::{Secp256k1, All}; //! # use bitcoin::*; //! # use bitcoin::psbt; -//! # 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 4af7b3bf44..f8b92c23b7 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(); @@ -31,7 +31,7 @@ //! // Create a transaction with one output to `to_address` of 50_000 satoshi //! .add_recipient(to_address.script_pubkey(), 50_000) //! // With a custom fee rate of 5.0 satoshi/vbyte -//! .fee_rate(bdk::FeeRate::from_sat_per_vb(5.0)) +//! .fee_rate(bdk_wallet::FeeRate::from_sat_per_vb(5.0)) //! // Only spend non-change outputs //! .do_not_spend_change() //! // Turn on RBF signaling @@ -81,12 +81,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!(); @@ -268,7 +268,7 @@ impl<'a, D, Cs: CoinSelectionAlgorithm, Ctx: TxBuilderContext> TxBuilder<'a, D, /// # use std::str::FromStr; /// # use std::collections::BTreeMap; /// # use bitcoin::*; - /// # use bdk::*; + /// # use bdk_wallet::*; /// # let to_address = /// Address::from_str("2N4eQYCbKUHCCTUjBJeHcJp9ok6J2GZsTDt") /// .unwrap() @@ -761,10 +761,10 @@ impl<'a, D, Cs: CoinSelectionAlgorithm> TxBuilder<'a, D, 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 = @@ -779,7 +779,7 @@ impl<'a, D, Cs: CoinSelectionAlgorithm> TxBuilder<'a, D, Cs, CreateTx> { /// .drain_wallet() /// // Send the excess (which is all the coins minus the fee) to this address. /// .drain_to(to_address.script_pubkey()) - /// .fee_rate(bdk::FeeRate::from_sat_per_vb(5.0)) + /// .fee_rate(bdk_wallet::FeeRate::from_sat_per_vb(5.0)) /// .enable_rbf(); /// let psbt = tx_builder.finish()?; /// # Ok::<(), anyhow::Error>(()) 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 98% rename from crates/bdk/tests/common.rs rename to crates/wallet/tests/common.rs index 3e0292a299..333341a4db 100644 --- a/crates/bdk/tests/common.rs +++ b/crates/wallet/tests/common.rs @@ -1,8 +1,8 @@ #![allow(unused)] -use bdk::{wallet::AddressIndex, KeychainKind, LocalOutput, Wallet}; use bdk_chain::indexed_tx_graph::Indexer; use bdk_chain::{BlockId, ConfirmationTime}; +use bdk_wallet::{wallet::AddressIndex, KeychainKind, LocalOutput, Wallet}; use bitcoin::hashes::Hash; use bitcoin::{Address, BlockHash, Network, OutPoint, Transaction, TxIn, TxOut, Txid}; use std::str::FromStr; diff --git a/crates/bdk/tests/psbt.rs b/crates/wallet/tests/psbt.rs similarity index 94% rename from crates/bdk/tests/psbt.rs rename to crates/wallet/tests/psbt.rs index 3c4968bfeb..4b9ab7f1b5 100644 --- a/crates/bdk/tests/psbt.rs +++ b/crates/wallet/tests/psbt.rs @@ -1,7 +1,7 @@ -use bdk::bitcoin::TxIn; -use bdk::wallet::AddressIndex; -use bdk::wallet::AddressIndex::New; -use bdk::{psbt, FeeRate, SignOptions}; +use bdk_wallet::bitcoin::TxIn; +use bdk_wallet::wallet::AddressIndex; +use bdk_wallet::wallet::AddressIndex::New; +use bdk_wallet::{psbt, FeeRate, SignOptions}; use bitcoin::psbt::PartiallySignedTransaction as Psbt; use core::str::FromStr; mod common; @@ -159,8 +159,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::{secp256k1::Secp256k1, PrivateKey}; use miniscript::psbt::PsbtExt; use std::sync::Arc; @@ -171,10 +171,10 @@ fn test_psbt_multiple_internalkey_signers() { let mut builder = wallet.build_tx(); builder.add_recipient(send_to.script_pubkey(), 10_000); let mut psbt = builder.finish().unwrap(); - // Adds a signer for the wrong internal key, bdk should not use this key to sign + // Adds a signer for the wrong internal key, bdk wallet should not use this key to sign wallet.add_signer( KeychainKind::External, - // A signerordering lower than 100, bdk will use this signer first + // A signerordering lower than 100, bdk wallet will use this signer first SignerOrdering(0), Arc::new(SignerWrapper::new( PrivateKey::from_wif("5J5PZqvCe1uThJ3FZeUUFLCh2FuK9pZhtEK4MzhNmugqTmxCdwE").unwrap(), 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 271b871632..b4fdff2b32 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::{AddressIndex, AddressInfo, Balance, Wallet}; -use bdk::wallet::{AddressIndex::*, NewError}; -use bdk::{FeeRate, 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::{AddressIndex, AddressInfo, Balance, Wallet}; +use bdk_wallet::wallet::{AddressIndex::*, NewError}; +use bdk_wallet::{FeeRate, KeychainKind}; use bitcoin::hashes::Hash; use bitcoin::sighash::{EcdsaSighashType, TapSighashType}; use bitcoin::ScriptBuf; @@ -124,7 +124,7 @@ fn new_or_load() { assert!( matches!( err, - bdk::wallet::NewOrLoadError::LoadedNetworkDoesNotMatch { + bdk_wallet::wallet::NewOrLoadError::LoadedNetworkDoesNotMatch { got: Some(Network::Testnet), expected: Network::Bitcoin } @@ -153,7 +153,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: {}", @@ -713,7 +713,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.get_address(New); @@ -765,7 +765,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); @@ -2286,7 +2286,7 @@ fn test_bump_fee_unconfirmed_input() { #[test] fn test_fee_amount_negative_drain_val() { - // While building the transaction, bdk would calculate the drain_value + // While building the transaction, bdk wallet would calculate the drain_value // as // current_delta - fee_amount - drain_fee // using saturating_sub, meaning that if the result would end up negative, @@ -2746,7 +2746,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::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy").unwrap(); let mut wallet = Wallet::new_no_persist( Bip84(key, KeychainKind::External), @@ -2795,7 +2795,7 @@ fn test_get_address() { #[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::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy").unwrap(); @@ -3124,7 +3124,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.get_address(AddressIndex::New); @@ -3153,7 +3153,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()); @@ -3193,7 +3193,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()); @@ -3233,7 +3233,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.get_address(AddressIndex::New); 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 4f8aba9fd3..29071b4af2 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::SignOptions; -use bdk::{bitcoin::Network, Wallet}; 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::SignOptions; +use bdk_wallet::{bitcoin::Network, Wallet}; 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/*)"; @@ -29,7 +30,7 @@ fn main() -> Result<(), anyhow::Error> { Network::Testnet, )?; - let address = wallet.try_get_address(bdk::wallet::AddressIndex::New)?; + let address = wallet.try_get_address(bdk_wallet::wallet::AddressIndex::New)?; println!("Generated Address: {}", address); let balance = wallet.get_balance(); 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 690cd87e24..e25cd144d1 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::{AddressIndex, Update}, 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 73bfdd5598..e3385a1e2d 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::{AddressIndex, Update}, 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!(