@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
@@ -84,7 +84,7 @@ const LAUNCH_FIELDS = {
84
84
 
85
85
  graduation: nullable(object({ block: int, timestamp: int, tx: str })),
86
86
 
87
- teamSlot: array(object({ wallet: str, place: int })),
87
+ teamSlot: array(object({ wallet: str, place: int, shareBps: optional(nullable(int)), owed: optional(nullable(big)), claimed: optional(nullable(big)), teamBuy: optional(nullable(big)), teamBuyLocked: optional(nullable(big)), unlockAt: optional(nullable(int)) })),
88
88
  phase: oneOf("bonding", "stacks", "tail"),
89
89
  floorX64: big,
90
90
  sqrtF: big,
@@ -135,16 +135,27 @@ const LISTED_FIELDS = {
135
135
  volume24hGross: nullable(big),
136
136
  holders: int,
137
137
 
138
- newHolders1h: optional(nullable(int)),
138
+ holdersChange1h: nullable(int),
139
139
 
140
- newHolders24h: optional(nullable(int)),
140
+ holdersChange24h: nullable(int),
141
+
142
+ volume1h: nullable(big),
143
+
144
+ volumePrev1h: nullable(big),
141
145
 
142
146
  maxLossPpm: optional(nullable(int)),
143
147
 
144
148
  backedPpm: nullable(int),
145
149
  volume24hUsd: nullable(decimal),
150
+
151
+ volume1hUsd: nullable(decimal),
152
+ volumePrev1hUsd: nullable(decimal),
146
153
  marketCapUsd: nullable(decimal),
147
154
 
155
+ athPrice: nullable(big),
156
+
157
+ athPriceUsd: nullable(decimal),
158
+
148
159
  trendingScore: nullable(big),
149
160
 
150
161
  change24hBps: optional(nullable(int)),
@@ -191,6 +202,12 @@ const TRADE_FIELDS = {
191
202
  export const TRADE = object(TRADE_FIELDS);
192
203
  export type Trade = Infer<typeof TRADE>;
193
204
 
205
+ export const TRADE_REFS = object({ tp: optional(str), t: optional(array(str)), cp: optional(str), c: optional(array(str)) });
206
+ export type TradeRefs = Infer<typeof TRADE_REFS>;
207
+
208
+ export const STREAM_TRADE = object({ ...TRADE_FIELDS, refs: optional(TRADE_REFS) });
209
+ export type StreamTrade = Infer<typeof STREAM_TRADE>;
210
+
194
211
  export const PAGED_TRADE = object({ id: str, ...TRADE_FIELDS });
195
212
  export type PagedTrade = Infer<typeof PAGED_TRADE>;
196
213
 
@@ -310,7 +327,7 @@ export type LaunchClaim = Infer<typeof LAUNCH_CLAIM>;
310
327
  export const LAUNCH_CLAIMS = object({ indexed, claims: array(LAUNCH_CLAIM), next: optional(nullable(str)) });
311
328
  export type LaunchClaims = Infer<typeof LAUNCH_CLAIMS>;
312
329
 
313
- export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY), next: optional(nullable(str)) });
330
+ export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY), next: optional(nullable(str)), totals: object({ count: int, tokens: big, quote: big }), asOf: nullable(str) });
314
331
  export type DevBuys = Infer<typeof DEV_BUYS>;
315
332
 
316
333
  export const MEMBER_SOLD_ROW = object({ launch: str, member: str, place: int, amount: big, quoteOut: big, block: int, timestamp: int, tx: str, id: str });
@@ -356,6 +373,22 @@ export const CANDLE = object({
356
373
  });
357
374
  export type Candle = Infer<typeof CANDLE>;
358
375
 
376
+ export const MCAP_INTERVALS = ["1h", "1d"] as const;
377
+
378
+ export const MCAP_PAGE_MAX = 2_000;
379
+
380
+ export const MCAP_POINT = object({ time: int, marketCap: big, supply: big, priceX64: big });
381
+ export type McapPoint = Infer<typeof MCAP_POINT>;
382
+
383
+ export const MCAP = object({ indexed, launch: str, interval: oneOf(...MCAP_INTERVALS), points: array(MCAP_POINT), next: nullable(int) });
384
+ export type Mcap = Infer<typeof MCAP>;
385
+
386
+ export const HELD_ROW = object({ at: int, wallets: int, tokens: big });
387
+ export type HeldRow = Infer<typeof HELD_ROW>;
388
+
389
+ export const HELD = object({ indexed, launch: str, interval: nullable(oneOf(...MCAP_INTERVALS)), rows: array(HELD_ROW), next: nullable(int) });
390
+ export type Held = Infer<typeof HELD>;
391
+
359
392
  const USD_RATE = object({ centsX64: nullable(big), source: nullable(str), ageS: nullable(int) });
360
393
 
361
394
  export const CANDLES = object({
@@ -414,6 +447,184 @@ export type DevTrades = Infer<typeof DEV_TRADES>;
414
447
  export const BURNS = object({ indexed, launch: str, burns: array(object({ id: optional(str), amount: big, block: int, timestamp: int })), program: array(object({ ...BURN_FIELDS, id: optional(str) })), wallet: array(object({ ...BURN_FIELDS, id: optional(str) })), next: optional(nullable(str)) });
415
448
  export type Burns = Infer<typeof BURNS>;
416
449
 
450
+ export const RT_POINTS_MAX = 720;
451
+
452
+ export const RAISE_STEPS = [60, 300, 900, 3_600, 14_400, 86_400] as const;
453
+
454
+ function checked<T>(d: Decoder<T>, ok: (v: T) => string | null): Decoder<T> {
455
+ return (v, p) => {
456
+ const x = d(v, p);
457
+ const why = ok(x);
458
+ if (why !== null) throw new ShapeError(p, why, v);
459
+ return x;
460
+ };
461
+ }
462
+ const ascending = (xs: readonly { time: number }[], strict: boolean): boolean => xs.every((x, i) => i === 0 || (strict ? x.time > xs[i - 1]!.time : x.time >= xs[i - 1]!.time));
463
+
464
+ export const RAISE_COUNTS = object({
465
+ buys: int,
466
+ sells: int,
467
+
468
+ last: nullable(int),
469
+
470
+ largest: nullable(object({ time: int, amount: big, id: str })),
471
+
472
+ raised: big,
473
+ });
474
+
475
+ export const RAISE_SERIES = checked(
476
+ object({
477
+ indexed,
478
+ launch: str,
479
+ from: int,
480
+ to: int,
481
+ step: int,
482
+ points: array(object({ time: int, liveTotal: big })),
483
+ pace: array(object({ time: int, bought: big, sold: big })),
484
+ counts: RAISE_COUNTS,
485
+ total: int,
486
+ first: nullable(str),
487
+ asOf: nullable(str),
488
+ }),
489
+ (b) => (b.points.length > RT_POINTS_MAX ? `at most ${RT_POINTS_MAX} points` : !b.points.every((x, i) => i === 0 || x.time === b.points[i - 1]!.time + b.step) ? "points on the grid, oldest first" : !ascending(b.pace, true) ? "pace oldest first" : null),
490
+ );
491
+ export type RaiseSeries = Infer<typeof RAISE_SERIES>;
492
+
493
+ export const FLOOR_STEP = object({ id: str, block: int, timestamp: int, floorX64: big, floorMoney: nullable(big) });
494
+
495
+ export const FLOOR_STEPS = checked(
496
+ object({
497
+ indexed,
498
+ launch: str,
499
+ from: int,
500
+ to: int,
501
+ points: int,
502
+ steps: array(FLOOR_STEP),
503
+ totals: object({ steps: int, first: nullable(str), last: nullable(str), firstFloorX64: nullable(big), lastFloorX64: nullable(big) }),
504
+ asOf: nullable(str),
505
+ }),
506
+ (b) => (b.points > RT_POINTS_MAX || b.steps.length > b.points ? `at most ${Math.min(b.points, RT_POINTS_MAX)} steps` : !b.steps.every((x, i) => i === 0 || x.timestamp > b.steps[i - 1]!.timestamp) ? "steps oldest first" : b.steps.length > b.totals.steps ? "no more steps than the totals count" : null),
507
+ );
508
+ export type FloorSteps = Infer<typeof FLOOR_STEPS>;
509
+
510
+ export const roundTrip: Decoder<number> = (v, p) => {
511
+ if (typeof v !== "string") throw new ShapeError(p, "a round-trip number string", v);
512
+ const n = Number(v);
513
+ if (!Number.isFinite(n) || String(n) !== v) throw new ShapeError(p, "a round-trip number string", v);
514
+ return n;
515
+ };
516
+
517
+ export const POSITION_FOLD = object({
518
+
519
+ held: roundTrip,
520
+
521
+ cost: roundTrip,
522
+
523
+ realised: roundTrip,
524
+
525
+ costSold: roundTrip,
526
+
527
+ uncoveredSold: roundTrip,
528
+ });
529
+
530
+ export const POSITION_TOTALS_ROW = object({
531
+ wallet: str,
532
+ launch: str,
533
+ token: str,
534
+ quote: str,
535
+ fills: int,
536
+ buys: int,
537
+ sells: int,
538
+ bought: big,
539
+ sold: big,
540
+ spent: big,
541
+ received: big,
542
+ teamBuy: big,
543
+ firstTs: nullable(int),
544
+ lastTs: nullable(int),
545
+ asOf: nullable(str),
546
+ quoteDecimals: nullable(int),
547
+ fold: nullable(POSITION_FOLD),
548
+ foldReason: nullable(str),
549
+ });
550
+ export type PositionTotalsRow = Infer<typeof POSITION_TOTALS_ROW>;
551
+
552
+ export const POSITION_TOTALS = checked(
553
+ object({ indexed, wallet: str, positions: array(POSITION_TOTALS_ROW), next: nullable(str) }),
554
+ (b) => (b.positions.some((r) => (r.fold === null) === (r.foldReason === null)) ? "fold or its reason, one of them" : b.positions.some((r) => r.fills !== r.buys + r.sells) ? "fills = buys + sells" : null),
555
+ );
556
+ export type PositionTotals = Infer<typeof POSITION_TOTALS>;
557
+
558
+ export const STATS_MONEY = object({ byQuote: record(big), usd: decimal, usdMissing: int });
559
+
560
+ export const WALLET_STATS = object({
561
+ indexed: nullable(INDEXED),
562
+ wallet: str,
563
+ trader: object({
564
+ trades: int, buys: int, sells: int, launches: int,
565
+ volume: STATS_MONEY,
566
+ realised: object({ byQuote: record(roundTrip), usd: decimal, usdMissing: int }),
567
+ closed: int, wins: int, winRateBps: nullable(int),
568
+ biggestWin: nullable(object({ usd: decimal, launch: str })),
569
+ biggestLoss: nullable(object({ usd: decimal, launch: str })),
570
+ early: object({ firstBuyers: int, firstMinutes: int, buyersN: int, windowS: int }),
571
+ avgHoldS: nullable(int),
572
+ resaleBps: nullable(int),
573
+ }),
574
+ member: object({
575
+ places: int, launches: int,
576
+ buybacks: object({ count: int, spent: STATS_MONEY, tokens: big, weightedBps: nullable(int), weightedBpsByQuote: record(int), meanBps: nullable(int), firstTs: nullable(int), lastTs: nullable(int) }),
577
+ buybackDays: object({ days: int, streak: int, bestStreak: int, lastDay: nullable(int) }),
578
+ teamShare: object({ withdrawn: STATS_MONEY, boughtBack: STATS_MONEY, owed: nullable(STATS_MONEY), owedShareBoughtTokens: nullable(big) }),
579
+ burns: object({ count: int, tokens: big, supplyBps: int, usd: decimal, usdMissing: int }),
580
+ sold: object({ count: int, tokens: big, quote: STATS_MONEY, boughtTokens: big, soldBps: nullable(int) }),
581
+ teamBuy: object({
582
+ launches: int, tokens: big, burned: big, sold: big, kept: big, locked: big, unsplit: int,
583
+ launchesSold: int, launchesKept: int, firstSoldTs: nullable(int), avgHeldAfterLockS: nullable(int),
584
+ owedTokens: nullable(big), lockedTokens: nullable(big),
585
+ }),
586
+ }),
587
+ creator: object({
588
+ launches: int, graduated: int, graduationBps: nullable(int), medianGraduateS: nullable(int),
589
+ peakMcap: object({ bestUsd: nullable(decimal), bestLaunch: nullable(str), medianUsd: nullable(decimal) }),
590
+ volume: STATS_MONEY, holders: int, activeLaunches: int, activeWindowS: int,
591
+ teamBuy: object({ launches: int, tokens: big, cost: STATS_MONEY, unsplit: int, toOtherPlaces: big }),
592
+ teamSlot: object({ launches: int, members: int, maxMembers: int }),
593
+ refs: object({ takenFromTeamShare: STATS_MONEY }),
594
+ }),
595
+ referrer: object({ referred: int, earned: STATS_MONEY, owed: nullable(STATS_MONEY) }),
596
+ });
597
+ export type WalletStats = Infer<typeof WALLET_STATS>;
598
+
599
+ export const LAUNCH_TRADED = checked(
600
+ object({ indexed, launch: str, traded: array(object({ wallet: str, traded: bool, firstTs: nullable(int) })), asOf: nullable(str) }),
601
+ (b) => (b.traded.some((r) => r.traded === (r.firstTs === null)) ? "firstTs exactly where traded" : null),
602
+ );
603
+ export type LaunchTraded = Infer<typeof LAUNCH_TRADED>;
604
+
605
+ export const DEAL_PROOF = object({ state: int, hash: nullable(str), windowEnds: nullable(big), objected: bool });
606
+
607
+ export const DEAL_SPLIT = object({ kind: int, kol: str, kolPart: big, agency: nullable(str), agencyPart: big, tiers: array(nullable(str)), refs: array(big), feeRest: big });
608
+
609
+ export const DEAL_UPFRONT = object({ amount: big, fee: big, token: str, timestamp: int, tx: str });
610
+ export type DealUpfront = Infer<typeof DEAL_UPFRONT>;
611
+
612
+ export const DEAL = object({
613
+ escrow: str, launcher: str, kol: str, ref32: str, asset: str, isToken: bool, version: int,
614
+ targets: array(big), amounts: array(big), total: big, expiry: big, armedAt: array(big),
615
+ released: array(nullable(object({ amount: big, fee: big, marketCap: big }))),
616
+
617
+ upfront: array(DEAL_UPFRONT),
618
+ refunded: nullable(big), cancelAgreed: int, cancelled: bool,
619
+ kinds: array(int), proofMask: int, agency: nullable(str), agencyBps: int, volAtLock: big,
620
+ proof: array(nullable(DEAL_PROOF)), split: array(nullable(DEAL_SPLIT)),
621
+ });
622
+ export type Deal = Infer<typeof DEAL>;
623
+
624
+ export const SEAT_AGENCY = object({ place: int, key: str, agency: str, agencyBps: int, paid: big });
625
+ export const DEALS = object({ indexed, launch: str, deals: array(DEAL), seatAgencies: array(SEAT_AGENCY) });
626
+ export type Deals = Infer<typeof DEALS>;
627
+
417
628
  const LOCK_HOLDER = object({ wallet: str, place: nullable(int) });
418
629
 
419
630
  export const TEAM_BUY_LOCK = object({ kind: oneOf("teamBuy"), tokens: big, createdAt: int, unlocked: bool, unlockedAt: nullable(int), unlockAt: nullable(int), locked: big, claimed: big, holders: array(LOCK_HOLDER) });
@@ -581,15 +792,107 @@ export const FIRSTS_MANY = object({ indexed, wallets: record(FIRSTS_ROW) });
581
792
 
582
793
  const PER_QUOTE = array(object({ quote: str, amount: big }));
583
794
 
795
+ export const PEOPLE_ROLE = object({ kind: oneOf("trader", "creator"), tier: int, via: nullable(str) });
796
+
584
797
  export const PEOPLE = object({
585
798
  indexed,
586
799
  wallet: str,
587
- people: array(object({ wallet: str, chain: str, roles: array(object({ kind: oneOf("trader", "creator"), tier: int })), earned: PER_QUOTE, teamMilestone: PER_QUOTE })),
800
+ people: array(object({ wallet: str, chain: str, boundAt: optional(int), roles: array(PEOPLE_ROLE), earned: PER_QUOTE, teamMilestone: PER_QUOTE, unclaimed: PER_QUOTE })),
801
+ pooled: PER_QUOTE,
802
+
803
+ accountsAt: optional(nullable(int)),
804
+
805
+ og: optional(nullable(object({ from: int, until: int, revoked: bool }))),
588
806
 
589
807
  next: optional(nullable(str)),
590
808
  });
591
809
  export type People = Infer<typeof PEOPLE>;
592
810
 
811
+ export const TIE_FIRST_BUY = object({ ts: int, quote: big, usd: nullable(decimal) });
812
+ export type TieFirstBuy = Infer<typeof TIE_FIRST_BUY>;
813
+
814
+ const TIE_FLOW = { buys: int, buyQuote: big, buyUsd: decimal, sells: int, sellQuote: big, sellUsd: decimal, usdMissing: int } as const;
815
+
816
+ const TIE_EARNED_TIER = object({ quote: big, usd: decimal });
817
+
818
+ export const TIE_EARNED = object({ tier1: TIE_EARNED_TIER, tier2: TIE_EARNED_TIER, tier3: TIE_EARNED_TIER, usdMissing: int });
819
+ export type TieEarned = Infer<typeof TIE_EARNED>;
820
+
821
+ export const REFERRAL_LAUNCH_ROW = object({
822
+ launch: str,
823
+ token: str,
824
+ quote: str,
825
+ createdTs: int,
826
+ self: nullable(TIE_FIRST_BUY),
827
+ creator: bool,
828
+ teamSlot: bool,
829
+ buyers: int,
830
+ before: int,
831
+ after: int,
832
+ medianLeadS: nullable(int),
833
+ medianLagS: nullable(int),
834
+ earned: TIE_EARNED,
835
+ teamMilestone: TIE_EARNED,
836
+ referees: array(object({
837
+ wallet: str,
838
+ linked: array(object({ quote: str, tier: int })),
839
+ credited: array(object({ kind: oneOf("trader", "creator"), tier: int })),
840
+ teamSlot: bool,
841
+ firstBuy: TIE_FIRST_BUY,
842
+ offsetS: nullable(int),
843
+ ...TIE_FLOW,
844
+ followed: nullable(object(TIE_FLOW)),
845
+ })),
846
+ });
847
+ export type ReferralLaunchRow = Infer<typeof REFERRAL_LAUNCH_ROW>;
848
+ export const REFERRAL_LAUNCHES = object({
849
+ indexed,
850
+ wallet: str,
851
+ membership: oneOf("linkedNowOrEverCredited"),
852
+
853
+ people: int,
854
+ launches: array(REFERRAL_LAUNCH_ROW),
855
+
856
+ next: nullable(str),
857
+ });
858
+ export type ReferralLaunches = Infer<typeof REFERRAL_LAUNCHES>;
859
+
860
+ export const LAUNCH_TIES = object({
861
+ indexed,
862
+ launch: str,
863
+ quote: str,
864
+ at: int,
865
+ from: int,
866
+ to: int,
867
+ activeFrom: int,
868
+ activeTo: int,
869
+ holdingSource: oneOf("trades"),
870
+ wallets: array(object({
871
+ wallet: str,
872
+ active: bool,
873
+ firstFloorTradeAt: nullable(int),
874
+ teamSlot: bool,
875
+ firstBuy: nullable(TIE_FIRST_BUY),
876
+ offsetS: nullable(int),
877
+ inWindow: bool,
878
+ ...TIE_FLOW,
879
+ holding: array(object({ days: int, at: int, peak: nullable(big), held: nullable(big) })),
880
+ })),
881
+ base: object({ active: int, bought: int, ratePpm: nullable(int) }),
882
+ });
883
+ export type LaunchTies = Infer<typeof LAUNCH_TIES>;
884
+
885
+ export const COBUYS = object({
886
+ indexed,
887
+ wallet: str,
888
+ windowS: int,
889
+ minLaunches: int,
890
+ launches: int,
891
+ total: int,
892
+ cobuys: array(object({ wallet: str, launches: int, firstTs: int, lastTs: int })),
893
+ });
894
+ export type Cobuys = Infer<typeof COBUYS>;
895
+
593
896
  export const ROLES = object({
594
897
  indexed,
595
898
  wallet: str,
@@ -4,7 +4,7 @@ import { decode } from "./decode.ts";
4
4
  import { INDEXER_CONTRACT, clampLimit, pageAsked, routeLimit } from "./contract.ts";
5
5
  import type { RouteBody, RouteName } from "./contract.ts";
6
6
  import { indexerPath, query } from "./paths.ts";
7
- import type { CandlesManyQuery, CandlesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, StreamQuery, TradesQuery, WalletPage, WalletTradesQuery } from "./paths.ts";
7
+ import type { CandlesManyQuery, CandlesQuery, FloorStepsQuery, LaunchTiesQuery, PositionTotalsQuery, RaiseSeriesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, PeopleQuery, ReferralLaunchesQuery, StreamQuery, TradesQuery, WalletPage, WalletTradesQuery, HeldQuery, McapQuery } from "./paths.ts";
8
8
  import { IndexerError } from "./read.ts";
9
9
  import type { Get } from "./read.ts";
10
10
  import type { TraderWindow } from "./bodies.ts";
@@ -35,11 +35,18 @@ export interface RouteArgs {
35
35
  traders: L & { window?: TraderWindow; limit?: number };
36
36
  quoteChain: L;
37
37
  devTrades: L & { limit?: number };
38
- burns: L & Page;
38
+ burns: L & Page & { wallet?: string };
39
+ deals: L;
39
40
  launchLocks: L;
40
41
  marks: L & Page;
41
42
  price: L;
43
+ raiseSeries: L & RaiseSeriesQuery;
44
+ floorSteps: L & FloorStepsQuery;
45
+ launchTraded: L & { wallets: readonly string[] };
46
+ launchTies: L & LaunchTiesQuery;
42
47
  highs: L & { atLeast?: bigint | string; limit?: number };
48
+ mcap: L & McapQuery;
49
+ held: L & HeldQuery;
43
50
  candles: CandlesQuery;
44
51
  candlesMany: CandlesManyQuery;
45
52
  candleBundle: L & { intervals?: readonly string[]; limit?: number };
@@ -47,13 +54,17 @@ export interface RouteArgs {
47
54
  tonActivity: W & Page;
48
55
  tonOutcome: W & { queryId: bigint | string };
49
56
  positions: W & WalletPage;
57
+ positionTotals: W & PositionTotalsQuery;
50
58
  inbox: W & { limit?: number; before?: string };
51
59
  walletLocks: W & WalletPage;
52
60
  claimHistory: W & WalletPage;
53
61
  firsts: W;
62
+ walletStats: W;
63
+ cobuys: W & { limit?: number };
54
64
  firstsMany: { wallets: readonly string[] };
55
65
  claimView: W & WalletPage;
56
- people: W & WalletPage;
66
+ people: W & PeopleQuery;
67
+ referralLaunches: W & ReferralLaunchesQuery;
57
68
  roles: W & WalletPage;
58
69
  handlePlaces: { handle: string } & WalletPage;
59
70
  traderBoard: { window?: TraderWindow; limit?: number } | void;
@@ -99,10 +110,17 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
99
110
  quoteChain: (a) => indexerPath.quoteChain(a.launch),
100
111
  devTrades: ({ launch, ...q }) => indexerPath.devTrades(launch, q),
101
112
  burns: ({ launch, ...q }) => indexerPath.burns(launch, q),
113
+ deals: (a) => indexerPath.deals(a.launch),
102
114
  launchLocks: (a) => indexerPath.launchLocks(a.launch),
103
115
  marks: ({ launch, ...q }) => indexerPath.marks(launch, q),
104
116
  price: (a) => indexerPath.price(a.launch),
117
+ raiseSeries: ({ launch, ...q }) => indexerPath.raiseSeries(launch, q),
118
+ floorSteps: ({ launch, ...q }) => indexerPath.floorSteps(launch, q),
119
+ launchTraded: (a) => indexerPath.launchTraded(a.launch, a.wallets),
120
+ launchTies: ({ launch, ...q }) => indexerPath.launchTies(launch, q),
105
121
  highs: ({ launch, ...q }) => indexerPath.highs(launch, q),
122
+ mcap: ({ launch, ...q }) => indexerPath.mcap(launch, q),
123
+ held: ({ launch, ...q }) => indexerPath.held(launch, q),
106
124
  candles: (a) => indexerPath.candles(a),
107
125
  candlesMany: (a) => indexerPath.candlesMany(a),
108
126
  candleBundle: ({ launch, ...q }) => indexerPath.candleBundle(launch, q),
@@ -110,13 +128,17 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
110
128
  tonActivity: ({ wallet, ...q }) => indexerPath.tonActivity(wallet, q),
111
129
  tonOutcome: (a) => indexerPath.tonOutcome(a.wallet, a.queryId),
112
130
  positions: ({ wallet, ...q }) => indexerPath.positions(wallet, q),
131
+ positionTotals: ({ wallet, ...q }) => indexerPath.positionTotals(wallet, q),
113
132
  inbox: ({ wallet, ...q }) => indexerPath.inbox(wallet, q),
114
133
  walletLocks: ({ wallet, ...q }) => indexerPath.walletLocks(wallet, q),
115
134
  claimHistory: ({ wallet, ...q }) => indexerPath.claimHistory(wallet, q),
116
135
  firsts: (a) => indexerPath.firsts(a.wallet),
136
+ walletStats: (a) => indexerPath.walletStats(a.wallet),
137
+ cobuys: ({ wallet, ...q }) => indexerPath.cobuys(wallet, q),
117
138
  firstsMany: (a) => indexerPath.firstsMany(a.wallets),
118
139
  claimView: ({ wallet, ...q }) => indexerPath.claimView(wallet, q),
119
140
  people: ({ wallet, ...q }) => indexerPath.people(wallet, q),
141
+ referralLaunches: ({ wallet, ...q }) => indexerPath.referralLaunches(wallet, q),
120
142
  roles: ({ wallet, ...q }) => indexerPath.roles(wallet, q),
121
143
  handlePlaces: ({ handle, ...q }) => indexerPath.handlePlaces(handle, q),
122
144
  traderBoard: (a) => indexerPath.traderBoard(a ?? {}),
@@ -136,7 +158,7 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
136
158
  health: () => "/health",
137
159
  };
138
160
 
139
- export const DRAIN_NAMES = ["trades", "launchClaims", "memberSold", "burns", "walletTrades", "launches", "search", "marks", "inbox", "positions", "walletLocks", "claimHistory", "people", "roles", "tokenHolders", "tonActivity", "cgHistoricalTrades", "floorRouted", "devBuys", "claimView", "handlePlaces"] as const;
161
+ export const DRAIN_NAMES = ["trades", "launchClaims", "memberSold", "burns", "walletTrades", "launches", "search", "marks", "inbox", "positions", "walletLocks", "claimHistory", "people", "roles", "tokenHolders", "tonActivity", "cgHistoricalTrades", "floorRouted", "devBuys", "claimView", "handlePlaces", "positionTotals", "referralLaunches", "mcap", "held"] as const;
140
162
  export type DrainName = (typeof DRAIN_NAMES)[number];
141
163
 
142
164
  export type ReadName = Exclude<RouteName, "stream">;
@@ -178,6 +200,11 @@ export function createIndexerClient(opts: IndexerClientOptions): IndexerClient {
178
200
  const lim = routeLimit(name)!;
179
201
  let args: Record<string, unknown> = { ...a };
180
202
 
203
+ if (args.person !== undefined) {
204
+ yield await read(name, args);
205
+ return;
206
+ }
207
+
181
208
  if (page.kind === "cursor" && page.optIn !== undefined && args.before === undefined) args = { ...args, before: "" };
182
209
  if (page.kind === "keyset" && page.optIn === true && args.limit === undefined && args.cursor === undefined) args = { ...args, limit: lim.default };
183
210
  for (let i = 0; i < max; i++) {