0Bit Documentation

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

RecordWhy
Quote idConnects the locked price decision to the execution.
Trade idConnects status reads and support records to the execution result.
Partner account idEnforces ownership in your own system.
Current statusDrives user-facing processing, failed, or complete states.
Event ids or status-read idsKeeps 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 categoryPage behaviorSupport behavior
ProcessingShow that the trade is being confirmed.Keep the quote id, trade id, and last update time visible.
Settled or completeClose your own record exactly once.Show receipt-level details approved for the partner.
Failed or releasedShow a generic failure or fallback path.Preserve internal notes without exposing liquidity internals.
Unknown or delayedKeep 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.

On this page