@floorlaunchpad/sdk 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/LICENSE +201 -60
  3. package/README.md +45 -24
  4. package/dist/abi/evm-event-names.js +12 -0
  5. package/dist/abi/evm.gen.js +130 -0
  6. package/dist/abi/functions.gen.js +144 -0
  7. package/dist/abi/index.js +17 -0
  8. package/dist/abi/solana.gen.js +128 -0
  9. package/dist/burn.js +21 -0
  10. package/dist/client/evm/index.js +191 -0
  11. package/dist/client/index.js +19 -0
  12. package/dist/client/solana/index.js +259 -0
  13. package/dist/client/types.js +5 -0
  14. package/dist/codec.js +77 -0
  15. package/dist/config/codeHash.js +9 -0
  16. package/dist/config/generated.js +746 -0
  17. package/dist/config/index.js +49 -0
  18. package/dist/config/registry.gen.js +118 -0
  19. package/dist/config/solana-genesis.js +7 -0
  20. package/dist/ed25519.js +31 -0
  21. package/dist/errors.js +249 -0
  22. package/dist/events/index.js +40 -0
  23. package/dist/events/types.gen.js +3 -0
  24. package/dist/evm/abi.js +283 -0
  25. package/dist/evm/balances.js +26 -0
  26. package/dist/evm/chains.js +144 -0
  27. package/dist/evm/floor/abi.gen.js +195 -0
  28. package/dist/evm/floor/calls.js +230 -0
  29. package/dist/evm/floor/create.js +49 -0
  30. package/dist/evm/floor/events.js +41 -0
  31. package/dist/evm/floor/iface.js +44 -0
  32. package/dist/evm/items.js +209 -0
  33. package/dist/evm/keccak.js +118 -0
  34. package/dist/evm/multicall.js +30 -0
  35. package/dist/evm/router.js +184 -0
  36. package/dist/evm/zap.js +128 -0
  37. package/dist/fixtures.js +53 -0
  38. package/dist/generated/index.js +28 -0
  39. package/dist/generated/interface.gen.js +146 -0
  40. package/dist/handle.js +22 -0
  41. package/dist/index.js +91 -7
  42. package/dist/indexer/bodies.js +473 -0
  43. package/dist/indexer/client.js +104 -0
  44. package/dist/indexer/contract.js +349 -0
  45. package/dist/indexer/decode.js +97 -0
  46. package/dist/indexer/partners.js +100 -0
  47. package/dist/indexer/paths.js +127 -0
  48. package/dist/indexer/read.js +109 -0
  49. package/dist/indexer/stream.js +71 -0
  50. package/dist/lock.js +16 -0
  51. package/dist/math/fixed.js +154 -0
  52. package/dist/math/genesis.js +39 -0
  53. package/dist/math/index.js +20 -0
  54. package/dist/math/u256.js +49 -0
  55. package/dist/math/v2/ask.js +162 -0
  56. package/dist/math/v2/book.js +607 -0
  57. package/dist/math/v2/circulating.js +62 -0
  58. package/dist/math/v2/create.js +122 -0
  59. package/dist/math/v2/display.js +208 -0
  60. package/dist/math/v2/error.js +17 -0
  61. package/dist/math/v2/feasibility.js +174 -0
  62. package/dist/math/v2/fees.js +121 -0
  63. package/dist/math/v2/holders.js +105 -0
  64. package/dist/math/v2/milestones.js +40 -0
  65. package/dist/math/v2/pow.js +69 -0
  66. package/dist/math/v2/preset.js +151 -0
  67. package/dist/math/v2/receipt.js +108 -0
  68. package/dist/math/v2/relay.js +217 -0
  69. package/dist/math/v2/rows.js +365 -0
  70. package/dist/math/v2/split.js +111 -0
  71. package/dist/math/v2/sqrt.js +84 -0
  72. package/dist/math/v2/supply.js +21 -0
  73. package/dist/math/v2/team.js +75 -0
  74. package/dist/math/v2/trade.js +126 -0
  75. package/dist/math/v2/wide.js +51 -0
  76. package/dist/quote.js +6 -0
  77. package/dist/registryPrice.js +23 -0
  78. package/dist/route/edge-jupiter.js +42 -0
  79. package/dist/route/edge.js +11 -0
  80. package/dist/route/graph.js +51 -0
  81. package/dist/route/path.js +75 -0
  82. package/dist/route/quote.js +15 -0
  83. package/dist/route-jupiter.js +35 -0
  84. package/dist/route.js +8 -0
  85. package/dist/sha256.js +61 -0
  86. package/dist/solana/alt.js +18 -0
  87. package/dist/solana/floor/accounts.js +390 -0
  88. package/dist/solana/floor/borsh.js +66 -0
  89. package/dist/solana/floor/create.js +65 -0
  90. package/dist/solana/floor/events.js +140 -0
  91. package/dist/solana/floor/genesis.js +91 -0
  92. package/dist/solana/floor/genesisList.js +68 -0
  93. package/dist/solana/floor/instructions.js +435 -0
  94. package/dist/solana/floor/metadata.js +198 -0
  95. package/dist/solana/floor/mint.js +206 -0
  96. package/dist/solana/floor/program.js +64 -0
  97. package/dist/solana/floor/registry.js +83 -0
  98. package/dist/solana/instruction.js +49 -0
  99. package/dist/solana/pda.js +88 -0
  100. package/dist/solana/tx.js +138 -0
  101. package/dist/v2/burnPreview.js +35 -0
  102. package/dist/v2/circulating.js +11 -0
  103. package/dist/v2/claimAllEvm.js +70 -0
  104. package/dist/v2/claims-evm.js +120 -0
  105. package/dist/v2/claims.js +218 -0
  106. package/dist/v2/dead.js +21 -0
  107. package/dist/v2/devbuy.js +37 -0
  108. package/dist/v2/events.js +115 -0
  109. package/dist/v2/evm.js +299 -0
  110. package/dist/v2/evmReads.js +76 -0
  111. package/dist/v2/genesis.js +76 -0
  112. package/dist/v2/layouts.js +217 -0
  113. package/dist/v2/market-evm.js +74 -0
  114. package/dist/v2/presetRowEvm.js +45 -0
  115. package/dist/v2/press.js +106 -0
  116. package/dist/v2/quoteMint.js +52 -0
  117. package/dist/v2/receipt-tx.js +149 -0
  118. package/dist/v2/route-alt.js +114 -0
  119. package/dist/v2/route.js +389 -0
  120. package/dist/v2/solana.js +391 -0
  121. package/dist/v2/solanaSettle.js +97 -0
  122. package/dist/v2/tx/evm.js +126 -0
  123. package/dist/v2/tx/genesis.js +47 -0
  124. package/dist/v2/tx/index.js +5 -0
  125. package/dist/v2/tx/solana.js +118 -0
  126. package/dist/v2/types.js +13 -0
  127. package/docs/aggregator.md +61 -0
  128. package/docs/bot.md +50 -0
  129. package/docs/frontend.md +29 -0
  130. package/docs/wallet.md +54 -0
  131. package/package.json +428 -32
  132. package/src/abi/evm-event-names.ts +12 -0
  133. package/src/abi/evm.gen.ts +139 -0
  134. package/src/abi/functions.gen.ts +154 -0
  135. package/src/abi/index.ts +30 -0
  136. package/src/abi/solana.gen.ts +138 -0
  137. package/src/burn.ts +37 -0
  138. package/src/client/evm/index.ts +199 -0
  139. package/src/client/index.ts +23 -0
  140. package/src/client/solana/index.ts +260 -0
  141. package/src/client/types.ts +162 -0
  142. package/src/codec.ts +77 -0
  143. package/src/config/codeHash.ts +9 -0
  144. package/src/config/generated.ts +746 -0
  145. package/src/config/index.ts +91 -0
  146. package/src/config/registry.gen.ts +118 -0
  147. package/src/config/solana-genesis.ts +7 -0
  148. package/src/ed25519.ts +31 -0
  149. package/src/errors.ts +270 -0
  150. package/src/events/index.ts +44 -0
  151. package/src/events/types.gen.ts +831 -0
  152. package/src/evm/abi.ts +292 -0
  153. package/src/evm/balances.ts +26 -0
  154. package/src/evm/chains.ts +167 -0
  155. package/src/evm/floor/abi.gen.ts +195 -0
  156. package/src/evm/floor/calls.ts +247 -0
  157. package/src/evm/floor/create.ts +68 -0
  158. package/src/evm/floor/events.ts +51 -0
  159. package/src/evm/floor/iface.ts +45 -0
  160. package/src/evm/items.ts +252 -0
  161. package/src/evm/keccak.ts +118 -0
  162. package/src/evm/multicall.ts +43 -0
  163. package/src/evm/router.ts +209 -0
  164. package/src/evm/zap.ts +152 -0
  165. package/src/fixtures.ts +53 -0
  166. package/src/generated/index.ts +29 -0
  167. package/src/generated/interface.gen.ts +153 -0
  168. package/src/handle.ts +22 -0
  169. package/src/index.ts +91 -6
  170. package/src/indexer/bodies.ts +528 -0
  171. package/src/indexer/client.ts +178 -0
  172. package/src/indexer/contract.ts +410 -0
  173. package/src/indexer/decode.ts +109 -0
  174. package/src/indexer/partners.ts +109 -0
  175. package/src/indexer/paths.ts +190 -0
  176. package/src/indexer/read.ts +119 -0
  177. package/src/indexer/stream.ts +83 -0
  178. package/src/lock.ts +16 -0
  179. package/src/math/fixed.ts +154 -0
  180. package/src/math/genesis.ts +39 -0
  181. package/src/math/index.ts +24 -0
  182. package/src/math/u256.ts +49 -0
  183. package/src/math/v2/ask.ts +218 -0
  184. package/src/math/v2/book.ts +660 -0
  185. package/src/math/v2/circulating.ts +69 -0
  186. package/src/math/v2/create.ts +139 -0
  187. package/src/math/v2/display.ts +250 -0
  188. package/src/math/v2/error.ts +19 -0
  189. package/src/math/v2/feasibility.ts +200 -0
  190. package/src/math/v2/fees.ts +121 -0
  191. package/src/math/v2/holders.ts +124 -0
  192. package/src/math/v2/milestones.ts +51 -0
  193. package/src/math/v2/pow.ts +71 -0
  194. package/src/math/v2/preset.ts +189 -0
  195. package/src/math/v2/receipt.ts +162 -0
  196. package/src/math/v2/relay.ts +235 -0
  197. package/src/math/v2/rows.ts +412 -0
  198. package/src/math/v2/split.ts +160 -0
  199. package/src/math/v2/sqrt.ts +86 -0
  200. package/src/math/v2/supply.ts +27 -0
  201. package/src/math/v2/team.ts +75 -0
  202. package/src/math/v2/trade.ts +145 -0
  203. package/src/math/v2/wide.ts +52 -0
  204. package/src/quote.ts +6 -0
  205. package/src/registryPrice.ts +28 -0
  206. package/src/route/edge-jupiter.ts +71 -0
  207. package/src/route/edge.ts +22 -0
  208. package/src/route/graph.ts +77 -0
  209. package/src/route/path.ts +84 -0
  210. package/src/route/quote.ts +46 -0
  211. package/src/route-jupiter.ts +36 -0
  212. package/src/route.ts +8 -0
  213. package/src/sha256.ts +61 -0
  214. package/src/solana/alt.ts +25 -0
  215. package/src/solana/floor/accounts.ts +393 -0
  216. package/src/solana/floor/borsh.ts +66 -0
  217. package/src/solana/floor/create.ts +89 -0
  218. package/src/solana/floor/events.ts +147 -0
  219. package/src/solana/floor/genesis.ts +111 -0
  220. package/src/solana/floor/genesisList.ts +75 -0
  221. package/src/solana/floor/instructions.ts +491 -0
  222. package/src/solana/floor/metadata.ts +246 -0
  223. package/src/solana/floor/mint.ts +242 -0
  224. package/src/solana/floor/program.ts +64 -0
  225. package/src/solana/floor/registry.ts +96 -0
  226. package/src/solana/instruction.ts +61 -0
  227. package/src/solana/pda.ts +91 -0
  228. package/src/solana/tx.ts +143 -0
  229. package/src/v2/burnPreview.ts +52 -0
  230. package/src/v2/circulating.ts +22 -0
  231. package/src/v2/claimAllEvm.ts +97 -0
  232. package/src/v2/claims-evm.ts +179 -0
  233. package/src/v2/claims.ts +288 -0
  234. package/src/v2/dead.ts +21 -0
  235. package/src/v2/devbuy.ts +55 -0
  236. package/src/v2/events.ts +131 -0
  237. package/src/v2/evm.ts +349 -0
  238. package/src/v2/evmReads.ts +121 -0
  239. package/src/v2/genesis.ts +80 -0
  240. package/src/v2/layouts.ts +219 -0
  241. package/src/v2/market-evm.ts +95 -0
  242. package/src/v2/presetRowEvm.ts +54 -0
  243. package/src/v2/press.ts +124 -0
  244. package/src/v2/quoteMint.ts +63 -0
  245. package/src/v2/receipt-tx.ts +251 -0
  246. package/src/v2/route-alt.ts +114 -0
  247. package/src/v2/route.ts +494 -0
  248. package/src/v2/solana.ts +439 -0
  249. package/src/v2/solanaSettle.ts +117 -0
  250. package/src/v2/tx/evm.ts +152 -0
  251. package/src/v2/tx/genesis.ts +66 -0
  252. package/src/v2/tx/index.ts +5 -0
  253. package/src/v2/tx/solana.ts +140 -0
  254. package/src/v2/types.ts +284 -0
  255. package/dist/adapter.d.ts +0 -28
  256. package/dist/adapter.d.ts.map +0 -1
  257. package/dist/adapter.js +0 -2
  258. package/dist/adapter.js.map +0 -1
  259. package/dist/chain.d.ts +0 -23
  260. package/dist/chain.d.ts.map +0 -1
  261. package/dist/chain.js +0 -25
  262. package/dist/chain.js.map +0 -1
  263. package/dist/client.d.ts +0 -26
  264. package/dist/client.d.ts.map +0 -1
  265. package/dist/client.js +0 -43
  266. package/dist/client.js.map +0 -1
  267. package/dist/dex-adapter.d.ts +0 -228
  268. package/dist/dex-adapter.d.ts.map +0 -1
  269. package/dist/dex-adapter.js +0 -407
  270. package/dist/dex-adapter.js.map +0 -1
  271. package/dist/index.d.ts +0 -7
  272. package/dist/index.d.ts.map +0 -1
  273. package/dist/index.js.map +0 -1
  274. package/dist/quotes.d.ts +0 -12
  275. package/dist/quotes.d.ts.map +0 -1
  276. package/dist/quotes.gen.d.ts +0 -8
  277. package/dist/quotes.gen.d.ts.map +0 -1
  278. package/dist/quotes.gen.js +0 -2170
  279. package/dist/quotes.gen.js.map +0 -1
  280. package/dist/quotes.js +0 -24
  281. package/dist/quotes.js.map +0 -1
  282. package/dist/types.d.ts +0 -111
  283. package/dist/types.d.ts.map +0 -1
  284. package/dist/types.js +0 -2
  285. package/dist/types.js.map +0 -1
  286. package/src/adapter.ts +0 -20
  287. package/src/chain.ts +0 -39
  288. package/src/client.ts +0 -41
  289. package/src/dex-adapter.ts +0 -477
  290. package/src/quotes.gen.ts +0 -2170
  291. package/src/quotes.ts +0 -29
  292. package/src/types.ts +0 -115
