@floorlaunchpad/sdk 0.6.0 → 0.8.1

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 (125) hide show
  1. package/CHANGELOG.md +279 -0
  2. package/README.md +12 -1
  3. package/dist/abi/evm-event-names.js +7 -0
  4. package/dist/abi/evm.gen.js +81 -2
  5. package/dist/abi/functions.gen.js +135 -1
  6. package/dist/abi/solana.gen.js +64 -0
  7. package/dist/client/solana/index.js +25 -6
  8. package/dist/config/generated.js +803 -26374
  9. package/dist/errors.js +21 -2
  10. package/dist/events/types.gen.js +1 -1
  11. package/dist/evm/chains.js +80 -0
  12. package/dist/evm/floor/abi.gen.js +115 -0
  13. package/dist/evm/floor/calls.js +5 -0
  14. package/dist/evm/squid.js +21 -5
  15. package/dist/evm/venues.js +302 -0
  16. package/dist/generated/interface.gen.js +93 -44
  17. package/dist/index.js +7 -0
  18. package/dist/indexer/bodies.js +288 -5
  19. package/dist/indexer/client.js +17 -1
  20. package/dist/indexer/contract.js +141 -15
  21. package/dist/indexer/paths.js +80 -7
  22. package/dist/indexer/read.js +25 -3
  23. package/dist/indexer/stream.js +2 -2
  24. package/dist/math/v2/book.js +24 -7
  25. package/dist/math/v2/create.js +1 -1
  26. package/dist/math/v2/escrow.js +205 -0
  27. package/dist/math/v2/fees.js +30 -4
  28. package/dist/math/v2/milestones.js +1 -1
  29. package/dist/math/v2/office.js +110 -0
  30. package/dist/math/v2/receipt.js +3 -3
  31. package/dist/math/v2/relay.js +263 -96
  32. package/dist/math/v2/rows.js +17 -0
  33. package/dist/math/v2/team.js +42 -1
  34. package/dist/math/v2/trade.js +3 -1
  35. package/dist/reprice.js +88 -0
  36. package/dist/route/quote.js +16 -0
  37. package/dist/scaledUi.js +113 -0
  38. package/dist/solana/floor/accounts.js +38 -5
  39. package/dist/solana/floor/events.js +62 -1
  40. package/dist/solana/floor/instructions.js +39 -1
  41. package/dist/solana/floor/program.js +3 -0
  42. package/dist/stockRefresh.js +99 -0
  43. package/dist/ton/consts.generated.js +2 -2
  44. package/dist/ton/gas.js +3 -3
  45. package/dist/v2/claims.js +28 -5
  46. package/dist/v2/devbuy.js +28 -3
  47. package/dist/v2/events.js +2 -0
  48. package/dist/v2/evm.js +183 -5
  49. package/dist/v2/layouts.js +102 -2
  50. package/dist/v2/office-events.js +127 -0
  51. package/dist/v2/office-evm.js +68 -0
  52. package/dist/v2/office-read.js +182 -0
  53. package/dist/v2/office-solana.js +134 -0
  54. package/dist/v2/office-trade.js +73 -0
  55. package/dist/v2/route-alt.js +1 -0
  56. package/dist/v2/route.js +1 -1
  57. package/dist/v2/solana.js +224 -5
  58. package/dist/v2/solanaSettle.js +2 -0
  59. package/dist/v2/tx/evm.js +66 -2
  60. package/dist/v2/tx/solana.js +3 -3
  61. package/dist/v2/types.js +4 -0
  62. package/docs/aggregator.md +19 -0
  63. package/docs/cursor-pages.md +9 -3
  64. package/docs/ton.md +1 -1
  65. package/examples/floor-line.html +1 -1
  66. package/package.json +26 -1
  67. package/src/abi/evm-event-names.ts +7 -0
  68. package/src/abi/evm.gen.ts +81 -2
  69. package/src/abi/functions.gen.ts +135 -1
  70. package/src/abi/solana.gen.ts +64 -0
  71. package/src/client/solana/index.ts +25 -6
  72. package/src/config/generated.ts +803 -26374
  73. package/src/errors.ts +21 -2
  74. package/src/events/types.gen.ts +458 -1
  75. package/src/evm/chains.ts +89 -0
  76. package/src/evm/floor/abi.gen.ts +115 -0
  77. package/src/evm/floor/calls.ts +5 -0
  78. package/src/evm/squid.ts +22 -6
  79. package/src/evm/venues.ts +340 -0
  80. package/src/generated/interface.gen.ts +93 -44
  81. package/src/index.ts +7 -0
  82. package/src/indexer/bodies.ts +308 -5
  83. package/src/indexer/client.ts +31 -4
  84. package/src/indexer/contract.ts +148 -17
  85. package/src/indexer/paths.ts +139 -7
  86. package/src/indexer/read.ts +27 -5
  87. package/src/indexer/stream.ts +4 -4
  88. package/src/math/v2/book.ts +23 -7
  89. package/src/math/v2/create.ts +1 -1
  90. package/src/math/v2/escrow.ts +213 -0
  91. package/src/math/v2/fees.ts +30 -4
  92. package/src/math/v2/milestones.ts +1 -1
  93. package/src/math/v2/office.ts +114 -0
  94. package/src/math/v2/receipt.ts +7 -3
  95. package/src/math/v2/relay.ts +269 -96
  96. package/src/math/v2/rows.ts +17 -0
  97. package/src/math/v2/team.ts +42 -1
  98. package/src/math/v2/trade.ts +3 -1
  99. package/src/reprice.ts +121 -0
  100. package/src/route/quote.ts +16 -0
  101. package/src/scaledUi.ts +123 -0
  102. package/src/solana/floor/accounts.ts +38 -5
  103. package/src/solana/floor/events.ts +63 -2
  104. package/src/solana/floor/instructions.ts +39 -1
  105. package/src/solana/floor/program.ts +3 -0
  106. package/src/stockRefresh.ts +131 -0
  107. package/src/ton/consts.generated.ts +2 -2
  108. package/src/ton/gas.ts +3 -3
  109. package/src/v2/claims.ts +34 -5
  110. package/src/v2/devbuy.ts +38 -3
  111. package/src/v2/events.ts +3 -1
  112. package/src/v2/evm.ts +209 -5
  113. package/src/v2/layouts.ts +102 -2
  114. package/src/v2/office-events.ts +133 -0
  115. package/src/v2/office-evm.ts +76 -0
  116. package/src/v2/office-read.ts +264 -0
  117. package/src/v2/office-solana.ts +159 -0
  118. package/src/v2/office-trade.ts +96 -0
  119. package/src/v2/route-alt.ts +1 -0
  120. package/src/v2/route.ts +1 -1
  121. package/src/v2/solana.ts +235 -5
  122. package/src/v2/solanaSettle.ts +2 -0
  123. package/src/v2/tx/evm.ts +66 -2
  124. package/src/v2/tx/solana.ts +5 -3
  125. package/src/v2/types.ts +76 -1
