@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
@@ -3,8 +3,9 @@
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 { 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.js";
6
+ 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.js";
7
7
  import { SEARCH_PAGE_DEFAULT, SEARCH_PAGE_MAX, SEARCH_Q_MAX } from "./search.js";
8
+ import { PARTNER_QUOTE_UNIT } from "../scaledUi.js";
8
9
 
9
10
  export const UNITS = {
10
11
  site: "raw quote base units, token math units (6 dp), Q64.64 prices, unix s; bigint as decimal strings; USD as decimal strings",
@@ -84,9 +85,10 @@ function site (s ) {
84
85
  const params = [...s.pattern.matchAll(/<(launch|wallet|token|handle)>/g)].map((m) => m[1] );
85
86
  const { v2, ...rest } = s;
86
87
  const aliases = s.aliases ?? (v2 ? [s.pattern.replace(/^\/floor-amm\//, "/floor-amm/v2/")] : []);
87
- return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", audience: "site", ...rest, params, aliases };
88
+ return { mount: "chain", query: {}, page: NONE, errors: GATED, gated: true, units: "site", quoteUnit: "raw", audience: "site", ...rest, params, aliases };
88
89
  }
89
- function partner (s ) {
90
+
91
+ function partner (s ) {
90
92
  return { mount: "chain", params: [], query: {}, page: NONE, errors: [...GATED, "bad_query"], gated: true, units: "partner", audience: "partner", aliases: [], ...s };
91
93
  }
92
94
 
@@ -102,6 +104,9 @@ export const INDEXER_CONTRACT = {
102
104
  launch: { kind: "list", doc: "only these launches' frames (and their quote chains' relatives)" },
103
105
  state: { kind: "list", doc: "state frames (the launch whole on each change) for these", max: STREAM_STATE_MAX },
104
106
  lastEventId: { kind: "string", doc: "resume after this frame id (EventSource sends Last-Event-ID itself)" },
107
+ seat: { kind: "enum", doc: "relay: the site relay's seat (pipes are refused first)", values: ["relay"] },
108
+ compress: { kind: "bool", doc: "1: compress the stream (zstd, br or gzip as Accept-Encoding allows; relay seats by default)" },
109
+ refs: { kind: "bool", doc: "1: the trade frames carry `refs` (who a trade credited) when a referrer was credited" },
105
110
  },
106
111
  body: unknown,
107
112
  }),
@@ -204,7 +209,9 @@ export const INDEXER_CONTRACT = {
204
209
  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 }),
205
210
  quoteChain: site({ pattern: "/floor-amm/launches/<launch>/chain", v2: true, errors: LAUNCH_ERR, body: B.QUOTE_CHAIN }),
206
211
  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 }),
207
- 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 }),
212
+
213
+ 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 }),
214
+ deals: site({ pattern: "/floor-amm/launches/<launch>/deals", v2: true, errors: LAUNCH_ERR, body: B.DEALS }),
208
215
  launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
