@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / MarketActivityOptions

Type Alias: MarketActivityOptions

MarketActivityOptions = object

Defined in: packages/sdk/src/activity.ts:191

Options for SomniaMarketsClient.getMarketActivity. All optional.

Properties

limit?

optional limit?: number

Defined in: packages/sdk/src/activity.ts:199

Max rows to return (default 50).

Each source stream is asked for this many rows, and the merge keeps the newest limit of the union. So the result is the market's newest limit events, whichever kinds they are.


kinds?

optional kinds?: readonly MarketActivityKind[]

Defined in: packages/sdk/src/activity.ts:206

Which kinds to read (default: every kind).

A kind left out is excluded at the indexer, not dropped afterwards. An empty array therefore reads nothing and returns [].


since?

optional since?: number

Defined in: packages/sdk/src/activity.ts:208

Only rows at/after this unix-seconds timestamp.


until?

optional until?: number

Defined in: packages/sdk/src/activity.ts:231

Only rows at/before this unix-seconds timestamp.

This is the paging cursor. To read the page before the one you hold, pass the timestamp of its last row. There is no offset, because a row offset cannot page a merged feed: each stream would skip its own offset rows, so the second page would omit whatever the first page did not have room for.

KNOWN LIMIT — the cursor has one-second resolution, and the bound is inclusive, so the boundary second is re-read on the next page: expect a few duplicate ids across a page edge and de-duplicate by id if that matters. A second holding limit or more rows cannot be paged past at all, because the next request returns that same second again.

Tightening this needs a composite (timestamp, blockNumber, logIndex) cursor. The entity schema now carries logIndex on all four streams — this release adds it to the three that lacked it — so the cursor is expressible as soon as a REINDEXED deployment serves the column. It is not adopted here on purpose: ordering on a column the live Hasura does not serve is a validation error that fails the whole read, not a null, so the SDK would break against every indexer that has not caught up yet.


pool?

optional pool?: string

Defined in: packages/sdk/src/activity.ts:242

The market's pool address, when the caller already knows it.

An optimization, and safe to omit. Trades are selected by market id either way; supplying the pool adds the predicate that lets the indexer read them through the (pool, timestamp) index instead of sorting the market's fills. It cannot widen the result — on binary a recycled pool's earlier markets are still excluded by the market-id predicate, and on spot and perp the pool address IS the market id.