From af961ae718be2160e8339ca7c55b03cc546fed84 Mon Sep 17 00:00:00 2001 From: codaMW Date: Thu, 5 Mar 2026 18:13:12 +0200 Subject: [PATCH 1/3] fix(take_order): show correct label for fiat amount in takebuy When taking a buy order, the -a flag represents a fiat amount, not a sats amount. The display table was incorrectly labeling it as 'Amount (sats)' for both takebuy and takesell. Also fixed action match to use references (&action) to avoid moving a non-Copy enum value before second match. Now shows 'Fiat Amount' for TakeBuy and 'Amount (sats)' for TakeSell. --- src/cli/take_order.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/cli/take_order.rs b/src/cli/take_order.rs index e9f80bd..5046db6 100644 --- a/src/cli/take_order.rs +++ b/src/cli/take_order.rs @@ -59,7 +59,7 @@ pub async fn execute_take_order( amount: Option, ctx: &Context, ) -> Result<()> { - let action_name = match action { + let action_name = match &action { Action::TakeBuy => "take buy", Action::TakeSell => "take sell", _ => return Err(anyhow::anyhow!("Invalid action for take order")), @@ -78,13 +78,21 @@ pub async fn execute_take_order( if let Some(inv) = invoice { table.add_row(create_emoji_field_row("⚡ ", "Invoice", inv)); } + + + //new line if let Some(amt) = amount { - table.add_row(create_emoji_field_row( - "💰 ", - "Amount (sats)", - &amt.to_string(), - )); - } + let amount_label = match &action { + Action::TakeBuy => "Fiat Amount", + _ => "Amount (sats)", + }; + table.add_row(create_emoji_field_row( + "💰 ", + amount_label, + &amt.to_string(), + )); +} +//end here table.add_row(create_emoji_field_row( "🎯 ", "Mostro PubKey", From 1bd5bc0b395b4ec28cbc01ce3d9bb221aa4c85a6 Mon Sep 17 00:00:00 2001 From: codaMW Date: Thu, 5 Mar 2026 22:27:17 +0200 Subject: [PATCH 2/3] fix(take_order): correct amount label and help text for takebuy/takesell - takebuy now shows 'Fiat Amount' instead of 'Amount (sats)' in the confirmation table, since -a represents fiat not sats for this command - Fixed action match to use &action references to avoid moving a non-Copy enum before the second match - Updated help text for takesell -a to clarify user is paying fiat to buy sats from the seller - Updated help text for takebuy -a to clarify user is receiving fiat in exchange for selling sats to the buyer Matches the language used in the Mostro mobile app where buy orders show 'Someone is Buying Sats' and sell orders show 'Someone is Selling Sats' --- src/cli.rs | 4 ++-- src/cli/take_order.rs | 24 ++++++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 54f7fd0..47fcd91 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -145,7 +145,7 @@ pub enum Commands { /// Invoice string #[arg(short, long)] invoice: Option, - /// Amount of fiat to buy + /// Amount of fiat to pay (someone is selling sats, you are buying) #[arg(short, long)] amount: Option, }, @@ -154,7 +154,7 @@ pub enum Commands { /// Order id #[arg(short, long)] order_id: Uuid, - /// Amount of fiat to sell + /// Amount of fiat to receive (someone is buying sats, you are selling) #[arg(short, long)] amount: Option, }, diff --git a/src/cli/take_order.rs b/src/cli/take_order.rs index 5046db6..b5a7780 100644 --- a/src/cli/take_order.rs +++ b/src/cli/take_order.rs @@ -78,21 +78,17 @@ pub async fn execute_take_order( if let Some(inv) = invoice { table.add_row(create_emoji_field_row("⚡ ", "Invoice", inv)); } - - - //new line if let Some(amt) = amount { - let amount_label = match &action { - Action::TakeBuy => "Fiat Amount", - _ => "Amount (sats)", - }; - table.add_row(create_emoji_field_row( - "💰 ", - amount_label, - &amt.to_string(), - )); -} -//end here + let amount_label = match &action { + Action::TakeBuy => "Fiat Amount", + _ => "Amount (sats)", + }; + table.add_row(create_emoji_field_row( + "💰 ", + amount_label, + &amt.to_string(), + )); + } table.add_row(create_emoji_field_row( "🎯 ", "Mostro PubKey", From dcb0c0bc32472f93acd6e8ef708d031d911bd3a3 Mon Sep 17 00:00:00 2001 From: codaMW Date: Thu, 5 Mar 2026 23:08:04 +0200 Subject: [PATCH 3/3] fix(take_order): show Fiat Amount label for both takebuy and takesell TakeSell -a also accepts a fiat amount, not sats. Updated the amount label match to show 'Fiat Amount' for both TakeBuy and TakeSell actions as suggested in code review. --- src/cli/take_order.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/take_order.rs b/src/cli/take_order.rs index b5a7780..b6cca7d 100644 --- a/src/cli/take_order.rs +++ b/src/cli/take_order.rs @@ -80,7 +80,7 @@ pub async fn execute_take_order( } if let Some(amt) = amount { let amount_label = match &action { - Action::TakeBuy => "Fiat Amount", + Action::TakeBuy | Action::TakeSell => "Fiat Amount", _ => "Amount (sats)", }; table.add_row(create_emoji_field_row(