209
216
  marks: site({
210
217
  pattern: "/floor-amm/launches/<launch>/marks",
@@ -215,6 +222,52 @@ export const INDEXER_CONTRACT = {
215
222
  body: B.MARKS,
216
223
  }),
217
224
  price: site({ pattern: "/floor-amm/launches/<launch>/price", v2: true, errors: LAUNCH_ERR, body: B.PRICE }),
225
+
226
+ raiseSeries: site({
227
+ pattern: "/floor-amm/launches/<launch>/raise-series",
228
+ v2: true,
229
+ query: {
230
+ step: { kind: "enum", doc: "the grid in seconds", values: B.RAISE_STEPS.map(String), required: true },
231
+ from: { kind: "unix", doc: "the grid's left edge (absent: the launch's open)" },
232
+ to: { kind: "unix", doc: "the right edge (absent: the indexed head's time; never before the last fill)" },
233
+ },
234
+ page: { kind: "range", from: "from", to: "to", span: { interval: "step", max: B.RT_POINTS_MAX, seconds: true } },
235
+ errors: [...LAUNCH_ERR, "bad_query"],
236
+ body: B.RAISE_SERIES,
237
+ }),
238
+ floorSteps: site({
239
+ pattern: "/floor-amm/launches/<launch>/floor-steps",
240
+ v2: true,
241
+ query: {
242
+ from: { kind: "unix", doc: "the window's start (absent: the graduation, else the open)" },
243
+ to: { kind: "unix", doc: "the slices' right edge (absent: the indexed head's time; never before the last step)" },
244
+ 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 },
245
+ },
246
+ page: { kind: "range", from: "from", to: "to" },
247
+ errors: [...LAUNCH_ERR, "bad_query"],
248
+ body: B.FLOOR_STEPS,
249
+ }),
250
+
251
+ launchTraded: site({
252
+ pattern: "/floor-amm/launches/<launch>/traded",
253
+ v2: true,
254
+ query: { wallets: { kind: "list", doc: "the wallets asked, answered in this order", required: true, min: 1, max: TRADED_WALLETS_MAX } },
255
+ errors: [...LAUNCH_ERR, "bad_query"],
256
+ body: B.LAUNCH_TRADED,
257
+ }),
258
+
259
+ launchTies: site({
260
+ pattern: "/floor-amm/launches/<launch>/ties",
261
+ v2: true,
262
+ query: {
263
+ wallets: { kind: "list", doc: "the wallets asked, answered in this order", required: true, min: 1, max: TIES_WALLETS_MAX },
264
+ at: { kind: "unix", doc: "the second the ties are read around (a person's first buy, or a deal's Accept)", required: true },
265
+ from: { kind: "unix", doc: "the window's start (absent: at − 7 d)" },
266
+ to: { kind: "unix", doc: "the window's end, inclusive (absent: at + 7 d)" },
267
+ },
268
+ errors: [...LAUNCH_ERR, "bad_query"],
269
+ body: B.LAUNCH_TIES,
270
+ }),
218
271
  highs: site({
219
272
  pattern: "/floor-amm/launches/<launch>/highs",
220
273
  v2: true,
@@ -252,6 +305,38 @@ export const INDEXER_CONTRACT = {
252
305
  errors: [...GATED, "bad_query"],
253
306
  body: B.CANDLES_MANY,
254
307
  }),
308
+
309
+ mcap: site({
310
+ pattern: "/floor-amm/launches/<launch>/mcap",
311
+ v2: true,
312
+ query: {
313
+ interval: { kind: "enum", doc: "the bucket", values: B.MCAP_INTERVALS, default: "1h" },
314
+ from: { kind: "unix", doc: "first bucket's time, inclusive" },
315
+ to: { kind: "unix", doc: "last bucket's time, inclusive (absent: the indexed head)" },
316
+ limit: LIMIT(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
317
+ before: { kind: "unix", doc: "a page's next: only buckets starting before it" },
318
+ },
319
+ page: cursor(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
320
+ errors: [...LAUNCH_ERR, "bad_query"],
321
+ body: B.MCAP,
322
+ }),
323
+
324
+ held: site({
325
+ pattern: "/floor-amm/launches/<launch>/held",
326
+ v2: true,
327
+ query: {
328
+ wallets: { kind: "list", doc: "the wallets (EVM case-blind)", required: true, min: 1, max: HELD_WALLETS_MAX },
329
+ at: { kind: "list", doc: "the times (unix s) to read; not with the series' keys", max: HELD_AT_MAX },
330
+ interval: { kind: "enum", doc: "the series' bucket", values: B.MCAP_INTERVALS, default: "1h" },
331
+ from: { kind: "unix", doc: "series: first bucket's time, inclusive" },
332
+ to: { kind: "unix", doc: "series: last bucket's time, inclusive (absent: the indexed head)" },
333
+ limit: LIMIT(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
334
+ before: { kind: "unix", doc: "series: a page's next: only buckets starting before it" },
335
+ },
336
+ page: cursor(B.MCAP_PAGE_MAX, B.MCAP_PAGE_MAX),
337
+ errors: [...LAUNCH_ERR, "bad_query"],
338
+ body: B.HELD,
339
+ }),
255
340
  candleBundle: site({
256
341
  pattern: "/floor-amm/launches/<launch>/candle-bundle",
257
342
  v2: true,
@@ -289,6 +374,19 @@ export const INDEXER_CONTRACT = {
289
374
 
290
375
  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 }),
291
376
 
377
+ positionTotals: site({
378
+ pattern: "/floor-amm/wallets/<wallet>/position-totals",
379
+ v2: true,
380
+ query: {
381
+ launch: { kind: "string", doc: "only this launch's row (an id or its token)" },
382
+ limit: { kind: "int", doc: "launches a page (without launch)", min: 1, max: POSITION_TOTALS_PAGE_MAX, default: POSITION_TOTALS_PAGE_MAX },
383
+ cursor: { kind: "string", doc: "a page's next (opaque, launch create order)", max: WALLET_CURSOR_MAX, without: ["launch"] },
384
+ },
385
+ page: { kind: "keyset", limit: { default: POSITION_TOTALS_PAGE_MAX, max: POSITION_TOTALS_PAGE_MAX }, cursor: "cursor", next: "next", optIn: true },
386
+ errors: [...WALLET_ERR, "unknown_launch"],
387
+ body: B.POSITION_TOTALS,
388
+ }),
389
+
292
390
  inbox: site({
293
391
  pattern: "/floor-amm/wallets/<wallet>/inbox",
294
392
  v2: true,
@@ -300,9 +398,32 @@ export const INDEXER_CONTRACT = {
300
398
  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 }),
301
399
  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 }),
302
400
  firsts: site({ pattern: "/floor-amm/wallets/<wallet>/firsts", errors: WALLET_ERR, body: B.FIRSTS }),
401
+
402
+ walletStats: site({ pattern: "/floor-amm/wallets/<wallet>/stats", v2: true, errors: WALLET_ERR, body: B.WALLET_STATS }),
403
+
404
+ 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 }),
303
405
  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 }),
304
406
  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 }),
