Skip to Content
Symmio Trading-SDK — the SDK surface for builders on HyperEVM
CoreUnified QuotesapplyNotificationToQuotes

applyNotificationToQuotes

Apply a single notification to a list of UnifiedQuotes, returning a new list (pure — inputs are never mutated). This is the per-notification step reconcileQuotes runs internally over its notifications, exposed for consumers that fold notifications in themselves.

The notification is matched to a row by on-chain quote id, falling back to the pre-chain temp id — which is how an optimistic row gets linked to its on-chain quote (temp:<id>onchain:<id>). On the matched row it:

  • links tempQuoteIdquoteId and rekeys the row once the on-chain id appears;
  • fills openedPrice and advances to PRICE_FILLED on InstantRFQ success;
  • advances to WRITE_ONCHAIN on an open-anchor (SendQuoteTransaction) success while the on-chain read has not caught up;
  • advances the close stage on a row already in the closing flow (or an off-chain row): the request → CLOSE_PRICE_FILLED, the fill → WRITE_ONCHAIN_CLOSE, monotonically. A settled close (polled back to ONCHAIN) is no longer in a closing stage, so replayed close notifications match nothing to advance and never re-stick it;
  • advances to FAILED only for an anchored-but-unread row whose anchor reverted (origin === "onchain", raw.onchain absent). A failed close on a confirmed position stays put (defers to the poll), and a failed open’s optimistic row just vanishes when the hedger drops it — failure is an event, not a durable state.
import { applyNotificationToQuotes } from "@symmio/trading-core"; const next = applyNotificationToQuotes(quotes, notification);

Parameters

quotesUnifiedQuote[]required

The current unified rows.

nNotificationrequired

The normalized notification to apply.

Returns

A new list with the matched row updated; the same list (by content) when nothing matched. Notifications are replayed every reconcile tick, so this is idempotent — applying the same notification twice never regresses a row.

Last updated on