@floorlaunchpad/sdk 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +14 -0
  3. package/dist/abi/evm.gen.js +1 -1
  4. package/dist/abi/solana.gen.js +1 -1
  5. package/dist/client/evm/index.js +16 -2
  6. package/dist/client/solana/index.js +19 -7
  7. package/dist/config/generated.js +26864 -402
  8. package/dist/config/registry.gen.js +33 -2
  9. package/dist/evm/chains.js +9 -1
  10. package/dist/evm/floor/abi.gen.js +1 -1
  11. package/dist/evm/floor/events.js +9 -1
  12. package/dist/evm/floor/legacy-events.js +25 -0
  13. package/dist/indexer/bodies.js +91 -17
  14. package/dist/indexer/client.js +34 -14
  15. package/dist/indexer/contract.js +132 -28
  16. package/dist/indexer/partners.js +3 -2
  17. package/dist/indexer/paths.js +61 -29
  18. package/dist/indexer/read.js +27 -15
  19. package/dist/indexer/search.js +130 -0
  20. package/dist/indexer/stack-edge.js +35 -0
  21. package/dist/indexer/stream.js +70 -23
  22. package/dist/math/v2/split.js +11 -3
  23. package/dist/solana/floor/events.js +1 -1
  24. package/dist/solana/floor/genesis.js +9 -3
  25. package/dist/solana/floor/instructions.js +14 -5
  26. package/dist/solana/floor/registry.js +4 -0
  27. package/dist/v2/solana.js +17 -2
  28. package/dist/v2/tx/solana.js +1 -1
  29. package/docs/bot.md +36 -1
  30. package/docs/cursor-pages.md +56 -0
  31. package/docs/floor-line.md +9 -4
  32. package/examples/floor-line.html +6 -6
  33. package/package.json +1 -1
  34. package/src/abi/evm.gen.ts +1 -1
  35. package/src/abi/solana.gen.ts +1 -1
  36. package/src/client/evm/index.ts +16 -2
  37. package/src/client/solana/index.ts +19 -7
  38. package/src/client/types.ts +1 -1
  39. package/src/config/generated.ts +26864 -402
  40. package/src/config/index.ts +9 -2
  41. package/src/config/registry.gen.ts +33 -2
  42. package/src/events/types.gen.ts +2 -1
  43. package/src/evm/chains.ts +9 -1
  44. package/src/evm/floor/abi.gen.ts +1 -1
  45. package/src/evm/floor/events.ts +11 -1
  46. package/src/evm/floor/legacy-events.ts +27 -0
  47. package/src/indexer/bodies.ts +99 -17
  48. package/src/indexer/client.ts +52 -30
  49. package/src/indexer/contract.ts +151 -29
  50. package/src/indexer/partners.ts +3 -2
  51. package/src/indexer/paths.ts +84 -29
  52. package/src/indexer/read.ts +33 -17
  53. package/src/indexer/search.ts +138 -0
  54. package/src/indexer/stack-edge.ts +46 -0
  55. package/src/indexer/stream.ts +78 -24
  56. package/src/math/v2/split.ts +11 -3
  57. package/src/solana/floor/events.ts +1 -1
  58. package/src/solana/floor/genesis.ts +8 -2
  59. package/src/solana/floor/instructions.ts +13 -5
  60. package/src/solana/floor/registry.ts +4 -0
  61. package/src/v2/solana.ts +20 -3
  62. package/src/v2/tx/solana.ts +1 -1
@@ -3,7 +3,8 @@
3
3
  import { unknown } from "./decode.js";
4
4
  import * as B from "./bodies.js";
5
5
  import * as P from "./partners.js";
6
- import { FIRSTS_MAX, IDS_MAX, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX } from "./paths.js";
6
+ import { FIRSTS_MAX, IDS_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX } from "./paths.js";
7
+ import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.js";
7
8
 
