Skip to content

[Frontend] Unify the transaction lifecycle UX (build, sign, submit, confirm, error) #10

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

Transaction flows (loan wizard final signature, lend deposit and withdraw, repay, send remittance) each handle build, sign, submit, and confirmation slightly differently, and error handling is scattered. A single, well tested transaction state machine with a shared error taxonomy reduces dropped or double-submitted transactions and makes every money flow feel consistent.

Acceptance criteria

  • Introduce a shared transaction lifecycle (idle, building, awaiting-signature, submitting, confirming, success, error) used by all flows
  • Centralize error mapping in transactionErrors.ts (user rejected, insufficient fee, timeout, sequence, contract error) and show actionable messages
  • Guarantee idempotency so a double click or retry cannot submit twice
  • Reflect confirmation via the existing confirmation hook and invalidate the right queries on success
  • Unit tests for the state machine and error mapping

Files to touch

  • src/app/hooks/useContractMutation.ts, src/app/hooks/useConfirmedMutation.ts, src/app/hooks/useTransactionPreview.ts
  • src/app/utils/transactionErrors.ts, src/app/utils/transactionFormatter.ts
  • src/app/components/loan-wizard/StepFinalSignature.tsx
  • src/app/[locale]/lend/LendPageClient.tsx, src/app/[locale]/repay/[loanId]/page.tsx, src/app/[locale]/send-remittance/

Out of scope

  • Backend transaction submission
  • Fee-bump strategy

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or requesthardAdvanced / high-difficulty issuehelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions