Skip to content
PlutoDocs

Transaction lifecycle

Every swap and order runs through one state machine. Private mode has its own flow. Try it.

Transaction lifecycleLive demo, running the app's own codePress an event to move the real state machine.
IdlePreparingApprove in walletApprovingApprovedSigningConfirm in walletPendingSuccess
FailedReview new price
Current phase
Idle
Button shows
Swap
Ready
isBusy = false
Events

Path so far: Idle
Source: src/features/swap/tx-machine.ts

Phases

What you see in each phase
PreparingButton locked
Approve in walletButton lockedYour wallet is open
SigningButton lockedYour wallet is open
Confirm in walletButton lockedYour wallet is open
PendingButton locked
Success · Failed · Review new priceButton free
15 s: taking longer120 s: status unknown
Source: src/features/swap/tx-machine.ts · src/lib/wallet/confirm-tx.ts

Safe by construction

Three safety nets
  • Double-clickSecond click ignored
  • Price drops > 0.5%Stops at Review new price
  • Reject in walletBack to idle, nothing sent
Source: src/features/swap/use-swap-execution.ts