Skip to content

fix(take_order): correct amount label and help text for takebuy/takesell#158

Open
codaMW wants to merge 3 commits intoMostroP2P:mainfrom
codaMW:fix/takebuy-takesell-amount-label
Open

fix(take_order): correct amount label and help text for takebuy/takesell#158
codaMW wants to merge 3 commits intoMostroP2P:mainfrom
codaMW:fix/takebuy-takesell-amount-label

Conversation

@codaMW
Copy link
Contributor

@codaMW codaMW commented Mar 5, 2026

Problem

Two related UX issues were found when testing takebuy and takesell commands:

  1. The confirmation table for takebuy showed Amount (sats) but the
    -a flag accepts a fiat amount, not sats. This was misleading and
    inconsistent with takesell which correctly shows the sats amount.

  2. The help text for -a on both commands was confusing:

    • takesell -a said "Amount of fiat to buy" (ambiguous)
    • takebuy -a said "Amount of fiat to sell" (ambiguous)

Changes

  • takebuy confirmation table now shows Fiat Amount instead of Amount (sats)
  • Fixed match action to use &action references to avoid moving a
    non-Copy enum before second match
  • takesell -a help text now reads: "Amount of fiat to pay (someone is selling sats, you are buying)"
  • takebuy -a help text now reads: "Amount of fiat to receive (someone is buying sats, you are selling)"

Testing

Tested against staging Mostro pubkey:

  • mostro-cli takebuy -o <order-id> -a 5 confirms label shows Fiat Amount
  • mostro-cli takesell -o <order-id> -a 5 confirms label still shows Amount (sats)
  • mostro-cli takebuy -h shows updated help text
  • mostro-cli takesell -h shows updated help text

Notes

Help text language matches the Mostro mobile app which uses
"Someone is Buying Sats" for buy orders and "Someone is Selling Sats"
for sell orders.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented unintended action/state loss during order processing.
    • Amount field now displays context-aware labels: "Fiat Amount" for buy/sell actions, "Amount (sats)" otherwise.
  • Documentation

    • Clarified help text for buy and sell commands to explain fiat amount semantics when buying vs selling.

codaMW added 2 commits March 5, 2026 18:13
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.
- 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'
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c86d1c32-9f63-4be8-aaa0-6d8d2c7f53ea

📥 Commits

Reviewing files that changed from the base of the PR and between 1bd5bc0 and dcb0c0b.

📒 Files selected for processing (1)
  • src/cli/take_order.rs

Walkthrough

Clarified CLI help text for TakeSell and TakeBuy to explain fiat amount semantics; adjusted take_order display logic to borrow the action value and conditionally label the amount row as "Fiat Amount" for TakeBuy/TakeSell and "Amount (sats)" for other actions.

Changes

Cohort / File(s) Summary
CLI Help Text
src/cli.rs
Updated parameter help texts for TakeSell and TakeBuy to clarify that the fiat amount represents the payment direction when buying vs selling. No signature changes.
Order Display Logic
src/cli/take_order.rs
Changed action_name binding to borrow action (&action) instead of taking ownership; made amount row label conditional: "Fiat Amount" for TakeBuy/TakeSell, otherwise "Amount (sats)".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • grunch

Poem

🐰 A hop, a tweak, the labels sing,
Fiat or sats—the right bell we ring,
Borrowed action keeps things neat,
Buy and sell now clearly meet. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main changes: correcting the amount label and help text for takebuy/takesell commands, which aligns with the primary objectives of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cli/take_order.rs`:
- Around line 82-89: The confirmation table's amount_label match in
take_order.rs currently uses "Fiat Amount" only for Action::TakeBuy and a
generic "Amount (sats)" for all other actions, which contradicts the updated
fiat semantics for TakeSell; update the match on action (used where amount_label
is defined) to explicitly handle Action::TakeSell (and Action::TakeBuy) so both
use "Fiat Amount", and keep "Amount (sats)" for true sat-denominated actions
only, ensuring the label shown in create_emoji_field_row matches the -a help
text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8ac9478c-2c29-4f86-ace0-6192081209a2

📥 Commits

Reviewing files that changed from the base of the PR and between 9b0ecb2 and 1bd5bc0.

📒 Files selected for processing (2)
  • src/cli.rs
  • src/cli/take_order.rs

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant