All `Wallet` constructors are modified to require a change descriptor, where previously it was optional. Additionally we enforce uniqueness of the change descriptor to avoid ambiguity when deriving scripts and ensure the wallet will always have two distinct keystores. Notable changes * Add error DescriptorError::ExternalAndInternalAreTheSame * Remove error CreateTxError::ChangePolicyDescriptor * No longer rely on `map_keychain`
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
//! HWI Signer
|
|
//!
|
|
//! This crate contains HWISigner, an implementation of a [`TransactionSigner`] to be
|
|
//! used with hardware wallets.
|
|
//! ```no_run
|
|
//! # use bdk_wallet::bitcoin::Network;
|
|
//! # use bdk_wallet::signer::SignerOrdering;
|
|
//! # use bdk_hwi::HWISigner;
|
|
//! # use bdk_wallet::{KeychainKind, SignOptions, Wallet};
|
|
//! # use hwi::HWIClient;
|
|
//! # use std::sync::Arc;
|
|
//! #
|
|
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
//! let mut devices = HWIClient::enumerate()?;
|
|
//! if devices.is_empty() {
|
|
//! panic!("No devices found!");
|
|
//! }
|
|
//! let first_device = devices.remove(0)?;
|
|
//! let custom_signer = HWISigner::from_device(&first_device, Network::Testnet.into())?;
|
|
//!
|
|
//! # let mut wallet = Wallet::new_no_persist(
|
|
//! # "",
|
|
//! # "",
|
|
//! # Network::Testnet,
|
|
//! # )?;
|
|
//! #
|
|
//! // Adding the hardware signer to the BDK wallet
|
|
//! wallet.add_signer(
|
|
//! KeychainKind::External,
|
|
//! SignerOrdering(200),
|
|
//! Arc::new(custom_signer),
|
|
//! );
|
|
//!
|
|
//! # Ok(())
|
|
//! # }
|
|
//! ```
|
|
//!
|
|
//! [`TransactionSigner`]: bdk_wallet::wallet::signer::TransactionSigner
|
|
|
|
mod signer;
|
|
pub use signer::*;
|