Repository navigation
feat(order): show and enter BTC-pegged amounts right - #910
Conversation
For BTC, LBTC and RBTC (mostro docs/PRICE_PROVIDERS.md §11.9, protocol
"Bitcoin on other networks") an order's fiat amount counts sats of the
asset: fa = 100000 is 0.001 RBTC. Every screen read it as whole units,
so an RBTC order showed as "100,000 RBTC".
- btc_pegged.dart: isBtcPeggedCode and formatBtcPeggedAmount (the sats
in the asset unit, 8 decimals at most).
- Shown in the asset unit next to the code, so "{amount} {code}" stays
as it was: the order card, the take hero, formatFiatAmount (trade
card, trade detail, chat list and info panels; it now takes the
code), OrderItem.displayAmount (trade state header), the invoice
screen, the bond-slashed notification and the create preview.
- Entered in sats, which is what goes on the wire: the amount field
takes whole numbers with a "sats" unit for these codes, the take
range modal names sats instead of the code, and the out-of-range
message gives the sats bounds.
- Figures that mean nothing at 1:1 are replaced or dropped: a
fixed-sats card shows the premium its two figures imply instead of a
price per BTC, and the bond's and the node card's fiat equivalents
are omitted.
Refs #907 (items 6-8)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wLvLzCu94YTaE15zLR2Cn
Review round on the BTC-pegged amounts: - Switching the currency between a fiat and a BTC-pegged code changes the unit of the typed amount, whole units or sats, and the field kept the text: 12.5 USD became 12 sats of RBTC, and 100000 RBTC sats became 100,000 USD. AmountSection now clears the amount fields when the selected code crosses that boundary, whoever changed it. A switch between two fiats keeps the amount, as before. - formatBondFiat, used by the bond payout hero, printed a BTC-pegged claim as "100,000 RBTC"; it now reads the sats in the asset unit. - The chat's trade state header printed the amount without the locale and, for these codes, in 'en' only; it now uses formatFiatAmount, as the info panel of the same chat does. Refs #907 (items 6-8) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wLvLzCu94YTaE15zLR2Cn
|
Caution Review failedThe pull request is closed. WalkthroughThe change adds BTC-pegged currency detection and asset-unit formatting for BTC, LBTC, and RBTC. It applies these rules to amount entry, order and trade displays, bond calculations, notifications, and node metrics. ChangesBTC-Pegged Amount Handling
Priority: Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Possibly related issues
Possibly related PRs
Suggested reviewers: Merge Risk:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e682901d8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The design check reads every class a change touches, and the metrics strip of the node card and the trade card's amount row predate the scales (CI: DS-SPC-2 ×2, DS-TYP-4 ×1): - the strip's vertical padding 11 → 12, as its horizontal one; - the trade card's amount 21 → 19, the size of a headline figure in a list (§3.2), and its gap to the code 7 → 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wLvLzCu94YTaE15zLR2Cn
|
@codex review |
|
@coderabbitai review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Linked issue
Refs #907 (items 6–8). The issue closes with the last of its PRs. Merge order: #908 (rates), #909 (conversion), this one, then #911 (catalogue) and #912 (trade copy), which are stacked on it.
Type
feat
What changes and why
For
BTC,LBTCandRBTC(protocol "Bitcoin on other networks", mostroddocs/PRICE_PROVIDERS.md§11.9) an order's fiat amount counts sats of the asset:fa = 100000is 0.001 RBTC. Every screen read it as whole units, so an RBTC order showed as "100,000 RBTC", whichever client published it. This PR makes the amounts right before the codes become pickable (#911).0.001 RBTC. The "{amount} {code}" strings and their l10n stay as they are.satsunit, the take-order range modal names sats, and the out-of-range message gives the sats bounds.Affected flow
Dart only.
lib/shared/utils/btc_pegged.dart(new) and:order_list_item.dart).OrderCardFormats.amount) and the range modal (range_amount_modal.dart).amount_section.dart), the preview and the range warning (add_order_screen.dart).formatFiatAmountintrades_list_rules.dart, which now takes the code).trade_state_header.dart).bond_rules.dart).invoice_widgets.dart), the bond-slashed notification detail (notification_model.dart) and the node card (node_selector_rules.dart).Blast radius
25,50ines).Platforms tested
None by hand (see Manual testing).
flutter teston Linux.Manual testing
Not run. I could not run the app against a Mostro node here.
Setup
App built from this branch and from #911, against a mostrod with the pegged provider quoting
RBTC(MostroP2P/mostro#1091).Steps
100000.5. Expected: the field shows100,000withsatsbeside it, and the preview reads "… for 0.001 RBTC".0.001with the RBTC chip. (fails onmain):100,000.25.5. Expected: as onmain.Not covered
iOS and Android devices; the catalogue entries come with #911.
Screenshots
Visible change: the amounts of these codes, the
satsunit in the field, and the implied premium on a fixed card.The design check reads every class a change touches, so this branch also puts three older values on the scales:
The Update goldens workflow regenerated the goldens. Screenshots were not captured, because I could not run the app here; they are needed before merge. Design-guide rules touched: DS-TYP-4 and DS-SPC-2, none changed. The figures keep
AppFonts.figures.Automated tests
btc_pegged_test: the codes, and the asset-unit format in two locales.trades_list_rules_test:formatFiatAmountfor RBTC and an LBTC range.order_card_formats_test: card amounts, and the implied premium.order_item_display_amount_test:displayAmount.amount_section_test:satsunit;range_amount_modal_test: the modal names sats.bond_rules_test: no fiat equivalent, and the payout hero amount in the asset unit.node_selector_rules_test: no fiat equivalent for these codes.Whole suite: every new test passes, and the 98 failures are the same files as on a clean
main(goldens and release-script tests in this environment).Checklist
cd rust && cargo fmt --check && cargo clippy -- -D warnings && cargo testpass locally: no Rust change.dart format --set-exit-if-changed .,flutter analyzeandflutter testpass locally:flutter analyzereports only the existingtrades_screen.dartinfo. My local Flutter (3.47.8) formats differently from CI (3.41.9), so the changed lines keep the repository's style instead of reformatting whole files.rust/src/api/or an.arb: nosatsUnitLabelis reused.specs/states how amounts are shownAI assistance
Written with Claude Code from #907, with an independent review round (fixes in
fix(order): clear the amount when its unit changes) and a design-check round (fix(design): put the classes this branch touches on the scales).🤖 Generated with Claude Code
https://claude.ai/code/session_016wLvLzCu94YTaE15zLR2Cn