Skip to main content
This guide shows how to build real-time settlement tracking components - a step progress indicator, an event timeline, deposit status per leg, and a notification badge for settlements that need attention.

Prerequisites

  • @keystoneos/react installed
  • KeystoneProvider configured with settlements:read scope
  • A React project with TypeScript

What you will build

Four components that work together or independently:
  1. Progress stepper - visual indicator of where a settlement is in its lifecycle
  2. Event timeline - chronological list of every state transition
  3. Deposit tracker - per-leg deposit status for settlements awaiting deposits
  4. Notification badge - compact count of settlements needing action

Progress stepper

The settlement state machine follows a linear path (with branches for failure). Use getCurrentStepIndex() and SETTLEMENT_STEPS from @keystoneos/react to build a visual stepper.
The SETTLEMENT_STEPS array contains the ordered steps:

Event timeline

The useSettlementEvents hook returns every state transition that has occurred, in chronological order. This gives a full audit trail.

Deposit tracker

When a settlement is in AWAITING_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

The useSettlement 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
Use 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.