#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
use crate::utils::parse_proxy_auth;
+#[cfg(feature = "hwi")]
+use crate::handlers::hwi::HwiCommand;
+
/// The BDK Command Line Wallet App
///
/// bdk-cli is a lightweight command line bitcoin wallet, powered by BDK.
/// Resolves BIP-353 DNS payment instructions for a human-readable name.
#[cfg(feature = "dns_payment")]
ResolveDnsRecipient(ResolveDnsRecipientCommand),
+ /// Hardware wallet (HWI) operations.
+ ///
+ /// List connected devices, register a wallet policy, display a receive
+ /// address for verification, or sign a PSBT with a hardware wallet.
+ #[cfg(feature = "hwi")]
+ Hwi(HwiCommand),
}
/// Wallet operation subcommands.
pub mod descriptor;
#[cfg(feature = "dns_payment")]
pub mod dns;
+#[cfg(feature = "hwi")]
+pub mod hwi;
pub mod key;
pub mod offline;
pub mod online;
))]
pub mod payjoin;
pub mod repl;
-#[cfg(feature = "hwi")]
-pub mod hwi;
-
#[cfg(any(
feature = "electrum",
feature = "esplora",
feature = "rpc",
feature = "cbf",
- feature = "dns_payment"
+ feature = "dns_payment",
+ feature = "hwi"
))]
pub trait AsyncAppCommand<C> {
type Output: FormatOutput;
bdk_message_signer::{MessageProof, MessageSigner},
};
+/// When built with hardware wallet support, `create_tx` produces a
+/// PSBT that offline signers and hardware wallets can consume.
+#[cfg(feature = "hwi")]
+const DEFAULT_OFFLINE_SIGNER: bool = true;
+#[cfg(not(feature = "hwi"))]
+const DEFAULT_OFFLINE_SIGNER: bool = false;
+
+
impl OfflineWalletSubCommand {
pub fn execute(&self, ctx: &mut AppContext<OfflineOperations<'_>>) -> Result<(), Error> {
match self {
pub shrink_address: Option<Address>,
/// Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of `non_witness_utxo` and more details to let the signer identify the change output.
- #[arg(long = "offline_signer")]
+ #[arg(long = "offline_signer", default_value_t = DEFAULT_OFFLINE_SIGNER))]
pub offline_signer: bool,
/// Selects which utxos *must* be added to the tx. Unconfirmed utxos cannot be used.
use crate::commands::{CliOpts, CliSubCommand, WalletSubCommand};
use crate::error::BDKCliError as Error;
-#[cfg(feature = "dns_payment")]
+#[cfg(any(feature = "dns_payment", feature = "hwi"))]
use crate::handlers::AsyncAppCommand;
use crate::handlers::{AppCommand, AppContext};
use crate::utils::output::FormatOutput;
let mut ctx = AppContext::new(cli_opts.network, home_dir);
cmd.execute(&mut ctx).await?.write_out(std::io::stdout())?;
}
+ #[cfg(feature = "hwi")]
+ CliSubCommand::Hwi(cmd) => {
+ let mut ctx = AppContext::new(cli_opts.network, home_dir);
+ cmd.execute(&mut ctx).await?.write_out(std::io::stdout())?;
+ }
}
Ok(())
pub mod descriptors;
pub mod output;
pub use common::*;
-pub mod runtime;
-pub mod types;
#[cfg(feature = "hwi")]
pub mod hwi;
+pub mod runtime;
+pub mod types;