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 @@ -36,6 +36,7 @@ shlex = { version = "1.3.0", optional = true }
payjoin = { version = "1.0.0-rc.1", features = ["v1", "v2", "io", "_test-utils"], optional = true}
reqwest = { version = "0.12.23", default-features = false, optional = true }
url = { version = "2.5.4", optional = true }
bitcoin-payment-instructions = { version = "0.7.0", optional = true}

[features]
default = ["repl", "sqlite"]
Expand All @@ -51,7 +52,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
15 changes: 15 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
//! All subcommands are defined in the below enums.

#![allow(clippy::large_enum_variant)]

use bdk_wallet::bitcoin::{
Address, Network, OutPoint, ScriptBuf,
bip32::{DerivationPath, Xpriv},
};
use clap::{Args, Parser, Subcommand, ValueEnum, value_parser};

#[cfg(feature = "dns_payment")]
use crate::utils::parse_dns_recipients;
#[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 @@ -127,6 +130,10 @@ pub enum CliSubCommand {
},
/// List all saved wallet configurations.
Wallets,

#[cfg(feature = "dns_payment")]
/// Resolves the given hrn payment instructions
ResolveDnsRecipient { hrn: String , resolver: Option<String>},
Comment on lines +134 to +136
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[cfg(feature = "dns_payment")]
/// Resolves the given hrn payment instructions
ResolveDnsRecipient { hrn: String , resolver: Option<String>},
#[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,
},

This will make --help more useful:

-> % cargo run --all-features -- -n bitcoin resolve_dns_recipient --help
Resolves BIP-353 DNS payment instructions for a human-readable name

Usage: bdk-cli resolve_dns_recipient [OPTIONS] <HRN>

Arguments:
  <HRN>  Human-readable name (e.g. user@domain.com)

Options:
      --resolver <RESOLVER>  DNS resolver address [default: 8.8.8.8]
      --pretty               Output results in pretty format (instead of JSON)
  -h, --help                 Print help

Please note that the type for the resolver has changed.
See the suggested changes in the function itself.

}
/// Wallet operation subcommands.
#[derive(Debug, Subcommand, Clone, PartialEq)]
Expand Down Expand Up @@ -298,6 +305,14 @@ pub enum OfflineWalletSubCommand {
// Address and amount parsing is done at run time in handler function.
#[arg(env = "ADDRESS:SAT", long = "to", required = true, 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_recipients)]
dns_recipients: Vec<(String, u64)>,
#[cfg(feature = "dns_payment")]
/// Custom resolver DNS IP to be used for resolution.
#[arg(long = "dns_resolver", default_value = "8.8.8.8:53")]
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