@@ -4,8 +4,10 @@ import type { Decoder } from "./decode.ts";
4
4
  import { unknown } from "./decode.ts";
5
5
  import * as B from "./bodies.ts";
6
6
  import * as P from "./partners.ts";
7
- import { CANDLES_MANY_IDS_MAX, CANDLES_MANY_LIMIT_DEFAULT, CANDLES_MANY_ROWS_MAX, FIRSTS_MAX, IDS_MAX, LAUNCH_LISTS_QUOTES_MAX, LAUNCH_LISTS_ROWS_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.ts";
7
+ import { CANDLES_MANY_IDS_MAX, CANDLES_MANY_LIMIT_DEFAULT, CANDLES_MANY_ROWS_MAX, COBUYS_PAGE_DEFAULT, COBUYS_PAGE_MAX, FIRSTS_MAX, TIES_WALLETS_MAX, POSITION_TOTALS_PAGE_MAX, TRADED_WALLETS_MAX, IDS_MAX, LAUNCH_LISTS_QUOTES_MAX, LAUNCH_LISTS_ROWS_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PEOPLE_PERSON_MAX, PRESET_FILTER_MAX, REFERRAL_LAUNCHES_PAGE_MAX, STREAM_STATE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, HELD_AT_MAX, HELD_WALLETS_MAX } from "./paths.ts";
8
8
  import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.ts";
9
+ import { PARTNER_QUOTE_UNIT } from "../scaledUi.ts";
10
+ import type { QuoteUnit } from "../scaledUi.ts";
9
11
 
10
12
  export const UNITS = {
11
13
  site: "raw quote base units, token math units (6 dp), Q64.64 prices, unix s; bigint as decimal strings; USD as decimal strings",
@@ -100,10 +102,12 @@ export type Pagination =
100
102
  readonly optIn?: true;
101
103
  }
102
104
 
103
- | { readonly kind: "range"; readonly from: string; readonly to: string; readonly span?: { readonly interval: string; readonly max: number } };
105
+ | { readonly kind: "range"; readonly from: string; readonly to: string; readonly span?: { readonly interval: string; readonly max: number; readonly seconds?: true } };
104
106
 
105
107
  export type PathParam = "launch" | "wallet" | "token" | "handle";
106
108
 
109
+ export type RouteQuoteUnit = QuoteUnit | "none";
110
+
107
111
  export interface RouteContract<T = unknown> {
108
112
  readonly pattern: string;
109
113
  readonly aliases: readonly string[];
@@ -117,6 +121,8 @@ export interface RouteContract<T = unknown> {
117
121
 
118
122
  readonly sse?: true;
119
123
  readonly units: Units;
124
+
125
+ readonly quoteUnit: RouteQuoteUnit;
120
126
  readonly audience: "site" | "partner" | "ops";
121
127
  readonly body: Decoder<T>;
122
128
  }
@@ -141,15 +147,16 @@ const GATED = ["not_ready", "upstream"] as const;
141
147
  const LAUNCH_ERR = [...GATED, "unknown_launch"] as const;
142
148
  const WALLET_ERR = [...GATED, "bad_query"] as const;
143
149
 
144
- type Spec<T> = Omit<RouteContract<T>, "aliases" | "mount" | "params" | "query" | "page" | "errors" | "gated" | "units" | "audience"> & Partial<RouteContract<T>>;
150
+ type Spec<T> = Omit<RouteContract<T>, "aliases" | "mount" | "params" | "query" | "page" | "errors" | "gated" | "units" | "quoteUnit" | "audience"> & Partial<RouteContract<T>>;
145
151
 
146
152
  function site<T>(s: Spec<T> & { v2?: boolean }): RouteContract<T> {
147
153
  const params = [...s.pattern.matchAll(/<(launch|wallet|token|handle)>/g)].map((m) => m[1] as PathParam);
148
154
  const { v2, ...rest } = s;
149
155
  const aliases = s.aliases ?? (v2 ? [s.pattern.replace(/^\/floor-amm\//, "/floor-amm/v2/")] : []);
150
- return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", audience: "site", ...rest, params, aliases };
156
+ return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", quoteUnit: "raw", audience: "site", ...rest, params, aliases };
151
157
  }
152
- function partner<T>(s: Spec<T>): RouteContract<T> {
158
+
159
+ function partner<T>(s: Spec<T> & { quoteUnit: RouteQuoteUnit }): RouteContract<T> {
153
160
  return { mount: "chain", params: [], query: {}, page: NONE, errors: [...GATED, "bad_query"], gated: true, units: "partner", audience: "partner", aliases: [], ...s };
154
161
  }
155
162
 
@@ -165,6 +172,9 @@ export const INDEXER_CONTRACT = {
165
172
  launch: { kind: "list", doc: "only these launches' frames (and their quote chains' relatives)" },
166
173
  state: { kind: "list", doc: "state frames (the launch whole on each change) for these", max: STREAM_STATE_MAX },
167
174
  lastEventId: { kind: "string", doc: "resume after this frame id (EventSource sends Last-Event-ID itself)" },
175
+ seat: { kind: "enum", doc: "relay: the site relay's seat (pipes are refused first)", values: ["relay"] },
176
+ compress: { kind: "bool", doc: "1: compress the stream (zstd, br or gzip as Accept-Encoding allows; relay seats by default)" },
177
+ refs: { kind: "bool", doc: "1: the trade frames carry `refs` (who a trade credited) when a referrer was credited" },
168
178
  },
169
179
  body: unknown,
170
180
  }),
@@ -267,7 +277,9 @@ export const INDEXER_CONTRACT = {
267
277
  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 }),
268
278
  quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
269
279
  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 }),
270
- 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 }),
280
+
281
+ burns: site({ pattern: "/floor-amm/launches/<launch>/burns", v2: true, query: { limit: LIMIT(100, 500), before: BEFORE, wallet: { kind: "string", doc: "only this wallet's burns (EVM case-blind; not a wallet on the chain: 400)" } }, page: cursor(100, 500), errors: [...LAUNCH_ERR, "bad_query"], body: B.BURNS }),
282
+ deals: site({ pattern: "/floor-amm/launches/<launch>/deals", v2: true, errors: LAUNCH_ERR, body: B.DEALS }),
271
283
  launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
