/// Selects the wallet to use.
#[arg(skip)]
pub wallet: Option<String>,
- /// 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,
Ok(WalletOpts {
wallet: Some(config.wallet.clone()),
- verbose: false,
ext_descriptor: config.ext_descriptor.clone(),
int_descriptor: config.int_descriptor.clone(),
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")]
// let psbt_base64 = BASE64_STANDARD.encode(psbt.serialize());
- Ok(PsbtResult::new(&psbt, false, Some(false)))
+ Ok(PsbtResult::new(&psbt, Some(false)))
}
}
// let psbt_base64 = BASE64_STANDARD.encode(psbt.serialize());
- Ok(PsbtResult::new(&psbt, false, Some(false)))
+ Ok(PsbtResult::new(&psbt, Some(false)))
}
}
..Default::default()
};
let finalized = wallet.sign(&mut psbt, signopt)?;
- Ok(PsbtResult::new(&psbt, false, Some(finalized)))
+ Ok(PsbtResult::new(&psbt, Some(finalized)))
}
}
let finalized = wallet.finalize_psbt(&mut psbt, signopt)?;
- Ok(PsbtResult::new(&psbt, false, Some(finalized)))
+ Ok(PsbtResult::new(&psbt, Some(finalized)))
}
}
Ok(acc)
})?;
- Ok(PsbtResult::new(&final_psbt, false, None))
+ Ok(PsbtResult::new(&final_psbt, Some(false)))
}
}
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() {
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);
#[serde(skip_serializing_if = "Option::is_none")]
pub is_finalized: Option<bool>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub details: Option<serde_json::Value>,
}
impl PsbtResult {
- pub fn new(psbt: &Psbt, verbose: bool, finalized: Option<bool>) -> Self {
+ pub fn new(psbt: &Psbt, finalized: Option<bool>) -> 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
- },
}
}
}
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,
pub struct BdkCli {
pub network: String,
pub datadir: Option<PathBuf>,
- pub verbosity: bool,
pub recv_desc: Option<String>,
pub change_desc: Option<String>,
pub server_url: Option<String>,
Self {
network: network.to_string(),
datadir,
- verbosity: false,
recv_desc: None,
change_desc: None,
server_url: None,
cmd.arg("--datadir").arg(dir);
}
- if self.verbosity {
- cmd.arg("--verbose");
- }
-
if let Some(url) = &self.server_url {
cmd.arg("--server").arg(url);
}