8
9
  export const UNITS = {
9
10
  site: "raw quote base units, token math units (6 dp), Q64.64 prices, unix s; bigint as decimal strings; USD as decimal strings",
@@ -64,6 +65,15 @@ const limit = (dflt , max ) => ({ kind: "limit", limit: { default:
64
65
  const cursor = (dflt , max ) => ({ kind: "cursor", limit: { default: dflt, max }, cursor: "before", next: "next" }) ;
65
66
  const LIMIT = (dflt , max ) => ({ kind: "int", doc: "rows", min: 1, max, default: dflt });
66
67
  const BEFORE = { kind: "cursor", doc: "a block, or a row id <block>:<txnIndex>:<eventIndex> (a page's next): rows strictly before it" };
68
+ const keyset = (dflt , max ) => ({ kind: "keyset", limit: { default: dflt, max }, cursor: "cursor", next: "next" }) ;
69
+ const PRESETS = { kind: "list", doc: "only launches of these presets (ids 0..255)", max: PRESET_FILTER_MAX, item: { kind: "int", min: 0, max: 255 } } ;
70
+
71
+ const WALLET_PAGE = { kind: "keyset", limit: { default: WALLET_PAGE_DEFAULT, max: WALLET_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true } ;
72
+ const WALLET_PAGE_KEYS = (cursorDoc ) => ({
73
+ limit: { kind: "int", doc: "rows (asks a page)", min: 1, max: WALLET_PAGE_MAX, default: WALLET_PAGE_DEFAULT },
74
+ cursor: { kind: "string", doc: `a page's next (asks a page): ${cursorDoc}`, max: WALLET_CURSOR_MAX },
75
+ });
76
+ const KEYSET_CURSOR = (without ) => ({ kind: "string", doc: "a page's next: the rows after its last one (opaque)", max: LAUNCH_CURSOR_MAX, ...(without.length > 0 ? { without } : {}) });
67
77
  const WINDOW = { kind: "enum", doc: "the volume window", values: B.TRADER_WINDOWS, default: "24h" };
68
78
 
69
79
  const GATED = ["not_ready", "upstream"] ;
@@ -97,7 +107,16 @@ export const INDEXER_CONTRACT = {
97
107
  }),
98
108
  quotes: site({ pattern: "/floor-amm/quotes", body: B.QUOTES }),
99
109
  summary: site({ pattern: "/floor-amm/summary", aliases: ["/floor-amm/v2/summary"], body: B.SUMMARY }),
100
- floorRouted: site({ pattern: "/floor-amm/floor-routed", aliases: ["/floor-amm/v2/floor-routed"], body: B.FLOOR_ROUTED }),
110
+ floorRouted: site({
111
+ pattern: "/floor-amm/floor-routed",
112
+ aliases: ["/floor-amm/v2/floor-routed"],
113
+ query: {
114
+ limit: LIMIT(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
115
+ cursor: { kind: "string", doc: "a page's next: the launches after this launch id, in create order", max: LAUNCH_CURSOR_MAX },
116
+ },
117
+ page: keyset(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
118
+ body: B.FLOOR_ROUTED,
119
+ }),
101
120
  events: site({
102
121
  pattern: "/floor-amm/events",
103
122
  aliases: ["/events", "/v2/dex/events"],
@@ -113,19 +132,38 @@ export const INDEXER_CONTRACT = {
113
132
  query: {
114
133
  sort: { kind: "enum", doc: "the order (larger first with order=desc)", values: LAUNCH_SORTS, default: "created" },
115
134
  order: { kind: "enum", doc: "asc or desc", values: ["asc", "desc"], default: "desc" },
116
- q: { kind: "string", doc: "name or symbol contains, or an id, token or creator equals" },
135
+ q: { kind: "string", doc: "name or symbol contains, or an id, token or creator equals", max: SEARCH_Q_MAX },
117
136
  ids: { kind: "list", doc: "these launches (ids or tokens), in the order asked without sort", max: IDS_MAX },
118
137
  quote: { kind: "string", doc: "launches quoted in this coin" },
119
138
  creator: { kind: "string", doc: "launches by this creator" },
120
139
  rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
121
140
  graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
122
- limit: LIMIT(LAUNCHES_PAGE_MAX, LAUNCHES_PAGE_MAX),
123
- offset: { kind: "int", doc: "rows skipped", min: 0, default: 0 },
141
+ preset: PRESETS,
142
+ limit: LIMIT(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
143
+ cursor: KEYSET_CURSOR(["offset", "ids"]),
144
+ offset: { kind: "int", doc: "rows skipped (with total: an offset page)", min: 0, default: 0 },
124
145
  },
125
- page: { kind: "offset", limit: { default: LAUNCHES_PAGE_MAX, max: LAUNCHES_PAGE_MAX }, total: "total" },
146
+
147
+ page: keyset(LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX),
126
148
  errors: [...GATED, "bad_query"],
127
149
  body: B.LAUNCHES,
128
150
  }),
151
+ search: site({
152
+ pattern: "/floor-amm/search",
153
+ v2: true,
154
+ query: {
155
+ q: { kind: "string", doc: "the search: symbol, name or token (tiers 0-4, search.ts)", required: true, max: SEARCH_Q_MAX },
156
+ limit: LIMIT(SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX),
157
+ cursor: KEYSET_CURSOR([]),
158
+ rankable: { kind: "bool", doc: "true (or 1) listed only, false (or 0) unlisted only" },
159
+ graduated: { kind: "bool", doc: "graduated or not (true / false, or 1 / 0)" },
160
+ quote: { kind: "string", doc: "launches quoted in this coin" },
161
+ preset: PRESETS,
162
+ },
163
+ page: keyset(SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX),
164
+ errors: [...GATED, "bad_query"],
165
+ body: B.LAUNCH_SEARCH,
166
+ }),
129
167
  launch: site({ pattern: "/floor-amm/launches/<launch>", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ONE }),
130
168
  launchState: site({ pattern: "/floor-amm/launches/<launch>/state", v2: true, errors: ["not_ready", "unknown_launch"], body: B.LAUNCH_STATE }),
131
169
  milestones: site({ pattern: "/floor-amm/launches/<launch>/milestones", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_MILESTONES }),
@@ -138,16 +176,16 @@ export const INDEXER_CONTRACT = {
138
176
  errors: [...LAUNCH_ERR, "bad_query"],
139
177
  body: B.TRADES,
140
178
  }),
141
- launchClaims: site({ pattern: "/floor-amm/launches/<launch>/claims", v2: true, query: { claimer: { kind: "string", doc: "only this claimer's rows" } }, errors: LAUNCH_ERR, body: B.LAUNCH_CLAIMS }),
142
- devBuys: site({ pattern: "/floor-amm/launches/<launch>/dev-buys", v2: true, errors: LAUNCH_ERR, body: B.DEV_BUYS }),
179
+ launchClaims: site({ pattern: "/floor-amm/launches/<launch>/claims", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE, claimer: { kind: "string", doc: "only this claimer's rows" } }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.LAUNCH_CLAIMS }),
180
+ devBuys: site({ pattern: "/floor-amm/launches/<launch>/dev-buys", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.DEV_BUYS }),
143
181
 
144
- memberSold: site({ pattern: "/floor-amm/launches/<launch>/member-sold", v2: true, errors: LAUNCH_ERR, body: B.MEMBER_SOLD }),
182
+ memberSold: site({ pattern: "/floor-amm/launches/<launch>/member-sold", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.MEMBER_SOLD }),
145
183
 
146
184
  launchAccount: site({ pattern: "/floor-amm/launches/<launch>/account", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_ACCOUNT }),
147
185
  traders: site({ pattern: "/floor-amm/launches/<launch>/traders", v2: true, query: { window: WINDOW, limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.LAUNCH_TRADERS }),
148
186
  quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
149
187
  devTrades: site({ pattern: "/floor-amm/launches/<launch>/dev", v2: true, query: { limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.DEV_TRADES }),
150
- burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, errors: LAUNCH_ERR, body: B.BURNS }),
188
+ burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.BURNS }),
151
189
  launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
152
190
  marks: site({
153
191
  pattern: "/floor-amm/launches/<launch>/marks",
@@ -201,17 +239,44 @@ export const INDEXER_CONTRACT = {
201
239
  errors: [...WALLET_ERR, "unknown_launch"],
202
240
  body: B.WALLET_TRADES,
203
241
  }),
204
- positions: site({ pattern: "/floor-amm/wallets/<wallet>/positions", v2: true, errors: WALLET_ERR, body: B.POSITIONS }),
205
- inbox: site({ pattern: "/floor-amm/wallets/<wallet>/inbox", v2: true, query: { limit: LIMIT(1_000, 1_000) }, page: limit(1_000, 1_000), errors: WALLET_ERR, body: B.INBOX }),
206
- walletLocks: site({ pattern: "/floor-amm/wallets/<wallet>/locks", v2: true, errors: WALLET_ERR, body: B.WALLET_LOCKS }),
207
- claimHistory: site({ pattern: "/floor-amm/wallets/<wallet>/claims", errors: WALLET_ERR, body: B.CLAIM_HISTORY }),
242
+
243
+ tonActivity: site({
244
+ pattern: "/floor-amm/wallets/<wallet>/ton-activity",
245
+ query: { limit: LIMIT(100, 200), before: BEFORE },
246
+ page: cursor(100, 200),
247
+ errors: WALLET_ERR,
248
+ body: B.TON_ACTIVITY,
249
+ }),
250
+ tonOutcome: site({
251
+ pattern: "/floor-amm/wallets/<wallet>/ton-outcome",
252
+ query: { queryId: { kind: "string", doc: "the query id (uint64, decimal) the SDK message carried", required: true } },
253
+ errors: WALLET_ERR,
254
+ body: B.TON_OUTCOME,
255
+ }),
256
+
257
+ positions: site({ pattern: "/floor-amm/wallets/<wallet>/positions", v2: true, query: WALLET_PAGE_KEYS("opaque, launch create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.POSITIONS }),
258
+
259
+ inbox: site({
260
+ pattern: "/floor-amm/wallets/<wallet>/inbox",
261
+ v2: true,
262
+ query: { limit: LIMIT(1_000, 1_000), before: { kind: "cursor", doc: "asks a page: empty = the newest; a page's next (opaque): items strictly before it" } },
263
+ page: { kind: "cursor", limit: { default: 1_000, max: 1_000 }, cursor: "before", next: "next", optIn: { default: INBOX_PAGE_DEFAULT, max: INBOX_PAGE_MAX } },
264
+ errors: WALLET_ERR,
265
+ body: B.INBOX,
266
+ }),
267
+ walletLocks: site({ pattern: "/floor-amm/wallets/<wallet>/locks", v2: true, query: WALLET_PAGE_KEYS("opaque, launch create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.WALLET_LOCKS }),
268
+ claimHistory: site({ pattern: "/floor-amm/wallets/<wallet>/claims", query: WALLET_PAGE_KEYS("opaque, newest first"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.CLAIM_HISTORY }),
208
269
  firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
209
270
  firstsMany: site({ pattern: "/floor-amm/wallets/firsts", query: { wallets: { kind: "list", doc: "the wallets", required: true, min: 1, max: FIRSTS_MAX } }, errors: WALLET_ERR, body: B.FIRSTS_MANY }),
210
- claimView: site({ pattern: "/floor-amm/claims/<wallet>", errors: [...WALLET_ERR, "no_reader"], body: B.CLAIM_VIEW }),
211
- people: site({ pattern: "/floor-amm/referrals/<wallet>/people", errors: WALLET_ERR, body: B.PEOPLE }),
212
- roles: site({ pattern: "/floor-amm/roles/<wallet>", errors: WALLET_ERR, body: B.ROLES }),
271
+ claimView: site({ pattern: "/floor-amm/claims/<wallet>", query: WALLET_PAGE_KEYS("a page's next: the last row key (l:<launch>, r:<account>, p:<traderRef>, o:<quote>), string order"), page: WALLET_PAGE, errors: [...WALLET_ERR, "bad_query", "no_reader"], body: B.CLAIM_VIEW }),
272
+ people: site({ pattern: "/floor-amm/referrals/<wallet>/people", query: WALLET_PAGE_KEYS("opaque, referred wallet order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.PEOPLE }),
273
+ roles: site({ pattern: "/floor-amm/roles/<wallet>", query: WALLET_PAGE_KEYS("opaque, a page of launches in create order"), page: WALLET_PAGE, errors: WALLET_ERR, body: B.ROLES }),
213
274
 
214
- handlePlaces: site({ pattern: "/floor-amm/handles/<handle>/places", errors: WALLET_ERR, body: B.HANDLE_PLACES }),
275
+ handlePlaces: site({
276
+ pattern: "/floor-amm/handles/<handle>/places",
277
+ query: { limit: LIMIT(100, 500), cursor: { kind: "string", doc: "a page's next: <launch>:<place>, rows strictly after it", max: WALLET_CURSOR_MAX } },
278
+ page: keyset(100, 500),
279
+ errors: WALLET_ERR, body: B.HANDLE_PLACES }),
215
280
 
216
281
  traderBoard: site({ pattern: "/floor-amm/leaderboards/traders", v2: true, query: { window: WINDOW, limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...GATED, "bad_query"], body: B.TRADER_BOARD }),
217
282
  launcherBoard: site({ pattern: "/floor-amm/leaderboards/launchers", v2: true, query: { limit: LIMIT(100, 500) }, page: limit(100, 500), errors: [...GATED, "bad_query"], body: B.LAUNCHER_BOARD }),
@@ -236,12 +301,14 @@ export const INDEXER_CONTRACT = {
236
301
  query: {
237
302
  ticker_id: { kind: "string", doc: "<token>_<quote>", required: true },
238
303
  type: { kind: "enum", doc: "one side only", values: ["buy", "sell"] },
239
- limit: { kind: "int", doc: "rows per side (0: all)", min: 0 },
304
+ limit: { kind: "int", doc: "rows per side (absent: 500; 0: all, refused past 5000 rows in all: 413, page with before)", min: 0, max: 5000, default: 500 },
305
+ before: BEFORE,
240
306
  start_time: { kind: "unix", doc: "from (10^11 and over: milliseconds)" },
241
307
  end_time: { kind: "unix", doc: "to (10^11 and over: milliseconds)" },
242
308
  },
243
- page: { kind: "range", from: "start_time", to: "end_time" },
244
- errors: [...GATED, "bad_query", "not_found"],
309
+
310
+ page: cursor(500, 5000),
311
+ errors: [...GATED, "bad_query", "not_found", "too_many"],
245
312
  body: P.CG_HISTORICAL,
246
313
  }),
247
314
  llamaTvl: partner({ pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
@@ -283,7 +350,7 @@ export const OPEN_ROUTES = {
283
350
 
284
351
  export function routeLimit(name ) {
285
352
  const p = INDEXER_CONTRACT[name].page;
286
- return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" ? p.limit : null;
353
+ return p.kind === "limit" || p.kind === "offset" || p.kind === "cursor" || p.kind === "keyset" ? p.limit : null;
287
354
  }
288
355
 
289
356
  export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
@@ -291,9 +358,29 @@ export const LIMITS = Object.fromEntries(ROUTE_NAMES.flatMap((n) => {
291
358
  return l === null ? [] : [[n, l]];
292
359
  })) ;
293
360
 
294
- export function clampLimit(name , n ) {
295
- const l = routeLimit(name);
296
- return l === null ? n : Math.min(Math.max(1, Math.trunc(n)), l.max);
361
+ export function clampLimit(name , n , paged = false) {
362
+ const p = INDEXER_CONTRACT[name].page;
363
+ const l = paged && p.kind === "cursor" && p.optIn !== undefined ? p.optIn : routeLimit(name);
364
+
365
+ const lo = (INDEXER_CONTRACT[name].query ).limit?.min ?? 1;
366
+ return l === null ? n : Math.min(Math.max(lo, Math.trunc(n)), l.max);
367
+ }
368
+
369
+ export function pageAsked(name , _q ) {
370
+ const p = INDEXER_CONTRACT[name].page;
371
+
372
+ if (p.kind === "cursor" && p.optIn !== undefined) return true;
373
+ if (p.kind === "keyset" && p.optIn === true) return true;
374
+ return false;
375
+ }
376
+
377
+ export function pageLimit(name , q ) {
378
+ const p = INDEXER_CONTRACT[name].page;
379
+ if (p.kind === "cursor" && p.optIn !== undefined) {
380
+ const raw = q.get("limit");
381
+ return raw === null || raw === "" || !DIGITS.test(raw) ? p.optIn.default : Math.min(Math.max(1, Number(raw)), p.optIn.max);
382
+ }
383
+ return queryLimit(name, q);
297
384
  }
298
385
 
299
386
  const DIGITS = /^\d+$/;
@@ -309,7 +396,11 @@ export function queryRefusal(name , q )
309
396
  const spec = INDEXER_CONTRACT[name].query;
310
397
  for (const [key, k] of Object.entries(spec)) {
311
398
  const raw = q.get(key);
312
- if (raw === null || raw === "") continue;
399
+ if (raw === null || raw === "") {
400
+ if (k.required === true && TABLE_REQUIRED.has(name)) return `${key} is required`;
401
+ continue;
402
+ }
403
+ for (const w of k.without ?? []) if ((q.get(w) ?? "") !== "") return `${key} cannot be given with ${w}`;
313
404
  switch (k.kind) {
314
405
  case "int": {
315
406
  const lo = k.min ?? 0;
@@ -318,10 +409,15 @@ export function queryRefusal(name , q )
318
409
  break;
319
410
  }
320
411
  case "list": {
321
- const n = raw.split(",").filter((s) => s !== "").length;
322
- if (k.max !== undefined && n > k.max) return `at most ${k.max} ${key}`;
412
+ const parts = raw.split(",").filter((s) => s !== "");
413
+ if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
414
+ const it = k.item;
415
+ if (it !== undefined && parts.some((x) => !DIGITS.test(x) || Number(x) < it.min || Number(x) > it.max)) return `each ${key} must be an integer ${it.min}..${it.max}`;
323
416
  break;
324
417
  }
418
+ case "string":
419
+ if (k.max !== undefined && raw.length > k.max) return `${key} must be at most ${k.max} characters`;
420
+ break;
325
421
  case "enum":
326
422
  if (k.values !== undefined && !k.values.includes(raw)) return `${key} must be one of ${k.values.join(", ")}`;
327
423
  break;
@@ -332,9 +428,17 @@ export function queryRefusal(name , q )
332
428
  break;
333
429
  }
334
430
  }
431
+
432
+ const pg = INDEXER_CONTRACT[name].page;
433
+ if (pg.kind === "cursor" && pg.optIn !== undefined && q.get(pg.cursor) !== null) {
434
+ const raw = q.get("limit");
435
+ if (raw !== null && raw !== "" && Number(raw) > pg.optIn.max) return `limit must be 1..${pg.optIn.max} with ${pg.cursor}`;
436
+ }
335
437
  return spanRefusal(name, q);
336
438
  }
337
439
 
440
+ const TABLE_REQUIRED = new Set (["search"]);
441
+
338
442
  const BOOLS = { true: true, false: false, 1: true, 0: false };
339
443
 
340
444
  export function queryArg(name , q , key ) {
@@ -47,7 +47,8 @@ export const DEX_SUMMARY = object({
47
47
  });
48
48
 
49
49
  export const DEX_PAIR = object({
50
- pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num) }),
50
+ pair: object({ id: str, asset0Id: str, asset1Id: str, createdAtBlockNumber: int, createdAtBlockTimestamp: int, feeBps: nullable(num), dexKey: str, createdAtTxnId: optional(str), creator: str }),
51
+ launch: optional(object({ id: str, token: str })),
51
52
  });
52
53
 
53
54
  export const CG_PAIRS = array(object({ ticker_id: str, base: str, target: str, pool_id: str }));
@@ -74,7 +75,7 @@ export const CG_TICKERS = array(object({
74
75
 
75
76
  export const CG_TRADE = object({ trade_id: int, price: decimal, base_volume: decimal, target_volume: decimal, trade_timestamp: int, type: oneOf("buy", "sell") });
76
77
 
77
- export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)) });
78
+ export const CG_HISTORICAL = object({ buy: optional(array(CG_TRADE)), sell: optional(array(CG_TRADE)), next: optional(nullable(str)) });
78
79
 
79
80
  export const LLAMA_TVL = object({ mode: LIQUIDITY_MODE, tvl: record(big), launchTokens: array(str) });
80
81
 
@@ -6,22 +6,23 @@ export const INDEXER_ROUTES = {
6
6
  stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
7
7
  quotes: { pattern: "/floor-amm/quotes", keys: [] },
8
8
  summary: { pattern: "/floor-amm/summary", keys: [] },
9
- floorRouted: { pattern: "/floor-amm/floor-routed", keys: [] },
9
+ floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
10
10
  events: { pattern: "/floor-amm/events", keys: ["fromBlock", "toBlock"] },
11
- launches: { pattern: "/floor-amm/launches", keys: ["sort", "order", "q", "ids", "quote", "creator", "rankable", "graduated", "limit", "offset"] },
11
+ launches: { pattern: "/floor-amm/launches", keys: ["sort", "order", "q", "ids", "quote", "creator", "rankable", "graduated", "preset", "limit", "cursor", "offset"] },
12
+ search: { pattern: "/floor-amm/search", keys: ["q", "limit", "cursor", "rankable", "graduated", "quote", "preset"] },
12
13
  launch: { pattern: "/floor-amm/launches/<launch>", keys: [] },
13
14
  launchState: { pattern: "/floor-amm/launches/<launch>/state", keys: [] },
14
15
  milestones: { pattern: "/floor-amm/launches/<launch>/milestones", keys: [] },
15
16
  holders: { pattern: "/floor-amm/launches/<launch>/holders", keys: ["limit"] },
16
17
  trades: { pattern: "/floor-amm/launches/<launch>/trades", keys: ["limit", "before", "traders"] },
17
- launchClaims: { pattern: "/floor-amm/launches/<launch>/claims", keys: ["claimer"] },
18
- devBuys: { pattern: "/floor-amm/launches/<launch>/dev-buys", keys: [] },
19
- memberSold: { pattern: "/floor-amm/launches/<launch>/member-sold", keys: [] },
18
+ launchClaims: { pattern: "/floor-amm/launches/<launch>/claims", keys: ["limit", "before", "claimer"] },
19
+ devBuys: { pattern: "/floor-amm/launches/<launch>/dev-buys", keys: ["limit", "before"] },
20
+ memberSold: { pattern: "/floor-amm/launches/<launch>/member-sold", keys: ["limit", "before"] },
20
21
  launchAccount: { pattern: "/floor-amm/launches/<launch>/account", keys: [] },
21
22
  traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
22
23
  quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
23
24
  devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
24
- burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: [] },
25
+ burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
25
26
  launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
26
27
  marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
27
28
  price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
@@ -29,26 +30,41 @@ export const INDEXER_ROUTES = {
29
30
  candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
30
31
  candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
31
32
  walletTrades: { pattern: "/floor-amm/wallets/<wallet>/trades", keys: ["limit", "before", "launch"] },
32
- positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: [] },
33
- inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit"] },
34
- walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: [] },
35
- claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: [] },
33
+ tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
34
+ tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
35
+ positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
36
+ inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
37
+ walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
38
+ claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
36
39
  firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
37
40
  firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
38
- claimView: { pattern: "/floor-amm/claims/<wallet>", keys: [] },
39
- people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: [] },
40
- roles: { pattern: "/floor-amm/roles/<wallet>", keys: [] },
41
- handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: [] },
41
+ claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
42
+ people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
43
+ roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
44
+ handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
42
45
  traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
43
46
  launcherBoard: { pattern: "/floor-amm/leaderboards/launchers", keys: ["limit"] },
44
47
  } ;
45
48
 
46
- export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "newHolders24h"] ;
49
+ export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "newHolders24h", "standingVolume", "standingMarketCap", "standingBacked", "maxloss"] ;
47
50
 
48
51
  export const IDS_MAX = 100;
49
52
 
50
53
  export const LAUNCHES_PAGE_MAX = 1_000;
51
54
 
55
+ export const LAUNCHES_PAGE_DEFAULT = 100;
56
+
57
+ export const LAUNCH_CURSOR_MAX = 512;
58
+
59
+ export const WALLET_PAGE_DEFAULT = 100;
60
+ export const WALLET_PAGE_MAX = 500;
61
+
62
+ export const WALLET_CURSOR_MAX = 256;
63
+ export const INBOX_PAGE_DEFAULT = 100;
64
+ export const INBOX_PAGE_MAX = 500;
65
+
66
+ export const PRESET_FILTER_MAX = 16;
67
+
52
68
  export const FIRSTS_MAX = 100;
53
69
 
54
70
  export const STREAM_STATE_MAX = 16;
@@ -69,6 +85,8 @@ const need = (s ) => {
69
85
  };
70
86
  const seg = (s ) => encodeURIComponent(need(s));
71
87
 
88
+ const presets = (p ) => (p === undefined || p.length === 0 ? undefined : p.map(String));
89
+
72
90
  const launchPath = (id , tail = "") => `/floor-amm/launches/${seg(id)}${tail}`;
73
91
  const walletPath = (w , tail ) => `/floor-amm/wallets/${seg(w)}${tail}`;
74
92
 
@@ -81,27 +99,33 @@ export const indexerPath = {
81
99
  },
82
100
  quotes: () => "/floor-amm/quotes",
83
101
  summary: () => "/floor-amm/summary",
84
- floorRouted: () => "/floor-amm/floor-routed",
102
+ floorRouted: (q = {}) => `/floor-amm/floor-routed${query({ limit: q.limit, cursor: q.cursor })}`,
85
103
  events: (fromBlock , toBlock ) => `/floor-amm/events${query({ fromBlock, toBlock })}`,
86
104
 
87
105
  launches: (q = {}) => {
88
106
  if (q.ids !== undefined && q.ids.length > IDS_MAX) throw new RangeError(`at most ${IDS_MAX} ids`);
89
107
  const sort = q.sort ?? (q.ids === undefined ? "created" : undefined);
90
- return `/floor-amm/launches${query({ sort, order: q.order, q: q.q, ids: q.ids, quote: q.quote, creator: q.creator, rankable: q.rankable, graduated: q.graduated, limit: q.limit, offset: q.offset })}`;
108
+ if (q.preset !== undefined && q.preset.length > PRESET_FILTER_MAX) throw new RangeError(`at most ${PRESET_FILTER_MAX} presets`);
109
+ return `/floor-amm/launches${query({ sort, order: q.order, q: q.q, ids: q.ids, quote: q.quote, creator: q.creator, rankable: q.rankable, graduated: q.graduated, preset: presets(q.preset), limit: q.limit, cursor: q.cursor, offset: q.offset })}`;
110
+ },
111
+ search: (q ) => {
112
+ if (q.q.trim() === "") throw new RangeError("an empty search");
113
+ if (q.preset !== undefined && q.preset.length > PRESET_FILTER_MAX) throw new RangeError(`at most ${PRESET_FILTER_MAX} presets`);
114
+ return `/floor-amm/search${query({ q: q.q, limit: q.limit, cursor: q.cursor, rankable: q.rankable, graduated: q.graduated, quote: q.quote, preset: presets(q.preset) })}`;
91
115
  },
92
116
  launch: (id ) => launchPath(id),
93
117
  launchState: (id ) => launchPath(id, "/state"),
94
118
  milestones: (id ) => launchPath(id, "/milestones"),
95
119
  holders: (id , q = {}) => launchPath(id, `/holders${query({ limit: q.limit })}`),
96
120
  trades: (id , q = {}) => launchPath(id, `/trades${query({ limit: q.limit, before: q.before, traders: q.traders?.length ? q.traders : undefined })}`),
97
- launchClaims: (id , q = {}) => launchPath(id, `/claims${query({ claimer: q.claimer })}`),
98
- devBuys: (id ) => launchPath(id, "/dev-buys"),
99
- memberSold: (id ) => launchPath(id, "/member-sold"),
121
+ launchClaims: (id , q = {}) => launchPath(id, `/claims${query({ limit: q.limit, before: q.before, claimer: q.claimer })}`),
122
+ devBuys: (id , q = {}) => launchPath(id, `/dev-buys${query({ limit: q.limit, before: q.before })}`),
123
+ memberSold: (id , q = {}) => launchPath(id, `/member-sold${query({ limit: q.limit, before: q.before })}`),
100
124
  launchAccount: (id ) => launchPath(id, "/account"),
101
125
  traders: (id , q = {}) => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
102
126
  quoteChain: (id ) => launchPath(id, "/chain"),
103
127
  devTrades: (id , q = {}) => launchPath(id, `/dev${query({ limit: q.limit })}`),
104
- burns: (id ) => launchPath(id, "/burns"),
128
+ burns: (id , q = {}) => launchPath(id, `/burns${query({ limit: q.limit, before: q.before })}`),
105
129
  launchLocks: (id ) => launchPath(id, "/locks"),
106
130
  marks: (id , q = {}) => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
107
131
  price: (id ) => launchPath(id, "/price"),
@@ -115,19 +139,27 @@ export const indexerPath = {
115
139
  return `/floor-amm/candles${query({ launch: need(q.launch), interval: q.interval, from: q.from, to: q.to, before: q.before, limit: q.limit })}`;
116
140
  },
117
141
  walletTrades: (w , q = {}) => walletPath(w, `/trades${query({ limit: q.limit, before: q.before, launch: q.launch })}`),
118
- positions: (w ) => walletPath(w, "/positions"),
119
- inbox: (w , q = {}) => walletPath(w, `/inbox${query({ limit: q.limit })}`),
120
- walletLocks: (w ) => walletPath(w, "/locks"),
121
- claimHistory: (w ) => walletPath(w, "/claims"),
142
+
143
+ tonActivity: (w , q = {}) => walletPath(w, `/ton-activity${query({ limit: q.limit, before: q.before })}`),
144
+ tonOutcome: (w , queryId ) => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
145
+
146
+ positions: (w , q = {}) => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
147
+
148
+ inbox: (w , q = {}) => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
149
+ walletLocks: (w , q = {}) => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
150
+
151
+ claimHistory: (w , q = {}) => walletPath(w, `/claims${query({ limit: q.limit, cursor: q.cursor })}`),
122
152
  firsts: (w ) => walletPath(w, "/firsts"),
123
153
  firstsMany: (wallets ) => {
124
154
  if (wallets.length === 0 || wallets.length > FIRSTS_MAX) throw new RangeError(`1..${FIRSTS_MAX} wallets`);
125
155
  return `/floor-amm/wallets/firsts${query({ wallets })}`;
126
156
  },
127
- claimView: (w ) => `/floor-amm/claims/${seg(w)}`,
128
- people: (w ) => `/floor-amm/referrals/${seg(w)}/people`,
129
- roles: (w ) => `/floor-amm/roles/${seg(w)}`,
130
- handlePlaces: (handle ) => `/floor-amm/handles/${seg(handle)}/places`,
157
+ claimView: (w , q = {}) => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
158
+
159
+ people: (w , q = {}) => `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor })}`,
160
+
161
+ roles: (w , q = {}) => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
162
+ handlePlaces: (handle , q = {}) => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
131
163
  traderBoard: (q = {}) => `/floor-amm/leaderboards/traders${query({ window: q.window, limit: q.limit })}`,
132
164
  launcherBoard: (q = {}) => `/floor-amm/leaderboards/launchers${query({ limit: q.limit })}`,
133
165
  } ;
@@ -9,11 +9,14 @@ import { errorCode } from "./contract.js";
9
9
  export * from "./bodies.js";
10
10
  export { ShapeError, decode } from "./decode.js";
11
11
 
12
- export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_MAX, LAUNCH_SORTS, STREAM_STATE_MAX, indexerPath, query } from "./paths.js";
12
+ export { FIRSTS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PRESET_FILTER_MAX, STREAM_STATE_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, indexerPath, query } from "./paths.js";
13
+ export { ADDRESS_PREFIX_MIN, SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_PARITY_CORPUS, SEARCH_Q_MAX, SEARCH_SUBSTRING_MIN, searchFold, searchNeedle, searchNeedles, searchServed, searchServedTier, searchTier, searchTierFolded } from "./search.js";
14
+
13
15
  export * from "./partners.js";
14
- export { INDEXER_CONTRACT, INDEXER_ERROR_CODES, LIMITS, OPEN_ROUTES, ROUTE_NAMES, UNITS, clampLimit, errorCode, matchRoute, queryArg, queryBool, queryLimit, queryRefusal, routeLimit, spanRefusal } from "./contract.js";
16
+ export * from "./stack-edge.js";
17
+ export { INDEXER_CONTRACT, INDEXER_ERROR_CODES, LIMITS, OPEN_ROUTES, ROUTE_NAMES, UNITS, clampLimit, errorCode, matchRoute, pageAsked, pageLimit, queryArg, queryBool, queryLimit, queryRefusal, routeLimit, spanRefusal } from "./contract.js";
15
18
 
16
- export { createIndexerClient, routePath } from "./client.js";
19
+ export { DRAIN_NAMES, createIndexerClient, routePath } from "./client.js";
17
20
 
18
21
  export class IndexerError extends Error {
19
22
  status ;
@@ -55,6 +58,8 @@ export const readEvents = (get , fromBlock , toBlock )
55
58
 
56
59
  export const readLaunches = (get , q = {}) => readRoute(get, indexerPath.launches(q), B.LAUNCHES);
57
60
 
61
+ export const readLaunchSearch = (get , q ) => readRoute(get, indexerPath.search(q), B.LAUNCH_SEARCH);
62
+
58
63
  export const readLaunch = (get , id ) => readRoute(get, indexerPath.launch(id), B.LAUNCH_ONE);
59
64
 
60
65
  export const readLaunchState = (get , id ) => readRoute(get, indexerPath.launchState(id), B.LAUNCH_STATE);
@@ -63,10 +68,10 @@ export const readMilestones = (get , id )
63
68
  export const readHolders = (get , id , q = {}) => readRoute(get, indexerPath.holders(id, q), B.HOLDERS);
64
69
 
65
70
  export const readTrades = (get , id , q = {}) => readRoute(get, indexerPath.trades(id, q), B.TRADES);
66
- export const readLaunchClaims = (get , id , q = {}) => readRoute(get, indexerPath.launchClaims(id, q), B.LAUNCH_CLAIMS);
67
- export const readDevBuys = (get , id ) => readRoute(get, indexerPath.devBuys(id), B.DEV_BUYS);
71
+ export const readLaunchClaims = (get , id , q = {}) => readRoute(get, indexerPath.launchClaims(id, q), B.LAUNCH_CLAIMS);
72
+ export const readDevBuys = (get , id , q = {}) => readRoute(get, indexerPath.devBuys(id, q), B.DEV_BUYS);
68
73
 
69
- export const readMemberSold = (get , id ) => readRoute(get, indexerPath.memberSold(id), B.MEMBER_SOLD);
74
+ export const readMemberSold = (get , id , q = {}) => readRoute(get, indexerPath.memberSold(id, q), B.MEMBER_SOLD);
70
75
 
71
76
  export const readLaunchAccount = (get , id ) => readRoute(get, indexerPath.launchAccount(id), B.LAUNCH_ACCOUNT);
72
77
 
@@ -81,7 +86,7 @@ export const readTraders = (get , id , q
81
86
  export const readQuoteChain = (get , id ) => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
82
87
 
83
88
  export const readDevTrades = (get , id , q = {}) => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
84
- export const readBurns = (get , id ) => readRoute(get, indexerPath.burns(id), B.BURNS);
89
+ export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
85
90
  export const readLaunchLocks = (get , id ) => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
86
91
 
87
92
  export const readMarks = (get , id , q = {}) => readRoute(get, indexerPath.marks(id, q), B.MARKS);
@@ -92,20 +97,22 @@ export const readCandleBundle = (get , id , q
92
97
  export const readHighs = (get , id , q = {}) => readRoute(get, indexerPath.highs(id, q), B.HIGHS);
93
98
 
94
99
  export const readWalletTrades = (get , wallet , q = {}) => readRoute(get, indexerPath.walletTrades(wallet, q), B.WALLET_TRADES);
95
- export const readPositions = (get , wallet ) => readRoute(get, indexerPath.positions(wallet), B.POSITIONS);
100
+ export const readTonActivity = (get , wallet , q = {}) => readRoute(get, indexerPath.tonActivity(wallet, q), B.TON_ACTIVITY);
101
+ export const readTonOutcome = (get , wallet , queryId ) => readRoute(get, indexerPath.tonOutcome(wallet, queryId), B.TON_OUTCOME);
102
+ export const readPositions = (get , wallet , q = {}) => readRoute(get, indexerPath.positions(wallet, q), B.POSITIONS);
96
103
 
97
- export const readInbox = (get , wallet , q = {}) => readRoute(get, indexerPath.inbox(wallet, q), B.INBOX);
98
- export const readWalletLocks = (get , wallet ) => readRoute(get, indexerPath.walletLocks(wallet), B.WALLET_LOCKS);
99
- export const readClaimHistory = (get , wallet ) => readRoute(get, indexerPath.claimHistory(wallet), B.CLAIM_HISTORY);
104
+ export const readInbox = (get , wallet , q = {}) => readRoute(get, indexerPath.inbox(wallet, q), B.INBOX);
105
+ export const readWalletLocks = (get , wallet , q = {}) => readRoute(get, indexerPath.walletLocks(wallet, q), B.WALLET_LOCKS);
106
+ export const readClaimHistory = (get , wallet , q = {}) => readRoute(get, indexerPath.claimHistory(wallet, q), B.CLAIM_HISTORY);
100
107
 
101
- export const readClaimView = (get , wallet ) => readRoute(get, indexerPath.claimView(wallet), B.CLAIM_VIEW);
108
+ export const readClaimView = (get , wallet , q = {}) => readRoute(get, indexerPath.claimView(wallet, q), B.CLAIM_VIEW);
102
109
  export const readFirsts = (get , wallet ) => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
103
110
 
104
111
  export const readFirstsMany = (get , wallets ) => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
105
- export const readPeople = (get , wallet ) => readRoute(get, indexerPath.people(wallet), B.PEOPLE);
106
- export const readRoles = (get , wallet ) => readRoute(get, indexerPath.roles(wallet), B.ROLES);
112
+ export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
113
+ export const readRoles = (get , wallet , q = {}) => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
107
114
 
108
- export const readHandlePlaces = (get , handle ) => readRoute(get, indexerPath.handlePlaces(handle), B.HANDLE_PLACES);
115
+ export const readHandlePlaces = (get , handle , q = {}) => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);
109
116
 
110
117
  export const readTraderBoard = (get , q = {}) => readRoute(get, indexerPath.traderBoard(q), B.TRADER_BOARD);
111
118
  export const readLauncherBoard = (get , q = {}) => readRoute(get, indexerPath.launcherBoard(q), B.LAUNCHER_BOARD);
@@ -120,3 +127,8 @@ export function offPriceBps(price , quotedX64
120
127
  if (p === 0n) return null;
121
128
  return Number(((quotedX64 - p) * 10_000n) / p);
122
129
  }
130
+
131
+ export function cursorPage (body , rows ) {
132
+ if (body.next === undefined) throw new Error(`not a page: the body has no next (rows ${rows})`);
133
+ return { rows: body[rows], next: body.next };
134
+ }