From: Vihiga Tyonum Date: Wed, 24 Jun 2026 19:10:27 +0000 (+0100) Subject: ref(verbose): Dropped `verbose` flag from tests X-Git-Tag: v4.0.0~5^2~9 X-Git-Url: http://internal-gitweb-vhost/blockdata/script/encode/-script/ui-kit/FromScriptException.UnrecognizedScript.html?a=commitdiff_plain;h=eec81e2cd5d42028da3e921bb979a9aa11c9e849;p=bdk-cli ref(verbose): Dropped `verbose` flag from tests --- diff --git a/src/commands.rs b/src/commands.rs index d5ae053..ac35877 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -223,9 +223,6 @@ pub struct WalletOpts { /// Selects the wallet to use. #[arg(skip)] pub wallet: Option, - /// Adds verbosity, returns PSBT in JSON format alongside serialized, displays expanded objects. - #[arg(env = "VERBOSE", short = 'v', long = "verbose")] - pub verbose: bool, /// Sets the descriptor to use for the external addresses. #[arg(env = "EXT_DESCRIPTOR", short = 'e', long, required = true)] pub ext_descriptor: String, diff --git a/src/config.rs b/src/config.rs index ec6adfa..6865ee0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -117,7 +117,6 @@ impl TryFrom<&WalletConfigInner> for WalletOpts { Ok(WalletOpts { wallet: Some(config.wallet.clone()), - verbose: false, ext_descriptor: config.ext_descriptor.clone(), int_descriptor: config.int_descriptor.clone(), diff --git a/src/handlers/config.rs b/src/handlers/config.rs index 3bd302c..8fe1c9d 100644 --- a/src/handlers/config.rs +++ b/src/handlers/config.rs @@ -95,7 +95,6 @@ impl AppCommand> for SaveConfigCommand { network: ctx.network.to_string(), ext_descriptor: self.wallet_opts.ext_descriptor.clone(), int_descriptor: self.wallet_opts.int_descriptor.clone(), - #[cfg(any(feature = "sqlite", feature = "redb"))] database_type: match self.wallet_opts.database_type { #[cfg(feature = "sqlite")] diff --git a/src/handlers/offline.rs b/src/handlers/offline.rs index b441230..6839b9b 100644 --- a/src/handlers/offline.rs +++ b/src/handlers/offline.rs @@ -303,7 +303,7 @@ impl AppCommand>> for CreateTxCommand { // let psbt_base64 = BASE64_STANDARD.encode(psbt.serialize()); - Ok(PsbtResult::new(&psbt, false, Some(false))) + Ok(PsbtResult::new(&psbt, Some(false))) } } @@ -594,7 +594,7 @@ impl AppCommand>> for BumpFeeCommand { // let psbt_base64 = BASE64_STANDARD.encode(psbt.serialize()); - Ok(PsbtResult::new(&psbt, false, Some(false))) + Ok(PsbtResult::new(&psbt, Some(false))) } } @@ -662,7 +662,7 @@ impl AppCommand>> for SignCommand { ..Default::default() }; let finalized = wallet.sign(&mut psbt, signopt)?; - Ok(PsbtResult::new(&psbt, false, Some(finalized))) + Ok(PsbtResult::new(&psbt, Some(finalized))) } } @@ -718,7 +718,7 @@ impl AppCommand>> for FinalizePsbtCommand { let finalized = wallet.finalize_psbt(&mut psbt, signopt)?; - Ok(PsbtResult::new(&psbt, false, Some(finalized))) + Ok(PsbtResult::new(&psbt, Some(finalized))) } } @@ -753,7 +753,7 @@ impl AppCommand>> for CombinePsbtCommand { Ok(acc) })?; - Ok(PsbtResult::new(&final_psbt, false, None)) + Ok(PsbtResult::new(&final_psbt, Some(false))) } } diff --git a/src/main.rs b/src/main.rs index 3f399dc..261d9fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,7 @@ use crate::handlers::{AppCommand, AppContext}; use crate::utils::output::FormatOutput; use crate::utils::runtime::WalletRuntime; use crate::utils::{command_requires_db, prepare_home_dir}; -use clap::Parser; +use clap::{CommandFactory, Parser}; #[tokio::main] async fn main() { @@ -187,8 +187,14 @@ async fn run(cli_opts: CliOpts) -> Result<(), Error> { cmd.execute(&mut ctx)?.write_out(std::io::stdout())?; } - CliSubCommand::Completions { shell: _ } => unimplemented!(), - + CliSubCommand::Completions { shell } => { + clap_complete::generate( + shell, + &mut CliOpts::command(), + "bdk-cli", + &mut std::io::stdout(), + ); + } #[cfg(feature = "silent-payments")] CliSubCommand::SilentPaymentCode(cmd) => { let mut ctx = AppContext::new(cli_opts.network, home_dir); diff --git a/src/utils/types.rs b/src/utils/types.rs index a8e2998..99bdcbd 100644 --- a/src/utils/types.rs +++ b/src/utils/types.rs @@ -78,21 +78,13 @@ pub struct PsbtResult { #[serde(skip_serializing_if = "Option::is_none")] pub is_finalized: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub details: Option, } impl PsbtResult { - pub fn new(psbt: &Psbt, verbose: bool, finalized: Option) -> Self { + pub fn new(psbt: &Psbt, finalized: Option) -> Self { Self { psbt: bdk_wallet::bitcoin::base64::prelude::BASE64_STANDARD.encode(psbt.serialize()), is_finalized: finalized, - details: if verbose { - Some(serde_json::to_value(psbt).unwrap_or_default()) - } else { - None - }, } } } diff --git a/tests/cli.rs b/tests/cli.rs index 1e06133..8f59717 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -552,7 +552,7 @@ mod test_offline { let sign_json: Value = serde_json::from_slice(&sign_output.stdout).unwrap(); let proof = sign_json["proof"].as_str().unwrap(); - // A tampered message should fail verification gracefully (valid: false) + // A tampered message should fail cli.wallet_cmd(&[ "--wallet", WALLET_NAME, diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 19be698..4322016 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -19,7 +19,6 @@ use std::path::PathBuf; pub struct BdkCli { pub network: String, pub datadir: Option, - pub verbosity: bool, pub recv_desc: Option, pub change_desc: Option, pub server_url: Option, @@ -31,7 +30,6 @@ impl BdkCli { Self { network: network.to_string(), datadir, - verbosity: false, recv_desc: None, change_desc: None, server_url: None, @@ -48,10 +46,6 @@ impl BdkCli { cmd.arg("--datadir").arg(dir); } - if self.verbosity { - cmd.arg("--verbose"); - } - if let Some(url) = &self.server_url { cmd.arg("--server").arg(url); }