Skip to content

feat(wallet): decide a failed Platform payment by the wallet's payment class - #1432

Draft
romchornyi wants to merge 7 commits into
feat/external-send-lock-heldfrom
feat/external-send-payment-class
Draft

romchornyi wants to merge 7 commits into
feat/external-send-lock-heldfrom
feat/external-send-payment-class

Conversation

@romchornyi

Copy link
Copy Markdown
Contributor

Stacked on #1423 (base feat/external-send-lock-held). Draft: it needs dashpay/platform#5928, which is not merged yet.

What

The new Send decided whether a failed Platform payment left the wallet from a list of PlatformWalletError types kept in the app. dashpay/platform#5928 moves that decision into the Rust wallet: every PlatformWalletError now carries a payment class (delivery: not sent, maybe sent, lock held). This PR makes the app read it.

  • SendOutcome maps a PlatformWalletError by delivery: .notSent → not sent (the type only picks the reason's words); .maybeSent, .lockHeld or unclassified → in progress. A held lock with its funding type still comes from the coordinator as lockHeld.
  • LiveCoreTwoStepSend.lockMayExist (Core → Identity) reads the same class.
  • Pattern matches across the app adapted to the SDK's new payment payload on every case (AssetLockFailureStore, UsernameMarketplaceService, WalletSendService, EvonodeWithdrawalViewModel, MasternodeUnbanViewModel).
  • ADR-0054.

Why: a wallet error the app's list did not know read as "in progress" although nothing was sent (for example an identity lookup that fails before any spend), and the list could drift the other way. With the class, a new wallet error code needs no app change. Related: #1427 (the wallet classes a nonce mismatch as maybe sent, so it stays in progress).

Pin

.platform-ref → 79d5fe45ac on test/external-send-delivery = #5928 head 730a15273e + its review fixes (nonce docs, example apps read the class, the wallet owns a panicked payment's class). Development-only; moves to the merged commit once #5928 lands.

Testing

  • SendOutcomeMappingTests, ExternalSendExecutorTests, ConfirmViewModelTests, ExternalSendFlowTests, SendOutcomeRouterTests, AssetLockDiagnosticsTests, SendAmountViewModelTests, AddressViewModelTests: 513 tests, all green on the simulator against the pinned SDK; the whole test target compiles.
  • New: the class decides over the type (an "unconfirmed" type classed not sent is not sent, a "rejected" type classed maybe sent stays in progress), unclassified and lock-held stay in progress, nonce mismatch classed maybe sent stays in progress.
  • Not run: the full suite, Maestro flows (no visible UI change).

🤖 Generated with Claude Code

romchornyi and others added 7 commits November 16, 2026 02:12
The pure core of the new external send, with no screen or service using it
yet: the destination types and a parser for every address form, link and
Identity ID (network-checked), the four send sources and the routes between
them, one policy that decides every source and destination pair, the amount
rules, the Confirm warnings, and the three send outcomes the errors of the
existing spend paths map to (only "not sent" offers Retry).

Supporting changes: ScriptAddressCodec decodes an address's form and hash
whatever its network, DashAddressClassifier decodes bech32m without reading
the global network, PaymentNetworkResolver maps any network kind, and
WalletSendService's error domain and codes become readable so a send outcome
can be told from them. The old Send's Confirm texts move to SendWarningText
so both Sends show the same words.

The feature's decisions are recorded as ADR-0036 to ADR-0045 (docs/adr/).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: 306145f65dadd33ec186527e30890c7bb756d635
…equest checks

The services behind the new external send, with no screen calling them yet:
an executor that prepares and sends every source and destination pair over
the existing spend paths, a fee estimator, an Identity lookup that does not
block the main actor, and a fetcher for dash: payment requests.

A Core payment to someone else's Platform address records its recipient by
the asset lock's outpoint, so recovery after a crash pays that recipient and
never the wallet's own address; a lock whose recipient cannot be told is not
offered a retry, and locks the wallet marks as its own from this release on
keep resuming as before. A BIP70 payment the merchant acknowledged before the
broadcast failed, or before the request expired, is reported as in progress
rather than not sent.

Shared helpers the executor reuses: the identity top-up from Platform or
Shielded credits moves out of the profile sheet, the Unicode-name spelling of
merchant text is shared by both Sends, and the restore-sync gate of a Core
spend can be observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: 5d5b668099682851d541bb92b75d2c6c0a8d87ca
…failed as in progress

A gift-card payment whose Payment the merchant acknowledged, and whose broadcast
then failed or whose request then expired, reached DashSpend as a plain error
without the txid, while the merchant holds the signed bytes and may fulfil the
order. payWithDashUrl now maps it to the same in-progress error as an unknown
broadcast outcome, carrying the txid, so the purchase is recorded and the card
details screen opens. The BIP70 service it pays through can be injected, so the
mapping is tested against a fake wallet and merchant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: 5d5b668099682851d541bb92b75d2c6c0a8d87ca
The new Send flow on top of the domain model and services: Address (paste,
scan, clipboard, Identity lookup), Select source, the amount step with Max,
Confirm with the fee and warnings, and the sending, in-progress and failed
outcomes. It opens from the Payments send menu, the balance rows, the QR
scanner (an Identity ID is accepted) and dash: links, and the old Send keeps
contact payments. The Internal transfer sheet no longer has a send-from mode,
since the balance-row Send opens the new flow.

The public summary is docs/features/external-send/README.md; the decisions
(ADR-0036 to ADR-0045) came with the domain model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: abcc8fadb9369590f2862c6e14f8926be8e593cf
A Core to Platform or Core to Shielded send whose Platform step failed
after the asset lock was broadcast and recorded was reported as
inFlight, with the "It will finish on its own" Toast, but nothing
finished it: only Rebroadcast in the transaction details resumes the
lock.

The executor now reports such a send as lockHeld, carrying the lock's
outpoint and funding type. It opens its own sheet: "Your Dash is held
for this transfer. Finish it now, or later from the transaction
details." Finish runs the same resume as Rebroadcast
(AssetLockRecoveryService.retry, which asks for the PIN); Close leaves
the lock for the transaction details. inFlight keeps meaning submitted
with an unknown result. A Core to Identity send still reports inFlight:
its top-up call returns no outpoint to resume.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: abcc8fadb9369590f2862c6e14f8926be8e593cf
…fixes (test branch, development only)

test/external-send-delivery = #5928 head 730a15273e + the round's fixes; carries the Rust-owned payment class on every PlatformWalletError case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… payment class

SendOutcome reads PlatformWalletError.delivery (dashpay/platform#5928): not sent only when the wallet classes the failure not sent, in progress for maybe sent, a held lock or an unclassified error; the error type only picks the reason's words. LiveCoreTwoStepSend.lockMayExist reads the same class. The app's type list is gone, so a new wallet error code needs no app change (ADR-0054). Pattern matches adapted to the SDK's payment payload on every PlatformWalletError case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@thepastaclaw

Copy link
Copy Markdown
Contributor

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 5c90cf2. Normal review starts when eligible; priority review starts as soon as a slot is available.

@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch 5 times, most recently from 52f1d5e to e0d5835 Compare November 24, 2026 18:56
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch 4 times, most recently from 4adde32 to 888305c Compare November 27, 2026 06:26

This branch has not been deployed

No deployments
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.

2 participants