Prerequisites
@keystoneos/reactinstalledKeystoneProviderconfigured withsettlements:readscope- A React project with TypeScript
What you will build
Four components that work together or independently:- Progress stepper - visual indicator of where a settlement is in its lifecycle
- Event timeline - chronological list of every state transition
- Deposit tracker - per-leg deposit status for settlements awaiting deposits
- Notification badge - compact count of settlements needing action
Progress stepper
The settlement state machine follows a linear path (with branches for failure). UsegetCurrentStepIndex() and SETTLEMENT_STEPS from @keystoneos/react to build a visual stepper.
SETTLEMENT_STEPS array contains the ordered steps:
| Index | State | Label | Description |
|---|---|---|---|
| 0 | INSTRUCTED | Instructed | Settlement created from matched instructions |
| 1 | COMPLIANCE_CHECKING | Compliance Check | Screening parties and wallets |
| 2 | COMPLIANCE_CLEARED | Compliance Cleared | All checks passed |
| 3 | AWAITING_DEPOSITS | Awaiting Deposits | Waiting for escrow deposits |
| 4 | EXECUTING_SWAP | Executing Swap | Coordinating atomic transfer |
| 5 | FINALIZED | Finalized | Settlement complete |
Event timeline
TheuseSettlementEvents hook returns every state transition that has occurred, in chronological order. This gives a full audit trail.
Deposit tracker
When a settlement is inAWAITING_DEPOSITS, each leg needs a deposit to escrow. This component shows which legs are deposited and which are still pending.
Notification badge
A compact badge showing how many settlements need attention (e.g., awaiting deposits). Useful in navigation bars or sidebars.Putting it all together
Here is a complete settlement detail page combining the stepper, timeline, and deposit tracker.Auto-refresh behavior
TheuseSettlement hook subscribes to real-time updates automatically:
- While the settlement is in a non-terminal state, it polls for updates
- When a state change is detected, the settlement object updates and all components re-render
- Once the settlement reaches a terminal state (
FINALIZED,ROLLED_BACK,TIMED_OUT), polling stops
isTerminalState(settlement.state) to conditionally render UI - for example, hiding the deposit tracker once the settlement finalizes.
Next steps
Settlement Dashboard
Build a list view to monitor all settlements.
Custody Integration
Route deposits through Fireblocks or BitGo.
useSettlement Reference
Full API reference for the useSettlement hook.
State Machine
Understand settlement states and transitions.