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
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.
accountAddressoptionalFilter: counterparty (SubAccount) address.
quoteIdnumberoptionalFilter: on-chain quote id.
tempQuoteIdnumberoptionalFilter: pre-chain temporary quote id (negative). Enigma only.
timestampGtenumberoptionalFilter: created/emitted at or after this unix timestamp (seconds). Rasa only.
startnumberoptionalZero-based offset of the first row. Defaults to 0.
sizenumberoptionalMaximum 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.
chainIdnumberoptionalOptional chain override; defaults to the config’s defaultChainId.
baseUrlstringoptionalOverride 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.
totalnumberEnigma only. Total documents matching the filter, ignoring pagination.
countnumberNumber 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
SymmErrorNOTIFICATION_SEARCH_URL_NOT_CONFIGURED(enigma) when no search URL is configured for the solver and nobaseUrlis passed.SymmApiErrorwhen 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.
Related
- NotificationSearchResult — the per-kind union this returns.
- NotificationSearchFilter — the enigma-only advanced filter shape and its known keys.
- watchNotifications — the live stream over the same solver channel.
Cancellation and pagination compatibility
SearchNotificationsParameters.signal?: AbortSignal cancels the request for either solver kind. Query options forward TanStack’s signal unless an explicit signal is supplied, without adding cancellation to query identity.
Enigma preserves finite numeric pagination counts, including numeric strings from legacy responses. Missing or malformed counts fall back to the returned row count. A non-array notification payload produces an empty row list; it does not invent notification documents.