@floorlaunchpad/sdk 0.7.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 (105) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +12 -1
  3. package/dist/abi/evm.gen.js +75 -2
  4. package/dist/abi/functions.gen.js +87 -1
  5. package/dist/abi/solana.gen.js +59 -0
  6. package/dist/client/solana/index.js +25 -6
  7. package/dist/config/generated.js +803 -26374
  8. package/dist/errors.js +20 -1
  9. package/dist/events/types.gen.js +1 -1
  10. package/dist/evm/chains.js +49 -0
  11. package/dist/evm/floor/abi.gen.js +115 -0
  12. package/dist/evm/squid.js +21 -5
  13. package/dist/evm/venues.js +302 -0
  14. package/dist/generated/interface.gen.js +45 -1
  15. package/dist/index.js +7 -0
  16. package/dist/indexer/bodies.js +154 -2
  17. package/dist/indexer/client.js +8 -1
  18. package/dist/indexer/contract.js +78 -11
  19. package/dist/indexer/paths.js +46 -0
  20. package/dist/indexer/read.js +14 -1
  21. package/dist/math/v2/book.js +24 -7
  22. package/dist/math/v2/create.js +1 -1
  23. package/dist/math/v2/escrow.js +205 -0
  24. package/dist/math/v2/office.js +110 -0
  25. package/dist/math/v2/relay.js +263 -96
  26. package/dist/math/v2/team.js +28 -0
  27. package/dist/math/v2/trade.js +3 -1
  28. package/dist/reprice.js +88 -0
  29. package/dist/route/quote.js +16 -0
  30. package/dist/scaledUi.js +113 -0
  31. package/dist/solana/floor/accounts.js +8 -2
  32. package/dist/solana/floor/events.js +56 -1
  33. package/dist/solana/floor/instructions.js +16 -0
  34. package/dist/stockRefresh.js +99 -0
  35. package/dist/ton/consts.generated.js +2 -2
  36. package/dist/ton/gas.js +3 -3
  37. package/dist/v2/claims.js +28 -5
  38. package/dist/v2/devbuy.js +28 -3
  39. package/dist/v2/evm.js +178 -5
  40. package/dist/v2/layouts.js +100 -2
  41. package/dist/v2/office-events.js +127 -0
  42. package/dist/v2/office-evm.js +68 -0
  43. package/dist/v2/office-read.js +182 -0
  44. package/dist/v2/office-solana.js +134 -0
  45. package/dist/v2/office-trade.js +73 -0
  46. package/dist/v2/route-alt.js +1 -0
  47. package/dist/v2/route.js +1 -1
  48. package/dist/v2/solana.js +224 -5
  49. package/dist/v2/solanaSettle.js +2 -0
  50. package/dist/v2/tx/evm.js +51 -1
  51. package/dist/v2/tx/solana.js +3 -3
  52. package/dist/v2/types.js +4 -0
  53. package/docs/aggregator.md +19 -0
  54. package/examples/floor-line.html +1 -1
  55. package/package.json +26 -1
  56. package/src/abi/evm.gen.ts +75 -2
  57. package/src/abi/functions.gen.ts +87 -1
  58. package/src/abi/solana.gen.ts +59 -0
  59. package/src/client/solana/index.ts +25 -6
  60. package/src/config/generated.ts +803 -26374
  61. package/src/errors.ts +20 -1
  62. package/src/events/types.gen.ts +402 -1
  63. package/src/evm/chains.ts +58 -0
  64. package/src/evm/floor/abi.gen.ts +115 -0
  65. package/src/evm/squid.ts +22 -6
  66. package/src/evm/venues.ts +340 -0
  67. package/src/generated/interface.gen.ts +45 -1
  68. package/src/index.ts +7 -0
  69. package/src/indexer/bodies.ts +167 -2
  70. package/src/indexer/client.ts +16 -2
  71. package/src/indexer/contract.ts +84 -12
  72. package/src/indexer/paths.ts +77 -0
  73. package/src/indexer/read.ts +16 -3
  74. package/src/math/v2/book.ts +23 -7
  75. package/src/math/v2/create.ts +1 -1
  76. package/src/math/v2/escrow.ts +213 -0
  77. package/src/math/v2/office.ts +114 -0
  78. package/src/math/v2/relay.ts +269 -96
  79. package/src/math/v2/team.ts +28 -0
  80. package/src/math/v2/trade.ts +3 -1
  81. package/src/reprice.ts +121 -0
  82. package/src/route/quote.ts +16 -0
  83. package/src/scaledUi.ts +123 -0
  84. package/src/solana/floor/accounts.ts +8 -2
  85. package/src/solana/floor/events.ts +57 -2
  86. package/src/solana/floor/instructions.ts +16 -0
  87. package/src/stockRefresh.ts +131 -0
  88. package/src/ton/consts.generated.ts +2 -2
  89. package/src/ton/gas.ts +3 -3
  90. package/src/v2/claims.ts +34 -5
  91. package/src/v2/devbuy.ts +38 -3
  92. package/src/v2/evm.ts +204 -5
  93. package/src/v2/layouts.ts +100 -2
  94. package/src/v2/office-events.ts +133 -0
  95. package/src/v2/office-evm.ts +76 -0
  96. package/src/v2/office-read.ts +264 -0
  97. package/src/v2/office-solana.ts +159 -0
  98. package/src/v2/office-trade.ts +96 -0
  99. package/src/v2/route-alt.ts +1 -0
  100. package/src/v2/route.ts +1 -1
  101. package/src/v2/solana.ts +235 -5
  102. package/src/v2/solanaSettle.ts +2 -0
  103. package/src/v2/tx/evm.ts +51 -1
  104. package/src/v2/tx/solana.ts +5 -3
  105. package/src/v2/types.ts +66 -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,
@@ -373,6 +373,22 @@ export const CANDLE = object({
373
373
  });
374
374
  export type Candle = Infer<typeof CANDLE>;
375
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
+
376
392
  const USD_RATE = object({ centsX64: nullable(big), source: nullable(str), ageS: nullable(int) });
377
393
 
378
394
  export const CANDLES = object({
@@ -539,12 +555,76 @@ export const POSITION_TOTALS = checked(
539
555
  );
540
556
  export type PositionTotals = Infer<typeof POSITION_TOTALS>;
541
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
+
542
599
  export const LAUNCH_TRADED = checked(
543
600
  object({ indexed, launch: str, traded: array(object({ wallet: str, traded: bool, firstTs: nullable(int) })), asOf: nullable(str) }),
544
601
  (b) => (b.traded.some((r) => r.traded === (r.firstTs === null)) ? "firstTs exactly where traded" : null),
545
602
  );
546
603
  export type LaunchTraded = Infer<typeof LAUNCH_TRADED>;
547
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
+
548
628
  const LOCK_HOLDER = object({ wallet: str, place: nullable(int) });
549
629
 
550
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) });
@@ -717,7 +797,7 @@ export const PEOPLE_ROLE = object({ kind: oneOf("trader", "creator"), tier: int,
717
797
  export const PEOPLE = object({
718
798
  indexed,
719
799
  wallet: str,
720
- people: array(object({ wallet: str, chain: str, roles: array(PEOPLE_ROLE), earned: PER_QUOTE, teamMilestone: PER_QUOTE, unclaimed: 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 })),
721
801
  pooled: PER_QUOTE,
722
802
 
723
803
  accountsAt: optional(nullable(int)),
@@ -728,6 +808,91 @@ export const PEOPLE = object({
728
808
  });
729
809
  export type People = Infer<typeof PEOPLE>;
730
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
+
731
896
  export const ROLES = object({
732
897
  indexed,
733
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, FloorStepsQuery, PositionTotalsQuery, RaiseSeriesQuery, LaunchListsQuery, LaunchSearchQuery, LaunchesQuery, Page, PeopleQuery, 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";
@@ -36,13 +36,17 @@ export interface RouteArgs {
36
36
  quoteChain: L;
37
37
  devTrades: L & { limit?: number };
38
38
  burns: L & Page & { wallet?: string };
39
+ deals: L;
39
40
  launchLocks: L;
40
41
  marks: L & Page;
41
42
  price: L;
42
43
  raiseSeries: L & RaiseSeriesQuery;
43
44
  floorSteps: L & FloorStepsQuery;
44
45
  launchTraded: L & { wallets: readonly string[] };
46
+ launchTies: L & LaunchTiesQuery;
45
47
  highs: L & { atLeast?: bigint | string; limit?: number };
48
+ mcap: L & McapQuery;
49
+ held: L & HeldQuery;
46
50
  candles: CandlesQuery;
47
51
  candlesMany: CandlesManyQuery;
48
52
  candleBundle: L & { intervals?: readonly string[]; limit?: number };
@@ -55,9 +59,12 @@ export interface RouteArgs {
55
59
  walletLocks: W & WalletPage;
56
60
  claimHistory: W & WalletPage;
57
61
  firsts: W;
62
+ walletStats: W;
63
+ cobuys: W & { limit?: number };
58
64
  firstsMany: { wallets: readonly string[] };
59
65
  claimView: W & WalletPage;
60
66
  people: W & PeopleQuery;
67
+ referralLaunches: W & ReferralLaunchesQuery;
61
68
  roles: W & WalletPage;
62
69
  handlePlaces: { handle: string } & WalletPage;
63
70
  traderBoard: { window?: TraderWindow; limit?: number } | void;
@@ -103,13 +110,17 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
103
110
  quoteChain: (a) => indexerPath.quoteChain(a.launch),
104
111
  devTrades: ({ launch, ...q }) => indexerPath.devTrades(launch, q),
105
112
  burns: ({ launch, ...q }) => indexerPath.burns(launch, q),
113
+ deals: (a) => indexerPath.deals(a.launch),
106
114
  launchLocks: (a) => indexerPath.launchLocks(a.launch),
107
115
  marks: ({ launch, ...q }) => indexerPath.marks(launch, q),
108
116
  price: (a) => indexerPath.price(a.launch),
109
117
  raiseSeries: ({ launch, ...q }) => indexerPath.raiseSeries(launch, q),
110
118
  floorSteps: ({ launch, ...q }) => indexerPath.floorSteps(launch, q),
111
119
  launchTraded: (a) => indexerPath.launchTraded(a.launch, a.wallets),
120
+ launchTies: ({ launch, ...q }) => indexerPath.launchTies(launch, q),
112
121
  highs: ({ launch, ...q }) => indexerPath.highs(launch, q),
122
+ mcap: ({ launch, ...q }) => indexerPath.mcap(launch, q),
123
+ held: ({ launch, ...q }) => indexerPath.held(launch, q),
113
124
  candles: (a) => indexerPath.candles(a),
114
125
  candlesMany: (a) => indexerPath.candlesMany(a),
115
126
  candleBundle: ({ launch, ...q }) => indexerPath.candleBundle(launch, q),
@@ -122,9 +133,12 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
122
133
  walletLocks: ({ wallet, ...q }) => indexerPath.walletLocks(wallet, q),
123
134
  claimHistory: ({ wallet, ...q }) => indexerPath.claimHistory(wallet, q),
124
135
  firsts: (a) => indexerPath.firsts(a.wallet),
136
+ walletStats: (a) => indexerPath.walletStats(a.wallet),
137
+ cobuys: ({ wallet, ...q }) => indexerPath.cobuys(wallet, q),
125
138
  firstsMany: (a) => indexerPath.firstsMany(a.wallets),
126
139
  claimView: ({ wallet, ...q }) => indexerPath.claimView(wallet, q),
127
140
  people: ({ wallet, ...q }) => indexerPath.people(wallet, q),
141
+ referralLaunches: ({ wallet, ...q }) => indexerPath.referralLaunches(wallet, q),
128
142
  roles: ({ wallet, ...q }) => indexerPath.roles(wallet, q),
129
143
  handlePlaces: ({ handle, ...q }) => indexerPath.handlePlaces(handle, q),
130
144
  traderBoard: (a) => indexerPath.traderBoard(a ?? {}),
@@ -144,7 +158,7 @@ export const routePath: { [N in RouteName]: (a: RouteArgs[N]) => string } = {
144
158
  health: () => "/health",
145
159
  };
146
160
 
147
- 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"] 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;
148
162
  export type DrainName = (typeof DRAIN_NAMES)[number];
149
163
 
150
164
  export type ReadName = Exclude<RouteName, "stream">;
@@ -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, 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, 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",
@@ -104,6 +106,8 @@ export type Pagination =
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
 
@@ -272,6 +279,7 @@ export const INDEXER_CONTRACT = {
272
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 }),
273
280
 
274
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 }),
275
283
  launchLocks: site({ pattern: "/floor-amm/launches/<launch>/locks", v2: true, errors: LAUNCH_ERR, body: B.LAUNCH_LOCKS }),
276
284
  marks: site({
277
285
  pattern: "/floor-amm/launches/<launch>/marks",
@@ -315,6 +323,19 @@ export const INDEXER_CONTRACT = {
315
323
  errors: [...LAUNCH_ERR, "bad_query"],
316
324
  body: B.LAUNCH_TRADED,
317
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
+ }),
318
339
  highs: site({
319
340
  pattern: "/floor-amm/launches/<launch>/highs",
320
341
  v2: true,
@@ -352,6 +373,38 @@ export const INDEXER_CONTRACT = {
352
373
  errors: [...GATED, "bad_query"],
353
374
  body: B.CANDLES_MANY,
354
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
+ }),
355
408
  candleBundle: site({
356
409
  pattern: "/floor-amm/launches/<launch>/candle-bundle",
357
410
  v2: true,
@@ -413,6 +466,10 @@ export const INDEXER_CONTRACT = {
413
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 }),
414
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 }),
415
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 }),
416
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 }),
417
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 }),
418
475
 
