Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
CoreNotificationssearchNotifications

searchNotifications

Search a solver’s stored notification history — one interface over both solver kinds, dispatched by the resolved solverId:

  • enigma → the standalone notification service (POST /api/v1/search), returning the matched stored documents.
  • rasa → the solver’s own position-state endpoint (POST /position-state/{start}/{size}), returning position-state rows (the rasa protocol’s notification history).

Pass the common filters (account, quoteId, tempQuoteId, timestampGte) plus start / size; the SDK maps them to the resolved solver’s native query. The REST counterpart to the live watchNotifications stream.

The result is a per-kind union (NotificationSearchResult) — pass a literal solverId to narrow it to that kind’s variant, or branch on the returned kind discriminant.

import { searchNotifications } from "@symmio/trading-core"; // Chain default solver → the union; narrow on `kind`. const page = await searchNotifications(config, { account: "0xsub…", quoteId: 1024 }); if (page.kind === "enigma") { for (const doc of page.rows) console.log(doc.id, doc.data?.quote_id); } else { for (const row of page.rows) console.log(row.quote_id, row.last_seen_action); } // Literal solverId → the exact variant, no narrowing needed. const rasa = await searchNotifications(config, { solverId: "rasa", account: "0xsub…" }); rasa.rows.forEach((row) => console.log(row.quote_id, row.action_status));

The filters map per kind. tempQuoteId and the free-form filter are enigma-only; timestampGte is applied by rasa (the enigma service does not filter on it). account / quoteId / start / size map on both. Passing a filter a kind ignores is harmless — it just does not narrow that kind’s query.

Parameters

solverIdSolverIdoptional

Target solver — selects the search endpoint and the result variant. Defaults to the chain’s default solver. Pass a literal ("enigma" / "rasa") to narrow the return type.

accountAddressoptional

Filter: counterparty (SubAccount) address.

quoteIdnumberoptional

Filter: on-chain quote id.

tempQuoteIdnumberoptional

Filter: pre-chain temporary quote id (negative). Enigma only.

timestampGtenumberoptional

Filter: created/emitted at or after this unix timestamp (seconds). Rasa only.

startnumberoptional

Zero-based offset of the first row. Defaults to 0.

sizenumberoptional

Maximum rows to return. Defaults to the endpoint default.

Enigma-only advanced equality filter, merged over the mapped common filters. Ignored for rasa. Named filter (not query) so it never collides with the TanStack query overrides on the matching query-options factory.

chainIdnumberoptional

Optional chain override; defaults to the config’s defaultChainId.

baseUrlstringoptional

Override the enigma notification-service base URL. Defaults to the resolved solver’s notifications.searchUrl (enigma only). Ignored for rasa, which reads history from the solver itself.

Returns

Returns NotificationSearchResult — a per-kind union discriminated on kind:

kind"enigma" | "rasa"

Discriminant — which solver kind served the page. Narrow on it to reach kind-specific fields.

totalnumber

Enigma only. Total documents matching the filter, ignoring pagination.

countnumber

Number of rows returned in this page.

The matched rows for the requested start / size window — enigma stored documents or rasa position-state records.

Passing a literal solverId narrows the return to that kind’s variant (searchNotifications(config, { solverId: "rasa" }) → RasaNotificationSearchResult); omitting it yields the union.

Throws

  • SymmError NOTIFICATION_SEARCH_URL_NOT_CONFIGURED (enigma) when no search URL is configured for the solver and no baseUrl is passed.
  • SymmApiError when the search request fails.

Query options

import { searchNotificationsQueryOptions } from "@symmio/trading-core"; import { useQuery } from "@tanstack/react-query"; useQuery( searchNotificationsQueryOptions(config, { account: "0xsub…", tempQuoteId: -172, query: { refetchInterval: 5_000 }, }), );

searchNotificationsQueryKey builds the matching cache key — the filters (including the filter object) are folded in, so two searches with different filters cache independently.

Last updated on