NWC: a seller who made the order cannot cancel while the wallet pay screen is up

Open Beginner friendly
#954 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start with pay_lightning_invoice_screen.dart around the wallet mode rendering and _cancelOrder, then inspect NwcPaymentWidget to see how payment-in-flight state is exposed. Add the cancel link beneath the wallet payment widget, disable it while cancellation or payment is in flight, and add a widget test covering confirmation and the cancel request.

Written by the indexing model from the issue text.

Description

area: ui bug priority: medium

Context

A seller who made a sell order and has an NWC wallet connected funds the trade from PayLightningInvoiceScreen in wallet mode (isWalletConnected && !_manualMode, pay_lightning_invoice_screen.dart:344). In manual mode the same screen offers "cancel trade" (InvoiceCancelLink, automation id pay.cancel, line 575), which calls _cancelOrder.

What happens

Wallet mode draws no cancel at all. It shows only the counterpart row and NwcPaymentWidget (the pay button). The only way out is the app bar's back button. For the maker who sells, the trade card routes a waitingPayment trade straight back to this screen (trade_card.dart:122, sellerFundingPath), so reopening the trade lands on the same screen. The trade detail, which has trade.cancel, is not reachable from the trades list in that state.

The seller can therefore only pay or wait for the hold invoice to expire. If they changed their mind, or the wallet has no funds, they have no cancel until the wallet fails once and the screen switches to manual mode. That happens only after a failed payment attempt.

A Mortsom live run (nwc_cancel_payment, Linux, main at 0293bd44) shows the screen exposing only pay.nwc, pay.order_id, appbar.back. Reopening the trade from the list returns to it.

A taker who sells is not affected: their card opens the trade detail, which offers trade.cancel.

How to fix

  1. Render the same InvoiceCancelLink(...).withAutomationId(AutomationIds.payCancel) under NwcPaymentWidget in wallet mode, wired to _cancelOrder. Disable it while _canceling.
  2. Hide or disable it while a payment is in flight (_paying in the widget, _waiting on the screen). Cancelling while the wallet may still pay would race the payment.
  3. Add a widget test: with a wallet connected, the pay screen shows pay.cancel, and tapping it asks for confirmation and sends the cancel.
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.