305
- 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 }),
407
+
408
+ people: site({
409
+ pattern: "/floor-amm/referrals/<wallet>/people",
410
+ 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"] } },
411
+ page: WALLET_PAGE,
412
+ errors: WALLET_ERR,
413
+ body: B.PEOPLE,
414
+ }),
415
+
416
+ referralLaunches: site({
417
+ pattern: "/floor-amm/referrals/<wallet>/launches",
418
+ query: {
419
+ launch: { kind: "string", doc: "only this launch's row (an id or its token)" },
420
+ limit: { kind: "int", doc: "launches a page", min: 1, max: REFERRAL_LAUNCHES_PAGE_MAX, default: WALLET_PAGE_DEFAULT },
421
+ cursor: { kind: "string", doc: "a page's next (opaque, launch create order)", max: WALLET_CURSOR_MAX, without: ["launch"] },
422
+ },
423
+ page: keyset(WALLET_PAGE_DEFAULT, REFERRAL_LAUNCHES_PAGE_MAX),
424
+ errors: [...WALLET_ERR, "unknown_launch"],
425
+ body: B.REFERRAL_LAUNCHES,
426
+ }),
306
427
  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 }),
307
428
 
308
429
  handlePlaces: site({
@@ -316,6 +437,7 @@ export const INDEXER_CONTRACT = {
316
437
 
317
438
  tokenHolders: partner({
318
439
  pattern: "/floor-amm/holders/<token>",
440
+ quoteUnit: "none",
319
441
  aliases: ["/holders/<token>"],
320
442
  params: ["token"],
321
443
  query: { limit: LIMIT(100, 500), offset: { kind: "int", doc: "rows skipped", min: 0, default: 0 } },
@@ -323,12 +445,13 @@ export const INDEXER_CONTRACT = {
323
445
  errors: [...GATED, "bad_query", "not_found"],
324
446
  body: P.TOKEN_HOLDERS,
325
447
  }),
326
- 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 }),
327
- 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 }),
328
- 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 }),
329
- cgPairs: partner({ pattern: "/v2/coingecko/pairs", aliases: ["/coingecko/pairs"], errors: GATED, body: P.CG_PAIRS }),
330
- cgTickers: partner({ pattern: "/v2/coingecko/tickers", aliases: ["/coingecko/tickers"], errors: GATED, body: P.CG_TICKERS }),
448
+ 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 }),
449
+ 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 }),
450
+ 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 }),
451
+ cgPairs: partner({ quoteUnit: "none", pattern: "/v2/coingecko/pairs", aliases: ["/coingecko/pairs"], errors: GATED, body: P.CG_PAIRS }),
452
+ cgTickers: partner({ quoteUnit: PARTNER_QUOTE_UNIT.coingecko, pattern: "/v2/coingecko/tickers", aliases: ["/coingecko/tickers"], errors: GATED, body: P.CG_TICKERS }),
331
453
  cgHistoricalTrades: partner({
454
+ quoteUnit: PARTNER_QUOTE_UNIT.coingecko,
332
455
  pattern: "/v2/coingecko/historical_trades",
333
456
  aliases: ["/coingecko/historical_trades", "/historical_trades"],
334
457
  query: {
@@ -344,15 +467,16 @@ export const INDEXER_CONTRACT = {
344
467
  errors: [...GATED, "bad_query", "not_found", "too_many"],
345
468
  body: P.CG_HISTORICAL,
346
469
  }),
347
- llamaTvl: partner({ pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
470
+ llamaTvl: partner({ quoteUnit: PARTNER_QUOTE_UNIT.defillama, pattern: "/v2/defillama/tvl", errors: GATED, body: P.LLAMA_TVL }),
348
471
  llamaFees: partner({
472
+ quoteUnit: PARTNER_QUOTE_UNIT.defillama,
349
473
  pattern: "/v2/defillama/fees",
350
474
  query: { from: { kind: "unix", doc: "window start, inclusive (with to)" }, to: { kind: "unix", doc: "window end, exclusive (with from)" } },
351
475
  page: { kind: "range", from: "from", to: "to" },
352
476
  body: P.LLAMA_FEES,
353
477
  }),
354
478
 
355
- health: { pattern: "/health", aliases: [], mount: "root", params: [], query: {}, page: NONE, errors: [], gated: false, units: "site", audience: "ops", body: P.HEALTH },
479
+ health: { pattern: "/health", aliases: [], mount: "root", params: [], query: {}, page: NONE, errors: [], gated: false, units: "site", quoteUnit: "none", audience: "ops", body: P.HEALTH },
356
480
  } ;
357
481
 
358
482
  export const ROUTE_NAMES = Object.keys(INDEXER_CONTRACT) ;
@@ -443,6 +567,7 @@ export function queryRefusal(name , q )
443
567
  }
444
568
  case "list": {
445
569
  const parts = raw.split(",").filter((s) => s !== "");
570
+ if (k.min !== undefined && parts.length < k.min) return `at least ${k.min} ${key}`;
446
571
  if (k.max !== undefined && parts.length > k.max) return `at most ${k.max} ${key}`;
447
572
  const it = k.item;
448
573
  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}`;
@@ -483,7 +608,7 @@ const ROWS_PRODUCT =
483
608
  candlesMany: { list: "ids", max: CANDLES_MANY_ROWS_MAX },
484
609
  };
485
610
 
486
- const TABLE_REQUIRED = new Set (["search", "launchLists", "candlesMany"]);
611
+ const TABLE_REQUIRED = new Set (["search", "launchLists", "candlesMany", "raiseSeries", "launchTraded", "launchTies"]);
487
612
 
488
613
  const BOOLS = { true: true, false: false, 1: true, 0: false };
489
614
 
@@ -502,7 +627,8 @@ export function queryBool(name , q , key )
502
627
  export function spanRefusal(name , q , toDefault ) {
503
628
  const p = INDEXER_CONTRACT[name].page;
504
629
  if (p.kind !== "range" || p.span === undefined) return null;
505
- const sec = (B.CANDLE_INTERVAL_SECS )[queryArg(name, q, p.span.interval) ?? ""];
630
+ const key = queryArg(name, q, p.span.interval) ?? "";
631
+ const sec = p.span.seconds === true ? (DIGITS.test(key) && Number(key) > 0 ? Number(key) : undefined) : (B.CANDLE_INTERVAL_SECS )[key];
506
632
  const fromRaw = q.get(p.from), toRaw = q.get(p.to);
507
633
  if (sec === undefined || fromRaw === null || !DIGITS.test(fromRaw)) return null;
508
634
  const to = toRaw === null ? toDefault : DIGITS.test(toRaw) ? Number(toRaw) : undefined;
@@ -510,5 +636,5 @@ export function spanRefusal(name , q , toDefault
510
636
  const from = Number(fromRaw);
511
637
  if (from > to) return null;
512
638
  const bucket = (t ) => Math.floor(t / sec) * sec;
513
- return (bucket(to) - bucket(from)) / sec + 1 > p.span.max ? `the range spans more than ${p.span.max} candles` : null;
639
+ 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;
514
640
  }
@@ -3,7 +3,7 @@
3
3
  export const INDEXER_ROUTES = {
4
4
  head: { pattern: "/floor-amm/head", keys: [] },
5
5
  latestBlock: { pattern: "/floor-amm/latest-block", keys: [] },
6
- stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId"] },
6
+ stream: { pattern: "/floor-amm/stream", keys: ["launch", "state", "lastEventId", "seat", "compress", "refs"] },
7
7
  quotes: { pattern: "/floor-amm/quotes", keys: [] },
8
8
  summary: { pattern: "/floor-amm/summary", keys: [] },
9
9
  floorRouted: { pattern: "/floor-amm/floor-routed", keys: ["limit", "cursor"] },
@@ -23,11 +23,18 @@ export const INDEXER_ROUTES = {
23
23
  traders: { pattern: "/floor-amm/launches/<launch>/traders", keys: ["window", "limit"] },
24
24
  quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
25
25
  devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
26
- burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before"] },
26
+ burns: { pattern: "/floor-amm/launches/<launch>/burns", keys: ["limit", "before", "wallet"] },
27
+ deals: { pattern: "/floor-amm/launches/<launch>/deals", keys: [] },
27
28
  launchLocks: { pattern: "/floor-amm/launches/<launch>/locks", keys: [] },
28
29
  marks: { pattern: "/floor-amm/launches/<launch>/marks", keys: ["limit", "before"] },
29
30
  price: { pattern: "/floor-amm/launches/<launch>/price", keys: [] },
31
+ raiseSeries: { pattern: "/floor-amm/launches/<launch>/raise-series", keys: ["step", "from", "to"] },
32
+ floorSteps: { pattern: "/floor-amm/launches/<launch>/floor-steps", keys: ["from", "to", "points"] },
33
+ launchTraded: { pattern: "/floor-amm/launches/<launch>/traded", keys: ["wallets"] },
34
+ launchTies: { pattern: "/floor-amm/launches/<launch>/ties", keys: ["wallets", "at", "from", "to"] },
30
35
  highs: { pattern: "/floor-amm/launches/<launch>/highs", keys: ["atLeast", "limit"] },
36
+ mcap: { pattern: "/floor-amm/launches/<launch>/mcap", keys: ["interval", "from", "to", "limit", "before"] },
37
+ held: { pattern: "/floor-amm/launches/<launch>/held", keys: ["wallets", "at", "interval", "from", "to", "limit", "before"] },
31
38
  candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
32
39
  candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
33
40
  candlesMany: { pattern: "/floor-amm/candles/many", keys: ["ids", "interval", "before", "limit"] },
@@ -35,20 +42,24 @@ export const INDEXER_ROUTES = {
35
42
  tonActivity: { pattern: "/floor-amm/wallets/<wallet>/ton-activity", keys: ["limit", "before"] },
36
43
  tonOutcome: { pattern: "/floor-amm/wallets/<wallet>/ton-outcome", keys: ["queryId"] },
37
44
  positions: { pattern: "/floor-amm/wallets/<wallet>/positions", keys: ["limit", "cursor"] },
45
+ positionTotals: { pattern: "/floor-amm/wallets/<wallet>/position-totals", keys: ["launch", "limit", "cursor"] },
38
46
  inbox: { pattern: "/floor-amm/wallets/<wallet>/inbox", keys: ["limit", "before"] },
39
47
  walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
40
48
  claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
41
49
  firsts: { pattern: "/floor-amm/wallets/<wallet>/firsts", keys: [] },
50
+ walletStats: { pattern: "/floor-amm/wallets/<wallet>/stats", keys: [] },
51
+ cobuys: { pattern: "/floor-amm/wallets/<wallet>/cobuys", keys: ["limit"] },
42
52
  firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
43
53
  claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
44
- people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor"] },
54
+ people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor", "person"] },
55
+ referralLaunches: { pattern: "/floor-amm/referrals/<wallet>/launches", keys: ["launch", "limit", "cursor"] },
45
56
  roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
46
57
  handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
47
58
  traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
48
59
  launcherBoard: { pattern: "/floor-amm/leaderboards/launchers", keys: ["limit"] },
49
60
  } ;
50
61
 
51
- 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"] ;
62
+ 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"] ;
52
63
 
53
64
  export const IDS_MAX = 100;
54
65
 
@@ -78,8 +89,33 @@ export const PRESET_FILTER_MAX = 16;
78
89
 
79
90
  export const FIRSTS_MAX = 100;
80
91
 
92
+ export const TRADED_WALLETS_MAX = 100;
93
+
94
+ export const POSITION_TOTALS_PAGE_MAX = 100;
95
+
96
+ export const HELD_WALLETS_MAX = 100;
97
+ export const HELD_AT_MAX = 200;
98
+
81
99
  export const STREAM_STATE_MAX = 16;
82
100
 
101
+ export const PEOPLE_PERSON_MAX = 8;
102
+
103
+ export const TIES_WALLETS_MAX = 100;
104
+
105
+ export const REFERRAL_LAUNCHES_PAGE_MAX = 100;
106
+
107
+ export const TIES_WINDOW_S = 7 * 86_400;
108
+
109
+ export const TIES_ACTIVE_S = 30 * 86_400;
110
+
111
+ export const TIES_HOLD_DAYS = [7, 30] ;
112
+
113
+ export const COBUY_WINDOW_S = 600;
114
+ export const COBUY_MIN_LAUNCHES = 3;
115
+
116
+ export const COBUYS_PAGE_DEFAULT = 100;
117
+ export const COBUYS_PAGE_MAX = 500;
118
+
83
119
  export function query(q ) {
84
120
  const p = new URLSearchParams();
85
121
  for (const [k, v] of Object.entries(q)) {
@@ -110,7 +146,7 @@ export const indexerPath = {
110
146
  latestBlock: () => "/floor-amm/latest-block",
111
147
  stream: (q = {}) => {
112
148
  if ((q.state?.length ?? 0) > STREAM_STATE_MAX) throw new RangeError(`at most ${STREAM_STATE_MAX} state ids`);
113
- return `/floor-amm/stream${query({ launch: q.launch?.length ? q.launch : undefined, state: q.state?.length ? q.state : undefined, lastEventId: q.lastEventId })}`;
149
+ 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 })}`;
114
150
  },
115
151
  quotes: () => "/floor-amm/quotes",
116
152
  summary: () => "/floor-amm/summary",
@@ -147,14 +183,37 @@ export const indexerPath = {
147
183
  traders: (id , q = {}) => launchPath(id, `/traders${query({ window: q.window, limit: q.limit })}`),
148
184
  quoteChain: (id ) => launchPath(id, "/chain"),
149
185
  devTrades: (id , q = {}) => launchPath(id, `/dev${query({ limit: q.limit })}`),
150
- burns: (id , q = {}) => launchPath(id, `/burns${query({ limit: q.limit, before: q.before })}`),
186
+
187
+ burns: (id , q = {}) => launchPath(id, `/burns${query({ limit: q.limit, before: q.before, wallet: q.wallet })}`),
188
+ deals: (id ) => launchPath(id, "/deals"),
151
189
  launchLocks: (id ) => launchPath(id, "/locks"),
152
190
  marks: (id , q = {}) => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
153
191
  price: (id ) => launchPath(id, "/price"),
192
+ raiseSeries: (id , q ) => launchPath(id, `/raise-series${query({ step: q.step, from: q.from, to: q.to })}`),
193
+ floorSteps: (id , q = {}) => launchPath(id, `/floor-steps${query({ from: q.from, to: q.to, points: q.points })}`),
194
+
195
+ launchTraded: (id , wallets ) => {
196
+ if (wallets.length === 0 || wallets.length > TRADED_WALLETS_MAX) throw new RangeError(`1..${TRADED_WALLETS_MAX} wallets`);
197
+ return launchPath(id, `/traded${query({ wallets })}`);
198
+ },
199
+
200
+ launchTies: (id , q ) => {
201
+ if (q.wallets.length === 0 || q.wallets.length > TIES_WALLETS_MAX) throw new RangeError(`1..${TIES_WALLETS_MAX} wallets`);
202
+ if (q.from !== undefined && q.to !== undefined && q.from > q.to) throw new RangeError("from > to");
203
+ return launchPath(id, `/ties${query({ wallets: q.wallets, at: q.at, from: q.from, to: q.to })}`);
204
+ },
154
205
 
155
206
  highs: (id , q = {}) => launchPath(id, `/highs${query({ atLeast: q.atLeast === undefined ? undefined : String(q.atLeast), limit: q.limit })}`),
156
207
 
157
208
  candleBundle: (id , q = {}) => launchPath(id, `/candle-bundle${query({ intervals: q.intervals?.length ? q.intervals : undefined, limit: q.limit })}`),
209
+ mcap: (id , q = {}) => launchPath(id, `/mcap${query({ interval: q.interval, from: q.from, to: q.to, limit: q.limit, before: q.before })}`),
210
+ held: (id , q ) => {
211
+ if (q.wallets.length === 0 || q.wallets.length > HELD_WALLETS_MAX) throw new RangeError(`1..${HELD_WALLETS_MAX} wallets`);
212
+ if (q.at !== undefined) {
213
+ if (q.at.length === 0 || q.at.length > HELD_AT_MAX) throw new RangeError(`1..${HELD_AT_MAX} times`);
214
+ }
215
+ 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 })}`);
216
+ },
158
217
  candles: (q ) => {
159
218
  if (q.before !== undefined && (q.from !== undefined || q.to !== undefined)) throw new RangeError("before cannot be given with from / to");
160
219
  if (q.limit !== undefined && q.before === undefined) throw new RangeError("limit is read only with before");
@@ -170,19 +229,33 @@ export const indexerPath = {
170
229
  tonOutcome: (w , queryId ) => walletPath(w, `/ton-outcome${query({ queryId: String(queryId) })}`),
171
230
 
172
231
  positions: (w , q = {}) => walletPath(w, `/positions${query({ limit: q.limit, cursor: q.cursor })}`),
232
+ positionTotals: (w , q = {}) => walletPath(w, `/position-totals${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`),
173
233
 
174
234
  inbox: (w , q = {}) => walletPath(w, `/inbox${query({ limit: q.limit, before: q.before })}`),
175
235
  walletLocks: (w , q = {}) => walletPath(w, `/locks${query({ limit: q.limit, cursor: q.cursor })}`),
176
236
 
177
237
  claimHistory: (w , q = {}) => walletPath(w, `/claims${query({ limit: q.limit, cursor: q.cursor })}`),
178
238
  firsts: (w ) => walletPath(w, "/firsts"),
239
+ walletStats: (w ) => walletPath(w, "/stats"),
240
+
241
+ cobuys: (w , q = {}) => walletPath(w, `/cobuys${query({ limit: q.limit })}`),
179
242
  firstsMany: (wallets ) => {
180
243
  if (wallets.length === 0 || wallets.length > FIRSTS_MAX) throw new RangeError(`1..${FIRSTS_MAX} wallets`);
181
244
  return `/floor-amm/wallets/firsts${query({ wallets })}`;
182
245
  },
183
246
  claimView: (w , q = {}) => `/floor-amm/claims/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
184
247
 
185
- people: (w , q = {}) => `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor })}`,
248
+ people: (w , q = {}) => {
249
+ if (q.person !== undefined) {
250
+
251
+ const canon = q.person.map((w) => (/^0x[0-9a-fA-F]{40}$/.test(w) ? w.toLowerCase() : w));
252
+ 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`);
253
+ if (q.limit !== undefined || q.cursor !== undefined) throw new RangeError("person cannot be given with limit / cursor");
254
+ }
255
+ return `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor, person: q.person })}`;
256
+ },
257
+
258
+ referralLaunches: (w , q = {}) => `/floor-amm/referrals/${seg(w)}/launches${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`,
186
259
 
187
260
  roles: (w , q = {}) => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
188
261
  handlePlaces: (handle , q = {}) => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
@@ -9,7 +9,7 @@ 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_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";
12
+ 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.js";
13
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
14
 
15
15
  export * from "./partners.js";
@@ -87,16 +87,33 @@ export const readTraders = (get , id , q
87
87
  export const readQuoteChain = (get , id ) => readRoute(get, indexerPath.quoteChain(id), B.QUOTE_CHAIN);
88
88
 
89
89
  export const readDevTrades = (get , id , q = {}) => readRoute(get, indexerPath.devTrades(id, q), B.DEV_TRADES);
90
- export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
90
+
91
+ export const readBurns = (get , id , q = {}) => readRoute(get, indexerPath.burns(id, q), B.BURNS);
92
+
93
+ export const readDeals = (get , id ) => readRoute(get, indexerPath.deals(id), B.DEALS);
91
94
  export const readLaunchLocks = (get , id ) => readRoute(get, indexerPath.launchLocks(id), B.LAUNCH_LOCKS);
92
95
 
93
96
  export const readMarks = (get , id , q = {}) => readRoute(get, indexerPath.marks(id, q), B.MARKS);
94
97
  export const readPrice = (get , id ) => readRoute(get, indexerPath.price(id), B.PRICE);
95
98
 
99
+ export const readRaiseSeries = (get , id , q ) => readRoute(get, indexerPath.raiseSeries(id, q), B.RAISE_SERIES);
100
+
101
+ export const readFloorSteps = (get , id , q = {}) => readRoute(get, indexerPath.floorSteps(id, q), B.FLOOR_STEPS);
102
+
103
+ export const readLaunchTraded = (get , id , wallets ) => readRoute(get, indexerPath.launchTraded(id, wallets), B.LAUNCH_TRADED);
104
+
105
+ export const readLaunchTies = (get , id , q ) => readRoute(get, indexerPath.launchTies(id, q), B.LAUNCH_TIES);
106
+
107
+ export const readPositionTotals = (get , wallet , q = {}) => readRoute(get, indexerPath.positionTotals(wallet, q), B.POSITION_TOTALS);
108
+
96
109
  export const readCandles = (get , q ) => readRoute(get, indexerPath.candles(q), B.CANDLES);
97
110
 
98
111
  export const readCandlesMany = (get , q ) => readRoute(get, indexerPath.candlesMany(q), B.CANDLES_MANY);
99
112
  export const readCandleBundle = (get , id , q = {}) => readRoute(get, indexerPath.candleBundle(id, q), B.CANDLE_BUNDLE);
113
+
114
+ export const readMcap = (get , id , q = {}) => readRoute(get, indexerPath.mcap(id, q), B.MCAP);
115
+
116
+ export const readHeld = (get , id , q ) => readRoute(get, indexerPath.held(id, q), B.HELD);
100
117
  export const readHighs = (get , id , q = {}) => readRoute(get, indexerPath.highs(id, q), B.HIGHS);
101
118
 
102
119
  export const readWalletTrades = (get , wallet , q = {}) => readRoute(get, indexerPath.walletTrades(wallet, q), B.WALLET_TRADES);
@@ -110,9 +127,14 @@ export const readClaimHistory = (get , wallet , q = {})
110
127
 
111
128
  export const readClaimView = (get , wallet , q = {}) => readRoute(get, indexerPath.claimView(wallet, q), B.CLAIM_VIEW);
112
129
  export const readFirsts = (get , wallet ) => readRoute(get, indexerPath.firsts(wallet), B.FIRSTS);
130
+ export const readWalletStats = (get , wallet ) => readRoute(get, indexerPath.walletStats(wallet), B.WALLET_STATS);
131
+
132
+ export const readCobuys = (get , wallet , q = {}) => readRoute(get, indexerPath.cobuys(wallet, q), B.COBUYS);
113
133
 
114
134
  export const readFirstsMany = (get , wallets ) => readRoute(get, indexerPath.firstsMany(wallets), B.FIRSTS_MANY);
115
- export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
135
+ export const readPeople = (get , wallet , q = {}) => readRoute(get, indexerPath.people(wallet, q), B.PEOPLE);
136
+
137
+ export const readReferralLaunches = (get , wallet , q = {}) => readRoute(get, indexerPath.referralLaunches(wallet, q), B.REFERRAL_LAUNCHES);
116
138
  export const readRoles = (get , wallet , q = {}) => readRoute(get, indexerPath.roles(wallet, q), B.ROLES);
117
139
 
118
140
  export const readHandlePlaces = (get , handle , q = {}) => readRoute(get, indexerPath.handlePlaces(handle, q), B.HANDLE_PLACES);
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  import { decode, int, nullable, object, optional, str, unknown } from "./decode.js";
4
- import { HEAD, LIVE_LAUNCH, TRADE } from "./bodies.js";
4
+ import { HEAD, LIVE_LAUNCH, STREAM_TRADE } from "./bodies.js";
5
5
 
6
6
  import { indexerPath } from "./paths.js";
7
7
 
@@ -24,7 +24,7 @@ export function decodeStreamFrame(event , data , id )
24
24
  return { event, data: decode(HEAD_SEEN, data) };
25
25
  case "trade":
26
26
  if (id === undefined) return null;
27
- return { event, id, data: decode(TRADE, data) };
27
+ return { event, id, data: decode(STREAM_TRADE, data) };
28
28
  case "launch": {
29
29
  const d = data ;
30
30
  if (d !== null && typeof d === "object" && d.gone === true) return { event: "launchGone", data: { launch: str(d.launch, "launch"), gone: true } };
@@ -31,6 +31,9 @@ export const KIND_TAIL = 5;
31
31
 
32
32
   
33
33
 
34
+  
35
+  
36
+
34
37
   
35
38
 
36
39
   
@@ -200,19 +203,31 @@ export const ckMoney = (b ) => sum(b.bandMoney, b.nBands) - sum(b.b
200
203
 
201
204
  export const ckHeld = (b ) => sum(b.bandTokens, b.nBands) + b.ckFloorTokens;
202
205
 
206
+ export const kKeptOf = (b ) => b.kKept ?? 0;
207
+
208
+ export const isK = (b , j ) => j >= b.nC || (j < 32 && ((kKeptOf(b) >>> j) & 1) === 1);
209
+
203
210
  export const kSeg = (b ) => (b.kpot && b.nBands === b.nC + 1 ? b.nC : null);
204
211
 
205
- export const cMoney = (b ) => sum(b.bandMoney, b.nC) - sum(b.bandF, b.nC) + (b.ckAtF - b.kAtF);
212
+ export const cMoney = (b ) => {
213
+ let t = b.ckAtF - b.kAtF;
214
+ for (let i = 0; i < b.nC; i++) if (!isK(b, i)) t += b.bandMoney[i] - b.bandF[i];
215
+ return t;
216
+ };
206
217
 
207
218
  export const kMoney = (b ) => ckMoney(b) - cMoney(b);
208
219
 
209
- export const cHeld = (b ) => sum(b.bandTokens, b.nC) + (b.ckFloorTokens - b.kFloorTokens);
220
+ export const cHeld = (b ) => {
221
+ let t = b.ckFloorTokens - b.kFloorTokens;
222
+ for (let i = 0; i < b.nC; i++) if (!isK(b, i)) t += b.bandTokens[i];
223
+ return t;
224
+ };
210
225
 
211
226
  export const kHeld = (b ) => ckHeld(b) - cHeld(b);
212
227
 
213
228
  export function kHolds(b ) {
214
- const k = kSeg(b);
215
- return k !== null && (b.bandTokens[k] > 0n || b.bandFClaim[k] > 0n);
229
+ for (let i = 0; i < b.nBands; i++) if (isK(b, i) && (b.bandTokens[i] > 0n || b.bandFClaim[i] > 0n)) return true;
230
+ return false;
216
231
  }
217
232
 
218
233
  const bidMoneySum = (b ) => b.floor + sum(b.bandMoney, b.nBands);
@@ -280,6 +295,8 @@ export function checkBook(b ) {
280
295
  if (b.ckAtF > b.floor || b.ckFloorTokens > b.floorTokens) fail("Overflow");
281
296
  if (b.kAtF > b.ckAtF || b.kFloorTokens > b.ckFloorTokens) fail("Overflow");
282
297
  if (b.kpot && b.nBands > b.nC + 1) fail("SqrtRange");
298
+ if (kKeptOf(b) !== 0 && (!b.kpot || kKeptOf(b) >>> b.nC !== 0)) fail("SqrtRange");
299
+ for (let i = 0; i < b.nC; i++) if ((kKeptOf(b) >>> i) & 1 && (b.bandMoney[i] !== 0n || b.bandF[i] !== 0n)) fail("SqrtRange");
283
300
  }
284
301
 
285
302
  function flatUp(b ) {
@@ -606,8 +623,8 @@ export function walkDownAcc(b , tokens , acc , u = new
606
623
  b.bandFClaim[j] = u128(b.bandFClaim[j] + dF);
607
624
  b.bandMoney[j] -= q;
608
625
  b.bandTokens[j] = u64(b.bandTokens[j] + dx);
609
- if (j < b.nC) w.fromC += q;
610
- else w.fromK += q;
626
+ if (isK(b, j)) w.fromK += q;
627
+ else w.fromC += q;
611
628
  b.sqrtP = p2;
612
629
  rem -= dx;
613
630
  w.tokens += dx; w.money += q;
@@ -617,7 +634,7 @@ export function walkDownAcc(b , tokens , acc , u = new
617
634
  b.floor = u128(b.floor + b.bandMoney[j]);
618
635
  b.ckAtF = u128(b.ckAtF + b.bandMoney[j] - b.bandF[j]);
619
636
 
620
- if (kSeg(b) === j) b.kAtF = u128(b.kAtF + b.bandMoney[j] - b.bandF[j]);
637
+ if (b.kpot && isK(b, j)) b.kAtF = u128(b.kAtF + b.bandMoney[j] - b.bandF[j]);
621
638
  b.bandMoney[j] = 0n;
622
639
  b.bandF[j] = 0n;
623
640
  }
@@ -115,7 +115,7 @@ export function teamBuyV2(book , gross , max ) {
115
115
  const take = gross < max ? gross : max;
116
116
  if (take === 0n) {
117
117
  return { gross, net: 0n, refund: gross, tokens: 0n, fees: [0n, 0n, 0n, 0n, 0n], fromResale: 0n, fromFirst: 0n, steps: 0, budgetHit: false, graduatedNow: false, sqrtBefore: book.sqrtP, sqrtAfter: book.sqrtP,
118
- split: { dF: 0n, ckAdd: 0n, ckTake: 0n, cAdd: 0n, kAdd: 0n, cTake: 0n, kTake: 0n, ms: 0n, booked: [0n, 0n, 0n, 0n], sqrtFNew: 0n }, relay: { nC: 0, nK: 0, laidC: 0n, laidK: 0n, atF: 0n, kAtF: 0n, kept: 0 } };
118
+ split: { dF: 0n, ckAdd: 0n, ckTake: 0n, cAdd: 0n, kAdd: 0n, cTake: 0n, kTake: 0n, ms: 0n, booked: [0n, 0n, 0n, 0n], sqrtFNew: 0n }, relay: { nC: 0, nK: 0, laidC: 0n, laidK: 0n, atF: 0n, kAtF: 0n, merges: 0, tiers: 0, tail: false, kept: 0 } };
119
119
  }
120
120
  const r = bookBuy(book, take, 0n);
121
121
  return { ...r, refund: r.refund + gross - take, gross };