@@ -423,6 +480,18 @@ export const INDEXER_CONTRACT = {
423
480
  errors: WALLET_ERR,
424
481
  body: B.PEOPLE,
425
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
+ }),
426
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 }),
427
496
 
428
497
  handlePlaces: site({
@@ -436,6 +505,7 @@ export const INDEXER_CONTRACT = {
436
505
 
437
506
  tokenHolders: partner({
438
507
  pattern: "/floor-amm/holders/<token>",
508
+ quoteUnit: "none",
439
509
  aliases: ["/holders/<token>"],
440
510
  params: ["token"],
441
511
  query: { limit: LIMIT(100, 500), offset: { kind: "int", doc: "rows skipped", min: 0, default: 0 } },
@@ -443,12 +513,13 @@ export const INDEXER_CONTRACT = {
443
513
  errors: [...GATED, "bad_query", "not_found"],
444
514
  body: P.TOKEN_HOLDERS,
445
515
  }),
446
- 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 }),
447
- 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 }),
448
- 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 }),
449
- cgPairs: partner({ pattern: "/v2/coingecko/pairs", aliases: ["/coingecko/pairs"], errors: GATED, body: P.CG_PAIRS }),
450
- 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 }),
451
521
  cgHistoricalTrades: partner({
522
+ quoteUnit: PARTNER_QUOTE_UNIT.coingecko,
452
523
  pattern: "/v2/coingecko/historical_trades",
453
524
  aliases: ["/coingecko/historical_trades", "/historical_trades"],
454
525
  query: {
@@ -464,15 +535,16 @@ export const INDEXER_CONTRACT = {
464
535
  errors: [...GATED, "bad_query", "not_found", "too_many"],
465
536
  body: P.CG_HISTORICAL,
466
537
  }),
467
- 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 }),
468
539
  llamaFees: partner({
540
+ quoteUnit: PARTNER_QUOTE_UNIT.defillama,
469
541
  pattern: "/v2/defillama/fees",
470
542
  query: { from: { kind: "unix", doc: "window start, inclusive (with to)" }, to: { kind: "unix", doc: "window end, exclusive (with from)" } },
471
543
  page: { kind: "range", from: "from", to: "to" },
472
544
  body: P.LLAMA_FEES,
473
545
  }),
