searchNotifications
Search stored notifications via the notification service’s POST /api/v1/search endpoint.
The filter is a free-form equality match over the stored document: every key is compared exactly, whether it is a top-level field (app_name, address, type, …) or a dotted path into the nested payload (data.temp_quote_id, data.quote_id, …). Known fields are offered as autocomplete; any other string key is still accepted.
The base URL resolves from the chain config’s notifications.searchUrl, or the per-call baseUrl override. The action appends /api/v1/search.
import { searchNotifications } from "@symmio/trading-core";
const { documents, total } = await searchNotifications(config, {
filter: { app_name: "Base_Superflow_Stage", "data.temp_quote_id": -172 },
size: 50,
});
for (const doc of documents) {
console.log(doc.id, doc.data?.quote_id);
}Parameters
Equality filter sent as the request query. Named filter (not query) so it never collides with the TanStack
query overrides on the matching query-options factory.
sizenumberoptionalMaximum number of results to return (1–100). Defaults to 100 (the backend default).
startnumberoptionalZero-based offset of the first result. Defaults to 0.
chainIdnumberoptionalOptional chain override; defaults to the config’s defaultChainId.
baseUrlstringoptionalOverride the notification-search base URL. Defaults to the chain config’s notifications.searchUrl.
Returns
totalnumberTotal matches.
countnumberNumber returned in this page.
documentsNotificationDocument[]The stored notification documents.
Throws
Throws a SymmApiError when the search request fails, and a SymmError when no search URL is configured for the chain and no baseUrl is passed.
Query options
import { searchNotificationsQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(
searchNotificationsQueryOptions(config, {
filter: { "data.temp_quote_id": -172 },
query: { refetchInterval: 5_000 },
}),
);The query is disabled until filter has at least one key, so an empty filter never fires a match-all request. searchNotificationsQueryKey builds the matching cache key — the filter object is folded in, so two searches with different filters cache independently.
Related
- NotificationSearchFilter — the filter shape and its known keys.
- watchNotifications — live stream over the same channel.