Skip to content

feat: route every internal signing flow through XState pipeline [PERA-3966]#397

Draft
fmsouza wants to merge 13 commits intomainfrom
feat/signing-pipeline-migration
Draft

feat: route every internal signing flow through XState pipeline [PERA-3966]#397
fmsouza wants to merge 13 commits intomainfrom
feat/signing-pipeline-migration

Conversation

@fmsouza
Copy link
Copy Markdown
Contributor

@fmsouza fmsouza commented Apr 28, 2026

Description

Funnels every internally-initiated transaction (asset opt-in, asset opt-out, payments, asset transfers, ARC-59 send / claim / reject) through the existing XState signing pipeline. Before this branch the opt-in / opt-out / send-flow hooks called useTransactionSigner + algokit.send.* directly — for Ledger accounts that path silently invoked the BLE signer with no UI overlay (the bug). After, every flow uses a new shared helper useSignAndSubmitGroup that pushes pre-built unsigned transactions through the pipeline as a headless: true, transport: 'callback' request.

  • Non-Ledger accounts (HD / Algo25): zero behavioural change. headless: true skips the review sheet and post-completion notification — same brief spinner UX as today.
  • Ledger accounts: get the existing LedgerSigningOverlay automatically. The pipeline's hardware actor binds phase callbacks unconditionally, so opt-in / opt-out / every send mode now shows connecting → awaiting-approval → progress → typed errors (LedgerConnectionError, LedgerTimeoutError, LedgerUserRejectedError, LedgerAddressMismatchError, LedgerAppNotOpenError, LedgerDisconnectedError).

Architecture highlights:

  • New helper useSignAndSubmitGroup in packages/signing — single entry point. Resolves { txIds } after approve + submitSignedTransactionGroup; rejects with typed UserRejectedSigningError on cancel.
  • ARC-59 hooks (useArc59SendTransaction, useArc59ClaimTransaction) refactored to return unsigned-tx builders (no signer arg). Send-flow consumes those and submits via the helper.
  • Dead hardware-wallet branch removed from useTransactionSigner — once nothing outside the pipeline reaches it. The XState hardwareSignerActor calls signTransactionsOnHardwareWallet directly and is unaffected.
  • Mobile screen consumers (AddAssetScreen, AccountAssetList, RemoveAssetsScreen, CollectibleDetailScreen, TransactionProcessingScreen, ClaimProcessingScreen) check instanceof UserRejectedSigningError and suppress the generic error toast on cancel — silent dismiss / silent goBack().
  • executeSend's switch now has a default: { params.sendMode satisfies never; throw } exhaustiveness guard.

Related Issues

Checklist

  • Have you tested your changes locally?
  • Have you reviewed the code for any potential issues?
  • Have you documented any necessary changes in the project's documentation?
  • Have you added any necessary tests for your changes?
  • Have you updated any relevant dependencies?

@fmsouza fmsouza requested a review from a team as a code owner April 28, 2026 23:02
@fmsouza fmsouza self-assigned this Apr 28, 2026
@fmsouza fmsouza marked this pull request as draft April 29, 2026 09:46
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