Track pool trades
For approved 0Pools partners, track quote-backed trades with partner-scoped status and public-safe support records.
After execution, your product needs a durable trade timeline. Track the trade by quote id or trade id, reconcile only partner-scoped records, and keep liquidity internals out of customer-facing screens.
Tracking is partner-scoped
Trade reads are for the authenticated partner's own records. They should not expose another partner's trades, internal liquidity state, or operational settlement details.
Tracking flow
State to keep
| Record | Why |
|---|---|
| Quote id | Connects the locked price decision to the execution. |
| Trade id | Connects status reads and support records to the execution result. |
| Partner account id | Enforces ownership in your own system. |
| Current status | Drives user-facing processing, failed, or complete states. |
| Event ids or status-read ids | Keeps updates idempotent and auditable. |
Server pattern
async function refreshPoolTrade(input: { tradeId: string; accountId: string }) {
const local = await poolTrades.getForAccount(input.tradeId, input.accountId);
if (!local) return { view: 'not_found' };
const remote = await poolsClient.retrieveTrade(local.tradeId);
await poolTrades.recordStatus({
tradeId: local.tradeId,
quoteId: local.quoteId,
status: remote.status,
observedAt: new Date().toISOString(),
});
return toSafeTradeView(remote.status);
}Status handling
| Status category | Page behavior | Support behavior |
|---|---|---|
| Processing | Show that the trade is being confirmed. | Keep the quote id, trade id, and last update time visible. |
| Settled or complete | Close your own record exactly once. | Show receipt-level details approved for the partner. |
| Failed or released | Show a generic failure or fallback path. | Preserve internal notes without exposing liquidity internals. |
| Unknown or delayed | Keep processing with a retry or support path. | Trigger reconciliation from trusted backend state. |
Guardrails
- Do not show provider, venue, reserve, treasury, route, or balance diagnostics to users.
- Do not update records from unverified browser-only status.
- Do not let status polling mutate money state unless the API contract explicitly says the read can advance status.
- Do not publish event payload examples with real partner, account, or customer data.