272
284
  marks: site({
273
285
  pattern: "/floor-amm/launches/<launch>/marks",
@@ -278,6 +290,52 @@ export const INDEXER_CONTRACT = {
278
290
  body: B.MARKS,
279
291
  }),
280
292
  price: site({ pattern: "/floor-amm/launches/<launch>/price", v2: true, errors: LAUNCH_ERR, body: B.PRICE }),
293
+
294
+ raiseSeries: site({
295
+ pattern: "/floor-amm/launches/<launch>/raise-series",
296
+ v2: true,
297
+ query: {
298
+ step: { kind: "enum", doc: "the grid in seconds", values: B.RAISE_STEPS.map(String), required: true },
299
+ from: { kind: "unix", doc: "the grid's left edge (absent: the launch's open)" },
300
+ to: { kind: "unix", doc: "the right edge (absent: the indexed head's time; never before the last fill)" },
301
+ },
302
+ page: { kind: "range", from: "from", to: "to", span: { interval: "step", max: B.RT_POINTS_MAX, seconds: true } },
303
+ errors: [...LAUNCH_ERR, "bad_query"],
304
+ body: B.RAISE_SERIES,
305
+ }),
306
+ floorSteps: site({
307
+ pattern: "/floor-amm/launches/<launch>/floor-steps",
308
+ v2: true,
309
+ query: {
310
+ from: { kind: "unix", doc: "the window's start (absent: the graduation, else the open)" },
311
+ to: { kind: "unix", doc: "the slices' right edge (absent: the indexed head's time; never before the last step)" },
312
+ points: { kind: "int", doc: "the slices (the last step of each is kept)", min: 1, max: B.RT_POINTS_MAX, default: B.RT_POINTS_MAX },
313
+ },
314
+ page: { kind: "range", from: "from", to: "to" },
315
+ errors: [...LAUNCH_ERR, "bad_query"],
316
+ body: B.FLOOR_STEPS,
317
+ }),
318
+
319
+ launchTraded: site({
320
+ pattern: "/floor-amm/launches/<launch>/traded",
321
+ v2: true,
322
+ query: { wallets: { kind: "list", doc: "the wallets asked, answered in this order", required: true, min: 1, max: TRADED_WALLETS_MAX } },
323
+ errors: [...LAUNCH_ERR, "bad_query"],
324
+ body: B.LAUNCH_TRADED,
325
+ }),
326
+
327
+ launchTies: site({
328
+ pattern: "/floor-amm/launches/<launch>/ties",
329
+ v2: true,
330
+ query: {
331
+ wallets: { kind: "list", doc: "the wallets asked, answered in this order", required: true, min: 1, max: TIES_WALLETS_MAX },
332
+ at: { kind: "unix", doc: "the second the ties are read around (a person's first buy, or a deal's Accept)", required: true },
333
+ from: { kind: "unix", doc: "the window's start (absent: at − 7 d)" },
334
+ to: { kind: "unix", doc: "the window's end, inclusive (absent: at + 7 d)" },
335
+ },
336
+ errors: [...LAUNCH_ERR, "bad_query"],
337
+ body: B.LAUNCH_TIES,
338
+ }),
281
339
  highs: site({
282
340
  pattern: "/floor-amm/launches/<launch>/highs",
283
341
  v2: true,
@@ -315,6 +373,38 @@ export const INDEXER_CONTRACT = {
315
373
  errors: [...GATED, "bad_query"],
316
374
  body: B.CANDLES_MANY,
317
375
  }),
376
+
377
+ mcap: site({
378
+ pattern: "/floor-amm/launches/<launch>/mcap",
379
+ v2: true,
380
+ query: {
381
+ interval: { kind: "enum", doc: "the bucket", values: B.MCAP_INTERVALS, default: "1h" },
382
+ from: { kind: "unix", doc: "first bucket's time, inclusive" },
383
+ to: { kind: "unix", doc: "last bucket's time, inclusive (absent: the indexed head)" },
384
+ limit: LIMIT(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
385
+ before: { kind: "unix", doc: "a page's next: only buckets starting before it" },
386
+ },
387
+ page: cursor(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
388
+ errors: [...LAUNCH_ERR, "bad_query"],
389
+ body: B.MCAP,
390
+ }),
391
+
392
+ held: site({
393
+ pattern: "/floor-amm/launches/<launch>/held",
394
+ v2: true,
395
+ query: {
396
+ wallets: { kind: "list", doc: "the wallets (EVM case-blind)", required: true, min: 1, max: HELD_WALLETS_MAX },
397
+ at: { kind: "list", doc: "the times (unix s) to read; not with the series' keys", max: HELD_AT_MAX },
398
+ interval: { kind: "enum", doc: "the series' bucket", values: B.MCAP_INTERVALS, default: "1h" },
399
+ from: { kind: "unix", doc: "series: first bucket's time, inclusive" },
400
+ to: { kind: "unix", doc: "series: last bucket's time, inclusive (absent: the indexed head)" },
401
+ limit: LIMIT(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
402
+ before: { kind: "unix", doc: "series: a page's next: only buckets starting before it" },
403
+ },
404
+ page: cursor(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
405
+ errors: [...LAUNCH_ERR, "bad_query"],
406
+ body: B.HELD,
407
+ }),
318
408
  candleBundle: site({
319
409
  pattern: "/floor-amm/launches/<launch>/candle-bundle",
320
410
  v2: true,
@@ -352,6 +442,19 @@ export const INDEXER_CONTRACT = {
352
442
 
353
443
  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 }),
354
444
 
445
+ positionTotals: site({
446
+ pattern: "/floor-amm/wallets/<wallet>/position-totals",
447
+ v2: true,
448
+ query: {
449
+ launch: { kind: "string", doc: "only this launch's row (an id or its token)" },
450
+ limit: { kind: "int", doc: "launches a page (without launch)", min: 1, max: POSITION_TOTALS_PAGE_MAX, default: POSITION_TOTALS_PAGE_MAX },
451
+ cursor: { kind: "string", doc: "a page's next (opaque, launch create order)", max: WALLET_CURSOR_MAX, without: ["launch"] },
452
+ },
453
+ page: { kind: "keyset", limit: { default: POSITION_TOTALS_PAGE_MAX, max: POSITION_TOTALS_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true },
454
+ errors: [...WALLET_ERR, "unknown_launch"],
455
+ body: B.POSITION_TOTALS,
456
+ }),
457
+
355
458
  inbox: site({
356
459
  pattern: "/floor-amm/wallets/<wallet>/inbox",
357
460
  v2: true,
@@ -363,9 +466,32 @@ export const INDEXER_CONTRACT = {
363
466
  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 }),
364
467
  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 }),
365
468
  firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
469
+
470
+ walletStats: site({ pattern: "/floor-amm/wallets/<wallet>/stats", v2: true, errors: WALLET_ERR, body: B.WALLET_STATS }),
471
+
472
+ cobuys: site({ pattern: "/floor-amm/wallets/<wallet>/cobuys", query: { limit: LIMIT(COBUYS_PAGE_DEFAULT, COBUYS_PAGE_MAX) }, page: limit(COBUYS_PAGE_DEFAULT, COBUYS_PAGE_MAX), errors: WALLET_ERR, body: B.COBUYS }),
366
473
  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 }),
367
474
  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 }),
368
- 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 }),
475
+
476
+ people: site({
477
+ pattern: "/floor-amm/referrals/<wallet>/people",
478
+ query: { ...WALLET_PAGE_KEYS("opaque, referred wallet order"), person: { kind: "list", doc: "only these referred wallets' rows (distinct; no next)", min: 1, max: PEOPLE_PERSON_MAX, without: ["limit", "cursor"] } },
479
+ page: WALLET_PAGE,
480
+ errors: WALLET_ERR,
481
+ body: B.PEOPLE,
482
+ }),
483
+
484
+ referralLaunches: site({
485
+ pattern: "/floor-amm/referrals/<wallet>/launches",
486
+ query: {
487
+ launch: { kind: "string", doc: "only this launch's row (an id or its token)" },
488
+ limit: { kind: "int", doc: "launches a page", min: 1, max: REFERRAL_LAUNCHES_PAGE_MAX, default: WALLET_PAGE_DEFAULT },
489
+ cursor: { kind: "string", doc: "a page's next (opaque, launch create order)", max: WALLET_CURSOR_MAX, without: ["launch"] },
490
+ },
491
+ page: keyset(WALLET_PAGE_DEFAULT, REFERRAL_LAUNCHES_PAGE_MAX),
492
+ errors: [...WALLET_ERR, "unknown_launch"],
493
+ body: B.REFERRAL_LAUNCHES,
494
+ }),
369
495
  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 }),