474
546
 
475
- 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 },
476
548
  } as const satisfies Record<string, RouteContract<any>>;
477
549
 
478
550
  export type RouteName = keyof typeof INDEXER_CONTRACT;
@@ -620,7 +692,7 @@ const ROWS_PRODUCT: Partial<Record<RouteName, { list: string; max: number }>> =
620
692
  candlesMany: { list: "ids", max: CANDLES_MANY_ROWS_MAX },
621
693
  };
622
694
 
623
- const TABLE_REQUIRED: ReadonlySet<RouteName> = new Set<RouteName>(["search", "launchLists", "candlesMany", "raiseSeries", "launchTraded"]);
695
+ const TABLE_REQUIRED: ReadonlySet<RouteName> = new Set<RouteName>(["search", "launchLists", "candlesMany", "raiseSeries", "launchTraded", "launchTies"]);
624
696
 
625
697
  const BOOLS: Readonly<Record<string, boolean>> = { true: true, false: false, 1: true, 0: false };
626
698
 
@@ -29,13 +29,17 @@ export const INDEXER_ROUTES = {
29
29
  quoteChain: { pattern: "/floor-amm/launches/<launch>/chain", keys: [] },
30
30
  devTrades: { pattern: "/floor-amm/launches/<launch>/dev", keys: ["limit"] },
31
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: [] },
35
36
  raiseSeries: { pattern: "/floor-amm/launches/<launch>/raise-series", keys: ["step", "from", "to"] },
