import { type ActivityItem } from '@lifi/perps-types'; /** * Per-endpoint cursor envelope for Lighter activity pagination. * * Each key holds the upstream `cursor` / `next_cursor` returned by that * endpoint on the previous call. When a key is **present** with a non-empty * string the corresponding endpoint will be re-fetched at that cursor on the * next call; when a key is **absent** the endpoint is treated as exhausted * (or never paged because the type filter excluded it) and skipped. * * The envelope is round-tripped through `cursor` as base64url JSON so callers * don't need to know the per-endpoint shape. The encoding mirrors the LI.FI * backend's wire format so cursors created by the backend remain usable. * @public */ export interface LighterActivityCursor { deposits?: string; withdraws?: string; fundings?: string; liquidations?: string; transfers?: string; /** * Already-fetched, merged-and-sorted rows that did not fit under the page * `limit`. The upstream cursors above have advanced past these rows, so they * are replayed (prepended) on the next page before any fresh fetch — without * them the tail would be lost forever. */ overflow?: ActivityItem[]; } /** * Encode a `LighterActivityCursor` as the base64url-of-JSON cursor string * Lighter widgets persist between activity pages. Returns `undefined` when * every per-endpoint key is empty and no `overflow` rows remain — the caller * should report `hasMore: false` and omit `cursor` from `Pagination` then. * * Browser-direct: `Buffer` is Node-only. We use `btoa` over a Latin-1 * encoding of the UTF-8 bytes and then rewrite `+/=` to base64url. This is * the same byte sequence Node's `Buffer.from(json, 'utf8').toString('base64url')` * produces, so cursors round-trip across environments. * @public */ export declare const encodeActivityCursor: (env: LighterActivityCursor) => string | undefined; /** * Decode a previously-encoded activity cursor. Returns `undefined` for an * absent cursor (first page) and throws {@link PerpsError} with * `ValidationError` if the string is malformed — we'd rather fail loudly than * silently re-page from page 1 and re-deliver already-paginated rows. * @public */ export declare const decodeActivityCursor: (cursor: string | undefined) => LighterActivityCursor | undefined; //# sourceMappingURL=activityCursor.d.ts.map