370
496
 
371
497
  handlePlaces: site({
@@ -379,6 +505,7 @@ export const INDEXER_CONTRACT = {
379
505
 
380
506
  tokenHolders: partner({
381
507
  pattern: "/floor-amm/holders/<token>",
508
+ quoteUnit: "none",
382
509
  aliases: ["/holders/<token>"],
383
510
  params: ["token"],
384
511
  query: { limit: LIMIT(100, 500), offset: { kind: "int", doc: "rows skipped", min: 0, default: 0 } },
@@ -386,12 +513,13 @@ export const INDEXER_CONTRACT = {
386
513
  errors: [...GATED, "bad_query", "not_found"],
387
514
  body: P.TOKEN_HOLDERS,
388
515
  }),
389
- dexAsset: partner({ pattern: "/v2/dex/asset", aliases: ["/asset"], query: { id: { kind: "string", doc: "a launch's token, or a quote", required: true } }, errors: [...GATED, "bad_query", "not_found", "not_indexed"], body: P.DEX_ASSET }),
390
- dexSummary: partner({ pattern: "/v2/dex/summary", aliases: ["/summary"], query: { id: { kind: "string", doc: "the pair id", required: true } }, errors: [...GATED, "bad_query", "not_found"], body: P.DEX_SUMMARY }),
391
- dexPair: partner({ pattern: "/v2/dex/pair", aliases: ["/pair"], query: { id: { kind: "string", doc: "the pair id", required: true } }, errors: [...GATED, "unknown_launch"], body: P.DEX_PAIR }),
392
- cgPairs: partner({ pattern: "/v2/coingecko/pairs", aliases: ["/coingecko/pairs"], errors: GATED, body: P.CG_PAIRS }),
393
- cgTickers: partner({ pattern: "/v2/coingecko/tickers", aliases: ["/coingecko/tickers"], errors: GATED, body: P.CG_TICKERS }),
516
+ dexAsset: partner({ quoteUnit: PARTNER_QUOTE_UNIT.dexscreener, pattern: "/v2/dex/asset", aliases: ["/asset"], query: { id: { kind: "string", doc: "a launch's token, or a quote", required: true } }, errors: [...GATED, "bad_query", "not_found", "not_indexed"], body: P.DEX_ASSET }),
517
+ dexSummary: partner({ quoteUnit: PARTNER_QUOTE_UNIT.dexscreener, pattern: "/v2/dex/summary", aliases: ["/summary"], query: { id: { kind: "string", doc: "the pair id", required: true } }, errors: [...GATED, "bad_query", "not_found"], body: P.DEX_SUMMARY }),
518
+ dexPair: partner({ quoteUnit: PARTNER_QUOTE_UNIT.dexscreener, pattern: "/v2/dex/pair", aliases: ["/pair"], query: { id: { kind: "string", doc: "the pair id", required: true } }, errors: [...GATED, "unknown_launch"], body: P.DEX_PAIR }),
519
+ cgPairs: partner({ quoteUnit: "none", pattern: "/v2/coingecko/pairs", aliases: ["/coingecko/pairs"], errors: GATED, body: P.CG_PAIRS }),
520
+ cgTickers: partner({ quoteUnit: PARTNER_QUOTE_UNIT.coingecko, pattern: "/v2/coingecko/tickers", aliases: ["/coingecko/tickers"], errors: GATED, body: P.CG_TICKERS }),
394
521
  cgHistoricalTrades: partner({
522
+ quoteUnit: PARTNER_QUOTE_UNIT.coingecko,
395
523
  pattern: "/v2/coingecko/historical_trades",
396
524
  aliases: ["/coingecko/historical_trades", "/historical_trades"],
397
525
  query: {
@@ -407,15 +535,16 @@ export const INDEXER_CONTRACT = {
407
535
  errors: [...GATED, "bad_query", "not_found", "too_many"],
408
536
  body: P.CG_HISTORICAL,
409
537
  }),
410
- llamaTvl: partner({ pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
538
+ llamaTvl: partner({ quoteUnit: PARTNER_QUOTE_UNIT.defillama, pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
411
539
  llamaFees: partner({
540
+ quoteUnit: PARTNER_QUOTE_UNIT.defillama,
412
541
  pattern: "/v2/defillama/fees",
413
542
  query: { from: { kind: "unix", doc: "window start, inclusive (with to)" }, to: { kind: "unix", doc: "window end, exclusive (with from)" } },
414
543
  page: { kind: "range", from: "from", to: "to" },
415
544
  body: P.LLAMA_FEES,
416
545
  }),
417
546
 
418
- health: { pattern: "/health", aliases: [], mount: "root", params: [], query: {}, page: NONE, errors: [], gated: false, units: "site", audience: "ops", body: P.HEALTH },
547
+ health: { pattern: "/health", aliases: [], mount: "root", params: [], query: {}, page: NONE, errors: [], gated: false, units: "site", quoteUnit: "none", audience: "ops", body: P.HEALTH },
419
548
  } as const satisfies Record<string, RouteContract<any>>;
420
549
 
421
550
  export type RouteName = keyof typeof INDEXER_CONTRACT;
@@ -522,6 +651,7 @@ export function queryRefusal(name: RouteName, q: URLSearchParams): string | null
522
651
  }
523
652
  case "list": {
524
653
  const parts = raw.split(",").filter((s) => s !== "");
654
+ if (k.min !== undefined && parts.length < k.min) return `at least ${k.min} ${key}`;
525
655
  if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
526
656
  const it = k.item;
527
657
  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}`;
@@ -562,7 +692,7 @@ const ROWS_PRODUCT: Partial<Record<RouteName, { list: string; max: number }>> =
562
692
  candlesMany: { list: "ids", max: CANDLES_MANY_ROWS_MAX },
563
693
  };
564
694
 
565
- const TABLE_REQUIRED: ReadonlySet<RouteName> = new Set<RouteName>(["search", "launchLists", "candlesMany"]);
695
+ const TABLE_REQUIRED: ReadonlySet<RouteName> = new Set<RouteName>(["search", "launchLists", "candlesMany", "raiseSeries", "launchTraded", "launchTies"]);
566
696
 
567
697
  const BOOLS: Readonly<Record<string, boolean>> = { true: true, false: false, 1: true, 0: false };
568
698
 
@@ -581,7 +711,8 @@ export function queryBool(name: RouteName, q: URLSearchParams, key: string): boo
581
711
  export function spanRefusal(name: RouteName, q: URLSearchParams, toDefault?: number): string | null {
582
712
  const p: Pagination = INDEXER_CONTRACT[name].page;
583
713
  if (p.kind !== "range" || p.span === undefined) return null;
584
- const sec = (B.CANDLE_INTERVAL_SECS as Readonly<Record<string, number>>)[queryArg(name, q, p.span.interval) ?? ""];
714
+ const key = queryArg(name, q, p.span.interval) ?? "";
715
+ const sec = p.span.seconds === true ? (DIGITS.test(key) && Number(key) > 0 ? Number(key) : undefined) : (B.CANDLE_INTERVAL_SECS as Readonly<Record<string, number>>)[key];
585
716
  const fromRaw = q.get(p.from), toRaw = q.get(p.to);
586
717
  if (sec === undefined || fromRaw === null || !DIGITS.test(fromRaw)) return null;
587
718
  const to = toRaw === null ? toDefault : DIGITS.test(toRaw) ? Number(toRaw) : undefined;
@@ -589,5 +720,5 @@ export function spanRefusal(name: RouteName, q: URLSearchParams, toDefault?: num
589
720
  const from = Number(fromRaw);
590
721
  if (from > to) return null;
591
722
  const bucket = (t: number) => Math.floor(t / sec) * sec;
592
- return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} candles` : null;
723
+ return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} ${p.span.seconds === true ? "points" : "candles"}` : null;
593
724
  }
@@ -8,7 +8,7 @@ export interface IndexerRoute {
8
8
  export const INDEXER_ROUTES = {
9
9
  head: { pattern: "/floor-amm/head", keys: [] },
10
10
  latestBlock: { pattern: "/floor-amm/latest-block", keys: [] },
11
- stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
11
+ stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId", "seat", "compress", "refs"] },
12
12
  quotes: { pattern: "/floor-amm/quotes", keys: [] },
13
13
  summary: { pattern: "/floor-amm/summary", keys: [] },
14
14
  floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
@@ -28,11 +28,18 @@ export const INDEXER_ROUTES = {
28
28
  traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
29
29
  quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
30
30
  devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
31
- burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
31
+ burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before", "wallet"] },
32
+ deals: { pattern: "/floor-amm/launches/<launch>/deals", keys: [] },
32
33
  launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
33
34
  marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
34
35
  price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
36
+ raiseSeries: { pattern: "/floor-amm/launches/<launch>/raise-series", keys: ["step", "from", "to"] },
37
+ floorSteps: { pattern: "/floor-amm/launches/<launch>/floor-steps", keys: ["from", "to", "points"] },
38
+ launchTraded: { pattern: "/floor-amm/launches/<launch>/traded", keys: ["wallets"] },
39
+ launchTies: { pattern: "/floor-amm/launches/<launch>/ties", keys: ["wallets", "at", "from", "to"] },
35
40
  highs: { pattern: "/floor-amm/launches/<launch>/highs", keys: ["atLeast", "limit"] },
41
+ mcap: { pattern: "/floor-amm/launches/<launch>/mcap", keys: ["interval", "from", "to", "limit", "before"] },
42
+ held: { pattern: "/floor-amm/launches/<launch>/held", keys: ["wallets", "at", "interval", "from", "to", "limit", "before"] },
36
43
  candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
37
44
  candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
38
45
  candlesMany: { pattern: "/floor-amm/candles/many", keys: ["ids", "interval", "before", "limit"] },
@@ -40,13 +47,17 @@ export const INDEXER_ROUTES = {
40
47
  tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
41
48
  tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
42
49
  positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
50
+ positionTotals: { pattern: "/floor-amm/wallets/<wallet>/position-totals", keys: ["launch", "limit", "cursor"] },
43
51
  inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
44
52
  walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
45
53
  claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
46
54
  firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
55
+ walletStats: { pattern: "/floor-amm/wallets/<wallet>/stats", keys: [] },
56
+ cobuys: { pattern: "/floor-amm/wallets/<wallet>/cobuys", keys: ["limit"] },
47
57
  firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
48
58
  claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
49
- people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
59
+ people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor", "person"] },
60
+ referralLaunches: { pattern: "/floor-amm/referrals/<wallet>/launches", keys: ["launch", "limit", "cursor"] },
50
61
  roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
51
62
  handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
52
63
  traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
@@ -55,7 +66,7 @@ export const INDEXER_ROUTES = {
55
66
 
56
67
  export type IndexerRouteName = keyof typeof INDEXER_ROUTES;
57
68
 
58
- 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"] as const;
69
+ export const LAUNCH_SORTS = ["created", "newest", "volume1h", "volume24h", "volume7d", "volume", "marketCap", "liquidity", "backed", "trades24h", "holders", "change1h", "change24h", "lastTrade", "nearFloor", "trending", "holdersChange24h", "standingVolume", "standingMarketCap", "standingBacked", "maxloss"] as const;
59
70
  export type LaunchSort = (typeof LAUNCH_SORTS)[number];
60
71
 
61
72
  export const IDS_MAX = 100;
@@ -86,8 +97,33 @@ export const PRESET_FILTER_MAX = 16;
86
97
 
87
98
  export const FIRSTS_MAX = 100;
88
99
 
100
+ export const TRADED_WALLETS_MAX = 100;
101
+
102
+ export const POSITION_TOTALS_PAGE_MAX = 100;
103
+
104
+ export const HELD_WALLETS_MAX = 100;
105
+ export const HELD_AT_MAX = 200;
106
+
89
107
  export const STREAM_STATE_MAX = 16;
90
108
 
109
+ export const PEOPLE_PERSON_MAX = 8;
110
+
111
+ export const TIES_WALLETS_MAX = 100;
112
+
113
+ export const REFERRAL_LAUNCHES_PAGE_MAX = 100;
114
+
115
+ export const TIES_WINDOW_S = 7 * 86_400;
116
+
117
+ export const TIES_ACTIVE_S = 30 * 86_400;
118
+
119
+ export const TIES_HOLD_DAYS = [7, 30] as const;
120
+
121
+ export const COBUY_WINDOW_S = 600;
122
+ export const COBUY_MIN_LAUNCHES = 3;
123
+
124
+ export const COBUYS_PAGE_DEFAULT = 100;
125
+ export const COBUYS_PAGE_MAX = 500;
126
+
91
127
  type QueryValue = string | number | boolean | readonly string[] | undefined | null;
92
128
 
93
129
  export function query(q: Record<string, QueryValue>): string {
@@ -175,6 +211,10 @@ export interface WalletPage {
175
211
  cursor?: string;
176
212
  }
177
213
 
214
+ export interface PeopleQuery extends WalletPage {
215
+ person?: readonly string[];
216
+ }
217
+
178
218
  export interface Page {
179
219
  limit?: number;
180
220
 
@@ -203,6 +243,55 @@ export interface CandlesQuery {
203
243
  limit?: number;
204
244
  }
205
245
 
246
+ export interface RaiseSeriesQuery {
247
+ step: number;
248
+ from?: number;
249
+ to?: number;
250
+ }
251
+
252
+ export interface PositionTotalsQuery {
253
+ launch?: string;
254
+ limit?: number;
255
+ cursor?: string;
256
+ }
257
+
258
+ export interface LaunchTiesQuery {
259
+ wallets: readonly string[];
260
+ at: number;
261
+ from?: number;
262
+ to?: number;
263
+ }
264
+
265
+ export interface ReferralLaunchesQuery {
266
+ launch?: string;
267
+ limit?: number;
268
+ cursor?: string;
269
+ }
270
+
271
+ export interface FloorStepsQuery {
272
+ from?: number;
273
+ to?: number;
274
+ points?: number;
275
+ }
276
+
277
+ export interface McapQuery {
278
+ interval?: "1h" | "1d";
279
+ from?: number;
280
+ to?: number;
281
+ limit?: number;
282
+ before?: number;
283
+ }
284
+
285
+ export interface HeldQuery {
286
+ wallets: readonly string[];
287
+ at?: readonly number[];
288
+ interval?: "1h" | "1d";
289
+ from?: number;
290
+ to?: number;
291
+ limit?: number;
292
+ before?: number;
293
+ }
294
+
206
295
  export interface StreamQuery {
207
296
 
208
297
  launch?: readonly string[];
@@ -210,6 +299,12 @@ export interface StreamQuery {
210
299
  state?: readonly string[];
211
300
 
212
301
  lastEventId?: string;
302
+
303
+ seat?: "relay";
304
+
305
+ compress?: boolean;
306
+
307
+ refs?: boolean;
213
308
  }
214
309
 
215
310
  export const indexerPath = {
@@ -217,7 +312,7 @@ export const indexerPath = {
217
312
  latestBlock: (): string => "/floor-amm/latest-block",
218
313
  stream: (q: StreamQuery = {}): string => {
219
314
  if ((q.state?.length ?? 0) > STREAM_STATE_MAX) throw new RangeError(`at most ${STREAM_STATE_MAX} state ids`);
220
- return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId })}`;
315
+ return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId, seat: q.seat, compress: q.compress === true ? 1 : undefined, refs: q.refs === true ? 1 : undefined })}`;
221
316
  },
222
317
  quotes: (): string => "/floor-amm/quotes",
223
318
  summary: (): string => "/floor-amm/summary",
@@ -254,14 +349,37 @@ export const indexerPath = {
254
349
  traders: (id: string, q: { window?: "1h" | "24h" | "7d" | "all"; limit?: number } = {}): string => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
255
350
  quoteChain: (id: string): string => launchPath(id, "/chain"),
256
351
  devTrades: (id: string, q: { limit?: number } = {}): string => launchPath(id, `/dev${query({ limit: q.limit })}`),
257
- burns: (id: string, q: Page = {}): string => launchPath(id, `/burns${query({ limit: q.limit, before: q.before })}`),
352
+
353
+ burns: (id: string, q: Page & { wallet?: string } = {}): string => launchPath(id, `/burns${query({ limit: q.limit, before: q.before, wallet: q.wallet })}`),
354
+ deals: (id: string): string => launchPath(id, "/deals"),
258
355
  launchLocks: (id: string): string => launchPath(id, "/locks"),
259
356
  marks: (id: string, q: Page = {}): string => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
260
357
  price: (id: string): string => launchPath(id, "/price"),
358
+ raiseSeries: (id: string, q: RaiseSeriesQuery): string => launchPath(id, `/raise-series${query({ step: q.step, from: q.from, to: q.to })}`),
359
+ floorSteps: (id: string, q: FloorStepsQuery = {}): string => launchPath(id, `/floor-steps${query({ from: q.from, to: q.to, points: q.points })}`),
360
+
361
+ launchTraded: (id: string, wallets: readonly string[]): string => {
362
+ if (wallets.length === 0 || wallets.length > TRADED_WALLETS_MAX) throw new RangeError(`1..${TRADED_WALLETS_MAX} wallets`);
363
+ return launchPath(id, `/traded${query({ wallets })}`);
364
+ },
365
+
366
+ launchTies: (id: string, q: LaunchTiesQuery): string => {
367
+ if (q.wallets.length === 0 || q.wallets.length > TIES_WALLETS_MAX) throw new RangeError(`1..${TIES_WALLETS_MAX} wallets`);
368
+ if (q.from !== undefined && q.to !== undefined && q.from > q.to) throw new RangeError("from > to");
369
+ return launchPath(id, `/ties${query({ wallets: q.wallets, at: q.at, from: q.from, to: q.to })}`);
370
+ },
261
371
 
262
372
  highs: (id: string, q: { atLeast?: bigint | string; limit?: number } = {}): string => launchPath(id, `/highs${query({ atLeast: q.atLeast === undefined ? undefined : String(q.atLeast), limit: q.limit })}`),
263
373
 
264
374
  candleBundle: (id: string, q: { intervals?: readonly string[]; limit?: number } = {}): string => launchPath(id, `/candle-bundle${query({ intervals: q.intervals?.length ? q.intervals : undefined, limit: q.limit })}`),
375
+ mcap: (id: string, q: McapQuery = {}): string => launchPath(id, `/mcap${query({ interval: q.interval, from: q.from, to: q.to, limit: q.limit, before: q.before })}`),
376
+ held: (id: string, q: HeldQuery): string => {
377
+ if (q.wallets.length === 0 || q.wallets.length > HELD_WALLETS_MAX) throw new RangeError(`1..${HELD_WALLETS_MAX} wallets`);
378
+ if (q.at !== undefined) {
379
+ if (q.at.length === 0 || q.at.length > HELD_AT_MAX) throw new RangeError(`1..${HELD_AT_MAX} times`);
380
+ }
381
+ return launchPath(id, `/held${query({ wallets: q.wallets.join(","), at: q.at?.join(","), interval: q.interval, from: q.from, to: q.to, limit: q.limit, before: q.before })}`);
382
+ },
265
383
  candles: (q: CandlesQuery): string => {
266
384
  if (q.before !== undefined && (q.from !== undefined || q.to !== undefined)) throw new RangeError("before cannot be given with from / to");
267
385
  if (q.limit !== undefined && q.before === undefined) throw new RangeError("limit is read only with before");
@@ -277,19 +395,33 @@ export const indexerPath = {
277
395
  tonOutcome: (w: string, queryId: bigint | string): string => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
278
396
 
279
397
  positions: (w: string, q: WalletPage = {}): string => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
398
+ positionTotals: (w: string, q: PositionTotalsQuery = {}): string => walletPath(w, `/position-totals${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`),
280
399
 
281
400
  inbox: (w: string, q: { limit?: number; before?: string } = {}): string => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
282
401
  walletLocks: (w: string, q: WalletPage = {}): string => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
283
402
 
284
403
  claimHistory: (w: string, q: WalletPage = {}): string => walletPath(w, `/claims${query({ limit: q.limit, cursor: q.cursor })}`),
285
404
  firsts: (w: string): string => walletPath(w, "/firsts"),
405
+ walletStats: (w: string): string => walletPath(w, "/stats"),
406
+
407
+ cobuys: (w: string, q: { limit?: number } = {}): string => walletPath(w, `/cobuys${query({ limit: q.limit })}`),
286
408
  firstsMany: (wallets: readonly string[]): string => {
287
409
  if (wallets.length === 0 || wallets.length > FIRSTS_MAX) throw new RangeError(`1..${FIRSTS_MAX} wallets`);
288
410
  return `/floor-amm/wallets/firsts${query({ wallets })}`;
289
411
  },
290
412
  claimView: (w: string, q: WalletPage = {}): string => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
291
413
 
292
- people: (w: string, q: WalletPage = {}): string => `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor })}`,
414
+ people: (w: string, q: PeopleQuery = {}): string => {
415
+ if (q.person !== undefined) {
416
+
417
+ const canon = q.person.map((w) => (/^0x[0-9a-fA-F]{40}$/.test(w) ? w.toLowerCase() : w));
418
+ if (q.person.length < 1 || q.person.length > PEOPLE_PERSON_MAX || new Set(canon).size !== canon.length) throw new RangeError(`1..${PEOPLE_PERSON_MAX} distinct person wallets`);
419
+ if (q.limit !== undefined || q.cursor !== undefined) throw new RangeError("person cannot be given with limit / cursor");
420
+ }
421
+ return `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor, person: q.person })}`;
422
+ },
423
+
424
+ referralLaunches: (w: string, q: ReferralLaunchesQuery = {}): string => `/floor-amm/referrals/${seg(w)}/launches${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`,
293
425
 
294
426
  roles: (w: string, q: WalletPage = {}): string => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
295
427
  handlePlaces: (handle: string, q: WalletPage = {}): string => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
@@ -6,12 +6,12 @@ import * as B from "./bodies.ts";
6
6
  import { indexerPath } from "./paths.ts";
7
7
  import { errorCode } from "./contract.ts";
8
8
  import type { IndexerErrorCode } from "./contract.ts";
9
- import type { CandlesManyQuery, CandlesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, TradesQuery, WalletPage, WalletTradesQuery } from "./paths.ts";
9
+ import type { CandlesManyQuery, CandlesQuery, FloorStepsQuery, LaunchTiesQuery, PositionTotalsQuery, RaiseSeriesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, PeopleQuery, ReferralLaunchesQuery, TradesQuery, WalletPage, WalletTradesQuery, HeldQuery, McapQuery } from "./paths.ts";
10
10
 
11
11
  export * from "./bodies.ts";
12
12
  export { ShapeError, decode } from "./decode.ts";
13
13
  export type { Decoder, Infer } from "./decode.ts";
14
- 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.ts";
14
+ export { COBUY_MIN_LAUNCHES, COBUY_WINDOW_S, COBUYS_PAGE_DEFAULT, COBUYS_PAGE_MAX, FIRSTS_MAX, POSITION_TOTALS_PAGE_MAX, TIES_ACTIVE_S, TIES_HOLD_DAYS, TIES_WALLETS_MAX, TIES_WINDOW_S, TRADED_WALLETS_MAX, IDS_MAX, INDEXER_ROUTES, LAUNCHES_PAGE_DEFAULT, LAUNCHES_PAGE_MAX, LAUNCH_CURSOR_MAX, LAUNCH_SORTS, PEOPLE_PERSON_MAX, PRESET_FILTER_MAX, REFERRAL_LAUNCHES_PAGE_MAX, STREAM_STATE_MAX, INBOX_PAGE_DEFAULT, INBOX_PAGE_MAX, WALLET_CURSOR_MAX, WALLET_PAGE_DEFAULT, WALLET_PAGE_MAX, indexerPath, query } from "./paths.ts";
15
15
  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.ts";
16
16
  export type { SearchSubject, SearchTier } from "./search.ts";
17
17
  export * from "./partners.ts";
@@ -20,7 +20,7 @@ export { INDEXER_CONTRACT, INDEXER_ERROR_CODES, LIMITS, OPEN_ROUTES, ROUTE_NAMES
20
20
  export type { IndexerErrorCode, Pagination, PathParam, QueryKey, RouteBody, RouteContract, RouteName, Served, ServedBody, ServedKeys, Units } from "./contract.ts";
21
21
  export { DRAIN_NAMES, createIndexerClient, routePath } from "./client.ts";
22
22
  export type { DrainName, IndexerClient, IndexerClientOptions, ReadName, RouteArgs } from "./client.ts";
23
- export type { CandlesManyQuery, CandlesQuery, LaunchListsQuery, IndexerRoute, IndexerRouteName, LaunchSearchQuery, LaunchSort, LaunchesQuery, Page, StreamQuery, TradesQuery, WalletPage, WalletTradesQuery } from "./paths.ts";
23
+ export type { CandlesManyQuery, CandlesQuery, FloorStepsQuery, LaunchTiesQuery, PositionTotalsQuery, RaiseSeriesQuery, LaunchListsQuery, IndexerRoute, IndexerRouteName, LaunchSearchQuery, LaunchSort, LaunchesQuery, Page, PeopleQuery, ReferralLaunchesQuery, StreamQuery, TradesQuery, WalletPage, WalletTradesQuery } from "./paths.ts";
24
24
 
25
25
  export type LaunchId = string;
26
26
 
@@ -97,16 +97,33 @@ export const readTraders = (get: Get, id: LaunchId, q: { window?: B.TraderWindow
97
97
  export const readQuoteChain = (get: Get, id: LaunchId): Promise<B.QuoteChain> => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
98
98
 
99
99
  export const readDevTrades = (get: Get, id: LaunchId, q: { limit?: number } = {}): Promise<B.DevTrades> => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
100
- export const readBurns = (get: Get, id: LaunchId, q: Page = {}): Promise<B.Burns> => readRoute(get, indexerPath.burns(id, q), B.BURNS);
100
+
101
+ export const readBurns = (get: Get, id: LaunchId, q: Page & { wallet?: string } = {}): Promise<B.Burns> => readRoute(get, indexerPath.burns(id, q), B.BURNS);
102
+
103
+ export const readDeals = (get: Get, id: LaunchId): Promise<B.Deals> => readRoute(get, indexerPath.deals(id), B.DEALS);
101
104
  export const readLaunchLocks = (get: Get, id: LaunchId): Promise<B.LaunchLocks> => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
102
105
 
103
106
  export const readMarks = (get: Get, id: LaunchId, q: Page = {}): Promise<B.Marks> => readRoute(get, indexerPath.marks(id, q), B.MARKS);
104
107
  export const readPrice = (get: Get, id: LaunchId): Promise<B.Price> => readRoute(get, indexerPath.price(id), B.PRICE);
105
108
 
109
+ export const readRaiseSeries = (get: Get, id: LaunchId, q: RaiseSeriesQuery): Promise<B.RaiseSeries> => readRoute(get, indexerPath.raiseSeries(id, q), B.RAISE_SERIES);
110
+
111
+ export const readFloorSteps = (get: Get, id: LaunchId, q: FloorStepsQuery = {}): Promise<B.FloorSteps> => readRoute(get, indexerPath.floorSteps(id, q), B.FLOOR_STEPS);
112
+
113
+ export const readLaunchTraded = (get: Get, id: LaunchId, wallets: readonly string[]): Promise<B.LaunchTraded> => readRoute(get, indexerPath.launchTraded(id, wallets), B.LAUNCH_TRADED);
114
+
115
+ export const readLaunchTies = (get: Get, id: LaunchId, q: LaunchTiesQuery): Promise<B.LaunchTies> => readRoute(get, indexerPath.launchTies(id, q), B.LAUNCH_TIES);
116
+
117
+ export const readPositionTotals = (get: Get, wallet: string, q: PositionTotalsQuery = {}): Promise<B.PositionTotals> => readRoute(get, indexerPath.positionTotals(wallet, q), B.POSITION_TOTALS);
118
+
106
119
  export const readCandles = (get: Get, q: CandlesQuery): Promise<B.Candles> => readRoute(get, indexerPath.candles(q), B.CANDLES);
107
120
 
108
121
  export const readCandlesMany = (get: Get, q: CandlesManyQuery): Promise<B.CandlesMany> => readRoute(get, indexerPath.candlesMany(q), B.CANDLES_MANY);
109
122
  export const readCandleBundle = (get: Get, id: LaunchId, q: { intervals?: readonly string[]; limit?: number } = {}): Promise<B.CandleBundle> => readRoute(get, indexerPath.candleBundle(id, q), B.CANDLE_BUNDLE);
123
+
124
+ export const readMcap = (get: Get, id: LaunchId, q: McapQuery = {}): Promise<B.Mcap> => readRoute(get, indexerPath.mcap(id, q), B.MCAP);
125
+
126
+ export const readHeld = (get: Get, id: LaunchId, q: HeldQuery): Promise<B.Held> => readRoute(get, indexerPath.held(id, q), B.HELD);
110
127
  export const readHighs = (get: Get, id: LaunchId, q: { atLeast?: bigint | string; limit?: number } = {}): Promise<B.Highs> => readRoute(get, indexerPath.highs(id, q), B.HIGHS);
111
128
 
112
129
  export const readWalletTrades = (get: Get, wallet: string, q: WalletTradesQuery = {}): Promise<B.WalletTrades> => readRoute(get, indexerPath.walletTrades(wallet, q), B.WALLET_TRADES);
@@ -120,9 +137,14 @@ export const readClaimHistory = (get: Get, wallet: string, q: WalletPage = {}):
120
137
 
121
138
  export const readClaimView = (get: Get, wallet: string, q: WalletPage = {}): Promise<B.ClaimView> => readRoute(get, indexerPath.claimView(wallet, q), B.CLAIM_VIEW);
122
139
  export const readFirsts = (get: Get, wallet: string): Promise<At & { wallet: string } & B.Firsts> => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
140
+ export const readWalletStats = (get: Get, wallet: string): Promise<B.WalletStats> => readRoute(get, indexerPath.walletStats(wallet), B.WALLET_STATS);
141
+
142
+ export const readCobuys = (get: Get, wallet: string, q: { limit?: number } = {}): Promise<B.Cobuys> => readRoute(get, indexerPath.cobuys(wallet, q), B.COBUYS);
123
143
 
124
144
  export const readFirstsMany = (get: Get, wallets: readonly string[]): Promise<At & { wallets: Record<string, B.Firsts> }> => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
125
- export const readPeople = (get: Get, wallet: string, q: WalletPage = {}): Promise<B.People> => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
145
+ export const readPeople = (get: Get, wallet: string, q: PeopleQuery = {}): Promise<B.People> => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
146
+
147
+ export const readReferralLaunches = (get: Get, wallet: string, q: ReferralLaunchesQuery = {}): Promise<B.ReferralLaunches> => readRoute(get, indexerPath.referralLaunches(wallet, q), B.REFERRAL_LAUNCHES);
126
148
  export const readRoles = (get: Get, wallet: string, q: WalletPage = {}): Promise<B.Roles> => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
127
149
 
128
150
  export const readHandlePlaces = (get: Get, handle: string, q: WalletPage = {}): Promise<B.HandlePlaces> => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);