36
37
  floorSteps: { pattern: "/floor-amm/launches/<launch>/floor-steps", keys: ["from", "to", "points"] },
37
38
  launchTraded: { pattern: "/floor-amm/launches/<launch>/traded", keys: ["wallets"] },
39
+ launchTies: { pattern: "/floor-amm/launches/<launch>/ties", keys: ["wallets", "at", "from", "to"] },
38
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"] },
39
43
  candleBundle: { pattern: "/floor-amm/launches/<launch>/candle-bundle", keys: ["intervals", "limit"] },
40
44
  candles: { pattern: "/floor-amm/candles", keys: ["launch", "interval", "from", "to", "before", "limit"] },
41
45
  candlesMany: { pattern: "/floor-amm/candles/many", keys: ["ids", "interval", "before", "limit"] },
@@ -48,9 +52,12 @@ export const INDEXER_ROUTES = {
48
52
  walletLocks: { pattern: "/floor-amm/wallets/<wallet>/locks", keys: ["limit", "cursor"] },
49
53
  claimHistory: { pattern: "/floor-amm/wallets/<wallet>/claims", keys: ["limit", "cursor"] },
50
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"] },
51
57
  firstsMany: { pattern: "/floor-amm/wallets/firsts", keys: ["wallets"] },
52
58
  claimView: { pattern: "/floor-amm/claims/<wallet>", keys: ["limit", "cursor"] },
53
59
  people: { pattern: "/floor-amm/referrals/<wallet>/people", keys: ["limit", "cursor", "person"] },
60
+ referralLaunches: { pattern: "/floor-amm/referrals/<wallet>/launches", keys: ["launch", "limit", "cursor"] },
54
61
  roles: { pattern: "/floor-amm/roles/<wallet>", keys: ["limit", "cursor"] },
55
62
  handlePlaces: { pattern: "/floor-amm/handles/<handle>/places", keys: ["limit", "cursor"] },
56
63
  traderBoard: { pattern: "/floor-amm/leaderboards/traders", keys: ["window", "limit"] },
@@ -94,10 +101,29 @@ export const TRADED_WALLETS_MAX = 100;
94
101
 
95
102
  export const POSITION_TOTALS_PAGE_MAX = 100;
96
103
 
104
+ export const HELD_WALLETS_MAX = 100;
105
+ export const HELD_AT_MAX = 200;
106
+
97
107
  export const STREAM_STATE_MAX = 16;
98
108
 
99
109
  export const PEOPLE_PERSON_MAX = 8;
100
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
+
101
127
  type QueryValue = string | number | boolean | readonly string[] | undefined | null;
102
128
 
103
129
  export function query(q: Record<string, QueryValue>): string {
@@ -229,12 +255,43 @@ export interface PositionTotalsQuery {
229
255
  cursor?: string;
230
256
  }
231
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
+
232
271
  export interface FloorStepsQuery {
233
272
  from?: number;
234
273
  to?: number;
235
274
  points?: number;
236
275
  }
237
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
+
238
295
  export interface StreamQuery {
239
296
 
240
297
  launch?: readonly string[];
@@ -294,6 +351,7 @@ export const indexerPath = {
294
351
  devTrades: (id: string, q: { limit?: number } = {}): string => launchPath(id, `/dev${query({ limit: q.limit })}`),
295
352
 
296
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"),
297
355
  launchLocks: (id: string): string => launchPath(id, "/locks"),
298
356
  marks: (id: string, q: Page = {}): string => launchPath(id, `/marks${query({ limit: q.limit, before: q.before })}`),
299
357
  price: (id: string): string => launchPath(id, "/price"),
@@ -305,9 +363,23 @@ export const indexerPath = {
305
363
  return launchPath(id, `/traded${query({ wallets })}`);
306
364
  },
307
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
+ },
371
+
308
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 })}`),
309
373
 
310
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
+ },
311
383
  candles: (q: CandlesQuery): string => {
312
384
  if (q.before !== undefined && (q.from !== undefined || q.to !== undefined)) throw new RangeError("before cannot be given with from / to");
313
385
  if (q.limit !== undefined && q.before === undefined) throw new RangeError("limit is read only with before");
@@ -330,6 +402,9 @@ export const indexerPath = {
330
402
 
331
403
  claimHistory: (w: string, q: WalletPage = {}): string => walletPath(w, `/claims${query({ limit: q.limit, cursor: q.cursor })}`),
332
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 })}`),
333
408
  firstsMany: (wallets: readonly string[]): string => {
334
409
  if (wallets.length === 0 || wallets.length > FIRSTS_MAX) throw new RangeError(`1..${FIRSTS_MAX} wallets`);
335
410
  return `/floor-amm/wallets/firsts${query({ wallets })}`;
@@ -346,6 +421,8 @@ export const indexerPath = {
346
421
  return `/floor-amm/referrals/${seg(w)}/people${query({ limit: q.limit, cursor: q.cursor, person: q.person })}`;
347
422
  },
348
423
 
424
+ referralLaunches: (w: string, q: ReferralLaunchesQuery = {}): string => `/floor-amm/referrals/${seg(w)}/launches${query({ launch: q.launch, limit: q.limit, cursor: q.cursor })}`,
425
+
349
426
  roles: (w: string, q: WalletPage = {}): string => `/floor-amm/roles/${seg(w)}${query({ limit: q.limit, cursor: q.cursor })}`,
350
427
  handlePlaces: (handle: string, q: WalletPage = {}): string => `/floor-amm/handles/${seg(handle)}/places${query({ limit: q.limit, cursor: q.cursor })}`,
351
428
  traderBoard: (q: { window?: "1h" | "24h" | "7d" | "all"; limit?: number } = {}): string => `/floor-amm/leaderboards/traders${query({ window: q.window, limit: q.limit })}`,