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
63 changes: 63 additions & 0 deletions 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 @@ -411,6 +423,57 @@ pub enum OfflineWalletSubCommand {
)]
add_data: Option<String>, //base 64 econding
},
#[cfg(feature = "dns_payment")]
/// Creates a new unsigned transaction from DNS payment instructions.
CreateDnsTx {
/// Adds a recipient to the transaction.
#[arg(env = "ADDRESS:SAT", long = "to", value_parser = parse_recipient)]
recipients: Vec<(ScriptBuf, u64)>,
#[arg(long = "to_dns", value_parser = parse_dns_recipient)]
dns_recipients: Vec<(String, u64)>,
#[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,
/// Enables Replace-By-Fee (BIP125).
#[arg(long = "enable_rbf", short = 'r', default_value_t = true)]
enable_rbf: bool,
/// 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")]
offline_signer: bool,
/// Selects which utxos *must* be spent.
#[arg(env = "MUST_SPEND_TXID:VOUT", long = "utxos", value_parser = parse_outpoint)]
utxos: Option<Vec<OutPoint>>,
/// Marks a utxo as unspendable.
#[arg(env = "CANT_SPEND_TXID:VOUT", long = "unspendable", value_parser = parse_outpoint)]
unspendable: Option<Vec<OutPoint>>,
/// Fee rate to use in sat/vbyte.
#[arg(env = "SATS_VBYTE", short = 'f', long = "fee_rate")]
fee_rate: Option<f32>,
/// Selects which policy should be used to satisfy the external descriptor.
#[arg(env = "EXT_POLICY", long = "external_policy")]
external_policy: Option<String>,
/// Selects which policy should be used to satisfy the internal descriptor.
#[arg(env = "INT_POLICY", long = "internal_policy")]
internal_policy: Option<String>,
/// Optionally create an OP_RETURN output containing given String in utf8 encoding (max 80 bytes)
#[arg(
env = "ADD_STRING",
long = "add_string",
short = 's',
conflicts_with = "add_data"
)]
add_string: Option<String>,
/// Optionally create an OP_RETURN output containing given base64 encoded String. (max 80 bytes)
#[arg(
env = "ADD_DATA",
long = "add_data",
short = 'o',
conflicts_with = "add_string"
)]
add_data: Option<String>, //base 64 econding
},
/// Creates a silent payment transaction
///
/// This sub-command is **EXPERIMENTAL** and should only be used for testing. Do not use this
Expand Down
Loading