Skip to content

Commit 977534a

Browse files
committed
feat: integrate BIP 353 dns payment instructions
1 parent b9cf2ac commit 977534a

File tree

7 files changed

+463
-9
lines changed

7 files changed

+463
-9
lines changed

Cargo.lock

Lines changed: 93 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ shlex = { version = "1.3.0", optional = true }
3636
payjoin = { version = "1.0.0-rc.1", features = ["v1", "v2", "io", "_test-utils"], optional = true}
3737
reqwest = { version = "0.12.23", default-features = false, optional = true }
3838
url = { version = "2.5.4", optional = true }
39+
bitcoin-payment-instructions = { version = "0.7.0", optional = true}
3940

4041
[features]
4142
default = ["repl", "sqlite"]
@@ -51,7 +52,8 @@ redb = ["bdk_redb"]
5152
cbf = ["bdk_kyoto", "_payjoin-dependencies"]
5253
electrum = ["bdk_electrum", "_payjoin-dependencies"]
5354
esplora = ["bdk_esplora", "_payjoin-dependencies"]
54-
rpc = ["bdk_bitcoind_rpc", "_payjoin-dependencies"]
55+
rpc = ["bdk_bitcoind_rpc", "_payjoin-dependencies"]
56+
dns_payment = ["bitcoin-payment-instructions"]
5557

5658
# Internal features
5759
_payjoin-dependencies = ["payjoin", "reqwest", "url"]

src/commands.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
//! All subcommands are defined in the below enums.
1414
1515
#![allow(clippy::large_enum_variant)]
16+
1617
use bdk_wallet::bitcoin::{
1718
Address, Network, OutPoint, ScriptBuf,
1819
bip32::{DerivationPath, Xpriv},
1920
};
2021
use clap::{Args, Parser, Subcommand, ValueEnum, value_parser};
2122

23+
#[cfg(feature = "dns_payment")]
24+
use crate::utils::parse_dns_recipients;
2225
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
2326
use crate::utils::parse_proxy_auth;
2427
use crate::utils::{parse_address, parse_outpoint, parse_recipient};
@@ -127,6 +130,10 @@ pub enum CliSubCommand {
127130
},
128131
/// List all saved wallet configurations.
129132
Wallets,
133+
134+
#[cfg(feature = "dns_payment")]
135+
/// Resolves the given hrn payment instructions
136+
ResolveDnsRecipient { hrn: String , resolver: Option<String>},
130137
}
131138
/// Wallet operation subcommands.
132139
#[derive(Debug, Subcommand, Clone, PartialEq)]
@@ -298,6 +305,14 @@ pub enum OfflineWalletSubCommand {
298305
// Address and amount parsing is done at run time in handler function.
299306
#[arg(env = "ADDRESS:SAT", long = "to", required = true, value_parser = parse_recipient)]
300307
recipients: Vec<(ScriptBuf, u64)>,
308+
#[cfg(feature = "dns_payment")]
309+
/// Adds DNS recipients to the transaction
310+
#[arg(long = "to_dns", value_parser = parse_dns_recipients)]
311+
dns_recipients: Vec<(String, u64)>,
312+
#[cfg(feature = "dns_payment")]
313+
/// Custom resolver DNS IP to be used for resolution.
314+
#[arg(long = "dns_resolver", default_value = "8.8.8.8:53")]
315+
dns_resolver: String,
301316
/// Sends all the funds (or all the selected utxos). Requires only one recipient with value 0.
302317
#[arg(long = "send_all", short = 'a')]
303318
send_all: bool,

0 commit comments

Comments
 (0)