From 12de46f046743b10d5df40889ce26857f33d8790 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 26 Nov 2024 12:15:15 -0800 Subject: [PATCH] Improve `ord wallet send` help message and rename output `outgoing` to `asset` (#4105) --- src/subcommand/wallet/burn.rs | 2 +- src/subcommand/wallet/send.rs | 15 +++++++++++---- tests/wallet/send.rs | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/subcommand/wallet/burn.rs b/src/subcommand/wallet/burn.rs index 4312987e1d..53e6a5adb2 100644 --- a/src/subcommand/wallet/burn.rs +++ b/src/subcommand/wallet/burn.rs @@ -99,7 +99,7 @@ impl Burn { Ok(Some(Box::new(send::Output { txid, psbt, - outgoing: Outgoing::InscriptionId(self.inscription), + asset: Outgoing::InscriptionId(self.inscription), fee, }))) } diff --git a/src/subcommand/wallet/send.rs b/src/subcommand/wallet/send.rs index da9785ccc5..89abbf6a77 100644 --- a/src/subcommand/wallet/send.rs +++ b/src/subcommand/wallet/send.rs @@ -12,15 +12,22 @@ pub(crate) struct Send { value_name = "AMOUNT" )] pub(crate) postage: Option, + #[arg(help = "Recipient address")] address: Address, - outgoing: Outgoing, + #[arg( + help = "Outgoing asset formatted as a bitcoin amount, rune amount, sat name, satpoint, or \ + inscription ID. Bitcoin amounts are `DECIMAL UNIT` where `UNIT` is one of \ + `bit btc cbtc mbtc msat nbtc pbtc sat satoshi ubtc`. Rune amounts are `DECIMAL:RUNE` and \ + respect divisibility" + )] + asset: Outgoing, } #[derive(Debug, Serialize, Deserialize)] pub struct Output { pub txid: Txid, pub psbt: String, - pub outgoing: Outgoing, + pub asset: Outgoing, pub fee: u64, } @@ -31,7 +38,7 @@ impl Send { .clone() .require_network(wallet.chain().network())?; - let unsigned_transaction = match self.outgoing { + let unsigned_transaction = match self.asset { Outgoing::Amount(amount) => { Self::create_unsigned_send_amount_transaction(&wallet, address, amount, self.fee_rate)? } @@ -79,7 +86,7 @@ impl Send { Ok(Some(Box::new(Output { txid, psbt, - outgoing: self.outgoing, + asset: self.asset, fee, }))) } diff --git a/tests/wallet/send.rs b/tests/wallet/send.rs index 46ef3ec635..2d843f65b8 100644 --- a/tests/wallet/send.rs +++ b/tests/wallet/send.rs @@ -671,7 +671,7 @@ fn send_dry_run() { .to_sat(), output.fee ); - assert_eq!(output.outgoing, Outgoing::InscriptionId(inscription)); + assert_eq!(output.asset, Outgoing::InscriptionId(inscription)); } #[test]