From 7fa35478d2a416c5e668a786b6caa2b1e84989cb Mon Sep 17 00:00:00 2001 From: Lorenzo Ronzani Date: Wed, 18 Dec 2024 14:04:35 +0100 Subject: [PATCH 1/6] added trust-dns-resolver to query dns records --- cli/Cargo.lock | 119 ++++++++++++++++++++++++++++++++++++++++++++ lib/Cargo.lock | 119 ++++++++++++++++++++++++++++++++++++++++++++ lib/core/Cargo.toml | 1 + 3 files changed, 239 insertions(+) diff --git a/cli/Cargo.lock b/cli/Cargo.lock index e12051610..7b4fd3c43 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -679,6 +679,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-tungstenite", + "trust-dns-resolver", "url", "x509-parser", "zbase32", @@ -1068,6 +1069,18 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "env_filter" version = "0.1.2" @@ -1526,6 +1539,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "http" version = "0.2.12" @@ -1804,6 +1828,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -1943,6 +1979,12 @@ dependencies = [ "hex-conservative 0.2.1", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1965,6 +2007,15 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "lwk_common" version = "0.7.0" @@ -2053,6 +2104,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchit" version = "0.7.3" @@ -2788,6 +2845,16 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "ring" version = "0.16.20" @@ -3808,6 +3875,52 @@ dependencies = [ "tracing", ] +[[package]] +name = "trust-dns-proto" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.3", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -4108,6 +4221,12 @@ dependencies = [ "rustix", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 2029f6971..3694ff201 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -780,6 +780,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-tungstenite", + "trust-dns-resolver", "url", "uuid", "x509-parser", @@ -1243,6 +1244,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "env_filter" version = "0.1.2" @@ -1710,6 +1723,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "http" version = "0.2.12" @@ -2007,6 +2031,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipnet" version = "2.10.0" @@ -2146,6 +2182,12 @@ dependencies = [ "hex-conservative 0.2.1", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2168,6 +2210,15 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "lwk_common" version = "0.7.0" @@ -2256,6 +2307,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchit" version = "0.7.3" @@ -3050,6 +3107,16 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "ring" version = "0.16.20" @@ -4102,6 +4169,52 @@ dependencies = [ "tracing", ] +[[package]] +name = "trust-dns-proto" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.3", + "rand 0.8.5", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -4686,6 +4799,12 @@ dependencies = [ "rustix", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" diff --git a/lib/core/Cargo.toml b/lib/core/Cargo.toml index 9c1e1c132..78ac6a0d4 100644 --- a/lib/core/Cargo.toml +++ b/lib/core/Cargo.toml @@ -54,6 +54,7 @@ electrum-client = { version = "0.19.0" } zbase32 = "0.1.2" x509-parser = { version = "0.16.0" } tempfile = "3" +trust-dns-resolver = "0.23.2" [dev-dependencies] lazy_static = "1.5.0" From e20aa65cca1178448576d12ed13d9bbb9b2f6cee Mon Sep 17 00:00:00 2001 From: Lorenzo Ronzani Date: Wed, 18 Dec 2024 14:05:40 +0100 Subject: [PATCH 2/6] implemented first solution to extract bolt12 offer from a bit353 pay_code --- cli/src/commands.rs | 23 +++++++++++++++++------ lib/core/src/model.rs | 2 +- lib/core/src/sdk.rs | 42 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 9 deletions(-) diff --git a/cli/src/commands.rs b/cli/src/commands.rs index 1101724b8..685afe008 100644 --- a/cli/src/commands.rs +++ b/cli/src/commands.rs @@ -29,10 +29,14 @@ pub(crate) enum Command { #[arg(long)] offer: Option, - /// Either BIP21 URI or Liquid address we intend to pay to + /// Either BIP21 URI, Liquid address we intend to pay to #[arg(long)] address: Option, + /// BIP353 address that contains a BOLT12 offer. If specified, amount_sat must also be set. + #[arg(long)] + pay_code: Option, + /// The amount in satoshi to pay, in case of a direct Liquid address /// or amount-less BIP21 #[arg(short, long)] @@ -326,20 +330,27 @@ pub(crate) async fn handle_command( invoice, offer, address, + pay_code, amount_sat, drain, delay, } => { - let destination = match (invoice, offer, address) { - (Some(invoice), None, None) => Ok(invoice), - (None, Some(offer), None) => match amount_sat { + let destination = match (invoice, offer, address, pay_code) { + (Some(invoice), None, None, None) => Ok(invoice), + (None, Some(offer), None, None) => match amount_sat { Some(_) => Ok(offer), None => Err(anyhow!( "Must specify an amount for a BOLT12 offer." )) }, - (None, None, Some(address)) => Ok(address), - (Some(_), _, Some(_)) => { + (None, None, Some(address), None) => Ok(address), + (None, None, None, Some(pay_code)) => match amount_sat { + Some(_) => Ok(pay_code), + None => Err(anyhow!( + "Must specify an amount for a BOLT12 offer." + )) + }, + (Some(_), _, Some(_), _) => { Err(anyhow::anyhow!( "Cannot specify both invoice and address at the same time." )) diff --git a/lib/core/src/model.rs b/lib/core/src/model.rs index 608ee507a..3719065ae 100644 --- a/lib/core/src/model.rs +++ b/lib/core/src/model.rs @@ -384,7 +384,7 @@ pub struct OnchainPaymentLimitsResponse { #[derive(Debug, Serialize, Clone)] pub struct PrepareSendRequest { /// The destination we intend to pay to. - /// Supports BIP21 URIs, BOLT11 invoices, BOLT12 offers and Liquid addresses + /// Supports BIP21 URIs, BOLT11 invoices, BOLT12 offers, BIP353 addresses and Liquid addresses pub destination: String, /// Should only be set when paying directly onchain or to a BIP21 URI diff --git a/lib/core/src/sdk.rs b/lib/core/src/sdk.rs index 17397fa0a..90ea0dbd8 100644 --- a/lib/core/src/sdk.rs +++ b/lib/core/src/sdk.rs @@ -25,6 +25,8 @@ use std::{fs, path::PathBuf, str::FromStr, sync::Arc, time::Duration}; use tokio::sync::{watch, Mutex, RwLock}; use tokio::time::MissedTickBehavior; use tokio_stream::wrappers::BroadcastStream; +use trust_dns_resolver::config::*; +use trust_dns_resolver::TokioAsyncResolver; use x509_parser::parse_x509_certificate; use crate::chain::bitcoin::BitcoinChainService; @@ -72,6 +74,7 @@ pub struct LiquidSdk { pub(crate) receive_swap_handler: ReceiveSwapHandler, pub(crate) chain_swap_handler: Arc, pub(crate) buy_bitcoin_service: Arc, + pub(crate) dns_resolver: Arc, } impl LiquidSdk { @@ -216,6 +219,11 @@ impl LiquidSdk { let buy_bitcoin_service = Arc::new(BuyBitcoinService::new(config.clone(), breez_server.clone())); + let dns_resolver = Arc::new(TokioAsyncResolver::tokio( + ResolverConfig::default(), + ResolverOpts::default(), + )); + let sdk = Arc::new(LiquidSdk { config: config.clone(), onchain_wallet, @@ -234,6 +242,7 @@ impl LiquidSdk { receive_swap_handler, chain_swap_handler, buy_bitcoin_service, + dns_resolver, }); Ok(sdk) } @@ -801,7 +810,7 @@ impl LiquidSdk { /// # Arguments /// /// * `req` - the [PrepareSendRequest] containing: - /// * `destination` - Either a Liquid BIP21 URI/address, a BOLT11 invoice or a BOLT12 offer + /// * `destination` - Either a Liquid BIP21 URI/address, a BOLT11 invoice, a BOLT12 offer or a BIP353 pay code that contains a BOLT12 offer /// * `amount` - The optional amount of type [PayAmount]. Should only be specified /// when paying directly onchain or via amount-less BIP21. /// - [PayAmount::Drain] which uses all funds @@ -2710,7 +2719,36 @@ impl LiquidSdk { /// /// Can optionally be configured to use external input parsers by providing `external_input_parsers` in [Config]. pub async fn parse(&self, input: &str) -> Result { - if let Ok(offer) = input.parse::() { + let mut input_str = input.to_string(); + + if let Some((local_part, domain)) = input.split_once('@') { + let resolver = Arc::clone(&self.dns_resolver); + + let dns_name = format!("{local_part}.user._bitcoin-payment.{domain}"); + + // Query for TXT records of a domain + let txt_data = match resolver.txt_lookup(dns_name).await { + Ok(records) => records + .iter() + .flat_map(|record| record.to_string().into_bytes()) // Convert each record to bytes + .collect::>(), + Err(e) => { + eprintln!("Failed to lookup TXT records: {}", e); + Vec::new() + } + }; + + match String::from_utf8(txt_data) { + Ok(decoded) => { + if let Some((_, bolt12_address)) = decoded.split_once("lno=") { + input_str = bolt12_address.to_string(); + } + } + Err(e) => eprintln!("Failed to decode TXT data: {}", e), + }; + } + + if let Ok(offer) = input_str.parse::() { // TODO This conversion (between lightning-v0.0.125 to -v0.0.118 Amount types) // won't be needed when Liquid SDK uses the same lightning crate version as sdk-common let min_amount = offer From e7f2c2d6977701367b6225036966f089b6a4ad71 Mon Sep 17 00:00:00 2001 From: Lorenzo Ronzani Date: Wed, 18 Dec 2024 14:25:59 +0100 Subject: [PATCH 3/6] edited the sdk declaration inside the tests --- lib/core/src/test_utils/sdk.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/core/src/test_utils/sdk.rs b/lib/core/src/test_utils/sdk.rs index ae34026bb..4acc82e28 100644 --- a/lib/core/src/test_utils/sdk.rs +++ b/lib/core/src/test_utils/sdk.rs @@ -24,6 +24,9 @@ use super::{ wallet::{MockSigner, MockWallet}, }; +use trust_dns_resolver::config::*; +use trust_dns_resolver::TokioAsyncResolver; + pub(crate) fn new_liquid_sdk( persister: Arc, swapper: Arc, @@ -91,6 +94,11 @@ pub(crate) fn new_liquid_sdk_with_chain_services( let buy_bitcoin_service = Arc::new(BuyBitcoinService::new(config.clone(), breez_server.clone())); + let dns_resolver = Arc::new(TokioAsyncResolver::tokio( + ResolverConfig::default(), + ResolverOpts::default(), + )); + Ok(LiquidSdk { config, onchain_wallet, @@ -109,5 +117,6 @@ pub(crate) fn new_liquid_sdk_with_chain_services( receive_swap_handler, chain_swap_handler, buy_bitcoin_service, + dns_resolver, }) } From aafda5ff8c93a48ff6592f4697bf279ae2173aae Mon Sep 17 00:00:00 2001 From: Lorenzo Ronzani Date: Wed, 18 Dec 2024 14:26:26 +0100 Subject: [PATCH 4/6] extract the bip353_parse functionality --- lib/core/src/sdk.rs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/core/src/sdk.rs b/lib/core/src/sdk.rs index 90ea0dbd8..f9798742f 100644 --- a/lib/core/src/sdk.rs +++ b/lib/core/src/sdk.rs @@ -2715,12 +2715,7 @@ impl LiquidSdk { Ok(config) } - /// Parses a string into an [InputType]. See [input_parser::parse]. - /// - /// Can optionally be configured to use external input parsers by providing `external_input_parsers` in [Config]. - pub async fn parse(&self, input: &str) -> Result { - let mut input_str = input.to_string(); - + async fn bip353_parse(&self, input: &str) -> Option { if let Some((local_part, domain)) = input.split_once('@') { let resolver = Arc::clone(&self.dns_resolver); @@ -2730,24 +2725,39 @@ impl LiquidSdk { let txt_data = match resolver.txt_lookup(dns_name).await { Ok(records) => records .iter() - .flat_map(|record| record.to_string().into_bytes()) // Convert each record to bytes + .flat_map(|record| record.to_string().into_bytes()) .collect::>(), Err(e) => { eprintln!("Failed to lookup TXT records: {}", e); - Vec::new() + return None; } }; + // Decode TXT data match String::from_utf8(txt_data) { Ok(decoded) => { if let Some((_, bolt12_address)) = decoded.split_once("lno=") { - input_str = bolt12_address.to_string(); + return Some(bolt12_address.to_string()); } } - Err(e) => eprintln!("Failed to decode TXT data: {}", e), - }; + Err(e) => { + eprintln!("Failed to decode TXT data: {}", e); + } + } } + None + } + + /// Parses a string into an [InputType]. See [input_parser::parse]. + /// + /// Can optionally be configured to use external input parsers by providing `external_input_parsers` in [Config]. + pub async fn parse(&self, input: &str) -> Result { + let input_str = match self.bip353_parse(input).await { + Some(value) => value, + None => input.to_string(), + }; + if let Ok(offer) = input_str.parse::() { // TODO This conversion (between lightning-v0.0.125 to -v0.0.118 Amount types) // won't be needed when Liquid SDK uses the same lightning crate version as sdk-common From 61778312361470c5028ab3fae59ecf326fd29d41 Mon Sep 17 00:00:00 2001 From: Lorenzo Ronzani Date: Thu, 19 Dec 2024 08:28:59 +0100 Subject: [PATCH 5/6] implemented the lnurl-pay parsing --- lib/core/src/sdk.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/core/src/sdk.rs b/lib/core/src/sdk.rs index f9798742f..926468440 100644 --- a/lib/core/src/sdk.rs +++ b/lib/core/src/sdk.rs @@ -54,6 +54,10 @@ pub const DEFAULT_DATA_DIR: &str = ".data"; /// Number of blocks to monitor a swap after its timeout block height pub const CHAIN_SWAP_MONITORING_PERIOD_BITCOIN_BLOCKS: u32 = 4320; +const USER_BITCOIN_PAYMENT_PREFIX: &str = "user._bitcoin-payment"; +const BOLT12_PREFIX: &str = "lno="; +const LNURL_PAY_PREFIX: &str = "lnurl="; + pub struct LiquidSdk { pub(crate) config: Config, pub(crate) onchain_wallet: Arc, @@ -2719,7 +2723,7 @@ impl LiquidSdk { if let Some((local_part, domain)) = input.split_once('@') { let resolver = Arc::clone(&self.dns_resolver); - let dns_name = format!("{local_part}.user._bitcoin-payment.{domain}"); + let dns_name = format!("{}.{}.{}", local_part, USER_BITCOIN_PAYMENT_PREFIX, domain); // Query for TXT records of a domain let txt_data = match resolver.txt_lookup(dns_name).await { @@ -2736,9 +2740,13 @@ impl LiquidSdk { // Decode TXT data match String::from_utf8(txt_data) { Ok(decoded) => { - if let Some((_, bolt12_address)) = decoded.split_once("lno=") { + if let Some((_, bolt12_address)) = decoded.split_once(BOLT12_PREFIX) { return Some(bolt12_address.to_string()); } + + if let Some((_, lnurl)) = decoded.split_once(LNURL_PAY_PREFIX) { + return Some(lnurl.to_string()); + } } Err(e) => { eprintln!("Failed to decode TXT data: {}", e); @@ -2753,6 +2761,7 @@ impl LiquidSdk { /// /// Can optionally be configured to use external input parsers by providing `external_input_parsers` in [Config]. pub async fn parse(&self, input: &str) -> Result { + // Try to parse the destination as a bip353 address. let input_str = match self.bip353_parse(input).await { Some(value) => value, None => input.to_string(), From 51cf0e48605d5df88f26a3b12a21e2332c89e607 Mon Sep 17 00:00:00 2001 From: Lorenzo Ronzani Date: Thu, 19 Dec 2024 09:13:01 +0100 Subject: [PATCH 6/6] edited comment like before --- cli/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/commands.rs b/cli/src/commands.rs index 685afe008..7e3905746 100644 --- a/cli/src/commands.rs +++ b/cli/src/commands.rs @@ -29,7 +29,7 @@ pub(crate) enum Command { #[arg(long)] offer: Option, - /// Either BIP21 URI, Liquid address we intend to pay to + /// Either BIP21 URI or Liquid address we intend to pay to #[arg(long)] address: Option,