Skip to content

Introduce bdk::Wallet builder API #1250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/bdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ fn main() {
let db = ();

let descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/0'/0'/0/*)";
let mut wallet = Wallet::new(descriptor, None, db, Network::Testnet).expect("should create");
let mut wallet = Wallet::builder(descriptor)
.with_network(Network::Testnet)
.init(db)
.expect("should create");

// get a new address (this increments revealed derivation index)
println!("revealed address: {}", wallet.get_address(AddressIndex::New));
Expand Down
4 changes: 3 additions & 1 deletion crates/bdk/examples/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ fn main() -> Result<(), Box<dyn Error>> {
println!("Compiled into following Descriptor: \n{}", descriptor);

// Create a new wallet from this descriptor
let mut wallet = Wallet::new_no_persist(&format!("{}", descriptor), None, Network::Regtest)?;
let mut wallet = Wallet::builder(&format!("{}", descriptor))
.with_network(Network::Regtest)
.init_without_persistence()?;

println!(
"First derived address from the descriptor: \n{}",
Expand Down
88 changes: 44 additions & 44 deletions crates/bdk/src/descriptor/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ impl<T: DescriptorTemplate> IntoWalletDescriptor for T {
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
/// let mut wallet = Wallet::new_no_persist(P2Pkh(key), None, Network::Testnet)?;
/// let mut wallet = Wallet::builder(P2Pkh(key))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(
/// wallet.get_address(New).to_string(),
Expand Down Expand Up @@ -107,7 +109,9 @@ impl<K: IntoDescriptorKey<Legacy>> DescriptorTemplate for P2Pkh<K> {
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
/// let mut wallet = Wallet::new_no_persist(P2Wpkh_P2Sh(key), None, Network::Testnet)?;
/// let mut wallet = Wallet::builder(P2Wpkh_P2Sh(key))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(
/// wallet.get_address(AddressIndex::New).to_string(),
Expand Down Expand Up @@ -136,7 +140,9 @@ impl<K: IntoDescriptorKey<Segwitv0>> DescriptorTemplate for P2Wpkh_P2Sh<K> {
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
/// let mut wallet = Wallet::new_no_persist(P2Wpkh(key), None, Network::Testnet)?;
/// let mut wallet = Wallet::builder(P2Wpkh(key))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(
/// wallet.get_address(New).to_string(),
Expand Down Expand Up @@ -164,7 +170,9 @@ impl<K: IntoDescriptorKey<Segwitv0>> DescriptorTemplate for P2Wpkh<K> {
///
/// let key =
/// bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
/// let mut wallet = Wallet::new_no_persist(P2TR(key), None, Network::Testnet)?;
/// let mut wallet = Wallet::builder(P2TR(key))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(
/// wallet.get_address(New).to_string(),
Expand Down Expand Up @@ -196,11 +204,10 @@ impl<K: IntoDescriptorKey<Tap>> DescriptorTemplate for P2TR<K> {
/// use bdk::template::Bip44;
///
/// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip44(key.clone(), KeychainKind::External),
/// Some(Bip44(key, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip44(key.clone(), KeychainKind::External))
/// .with_change_descriptor(Bip44(key, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "mmogjc7HJEZkrLqyQYqJmxUqFaC7i4uf89");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "pkh([c55b303f/44'/1'/0']tpubDCuorCpzvYS2LCD75BR46KHE8GdDeg1wsAgNZeNr6DaB5gQK1o14uErKwKLuFmeemkQ6N2m3rNgvctdJLyr7nwu2yia7413Hhg8WWE44cgT/0/*)#5wrnv0xt");
Expand Down Expand Up @@ -234,11 +241,10 @@ impl<K: DerivableKey<Legacy>> DescriptorTemplate for Bip44<K> {
///
/// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDDDzQ31JkZB7VxUr9bjvBivDdqoFLrDPyLWtLapArAi51ftfmCb2DPxwLQzX65iNcXz1DGaVvyvo6JQ6rTU73r2gqdEo8uov9QKRb7nKCSU")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip44Public(key.clone(), fingerprint, KeychainKind::External),
/// Some(Bip44Public(key, fingerprint, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip44Public(key.clone(), fingerprint, KeychainKind::External))
/// .with_change_descriptor(Bip44Public(key, fingerprint, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "miNG7dJTzJqNbFS19svRdTCisC65dsubtR");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "pkh([c55b303f/44'/1'/0']tpubDDDzQ31JkZB7VxUr9bjvBivDdqoFLrDPyLWtLapArAi51ftfmCb2DPxwLQzX65iNcXz1DGaVvyvo6JQ6rTU73r2gqdEo8uov9QKRb7nKCSU/0/*)#cfhumdqz");
Expand Down Expand Up @@ -271,11 +277,10 @@ impl<K: DerivableKey<Legacy>> DescriptorTemplate for Bip44Public<K> {
/// use bdk::template::Bip49;
///
/// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip49(key.clone(), KeychainKind::External),
/// Some(Bip49(key, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip49(key.clone(), KeychainKind::External))
/// .with_change_descriptor(Bip49(key, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "2N4zkWAoGdUv4NXhSsU8DvS5MB36T8nKHEB");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "sh(wpkh([c55b303f/49'/1'/0']tpubDDYr4kdnZgjjShzYNjZUZXUUtpXaofdkMaipyS8ThEh45qFmhT4hKYways7UXmg6V7het1QiFo9kf4kYUXyDvV4rHEyvSpys9pjCB3pukxi/0/*))#s9vxlc8e");
Expand Down Expand Up @@ -309,11 +314,10 @@ impl<K: DerivableKey<Segwitv0>> DescriptorTemplate for Bip49<K> {
///
/// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDC49r947KGK52X5rBWS4BLs5m9SRY3pYHnvRrm7HcybZ3BfdEsGFyzCMzayi1u58eT82ZeyFZwH7DD6Q83E3fM9CpfMtmnTygnLfP59jL9L")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip49Public(key.clone(), fingerprint, KeychainKind::External),
/// Some(Bip49Public(key, fingerprint, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip49Public(key.clone(), fingerprint, KeychainKind::External))
/// .with_change_descriptor(Bip49Public(key, fingerprint, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "2N3K4xbVAHoiTQSwxkZjWDfKoNC27pLkYnt");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "sh(wpkh([c55b303f/49'/1'/0']tpubDC49r947KGK52X5rBWS4BLs5m9SRY3pYHnvRrm7HcybZ3BfdEsGFyzCMzayi1u58eT82ZeyFZwH7DD6Q83E3fM9CpfMtmnTygnLfP59jL9L/0/*))#3tka9g0q");
Expand Down Expand Up @@ -346,11 +350,10 @@ impl<K: DerivableKey<Segwitv0>> DescriptorTemplate for Bip49Public<K> {
/// use bdk::template::Bip84;
///
/// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip84(key.clone(), KeychainKind::External),
/// Some(Bip84(key, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip84(key.clone(), KeychainKind::External))
/// .with_change_descriptor(Bip84(key, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "tb1qhl85z42h7r4su5u37rvvw0gk8j2t3n9y7zsg4n");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "wpkh([c55b303f/84'/1'/0']tpubDDc5mum24DekpNw92t6fHGp8Gr2JjF9J7i4TZBtN6Vp8xpAULG5CFaKsfugWa5imhrQQUZKXe261asP5koDHo5bs3qNTmf3U3o4v9SaB8gg/0/*)#6kfecsmr");
Expand Down Expand Up @@ -384,11 +387,10 @@ impl<K: DerivableKey<Segwitv0>> DescriptorTemplate for Bip84<K> {
///
/// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip84Public(key.clone(), fingerprint, KeychainKind::External),
/// Some(Bip84Public(key, fingerprint, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip84Public(key.clone(), fingerprint, KeychainKind::External))
/// .with_change_descriptor(Bip84Public(key, fingerprint, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "tb1qedg9fdlf8cnnqfd5mks6uz5w4kgpk2pr6y4qc7");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "wpkh([c55b303f/84'/1'/0']tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q/0/*)#dhu402yv");
Expand Down Expand Up @@ -421,11 +423,10 @@ impl<K: DerivableKey<Segwitv0>> DescriptorTemplate for Bip84Public<K> {
/// use bdk::template::Bip86;
///
/// let key = bitcoin::bip32::ExtendedPrivKey::from_str("tprv8ZgxMBicQKsPeZRHk4rTG6orPS2CRNFX3njhUXx5vj9qGog5ZMH4uGReDWN5kCkY3jmWEtWause41CDvBRXD1shKknAMKxT99o9qUTRVC6m")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip86(key.clone(), KeychainKind::External),
/// Some(Bip86(key, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip86(key.clone(), KeychainKind::External))
/// .with_change_descriptor(Bip86(key, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "tb1p5unlj09djx8xsjwe97269kqtxqpwpu2epeskgqjfk4lnf69v4tnqpp35qu");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "tr([c55b303f/86'/1'/0']tpubDCiHofpEs47kx358bPdJmTZHmCDqQ8qw32upCSxHrSEdeeBs2T5Mq6QMB2ukeMqhNBiyhosBvJErteVhfURPGXPv3qLJPw5MVpHUewsbP2m/0/*)#dkgvr5hm");
Expand Down Expand Up @@ -459,11 +460,10 @@ impl<K: DerivableKey<Tap>> DescriptorTemplate for Bip86<K> {
///
/// let key = bitcoin::bip32::ExtendedPubKey::from_str("tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q")?;
/// let fingerprint = bitcoin::bip32::Fingerprint::from_str("c55b303f")?;
/// let mut wallet = Wallet::new_no_persist(
/// Bip86Public(key.clone(), fingerprint, KeychainKind::External),
/// Some(Bip86Public(key, fingerprint, KeychainKind::Internal)),
/// Network::Testnet,
/// )?;
/// let mut wallet = Wallet::builder(Bip86Public(key.clone(), fingerprint, KeychainKind::External))
/// .with_change_descriptor(Bip86Public(key, fingerprint, KeychainKind::Internal))
/// .with_network(Network::Testnet)
/// .init_without_persistence()?;
///
/// assert_eq!(wallet.get_address(New).to_string(), "tb1pwjp9f2k5n0xq73ecuu0c5njvgqr3vkh7yaylmpqvsuuaafymh0msvcmh37");
/// assert_eq!(wallet.public_descriptor(KeychainKind::External).unwrap().to_string(), "tr([c55b303f/86'/1'/0']tpubDC2Qwo2TFsaNC4ju8nrUJ9mqVT3eSgdmy1yPqhgkjwmke3PRXutNGRYAUo6RCHTcVQaDR3ohNU9we59brGHuEKPvH1ags2nevW5opEE9Z5Q/0/*)#2p65srku");
Expand Down
98 changes: 98 additions & 0 deletions crates/bdk/src/wallet/builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
use bdk_chain::PersistBackend;
use bitcoin::constants::genesis_block;
use bitcoin::{BlockHash, Network};

use crate::descriptor::{DescriptorError, IntoWalletDescriptor};
use crate::wallet::{ChangeSet, Wallet};

use super::{InitError, InitOrLoadError};

/// Helper structure to initialize a fresh [`Wallet`] instance.
pub struct WalletBuilder<E> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about just calling this Builder, i.e. bdk::wallet::Builder ?

pub(super) descriptor: E,
pub(super) change_descriptor: Option<E>,
pub(super) network: Network,
pub(super) custom_genesis_hash: Option<BlockHash>,
}

impl<E> WalletBuilder<E> {
/// Start building a fresh [`Wallet`] instance.
pub(super) fn new(descriptor: E) -> Self {
Self {
descriptor,
change_descriptor: None,
network: Network::Bitcoin,
custom_genesis_hash: None,
}
}

/// Set the internal (change) keychain.
///
/// The internal keychain will be used to derive change addresses for change outputs.
///
/// If no internal keychain is set, the wallet will use the external keychain for deriving
/// change addresses.
pub fn with_change_descriptor(mut self, change_descriptor: E) -> Self {
self.change_descriptor = Some(change_descriptor);
self
}

/// Set the [`Network`] type for the wallet.
///
/// This changes the format of the derived wallet, as well as the internal genesis block hash.
/// The internal genesis block hash can be overriden by [`with_genesis_hash`].
///
/// By default, [`Network::Bitcoin`] is used.
///
/// [`with_genesis_hash`]: Self::with_genesis_hash
pub fn with_network(mut self, network: Network) -> Self {
self.network = network;
self
}

/// Overrides the genesis hash implied by [`with_network`].
///
/// [`with_network`]: Self::with_network
pub fn with_genesis_hash(mut self, genesis_hash: BlockHash) -> Self {
self.custom_genesis_hash = Some(genesis_hash);
self
}

pub(super) fn determine_genesis_hash(&self) -> BlockHash {
self.custom_genesis_hash
.unwrap_or_else(|| genesis_block(self.network).block_hash())
}
}

impl<E: IntoWalletDescriptor> WalletBuilder<E> {
/// Initializes a fresh wallet and persists it in `db`.
pub fn init<D>(self, db: D) -> Result<Wallet<D>, InitError<D::WriteError>>
where
D: PersistBackend<ChangeSet>,
{
Wallet::init(self, db)
}

/// Either loads [`Wallet`] from persistence, or initializes a fresh wallet if it does not
/// exist.
///
/// This method will fail if the persistence is non-empty with parameters that are different to
/// those specified by [`WalletBuilder`].
pub fn init_or_load<D>(
self,
db: D,
) -> Result<Wallet<D>, InitOrLoadError<D::WriteError, D::LoadError>>
where
D: PersistBackend<ChangeSet>,
{
Wallet::init_or_load(self, db)
}

/// Initializes a fresh wallet with no persistence.
pub fn init_without_persistence(self) -> Result<Wallet<()>, DescriptorError> {
Wallet::init(self, ()).map_err(|err| match err {
InitError::Descriptor(err) => err,
InitError::Write(_) => panic!("there is no db to write to"),
})
}
}
27 changes: 16 additions & 11 deletions crates/bdk/src/wallet/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
//! }"#;
//!
//! let import = FullyNodedExport::from_str(import)?;
//! let wallet = Wallet::new_no_persist(
//! &import.descriptor(),
//! import.change_descriptor().as_ref(),
//! Network::Testnet,
//! )?;
//! let descriptor = import.descriptor();
//! let change_descriptor = import.change_descriptor();
//! let mut builder = Wallet::builder(&descriptor).with_network(Network::Testnet);
//! if let Some(change_descriptor) = &change_descriptor {
//! builder = builder.with_change_descriptor(change_descriptor);
//! }
//! let wallet = builder.init_without_persistence()?;
//! # Ok::<_, Box<dyn std::error::Error>>(())
//! ```
//!
Expand All @@ -42,11 +44,10 @@
//! # use bitcoin::*;
//! # use bdk::wallet::export::*;
//! # use bdk::*;
//! let wallet = Wallet::new_no_persist(
//! "wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/0/*)",
//! Some("wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/1/*)"),
//! Network::Testnet,
//! )?;
//! let wallet = Wallet::builder("wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/0/*)")
//! .with_change_descriptor("wpkh([c258d2e4/84h/1h/0h]tpubDD3ynpHgJQW8VvWRzQ5WFDCrs4jqVFGHB3vLC3r49XHJSqP8bHKdK4AriuUKLccK68zfzowx7YhmDN8SiSkgCDENUFx9qVw65YyqM78vyVe/1/*)")
//! .with_network(Network::Testnet)
//! .init_without_persistence()?;
//! let export = FullyNodedExport::export_wallet(&wallet, "exported wallet", true).unwrap();
//!
//! println!("Exported: {}", export.to_string());
Expand Down Expand Up @@ -226,7 +227,11 @@ mod test {
change_descriptor: Option<&str>,
network: Network,
) -> Wallet<()> {
let mut wallet = Wallet::new_no_persist(descriptor, change_descriptor, network).unwrap();
let mut builder = Wallet::builder(descriptor).with_network(network);
if let Some(change_descriptor) = change_descriptor {
builder = builder.with_change_descriptor(change_descriptor);
}
let mut wallet = builder.init_without_persistence().unwrap();
let transaction = Transaction {
input: vec![],
output: vec![],
Expand Down
9 changes: 3 additions & 6 deletions crates/bdk/src/wallet/hardwaresigner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@
//! let first_device = devices.remove(0)?;
//! let custom_signer = HWISigner::from_device(&first_device, Network::Testnet.into())?;
//!
//! # let mut wallet = Wallet::new_no_persist(
//! # "",
//! # None,
//! # Network::Testnet,
//! # )?;
//! #
//! # let mut wallet = Wallet::builder("")
//! # .with_network(Network::Testnet)
//! # .init_without_persistence()?;
//! // Adding the hardware signer to the BDK wallet
//! wallet.add_signer(
//! KeychainKind::External,
Expand Down
Loading