Skip to content
Open
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
93 changes: 93 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ payjoin = { version = "=1.0.0-rc.1", features = ["v1", "v2", "io", "_test-utils"
reqwest = { version = "0.13.2", default-features = false, optional = true }
url = { version = "2.5.8", optional = true }
bdk_bip322 = { version = "0.1.0", optional = true }
bitcoin-payment-instructions = { version = "0.7.0", optional = true}

[features]
default = ["repl", "sqlite"]
Expand All @@ -55,7 +56,8 @@ redb = ["bdk_redb"]
cbf = ["bdk_kyoto", "_payjoin-dependencies"]
electrum = ["bdk_electrum", "_payjoin-dependencies"]
esplora = ["bdk_esplora", "_payjoin-dependencies"]
rpc = ["bdk_bitcoind_rpc", "_payjoin-dependencies"]
rpc = ["bdk_bitcoind_rpc", "_payjoin-dependencies"]
dns_payment = ["bitcoin-payment-instructions"]

# Internal features
_payjoin-dependencies = ["payjoin", "reqwest", "url"]
Expand Down
22 changes: 21 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use bdk_wallet::bitcoin::{
use clap::{Args, Parser, Subcommand, ValueEnum, value_parser};
use clap_complete::Shell;

#[cfg(feature = "dns_payment")]
use crate::utils::parse_dns_recipient;
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
use crate::utils::parse_proxy_auth;
use crate::utils::{parse_address, parse_outpoint, parse_recipient};
Expand Down Expand Up @@ -198,6 +200,16 @@ pub enum CliSubCommand {
#[arg(long = "spend_key")]
spend: bdk_sp::bitcoin::secp256k1::PublicKey,
},

#[cfg(feature = "dns_payment")]
/// Resolves BIP-353 DNS payment instructions for a human-readable name.
ResolveDnsRecipient {
/// Human-readable name (e.g. user@domain.com)
hrn: String,
/// DNS resolver address
#[arg(long, default_value = "8.8.8.8")]
resolver: String,
},
}

/// Wallet operation subcommands.
Expand Down Expand Up @@ -368,8 +380,16 @@ pub enum OfflineWalletSubCommand {
/// Adds a recipient to the transaction.
// Clap Doesn't support complex vector parsing https://github.com/clap-rs/clap/issues/1704.
// Address and amount parsing is done at run time in handler function.
#[arg(env = "ADDRESS:SAT", long = "to", required = true, value_parser = parse_recipient)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Making this optional here removes the validation that clap offers

#[arg(env = "ADDRESS:SAT", long = "to", value_parser = parse_recipient)]
recipients: Vec<(ScriptBuf, u64)>,
#[cfg(feature = "dns_payment")]
/// Adds DNS recipients to the transaction
#[arg(long = "to_dns", value_parser = parse_dns_recipient)]
dns_recipients: Vec<(String, u64)>,
Comment thread
sdmg15 marked this conversation as resolved.
#[cfg(feature = "dns_payment")]
/// Custom resolver DNS IP to be used for resolution.
#[arg(long = "dns_resolver", default_value = "8.8.8.8")]
dns_resolver: String,
/// Sends all the funds (or all the selected utxos). Requires only one recipient with value 0.
#[arg(long = "send_all", short = 'a')]
send_all: bool,
Expand Down
Loading
Loading