Import
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
settlementId | string | null | Yes | The settlement UUID. Pass null to skip fetching. |
Return Type
| Property | Type | Description |
|---|---|---|
settlement | Settlement | null | The settlement data, or null if not loaded. |
isLoading | boolean | true during the initial fetch. |
error | string | null | Error message if the fetch failed. |
refetch | () => Promise<void> | Manually trigger a re-fetch. |
Behavior
- Fetches the settlement on mount and whenever
settlementIdchanges. - Subscribes to real-time updates via the event bus (polling in Phase 1, SSE in Phase 2).
- When a
state_changedevent is received, the settlement object updates automatically. - Passing
nullassettlementIdclears the settlement and stops subscriptions.
Settlement Object
The returnedsettlement includes parties and legs: