Trade timeline: keep "Order taken" in progress while the taker's deposit is unpaid

Open
#927 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
dart, flutter
Domain
frontend, mobile

Research direction

Start with TradeView in lib/features/trades/models/trade_view.dart and the _steps() timeline logic in trade_detail_screen.dart; then read the two named bond and TradeView tests. Trace how waitingBond distinguishes taker from maker so the taker’s first step stays current while the maker never sees “Orden tomada.” Done means both taker roles show step 1 with later steps pending, existing post-bond behavior is preserved, and the maker timeline is correct; add the requested waitingBond timeline widget test.

Written by the indexing model from the issue text.

Description

area: ui bug

Context

On a node with the anti-abuse bond enabled (apply_to = "take" or "both"), taking an order puts it in WaitingTakerBond. The taker must first pay a bond hold invoice (PayBondInvoice). Only once that bond locks does the trade flow start. For a seller who takes a buy order, a second hold invoice for the full amount follows. These are two separate, sequential HTLCs (mostrod docs/ANTI_ABUSE_BOND.md §6.3).

In the app, both OrderStatus.waitingTakerBond and OrderStatus.waitingMakerBond map to TradeStatus.waitingBond. TradeView (lib/features/trades/models/trade_view.dart) gives that status step: 1.

Problem

While the deposit is unpaid, the trade timeline marks step 2 as current. For a seller, that step is "Bloqueas los sats" / the seller's escrow step (tradeStepInvoiceSeller). For a buyer, it is the buyer's invoice step (tradeStepInvoiceBuyer). Meanwhile, step 1, "Orden tomada", already shows the done check, and the primary button says "Pagar depósito".

Observed on a buy order taken as seller (7,000 ARS):

  • Header: PASO 2 DE 5, title "Bloquea tu depósito para continuar".
  • Timeline: ✓ Orden tomada, ◉ Bloqueas los sats, ○ El comprador envía el pago, ...
  • Button: "Pagar depósito".

This misleads the user in two ways:

  1. The seller may think the deposit locks the trade sats. It does not. The full-amount hold invoice still comes after it, so the second payment request is a surprise.
  2. "Orden tomada" looks done, but the take is not settled yet. Until the deposit locks, the order is still open to others, and another taker who pays their deposit first wins it.

Fix

Do not add a step. While the status is waitingBond for a taker, keep the take step current:

  • Use step: 0 for TradeStatus.waitingBond in TradeView, so the header reads PASO 1 DE 5 (1 de 6 for a buyer).
  • Label step 0 as "Orden tomada" (tradeStepOrderTaken) with the in-progress ring, not the done check, and not "Esperando tomador". Today _steps() in trade_detail_screen.dart picks the label from current == 0 alone (tradeStepWaitingTaker), so it needs the status (or a flag) to tell "waiting for a taker" apart from "taken, deposit pending".
  • Once the bond locks, the order moves to waitingPayment / waitingInvoice and the existing mapping applies: "Orden tomada" gets its check and step 2 becomes current.

Maker bond: waitingMakerBond maps to the same TradeStatus. A maker paying the bond has no taker, so "Orden tomada" would be wrong there. Either keep the maker on "Esperando tomador", or split the status by role.

Acceptance

  • Taker seller and taker buyer with an unpaid deposit: the timeline shows ◉ Orden tomada as current, every later step pending, and the header reads step 1.
  • After the deposit locks, the timeline is unchanged from today.
  • Maker with an unpaid maker bond: no "Orden tomada".
  • Tests: update test/features/trades/models/trade_view_test.dart and test/features/trades/trade_status_bond_test.dart, and add a widget test of the timeline in waitingBond.
Dominant language
Dart
Stars
11
Forks
9
Avg merge
2d 1h
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MostroP2P/app

All issues in MostroP2P/app

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.