package/src/index.ts CHANGED
@@ -1,6 +1,91 @@
1
- export * from './chain.js';
2
- export * from './types.js';
3
- export * from './adapter.js';
4
- export * from './client.js';
5
- export * as dex from './dex-adapter.js';
6
- export * from './quotes.js';
1
+
2
+
3
+ export * from "./v2/solanaSettle.ts";
4
+ export * from "./v2/burnPreview.ts";
5
+ export * from "./v2/evmReads.ts";
6
+ export * from "./v2/presetRowEvm.ts";
7
+
8
+ export * from "./v2/claimAllEvm.ts";
9
+
10
+ export * as math from "./math/index.ts";
11
+ export * as mathGenesis from "./math/genesis.ts";
12
+ export * as codec from "./codec.ts";
13
+ export * as quote from "./quote.ts";
14
+ export * as solanaInstruction from "./solana/instruction.ts";
15
+ export * as solanaPda from "./solana/pda.ts";
16
+ export * as solanaTx from "./solana/tx.ts";
17
+ export * as solanaAlt from "./solana/alt.ts";
18
+ export * as handle from "./handle.ts";
19
+ export * as burn from "./burn.ts";
20
+ export * as evmKeccak from "./evm/keccak.ts";
21
+ export * as evmAbi from "./evm/abi.ts";
22
+ export * as evmItems from "./evm/items.ts";
23
+ export * as evmZap from "./evm/zap.ts";
24
+ export * as evmRouter from "./evm/router.ts";
25
+ export * as evmChains from "./evm/chains.ts";
26
+ export * as evmMulticall from "./evm/multicall.ts";
27
+ export * as evmFloorAbiGen from "./evm/floor/abi.gen.ts";
28
+ export * as evmFloorIface from "./evm/floor/iface.ts";
29
+ export * as evmFloorCalls from "./evm/floor/calls.ts";
30
+ export * as evmFloorEvents from "./evm/floor/events.ts";
31
+ export * as solanaFloorProgram from "./solana/floor/program.ts";
32
+ export * as solanaFloorAccounts from "./solana/floor/accounts.ts";
33
+ export * as solanaFloorInstructions from "./solana/floor/instructions.ts";
34
+ export * as solanaFloorCreate from "./solana/floor/create.ts";
35
+ export * as solanaFloorEvents from "./solana/floor/events.ts";
36
+ export * as solanaFloorRegistry from "./solana/floor/registry.ts";
37
+ export * as solanaFloorMetadata from "./solana/floor/metadata.ts";
38
+ export * as solanaFloorGenesis from "./solana/floor/genesis.ts";
39
+ export * as solanaFloorMint from "./solana/floor/mint.ts";
40
+ export * as indexerRead from "./indexer/read.ts";
41
+ export * as indexerStream from "./indexer/stream.ts";
42
+ export * as evmBalances from "./evm/balances.ts";
43
+ export * as v2Circulating from "./v2/circulating.ts";
44
+ export * as v2Dead from "./v2/dead.ts";
45
+ export * as v2Layouts from "./v2/layouts.ts";
46
+ export * as v2Solana from "./v2/solana.ts";
47
+ export * as v2SolanaSettle from "./v2/solanaSettle.ts";
48
+ export * as v2BurnPreview from "./v2/burnPreview.ts";
49
+ export * as v2EvmReads from "./v2/evmReads.ts";
50
+ export * as v2PresetRowEvm from "./v2/presetRowEvm.ts";
51
+ export * as v2ClaimAllEvm from "./v2/claimAllEvm.ts";
52
+ export * as v2QuoteMint from "./v2/quoteMint.ts";
53
+ export * as v2Genesis from "./v2/genesis.ts";
54
+ export * as v2Events from "./v2/events.ts";
55
+ export * as v2Evm from "./v2/evm.ts";
56
+ export * as v2Types from "./v2/types.ts";
57
+ export * as mathV2Wide from "./math/v2/wide.ts";
58
+ export * as mathV2Sqrt from "./math/v2/sqrt.ts";
59
+ export * as mathV2Fees from "./math/v2/fees.ts";
60
+ export * as mathV2Book from "./math/v2/book.ts";
61
+ export * as mathV2Trade from "./math/v2/trade.ts";
62
+ export * as mathV2Supply from "./math/v2/supply.ts";
63
+ export * as mathV2Error from "./math/v2/error.ts";
64
+ export * as mathV2Holders from "./math/v2/holders.ts";
65
+ export * as mathV2Milestones from "./math/v2/milestones.ts";
66
+ export * as mathV2Rows from "./math/v2/rows.ts";
67
+ export * as mathV2Circulating from "./math/v2/circulating.ts";
68
+ export * as mathV2Ask from "./math/v2/ask.ts";
69
+ export * as mathV2Feasibility from "./math/v2/feasibility.ts";
70
+ export * as v2Devbuy from "./v2/devbuy.ts";
71
+ export * as v2Route from "./v2/route.ts";
72
+ export * as mathV2Split from "./math/v2/split.ts";
73
+ export * as mathV2Relay from "./math/v2/relay.ts";
74
+ export * as mathV2Create from "./math/v2/create.ts";
75
+ export * as mathV2Display from "./math/v2/display.ts";
76
+ export * as v2MarketEvm from "./v2/market-evm.ts";
77
+ export * as mathV2Team from "./math/v2/team.ts";
78
+ export * as mathV2Receipt from "./math/v2/receipt.ts";
79
+ export * as v2Claims from "./v2/claims.ts";
80
+ export * as v2ClaimsEvm from "./v2/claims-evm.ts";
81
+ export * as v2RouteAlt from "./v2/route-alt.ts";
82
+ export * as v2Tx from "./v2/tx/index.ts";
83
+ export * as events from "./events/index.ts";
84
+ export * as abi from "./abi/index.ts";
85
+ export * as v2Press from "./v2/press.ts";
86
+ export * as v2ReceiptTx from "./v2/receipt-tx.ts";
87
+ export * as config from "./config/index.ts";
88
+ export * as fixtures from "./fixtures.ts";
89
+ export * as client from "./client/index.ts";
90
+ export * as errors from "./errors.ts";
91
+ export * as generated from "./generated/index.ts";
@@ -0,0 +1,528 @@
1
+
2
+
3
+ import { array, big, bool, decimal, int, nullable, object, oneOf, optional, record, str } from "./decode.ts";
4
+ import type { Decoder, Infer } from "./decode.ts";
5
+ import type { DevBuy, DevBuyRole } from "../v2/devbuy.ts";
6
+
7
+ export const INDEXED = object({ block: int, timestamp: int });
8
+ export type Indexed = Infer<typeof INDEXED>;
9
+ const indexed = nullable(INDEXED);
10
+
11
+ export const FEES = object({ backing: big, team: big, platform: big, floorFee: big, holder: big });
12
+ export type Fees = Infer<typeof FEES>;
13
+
14
+ export const MILESTONE_CLASSES = ["team", "holder", "platform", "floor"] as const;
15
+ export const MILESTONES = object({ team: big, holder: big, platform: big, floor: big });
16
+ export type Milestones = Infer<typeof MILESTONES>;
17
+
18
+ export const DEV_BUY_ROLE: Decoder<DevBuyRole> = oneOf("creator", "team_member", "team_share_buy", "team_buy");
19
+
20
+ export const DEV_BUY = object({
21
+ role: DEV_BUY_ROLE,
22
+ trader: str,
23
+ quoteIn: big,
24
+ tokens: big,
25
+ priceBeforeX64: big,
26
+ priceAfterX64: big,
27
+ impactBps: big,
28
+ priceNowX64: big,
29
+ changeSinceBps: big,
30
+ block: int,
31
+ timestamp: int,
32
+ tx: str,
33
+ });
34
+
35
+ export type DevBuyItem = Infer<typeof DEV_BUY>;
36
+
37
+ type Assert<T extends true> = T;
38
+ type _DevBuyItemIsSdk = Assert<DevBuyItem extends Omit<DevBuy, "launch" | "slot"> ? true : false>;
39
+
40
+ export const BONDING = object({ tokens: big, sold: big, left: big, priceX64: big });
41
+
42
+ const BURN_FIELDS = {
43
+ timestamp: int,
44
+ block: int,
45
+ txnId: nullable(str),
46
+ source: oneOf("program", "dead", "wallet"),
47
+ wallet: nullable(str),
48
+ role: nullable(int),
49
+ place: nullable(int),
50
+ burned: big,
51
+ fromTeamBuy: nullable(big),
52
+ fromShareBought: nullable(big),
53
+ fromWallet: nullable(big),
54
+ balanceBefore: nullable(big),
55
+ pctBps: nullable(int),
56
+ supplyAfter: nullable(big),
57
+ sOutAfter: nullable(big),
58
+ floorAfterX64: nullable(big),
59
+ sOutBefore: nullable(big),
60
+ floorBeforeX64: nullable(big),
61
+ scene: bool,
62
+
63
+ floorRiseBps: nullable(int),
64
+ };
65
+ export const BURN = object(BURN_FIELDS);
66
+ export type Burn = Infer<typeof BURN>;
67
+ export type Bonding = Infer<typeof BONDING>;
68
+
69
+ const LAUNCH_FIELDS = {
70
+ id: str,
71
+
72
+ pair: str,
73
+ chain: str,
74
+ token: str,
75
+ quote: str,
76
+ creator: str,
77
+ name: nullable(str),
78
+ symbol: nullable(str),
79
+ tokenDecimals: nullable(int),
80
+ preset: int,
81
+ presetHash: str,
82
+ graduated: bool,
83
+
84
+ graduation: nullable(object({ block: int, timestamp: int, tx: str })),
85
+
86
+ teamSlot: array(object({ wallet: str, place: int })),
87
+ phase: oneOf("bonding", "stacks", "tail"),
88
+ floorX64: big,
89
+ sqrtF: big,
90
+
91
+ floorMoney: big,
92
+ cushionMoney: big,
93
+ vault: big,
94
+ bidMoney: big,
95
+ liquidity: big,
96
+ liquidityMode: oneOf("all", "bid"),
97
+ priceX64: big,
98
+ sqrtPrice: big,
99
+ sqrtLMax: big,
100
+ circulating: object({ sCirc: big, dead: big }),
101
+ marketCap: big,
102
+ supply: big,
103
+ unlisted: bool,
104
+ quoteDecimals: nullable(int),
105
+ teamSlotRateBps: nullable(int),
106
+ bidTopX64: nullable(big),
107
+ teamBuyUnlockAt: nullable(int),
108
+ teamBuyUnlocked: bool,
109
+ teamBuyUnlockedTs: nullable(int),
110
+ milestones: object({ booked: MILESTONES, paid: MILESTONES }),
111
+ holderIndex: object({ index: big, wMatured: big, wPending: big, carry: big, rolls: int }),
112
+ volumeGross: big,
113
+ trades: int,
114
+ feesOut: FEES,
115
+ conservation: nullable(object({ inBook: big, held: big, delta: big })),
116
+ devBuy: nullable(object({ count: int, teamBuyUnlocked: bool, quoteIn: big, tokens: big, latest: DEV_BUY })),
117
+
118
+ created: object({ block: int, timestamp: int, sqrtP0: nullable(big), teamBuy: big }),
119
+ bonding: nullable(BONDING),
120
+
121
+ burns: object({ count: int, burned: big, teamBuyBurned: big, shareBoughtBurned: big, walletBurned: big, last: nullable(BURN), lastScene: nullable(BURN) }),
122
+ };
123
+ export const LAUNCH = object(LAUNCH_FIELDS);
124
+ export type Launch = Infer<typeof LAUNCH>;
125
+
126
+ export const LISTED_LAUNCH = object({
127
+ ...LAUNCH_FIELDS,
128
+ volume24hGross: nullable(big),
129
+ holders: int,
130
+ backedPpm: nullable(int),
131
+ volume24hUsd: nullable(decimal),
132
+ marketCapUsd: nullable(decimal),
133
+ });
134
+ export type ListedLaunch = Infer<typeof LISTED_LAUNCH>;
135
+
136
+ export const LIVE_LAUNCH = object({ ...LAUNCH_FIELDS, volume24hGross: nullable(big), holders: int });
137
+ export type LiveLaunch = Infer<typeof LIVE_LAUNCH>;
138
+
139
+ const TRADE_FIELDS = {
140
+ launch: str,
141
+ trader: str,
142
+ side: oneOf("buy", "sell"),
143
+ tokens: big,
144
+ quoteGross: big,
145
+ quoteNet: big,
146
+ fees: FEES,
147
+ traderRef: big,
148
+ creatorRef: nullable(big),
149
+ recipient: str,
150
+ refund: big,
151
+ fromResale: big,
152
+ fromFirst: big,
153
+ unfilled: big,
154
+ steps: int,
155
+ budgetHit: bool,
156
+ kind: nullable(int),
157
+ credits: object({ backing: big, team: big, platform: big, floorFee: big, holder: big, traderRef: big, creatorRef: nullable(big), teamSlot: nullable(big), teamMilestone: big }),
158
+ priceX64: big,
159
+ floorX64: big,
160
+ circulating: big,
161
+
162
+ floorMoney: nullable(big),
163
+
164
+ bidMoney: nullable(big),
165
+ liquidity: big,
166
+ block: int,
167
+ timestamp: int,
168
+ tx: str,
169
+ txnIndex: int,
170
+ eventIndex: int,
171
+ };
172
+ export const TRADE = object(TRADE_FIELDS);
173
+ export type Trade = Infer<typeof TRADE>;
174
+
175
+ export const PAGED_TRADE = object({ id: str, ...TRADE_FIELDS });
176
+ export type PagedTrade = Infer<typeof PAGED_TRADE>;
177
+
178
+ export const HEAD = object({
179
+ chain: str,
180
+ indexed,
181
+ safe: nullable(int),
182
+ chainHead: nullable(int),
183
+ lag: nullable(int),
184
+ ready: bool,
185
+ servesUnsafe: bool,
186
+ rollbacks: int,
187
+ startBlock: int,
188
+ stalled: optional(nullable(object({ slot: int, signature: str, cycles: int, error: str, ok: bool }))),
189
+ });
190
+ export type Head = Infer<typeof HEAD>;
191
+
192
+ export const LATEST_BLOCK = object({ indexed, block: object({ blockNumber: int, blockTimestamp: int }) });
193
+ export type LatestBlock = Infer<typeof LATEST_BLOCK>;
194
+
195
+ export const QUOTES = object({
196
+ indexed,
197
+ priceUpdater: nullable(str),
198
+ priceUpdaterReported: bool,
199
+ maxAgeS: int,
200
+ quotes: array(object({ mint: str, enabled: bool, createFee: big, usdCentsX64: big, updatedAt: int, ageS: int, fresh: bool, symbol: nullable(str), name: nullable(str), decimals: nullable(int) })),
201
+ });
202
+ export type Quotes = Infer<typeof QUOTES>;
203
+
204
+ export const SUMMARY = object({
205
+ indexed,
206
+ liquidityMode: oneOf("all", "bid"),
207
+ quotes: array(object({
208
+ quote: str,
209
+ launches: int,
210
+ graduated: int,
211
+ backing: big,
212
+ liquidity: big,
213
+ volume: big,
214
+ marketCap: big,
215
+ liquidityUsd: nullable(decimal),
216
+ volumeUsd: nullable(decimal),
217
+ marketCapUsd: nullable(decimal),
218
+ usdSource: nullable(str),
219
+ })),
220
+ });
221
+ export type Summary = Infer<typeof SUMMARY>;
222
+
223
+ export const FLOOR_ROUTED = object({
224
+ indexed,
225
+ launches: array(object({ launch: str, quote: str, floorFee: big, floorMilestone: big })),
226
+ pending: array(object({ quote: str, amount: big })),
227
+ });
228
+ export type FloorRouted = Infer<typeof FLOOR_ROUTED>;
229
+
230
+ export const EVENTS = object({
231
+ events: array(object({
232
+ block: object({ blockNumber: int, blockTimestamp: int }),
233
+ eventType: oneOf("swap"),
234
+ txnId: str,
235
+ txnIndex: int,
236
+ eventIndex: int,
237
+ maker: str,
238
+ pairId: str,
239
+
240
+ asset0In: optional(decimal),
241
+ asset1In: optional(decimal),
242
+ asset0Out: optional(decimal),
243
+ asset1Out: optional(decimal),
244
+ priceNative: decimal,
245
+ reserves: object({ asset0: decimal, asset1: decimal }),
246
+ })),
247
+ });
248
+ export type Events = Infer<typeof EVENTS>;
249
+
250
+ export const LAUNCHES_ALL = object({ indexed, launches: array(LISTED_LAUNCH) });
251
+
252
+ export const LAUNCHES = object({ indexed, total: int, offset: int, launches: array(LISTED_LAUNCH), missing: array(str) });
253
+ export type Launches = Infer<typeof LAUNCHES>;
254
+
255
+ export const LAUNCH_ONE = object({ indexed, launch: LISTED_LAUNCH });
256
+
257
+ export const LAUNCH_STATE = object({ launch: str, mint: str, block: nullable(int), ts: nullable(int), seq: int, state: LIVE_LAUNCH });
258
+ export type LaunchState = Infer<typeof LAUNCH_STATE>;
259
+
260
+ export const LAUNCH_MILESTONES = object({ indexed, classes: array(str), booked: MILESTONES, paid: MILESTONES });
261
+ export type LaunchMilestones = Infer<typeof LAUNCH_MILESTONES>;
262
+
263
+ export const HOLDERS = object({ indexed, source: oneOf("positions", "trades"), total: int, holders: array(object({ holder: str, amount: big, openedTs: int })) });
264
+ export type Holders = Infer<typeof HOLDERS>;
265
+
266
+ export const TRADES = object({ indexed, trades: array(PAGED_TRADE), next: nullable(str) });
267
+ export type Trades = Infer<typeof TRADES>;
268
+
269
+ export const LAUNCH_CLAIM = object({ launch: str, claimer: str, types: int, quote: str, amount: big, holder: big, teamBuy: optional(big), block: int, ts: int, tx: str });
270
+ export type LaunchClaim = Infer<typeof LAUNCH_CLAIM>;
271
+ export const LAUNCH_CLAIMS = object({ indexed, claims: array(LAUNCH_CLAIM) });
272
+
273
+ export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY) });
274
+ export type DevBuys = Infer<typeof DEV_BUYS>;
275
+
276
+ export const CANDLE_INTERVALS = ["1s", "5s", "1m", "5m", "15m", "1h", "4h", "1d"] as const;
277
+ export type CandleInterval = (typeof CANDLE_INTERVALS)[number];
278
+
279
+ export const CANDLE_INTERVAL_SECS: Readonly<Record<CandleInterval, number>> = { "1s": 1, "5s": 5, "1m": 60, "5m": 300, "15m": 900, "1h": 3_600, "4h": 14_400, "1d": 86_400 };
280
+
281
+ export const CANDLES_MAX = 5_000;
282
+
283
+ export const CANDLE_BUNDLE_LIMIT = 300;
284
+
285
+ export const CANDLE = object({
286
+ time: int,
287
+ open: nullable(decimal),
288
+ high: nullable(decimal),
289
+ low: nullable(decimal),
290
+ close: nullable(decimal),
291
+ openX64: big,
292
+ highX64: big,
293
+ lowX64: big,
294
+ closeX64: big,
295
+ openUsd: nullable(decimal),
296
+ highUsd: nullable(decimal),
297
+ lowUsd: nullable(decimal),
298
+ closeUsd: nullable(decimal),
299
+ volumeQuoteRaw: big,
300
+ volumeUsd: nullable(decimal),
301
+ volumeTokensRaw: big,
302
+ volumeBuyQuoteRaw: big,
303
+ volumeSellQuoteRaw: big,
304
+ buys: int,
305
+ sells: int,
306
+ });
307
+ export type Candle = Infer<typeof CANDLE>;
308
+
309
+ const USD_RATE = object({ centsX64: nullable(big), source: nullable(str), ageS: nullable(int) });
310
+
311
+ export const CANDLES = object({
312
+ indexed,
313
+ launch: str,
314
+ token: str,
315
+ quote: str,
316
+ interval: str,
317
+ seconds: int,
318
+ from: int,
319
+ to: int,
320
+ quietBuckets: oneOf("absent"),
321
+ usd: USD_RATE,
322
+ candles: array(CANDLE),
323
+ });
324
+ export type Candles = Infer<typeof CANDLES>;
325
+
326
+ export const CANDLE_BUNDLE = object({
327
+ indexed,
328
+ launch: str,
329
+ token: str,
330
+ quote: str,
331
+ quietBuckets: oneOf("absent"),
332
+ usd: USD_RATE,
333
+ limit: int,
334
+ pages: record(object({ interval: str, seconds: int, from: int, to: int, candles: array(CANDLE) })),
335
+ });
336
+ export type CandleBundle = Infer<typeof CANDLE_BUNDLE>;
337
+
338
+ export const HIGH = object({ timestamp: int, block: int, txnId: nullable(str), txnIndex: int, eventIndex: int, priceX64: big, supply: big, marketCap: big });
339
+ export type High = Infer<typeof HIGH>;
340
+
341
+ export const HIGHS = object({ indexed, launch: str, first: nullable(HIGH), highs: array(HIGH), more: bool });
342
+ export type Highs = Infer<typeof HIGHS>;
343
+
344
+ export const TRADER_WINDOWS = ["1h", "24h", "7d", "all"] as const;
345
+ export type TraderWindow = (typeof TRADER_WINDOWS)[number];
346
+
347
+ export const LAUNCH_TRADERS = object({
348
+ indexed,
349
+ launch: str,
350
+ window: oneOf(...TRADER_WINDOWS),
351
+ traders: array(object({ trader: str, volume: big, bought: big, sold: big, spent: big, received: big, buys: int, sells: int, lastTimestamp: int })),
352
+ });
353
+ export type LaunchTraders = Infer<typeof LAUNCH_TRADERS>;
354
+
355
+ export const QUOTE_CHAIN = object({ indexed, launch: str, chain: array(object({ launch: str, token: str, quote: str })) });
356
+ export type QuoteChain = Infer<typeof QUOTE_CHAIN>;
357
+
358
+ export const DEV_TRADES = object({ indexed, launch: str, creator: str, trades: array(TRADE) });
359
+ export type DevTrades = Infer<typeof DEV_TRADES>;
360
+
361
+ export const BURNS = object({ indexed, launch: str, burns: array(object({ amount: big, block: int, timestamp: int })), program: array(BURN), wallet: array(BURN) });
362
+ export type Burns = Infer<typeof BURNS>;
363
+
364
+ const LOCK_HOLDER = object({ wallet: str, place: nullable(int) });
365
+
366
+ 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) });
367
+ export type TeamBuyLock = Infer<typeof TEAM_BUY_LOCK>;
368
+ export const LAUNCH_LOCKS = object({ indexed, launch: str, locks: array(TEAM_BUY_LOCK) });
369
+ export type LaunchLocks = Infer<typeof LAUNCH_LOCKS>;
370
+
371
+ export const MARK_ROLES = ["creator", "teamSlot", "creatorRef", "top10"] as const;
372
+ export type MarkRole = (typeof MARK_ROLES)[number];
373
+
374
+ export const MARK = object({ id: str, ...TRADE_FIELDS, who: array(oneOf(...MARK_ROLES)) });
375
+ export type Mark = Infer<typeof MARK>;
376
+
377
+ export const MARKS = object({ indexed, launch: str, trades: array(MARK), next: nullable(str) });
378
+ export type Marks = Infer<typeof MARKS>;
379
+
380
+ export const PRICE = object({
381
+ indexed,
382
+ launch: str,
383
+ phase: oneOf("bonding", "stacks", "tail"),
384
+ priceX64: big,
385
+ livePriceX64: big,
386
+ floorX64: big,
387
+ backedPpm: int,
388
+ bidTopX64: nullable(big),
389
+ lastTrade: nullable(object({ priceAfterX64: big, timestamp: int, block: int })),
390
+ headTimestamp: nullable(int),
391
+ ageS: nullable(int),
392
+ quoteUsd: USD_RATE,
393
+ priceUsd: nullable(decimal),
394
+ });
395
+ export type Price = Infer<typeof PRICE>;
396
+
397
+ export const WALLET_TRADES = object({ indexed, wallet: str, trades: array(PAGED_TRADE), next: nullable(str) });
398
+ export type WalletTrades = Infer<typeof WALLET_TRADES>;
399
+
400
+ export const POSITIONS = object({ indexed, wallet: str, positions: array(object({ launch: str, token: str, quote: str, tokens: big })) });
401
+ export type Positions = Infer<typeof POSITIONS>;
402
+
403
+ export const WALLET_LOCKS = object({
404
+ indexed,
405
+ wallet: str,
406
+ locks: array(object({ launch: str, token: str, kind: oneOf("teamBuy"), direction: oneOf("incoming", "outgoing"), tokens: big, place: nullable(int), createdAt: int, unlocked: bool, unlockedAt: nullable(int), unlockAt: nullable(int), locked: big, claimed: big, holders: array(LOCK_HOLDER) })),
407
+ });
408
+ export type WalletLocks = Infer<typeof WALLET_LOCKS>;
409
+
410
+ const AT = { timestamp: int, block: int };
411
+
412
+ export const INBOX_CLAIMED = object({ ...AT, kind: oneOf("claimed"), launch: str, quote: str, types: int, amount: big, holder: big, txnId: nullable(str) });
413
+
414
+ export const INBOX_GRADUATED = object({ ...AT, kind: oneOf("graduated"), launch: str, priceX64: big, txnId: nullable(str) });
415
+
416
+ export const INBOX_SLOT = object({ ...AT, kind: oneOf("slot"), launch: str, place: int });
417
+
418
+ export const INBOX_DEV_BURN = object({ ...BURN_FIELDS, kind: oneOf("devBurn"), launch: str });
419
+
420
+ export const INBOX_DEV_BUY = object({ ...AT, kind: oneOf("devBuy"), launch: str, wallet: str, role: DEV_BUY_ROLE, count: int, quoteIn: big, tokens: big, txnId: nullable(str) });
421
+
422
+ export type InboxItem = Infer<typeof INBOX_CLAIMED> | Infer<typeof INBOX_GRADUATED> | Infer<typeof INBOX_SLOT> | Infer<typeof INBOX_DEV_BURN> | Infer<typeof INBOX_DEV_BUY>;
423
+ export const INBOX_KINDS = ["claimed", "graduated", "slot", "devBurn", "devBuy"] as const;
424
+
425
+ const INBOX_BY_KIND = { claimed: INBOX_CLAIMED, graduated: INBOX_GRADUATED, slot: INBOX_SLOT, devBurn: INBOX_DEV_BURN, devBuy: INBOX_DEV_BUY };
426
+
427
+ export function inboxItem(v: unknown, p: string): InboxItem | null {
428
+ const kind = typeof v === "object" && v !== null ? (v as { kind?: unknown }).kind : undefined;
429
+ const d = typeof kind === "string" && Object.hasOwn(INBOX_BY_KIND, kind) ? INBOX_BY_KIND[kind as keyof typeof INBOX_BY_KIND] : null;
430
+ if (d === null) {
431
+ str(kind, `${p}.kind`);
432
+ return null;
433
+ }
434
+ return d(v, p) as InboxItem;
435
+ }
436
+
437
+ export const INBOX = object({ indexed, wallet: str, items: (v: unknown, p: string) => array(inboxItem)(v, p).filter((x): x is InboxItem => x !== null) });
438
+ export type Inbox = Infer<typeof INBOX>;
439
+
440
+ export const CLAIM_ROW = object({
441
+ block: int,
442
+ timestamp: int,
443
+ txnId: nullable(str),
444
+ sender: str,
445
+ launch: str,
446
+ quote: str,
447
+ types: int,
448
+ creator: big,
449
+ creatorRef: big,
450
+ teamSlot: big,
451
+ traderRef: big,
452
+ holder: big,
453
+ extra: big,
454
+ amount: big,
455
+ teamBuy: big,
456
+ });
457
+ export type ClaimRow = Infer<typeof CLAIM_ROW>;
458
+
459
+ export const CLAIM_HISTORY = object({ indexed, wallet: str, claims: array(CLAIM_ROW) });
460
+ export type ClaimHistory = Infer<typeof CLAIM_HISTORY>;
461
+
462
+ const QUOTE_TOTAL = object({ quote: str, total: big, types: int });
463
+
464
+ export const CLAIM_VIEW = object({
465
+ indexed,
466
+ claims: object({
467
+ wallet: str,
468
+ atBlock: nullable(int),
469
+ quotes: array(QUOTE_TOTAL),
470
+ totals: record(big),
471
+ launches: optional(array(object({
472
+ launch: str,
473
+ quoteMint: str,
474
+ places: array(int),
475
+ types: int,
476
+ owed: object({ creator: big, creatorRef: big, teamSlot: big }),
477
+ tokens: object({ teamBuy: big, shareBought: big, teamBuyLockedLot: big }),
478
+ }))),
479
+ refOwed: optional(array(object({ account: str, quoteMint: str, owed: big }))),
480
+ pendingRollUp: optional(array(object({ traderRef: str, quoteMint: str, amount: big }))),
481
+ owed: optional(array(object({ quote: str, creator: big, creatorRef: big, teamSlot: big, traderRef: big, holder: big, teamBuy: big }))),
482
+ }),
483
+ });
484
+ export type ClaimView = Infer<typeof CLAIM_VIEW>;
485
+
486
+ export const FIRSTS_ROW = object({ firstActivityAt: nullable(int), firstFloorTradeAt: nullable(int) });
487
+ export type Firsts = Infer<typeof FIRSTS_ROW>;
488
+ export const FIRSTS = object({ indexed, wallet: str, firstActivityAt: nullable(int), firstFloorTradeAt: nullable(int) });
489
+ export const FIRSTS_MANY = object({ indexed, wallets: record(FIRSTS_ROW) });
490
+
491
+ const PER_QUOTE = array(object({ quote: str, amount: big }));
492
+
493
+ export const PEOPLE = object({
494
+ indexed,
495
+ wallet: str,
496
+ people: array(object({ wallet: str, chain: str, roles: array(object({ kind: oneOf("trader", "creator"), tier: int })), earned: PER_QUOTE, teamMilestone: PER_QUOTE })),
497
+ });
498
+ export type People = Infer<typeof PEOPLE>;
499
+
500
+ export const ROLES = object({
501
+ indexed,
502
+ wallet: str,
503
+ roles: object({
504
+ traderRefOf: array(object({ quote: str, trader: str, tier: int })),
505
+ registered: array(object({ launch: str, roles: int })),
506
+ refOwedIn: array(str),
507
+ payoutOwedIn: array(str),
508
+ creatorOf: array(str),
509
+ creatorRefOf: array(object({ launch: str, tier: int })),
510
+ teamSlotOf: array(object({ launch: str, place: int })),
511
+ holdings: array(object({ launch: str, token: str, amount: big })),
512
+ }),
513
+ claimed: record(big),
514
+ });
515
+ export type Roles = Infer<typeof ROLES>;
516
+
517
+ export const TRADER_BOARD = object({
518
+ indexed,
519
+ window: oneOf(...TRADER_WINDOWS),
520
+ traders: array(object({ trader: str, volumeUsd: decimal, trades: int, launches: int, volumeByQuote: record(big), tradesByQuote: record(int) })),
521
+ });
522
+ export type TraderBoard = Infer<typeof TRADER_BOARD>;
523
+
524
+ export const LAUNCHER_BOARD = object({
525
+ indexed,
526
+ launchers: array(object({ creator: str, launches: int, graduated: int, volumeUsd: decimal, liquidityUsd: decimal, bestLaunch: nullable(str), byQuote: record(object({ volume: big, liquidity: big, launches: int })) })),
527
+ });
528
+ export type LauncherBoard = Infer<typeof LAUNCHER_BOARD>;