@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
@@ -0,0 +1,128 @@
1
+
2
+
3
+ import { bytesToHex, checksumAddress, encodeAbi, hexToBytes } from "./abi.js";
4
+ import { encodeFunctionData } from "./items.js";
5
+
6
+ export const UR_V3_SWAP_EXACT_IN = 0x00;
7
+ export const UR_V2_SWAP_EXACT_IN = 0x08;
8
+ export const UR_WRAP_ETH = 0x0b;
9
+ export const UR_UNWRAP_WETH = 0x0c;
10
+ export const UR_SWEEP = 0x04;
11
+ export const UR_MSG_SENDER = "0x0000000000000000000000000000000000000001";
12
+ export const UR_ADDRESS_THIS = "0x0000000000000000000000000000000000000002";
13
+
14
+ const fn = (name , inputs ) => ({ type: "function", name, inputs, outputs: [], stateMutability: "payable" }) ;
15
+ const tup = (fields ) => fields.map(([name, type]) => ({ name, type }));
16
+
17
+ export function v3Path(tokens , fees ) {
18
+ if (tokens.length < 2 || fees.length !== tokens.length - 1) throw new RangeError("a V3 path is n tokens and n − 1 fees");
19
+ let out = "0x";
20
+ tokens.forEach((t, i) => {
21
+ out += bytesToHex(hexToBytes(t)).slice(2);
22
+ if (i < fees.length) {
23
+ const f = fees[i];
24
+ if (!Number.isInteger(f) || f < 0 || f >= 1 << 24) throw new RangeError(`fee ${f} is not a uint24`);
25
+ out += f.toString(16).padStart(6, "0");
26
+ }
27
+ });
28
+ return out;
29
+ }
30
+
31
+ export function algebraPath(tokens ) {
32
+ if (tokens.length < 2) throw new RangeError("a path is at least two tokens");
33
+ return "0x" + tokens.map((t) => bytesToHex(hexToBytes(t)).slice(2)).join("");
34
+ }
35
+
36
+ const checkRoute = (p ) => {
37
+ if (p.amountIn <= 0n) throw new RangeError("amountIn must be > 0");
38
+ if (p.minQuoteOut <= 0n) throw new RangeError("minQuoteOut must be > 0 (the NO_MINIMUM rule)");
39
+ if (p.route.tokens.length < 2) throw new RangeError("a route is at least two tokens");
40
+ };
41
+
42
+ function universalRouter(p ) {
43
+ const wrap = bytesToHex(encodeAbi(["address", "uint256"], [UR_ADDRESS_THIS, p.amountIn]));
44
+ let cmd ;
45
+ let swap ;
46
+ if (p.route.fees) {
47
+ cmd = UR_V3_SWAP_EXACT_IN;
48
+ swap = bytesToHex(encodeAbi(["address", "uint256", "uint256", "bytes", "bool", "uint256[]"], [UR_MSG_SENDER, p.amountIn, p.minQuoteOut, v3Path(p.route.tokens, p.route.fees), false, []]));
49
+ } else {
50
+ cmd = UR_V2_SWAP_EXACT_IN;
51
+ swap = bytesToHex(encodeAbi(["address", "uint256", "uint256", "address[]", "bool", "uint256[]"], [UR_MSG_SENDER, p.amountIn, p.minQuoteOut, [...p.route.tokens], false, []]));
52
+ }
53
+ const commands = "0x" + [UR_WRAP_ETH, cmd].map((c) => c.toString(16).padStart(2, "0")).join("");
54
+ const abi = [fn("execute", [{ name: "commands", type: "bytes" }, { name: "inputs", type: "bytes[]" }, { name: "deadline", type: "uint256" }])];
55
+ return encodeFunctionData(abi, "execute", { commands, inputs: [wrap, swap], deadline: p.deadline });
56
+ }
57
+
58
+ const REFUND_ETH = [fn("refundETH", [])];
59
+ const REFUND_NATIVE = [fn("refundNativeToken", [])];
60
+
61
+ function v3Router(p , v02 ) {
62
+ const fees = p.route.fees;
63
+ if (!fees) throw new RangeError("a V3 router route needs its fees");
64
+ const [tokenIn, tokenOut] = [p.route.tokens[0], p.route.tokens[p.route.tokens.length - 1]];
65
+ let swap ;
66
+ if (p.route.tokens.length === 2) {
67
+ const fields = v02
68
+ ? [["tokenIn", "address"], ["tokenOut", "address"], ["fee", "uint24"], ["recipient", "address"], ["amountIn", "uint256"], ["amountOutMinimum", "uint256"], ["sqrtPriceLimitX96", "uint160"]]
69
+ : [["tokenIn", "address"], ["tokenOut", "address"], ["fee", "uint24"], ["recipient", "address"], ["deadline", "uint256"], ["amountIn", "uint256"], ["amountOutMinimum", "uint256"], ["sqrtPriceLimitX96", "uint160"]];
70
+ const abi = [fn("exactInputSingle", [{ name: "params", type: "tuple", components: tup(fields) }])];
71
+ swap = encodeFunctionData(abi, "exactInputSingle", { params: { tokenIn, tokenOut, fee: BigInt(fees[0]), recipient: p.zap, deadline: p.deadline, amountIn: p.amountIn, amountOutMinimum: p.minQuoteOut, sqrtPriceLimitX96: 0n } });
72
+ } else {
73
+ const fields = v02
74
+ ? [["path", "bytes"], ["recipient", "address"], ["amountIn", "uint256"], ["amountOutMinimum", "uint256"]]
75
+ : [["path", "bytes"], ["recipient", "address"], ["deadline", "uint256"], ["amountIn", "uint256"], ["amountOutMinimum", "uint256"]];
76
+ const abi = [fn("exactInput", [{ name: "params", type: "tuple", components: tup(fields) }])];
77
+ swap = encodeFunctionData(abi, "exactInput", { params: { path: v3Path(p.route.tokens, fees), recipient: p.zap, deadline: p.deadline, amountIn: p.amountIn, amountOutMinimum: p.minQuoteOut } });
78
+ }
79
+ const refund = encodeFunctionData(REFUND_ETH, "refundETH");
80
+ if (v02) return encodeFunctionData([fn("multicall", [{ name: "deadline", type: "uint256" }, { name: "data", type: "bytes[]" }])], "multicall", { deadline: p.deadline, data: [swap, refund] });
81
+ return encodeFunctionData([fn("multicall", [{ name: "data", type: "bytes[]" }])], "multicall", { data: [swap, refund] });
82
+ }
83
+
84
+ function algebra(p ) {
85
+ const [tokenIn, tokenOut] = [p.route.tokens[0], p.route.tokens[p.route.tokens.length - 1]];
86
+ let swap ;
87
+ if (p.route.tokens.length === 2) {
88
+ const fields = [["tokenIn", "address"], ["tokenOut", "address"], ["recipient", "address"], ["deadline", "uint256"], ["amountIn", "uint256"], ["amountOutMinimum", "uint256"], ["limitSqrtPrice", "uint160"]];
89
+ swap = encodeFunctionData([fn("exactInputSingle", [{ name: "params", type: "tuple", components: tup(fields) }])], "exactInputSingle", { params: { tokenIn, tokenOut, recipient: p.zap, deadline: p.deadline, amountIn: p.amountIn, amountOutMinimum: p.minQuoteOut, limitSqrtPrice: 0n } });
90
+ } else {
91
+ const fields = [["path", "bytes"], ["recipient", "address"], ["deadline", "uint256"], ["amountIn", "uint256"], ["amountOutMinimum", "uint256"]];
92
+ swap = encodeFunctionData([fn("exactInput", [{ name: "params", type: "tuple", components: tup(fields) }])], "exactInput", { params: { path: algebraPath(p.route.tokens), recipient: p.zap, deadline: p.deadline, amountIn: p.amountIn, amountOutMinimum: p.minQuoteOut } });
93
+ }
94
+ return encodeFunctionData([fn("multicall", [{ name: "data", type: "bytes[]" }])], "multicall", { data: [swap, encodeFunctionData(REFUND_NATIVE, "refundNativeToken")] });
95
+ }
96
+
97
+ function v2Router(p ) {
98
+ const abi = [fn("swapExactETHForTokens", tup([["amountOutMin", "uint256"], ["path", "address[]"], ["to", "address"], ["deadline", "uint256"]]))];
99
+ return encodeFunctionData(abi, "swapExactETHForTokens", { amountOutMin: p.minQuoteOut, path: [...p.route.tokens], to: p.zap, deadline: p.deadline });
100
+ }
101
+
102
+ function aerodromeV2(p ) {
103
+ const { tokens, stable, factory } = p.route;
104
+ if (!stable || stable.length !== tokens.length - 1 || !factory) throw new RangeError("an Aerodrome route needs a stable flag per hop and the factory");
105
+ const route = { name: "routes", type: "tuple[]", components: tup([["from", "address"], ["to", "address"], ["stable", "bool"], ["factory", "address"]]) };
106
+ const abi = [fn("swapExactETHForTokens", [{ name: "amountOutMin", type: "uint256" }, route, { name: "to", type: "address" }, { name: "deadline", type: "uint256" }])];
107
+ const routes = stable.map((s, i) => ({ from: tokens[i], to: tokens[i + 1], stable: s, factory }));
108
+ return encodeFunctionData(abi, "swapExactETHForTokens", { amountOutMin: p.minQuoteOut, routes, to: p.zap, deadline: p.deadline });
109
+ }
110
+
111
+ export function zapSwapData(p ) {
112
+ checkRoute(p);
113
+ checksumAddress(p.zap);
114
+ switch (p.family) {
115
+ case "uniswap-ur":
116
+ return universalRouter(p);
117
+ case "v3-router":
118
+ return v3Router(p, false);
119
+ case "v3-router02":
120
+ return v3Router(p, true);
121
+ case "algebra":
122
+ return algebra(p);
123
+ case "v2-router":
124
+ return v2Router(p);
125
+ case "aerodrome-v2":
126
+ return aerodromeV2(p);
127
+ }
128
+ }
@@ -0,0 +1,53 @@
1
+
2
+
3
+ import { addressBytes, base58Encode } from "./codec.js";
4
+ import { encodeAccount } from "./solana/floor/accounts.js";
5
+ import { TOKEN_PROGRAM_ID } from "./solana/pda.js";
6
+ import { encodeAccountV2 } from "./v2/layouts.js";
7
+
8
+ export function fixtureAddress(i ) {
9
+ if (!Number.isInteger(i) || i < 0 || i > 0xffff) throw new RangeError(`fixture slot ${i}`);
10
+ const b = new Uint8Array(32);
11
+ b[0] = 0xf0;
12
+ b[1] = i & 0xff;
13
+ b[2] = i >> 8;
14
+ return base58Encode(b);
15
+ }
16
+
17
+ export function fixtureEvmAddress(i ) {
18
+ if (!Number.isInteger(i) || i < 0 || i > 0xffff) throw new RangeError(`fixture slot ${i}`);
19
+ return "0x" + "f0".padEnd(36, "0") + i.toString(16).padStart(4, "0");
20
+ }
21
+
22
+ export const fixtureKeys = () => ({
23
+ launch: fixtureAddress(1), creator: fixtureAddress(2), wallet: fixtureAddress(3), quoteMint: fixtureAddress(4), baseMint: fixtureAddress(5),
24
+ tokenVault: fixtureAddress(6), quoteVault: fixtureAddress(7), teamSlot: fixtureAddress(8),
25
+ });
26
+
27
+ export function launchV2Fixture(v = {}) {
28
+ const k = fixtureKeys();
29
+ return {
30
+ address: k.launch,
31
+ data: encodeAccountV2("LaunchV2", {
32
+ createdAt: 1_000n, creator: k.creator, quoteMint: k.quoteMint, quoteTokenProgram: TOKEN_PROGRAM_ID, baseMint: k.baseMint, tokenVault: k.tokenVault,
33
+ quoteVault: k.quoteVault, creatorRef: [k.creator, k.creator, k.creator], ...v,
34
+ }),
35
+ };
36
+ }
37
+
38
+ export function teamSlotFixture(members = []) {
39
+ const k = fixtureKeys();
40
+ if (members.length > 10) throw new RangeError("a Team Slot holds at most 10 members");
41
+ const ms = Array.from({ length: 10 }, (_, i) => ({ key: members[i] ? addressBytes(members[i].key) : new Uint8Array(32), kind: members[i]?.kind ?? 0, state: members[i] ? members[i].state ?? 2 : 0 }));
42
+ return { address: k.teamSlot, data: encodeAccount("TeamSlot", { memberCount: members.length, flags: 1, launch: k.launch, creator: k.creator, members: ms }) };
43
+ }
44
+
45
+ export function holderPositionFixture(v = {}) {
46
+ const k = fixtureKeys();
47
+ return encodeAccountV2("HolderPosition", { launch: k.launch, owner: k.wallet, amount: v.amount ?? 0n, indexSnap: v.indexSnap ?? 0n, owed: v.owed ?? 0n });
48
+ }
49
+
50
+ export function holderBookFixture(v = {}) {
51
+ const k = fixtureKeys();
52
+ return encodeAccountV2("HolderBook", { launch: k.launch, mint: k.baseMint, w: v.w ?? 0n, index: v.index ?? 0n, carry: v.carry ?? 0n, bookedTotal: 0n, paidTotal: 0n });
53
+ }
@@ -0,0 +1,28 @@
1
+
2
+ import { EVM_FUNCTION_SELECTORS } from "./interface.gen.js";
3
+
4
+ export { CLAIM_BITS, CLAIM_KNOWN_MASKS, CLAIM_RESERVED, EVM_FUNCTION_SELECTORS, PROGRAM_IDS } from "./interface.gen.js";
5
+
6
+ import { CLAIM_BITS, CLAIM_RESERVED } from "./interface.gen.js";
7
+
8
+ export const CLAIM_CREATOR = CLAIM_BITS.solana.creator;
9
+ export const CLAIM_CREATOR_REF = CLAIM_BITS.solana.creatorRef;
10
+ export const CLAIM_TEAM_SLOT = CLAIM_BITS.solana.teamSlot;
11
+ export const CLAIM_TRADER_REF = CLAIM_BITS.solana.traderRef;
12
+
13
+ export const CLAIM_RESERVED_HOLDER = CLAIM_RESERVED.solana.holderV1;
14
+
15
+ export const CLAIM_EXTRA = CLAIM_RESERVED.solana.extra;
16
+
17
+ export const CLAIM_TEAM_BUY = CLAIM_BITS.solana.teamBuy;
18
+
19
+ export const CLAIM_SHARE_BOUGHT = CLAIM_BITS.solana.shareBought;
20
+
21
+ export function evmFunction(name , source ) {
22
+ const rows = EVM_FUNCTION_SELECTORS.filter((r) => r.name === name && (source === undefined || r.sources.includes(source)));
23
+ if (rows.length === 0) throw new Error(`no printed EVM function ${name}${source ? ` in ${source}` : ""}`);
24
+ if (rows.length > 1) throw new Error(`${name} is overloaded (${rows.map((r) => r.signature).join(", ")}): pass the source module`);
25
+ return rows[0];
26
+ }
27
+
28
+ export const evmSignature = (name , source ) => evmFunction(name, source).signature;
@@ -0,0 +1,146 @@
1
+
2
+
3
+ export const PROGRAM_IDS = {"floorAmm":"GUhcaRccPyjdXtXmRWWopvsERfTEweqSS1Sa1FsFLooR","floorHook":"HVo1eRwj5SHtjkmHa4cVSV5KeL2BenN2d5qM2bqFLooR","upgradeTimelock":"87UhRsuVHieTz8ZTWHW7YMGQCYgh5TJQjogQ9UbxTiME"};
4
+
5
+ export const CLAIM_BITS = {"solana":{"creator":1,"creatorRef":2,"teamSlot":4,"traderRef":8,"teamBuy":128,"shareBought":256,"holder":512,"payout":null},"evm":{"creator":1,"creatorRef":2,"teamSlot":4,"traderRef":8,"teamBuy":128,"shareBought":256,"holder":512,"payout":64}};
6
+
7
+ export const CLAIM_RESERVED = {"solana":{"holderV1":16,"payout":64,"extra":32},"evm":{"holderV1":16,"extra":32}};
8
+
9
+ export const CLAIM_KNOWN_MASKS = {"solana":{"claim":143,"claimWideV1":399,"v2":911},"evm":{"v1":111,"v2":975}};
10
+
11
+  
12
+
13
+ export const EVM_FUNCTION_SELECTORS = [
14
+ { name: "acceptAuthority", signature: "acceptAuthority()", selector: "0x1580798f", sources: ["floorAmm"] },
15
+ { name: "accounted", signature: "accounted(address)", selector: "0xee1a56ce", sources: ["floorAmm"] },
16
+ { name: "addPreset", signature: "addPreset(uint8,bytes)", selector: "0xb88257b1", sources: ["floorAmm"] },
17
+ { name: "addQuote", signature: "addQuote(address,uint256,uint256)", selector: "0x488c664b", sources: ["floorAmm"] },
18
+ { name: "addReward", signature: "addReward(uint256)", selector: "0x74de4ec4", sources: ["floorTokenIndexed"] },
19
+ { name: "allowance", signature: "allowance(address,address)", selector: "0xdd62ed3e", sources: ["floorToken","floorTokenIndexed"] },
20
+ { name: "approve", signature: "approve(address,uint256)", selector: "0x095ea7b3", sources: ["floorToken","floorTokenIndexed"] },
21
+ { name: "authority", signature: "authority()", selector: "0xbf7e214f", sources: ["floorAmm"] },
22
+ { name: "balanceOf", signature: "balanceOf(address)", selector: "0x70a08231", sources: ["floorToken","floorTokenIndexed"] },
23
+ { name: "bidMoney", signature: "bidMoney(uint256)", selector: "0x8e403c51", sources: ["floorAmmViewsV2"] },
24
+ { name: "bindHandle", signature: "bindHandle(bytes32,address,address[],uint256,bytes,bytes)", selector: "0xcea3463e", sources: ["floorAmm"] },
25
+ { name: "bookEngine", signature: "bookEngine()", selector: "0x72148c77", sources: ["floorAmmV2"] },
26
+ { name: "bookState", signature: "bookState()", selector: "0x2c14e3f2", sources: ["floorTokenIndexed"] },
27
+ { name: "bookTotals", signature: "bookTotals()", selector: "0xbffc2073", sources: ["floorTokenIndexed"] },
28
+ { name: "burn", signature: "burn(uint256)", selector: "0x42966c68", sources: ["floorToken","floorTokenIndexed"] },
29
+ { name: "burnFrom", signature: "burnFrom(address,uint256)", selector: "0x79cc6790", sources: ["floorToken","floorTokenIndexed"] },
30
+ { name: "burnTeamV2", signature: "burnTeamV2(uint256,uint8,uint256)", selector: "0x2f7bf11b", sources: ["floorAmmClaimsV2"] },
31
+ { name: "buy", signature: "buy(uint256,uint256,uint256,address,uint256)", selector: "0x102d8c79", sources: ["floorAmm","floorAmmV2"] },
32
+ { name: "buyFromBalance", signature: "buyFromBalance(uint256,uint256,address,address,uint256)", selector: "0x5f9f56d2", sources: ["floorAmm","floorAmmV2"] },
33
+ { name: "buyWithEth", signature: "buyWithEth(uint256,bytes,uint256,uint256,address,uint256)", selector: "0xef8772c4", sources: ["floorZap"] },
34
+ { name: "buyWithToken", signature: "buyWithToken(uint256,address,uint256,bytes,uint256,uint256,address,uint256)", selector: "0x9fd30605", sources: ["floorZap"] },
35
+ { name: "checkPreset", signature: "checkPreset(bytes)", selector: "0x6337513e", sources: ["floorAmm"] },
36
+ { name: "circulatingOf", signature: "circulatingOf(uint256)", selector: "0x72812fcf", sources: ["floorAmmViewsV2"] },
37
+ { name: "claim", signature: "claim(address,uint256,uint256[],address[])", selector: "0xa461a90d", sources: ["floorAmm","floorAmmClaimsV2"] },
38
+ { name: "claimPayoutTo", signature: "claimPayoutTo(address,address)", selector: "0xc14ab75d", sources: ["floorAmm"] },
39
+ { name: "clearTraderRef", signature: "clearTraderRef(address)", selector: "0x53550430", sources: ["floorAmm"] },
40
+ { name: "createBookEngine", signature: "createBookEngine()", selector: "0x0fdf26a7", sources: ["floorAmmCreateV2"] },
41
+ { name: "createLaunch", signature: "createLaunch((uint8,address,string,string,uint256,uint256,bool,bytes32,uint256,uint16))", selector: "0x25b62f18", sources: ["floorAmm","floorAmmCreateV2"] },
42
+ { name: "createPaused", signature: "createPaused()", selector: "0xbac7b497", sources: ["floorAmm"] },
43
+ { name: "creditBacking", signature: "creditBacking(uint256,uint256)", selector: "0x1f341504", sources: ["floorAmmV2"] },
44
+ { name: "DEAD", signature: "DEAD()", selector: "0x03fd2a45", sources: ["floorTokenIndexed"] },
45
+ { name: "decimals", signature: "decimals()", selector: "0x313ce567", sources: ["floorToken","floorTokenIndexed"] },
46
+ { name: "decodeRow", signature: "decodeRow(bytes)", selector: "0x8fff698d", sources: ["floorAmmCreateV2"] },
47
+ { name: "deletePreset", signature: "deletePreset(uint8)", selector: "0xb2d0d2a5", sources: ["floorAmm"] },
48
+ { name: "DOMAIN_SEPARATOR", signature: "DOMAIN_SEPARATOR()", selector: "0x3644e515", sources: ["floorToken","floorTokenIndexed"] },
49
+ { name: "eip712Domain", signature: "eip712Domain()", selector: "0x84b0196e", sources: ["floorTokenIndexed"] },
50
+ { name: "floorAmm", signature: "floorAmm()", selector: "0x78164d52", sources: ["floorZap"] },
51
+ { name: "floorTokenAccrued", signature: "floorTokenAccrued(address)", selector: "0xf3a261f9", sources: ["floorAmm"] },
52
+ { name: "handleOwed", signature: "handleOwed(bytes32,address)", selector: "0xaad2ed5c", sources: ["floorAmm"] },
53
+ { name: "handleWallet", signature: "handleWallet(bytes32)", selector: "0xc6da686d", sources: ["floorAmm"] },
54
+ { name: "holderBook", signature: "holderBook(uint256)", selector: "0xf5d23b14", sources: ["floorAmmViewsV2"] },
55
+ { name: "holderBucket", signature: "holderBucket(address)", selector: "0x088806d0", sources: ["floorAmm"] },
56
+ { name: "holderDest", signature: "holderDest()", selector: "0x84a6263a", sources: ["floorAmm"] },
57
+ { name: "initialize", signature: "initialize(address,address,address,address)", selector: "0xf8c8765e", sources: ["floorAmm"] },
58
+ { name: "initialize", signature: "initialize(string,string,uint256)", selector: "0xb119490e", sources: ["floorTokenIndexed"] },
59
+ { name: "launchBook", signature: "launchBook(uint256)", selector: "0x926310f1", sources: ["floorAmmViewsV2"] },
60
+ { name: "launchCount", signature: "launchCount()", selector: "0x27cca59f", sources: ["floorAmm","floorAmmViewsV2"] },
61
+ { name: "launchFeeCurve", signature: "launchFeeCurve(uint256)", selector: "0xc598083f", sources: ["floorAmmViewsV2"] },
62
+ { name: "launchId", signature: "launchId()", selector: "0x35f6efa9", sources: ["floorToken","floorTokenIndexed"] },
63
+ { name: "launchMilestones", signature: "launchMilestones(uint256)", selector: "0x2414ccf1", sources: ["floorAmmViewsV2"] },
64
+ { name: "launchOf", signature: "launchOf(address)", selector: "0x029282d7", sources: ["floorAmm","floorAmmViewsV2"] },
65
+ { name: "launchOfPair", signature: "launchOfPair(bytes32)", selector: "0x08415ca8", sources: ["floorAmmViewsV2"] },
66
+ { name: "launchQuote", signature: "launchQuote(uint256)", selector: "0x98032919", sources: ["floorAmm","floorAmmViewsV2"] },
67
+ { name: "launchState", signature: "launchState(uint256)", selector: "0xac3307e8", sources: ["floorAmm","floorAmmViewsV2"] },
68
+ { name: "launchToken", signature: "launchToken(uint256)", selector: "0x6a19197b", sources: ["floorAmm","floorAmmViewsV2"] },
69
+ { name: "metadataBase", signature: "metadataBase()", selector: "0x65b973c3", sources: ["floorAmm"] },
70
+ { name: "metadataURI", signature: "metadataURI()", selector: "0x03ee438c", sources: ["floorToken","floorTokenIndexed"] },
71
+ { name: "moveHandleOwed", signature: "moveHandleOwed(bytes32,address[])", selector: "0xc43594a1", sources: ["floorAmm"] },
72
+ { name: "name", signature: "name()", selector: "0x06fdde03", sources: ["floorToken","floorTokenIndexed"] },
73
+ { name: "NATIVE", signature: "NATIVE()", selector: "0xa0cf0aea", sources: ["floorAmm"] },
74
+ { name: "nativeCreateFee", signature: "nativeCreateFee()", selector: "0x10b51e45", sources: ["floorAmm"] },
75
+ { name: "nextModule", signature: "nextModule()", selector: "0xf85abfc7", sources: ["floorAmmV2","floorAmmViewsV2","floorAmmCreateV2","floorAmmClaimsV2"] },
76
+ { name: "nextPresetId", signature: "nextPresetId()", selector: "0xc8a768e6", sources: ["floorAmm"] },
77
+ { name: "nonces", signature: "nonces(address)", selector: "0x7ecebe00", sources: ["floorToken","floorTokenIndexed"] },
78
+ { name: "noteBurn", signature: "noteBurn(uint256)", selector: "0x6db7cd01", sources: ["floorAmmCreateV2"] },
79
+ { name: "noteDead", signature: "noteDead(uint256)", selector: "0xbdf3b0de", sources: ["floorAmmCreateV2"] },
80
+ { name: "optedIn", signature: "optedIn(address)", selector: "0x4824b8fd", sources: ["floorTokenIndexed"] },
81
+ { name: "optIn", signature: "optIn()", selector: "0x5b48684e", sources: ["floorTokenIndexed"] },
82
+ { name: "owedOf", signature: "owedOf(address,address)", selector: "0xfacba08d", sources: ["floorAmm"] },
83
+ { name: "owedOfMany", signature: "owedOfMany(address,address[])", selector: "0xa1efa4ba", sources: ["floorAmm"] },
84
+ { name: "owedV2", signature: "owedV2(address,uint256[],address[])", selector: "0xdd3ee1ef", sources: ["floorAmmViewsV2"] },
85
+ { name: "pairIdOf", signature: "pairIdOf(uint256)", selector: "0x83a74ea3", sources: ["floorAmmViewsV2"] },
86
+ { name: "payoutOwed", signature: "payoutOwed(address,address)", selector: "0xae3f9120", sources: ["floorAmm"] },
87
+ { name: "pendingAuthority", signature: "pendingAuthority()", selector: "0xfabb94bb", sources: ["floorAmm"] },
88
+ { name: "permit", signature: "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0xd505accf", sources: ["floorToken","floorTokenIndexed"] },
89
+ { name: "platformOwed", signature: "platformOwed(address)", selector: "0x240b9586", sources: ["floorAmm"] },
90
+ { name: "positionOf", signature: "positionOf(address)", selector: "0xfd2d39c5", sources: ["floorTokenIndexed"] },
91
+ { name: "predictToken", signature: "predictToken(address,bytes32)", selector: "0x486e36c8", sources: ["floorAmm","floorAmmCreateV2"] },
92
+ { name: "presetRow", signature: "presetRow(uint8)", selector: "0xa0c15861", sources: ["floorAmm"] },
93
+ { name: "priceUpdater", signature: "priceUpdater()", selector: "0xfc612a8d", sources: ["floorAmm"] },
94
+ { name: "program", signature: "program()", selector: "0xc860ebc6", sources: ["floorToken","floorTokenIndexed"] },
95
+ { name: "proxiableUUID", signature: "proxiableUUID()", selector: "0x52d1902d", sources: ["floorAmmV2"] },
96
+ { name: "quoteBuy", signature: "quoteBuy(uint256,uint256,address)", selector: "0xec7a34c9", sources: ["floorAmm","floorAmmV2"] },
97
+ { name: "quoteEntry", signature: "quoteEntry(address)", selector: "0x77665076", sources: ["floorAmm"] },
98
+ { name: "quoteRisk", signature: "quoteRisk(address)", selector: "0x1461d14e", sources: ["floorAmm"] },
99
+ { name: "quotes", signature: "quotes()", selector: "0xd6a5d7db", sources: ["floorAmm"] },
100
+ { name: "quoteSell", signature: "quoteSell(uint256,uint256,address)", selector: "0x0cff08d1", sources: ["floorAmm","floorAmmV2"] },
101
+ { name: "referralAuthority", signature: "referralAuthority()", selector: "0x2fe0a99a", sources: ["floorAmm"] },
102
+ { name: "releaseSkipped", signature: "releaseSkipped(address)", selector: "0x215fa9eb", sources: ["floorTokenIndexed"] },
103
+ { name: "router", signature: "router()", selector: "0xf887ea40", sources: ["floorZap"] },
104
+ { name: "sell", signature: "sell(uint256,uint256,uint256,address,uint256)", selector: "0xbadb999b", sources: ["floorAmm","floorAmmV2"] },
105
+ { name: "sellFromBalance", signature: "sellFromBalance(uint256,uint256,address,uint256)", selector: "0x611b00a8", sources: ["floorAmm","floorAmmV2"] },
106
+ { name: "sellWithPermit", signature: "sellWithPermit(uint256,uint256,uint256,address,uint256,uint256,uint8,bytes32,bytes32)", selector: "0x2ab030d3", sources: ["floorAmm","floorAmmV2"] },
107
+ { name: "setCreatePaused", signature: "setCreatePaused(bool)", selector: "0x83bcec85", sources: ["floorAmm"] },
108
+ { name: "setHolderDest", signature: "setHolderDest(address)", selector: "0x6ad3e66d", sources: ["floorAmm"] },
109
+ { name: "setMetadataBase", signature: "setMetadataBase(string)", selector: "0xd3811c0f", sources: ["floorAmm"] },
110
+ { name: "setNativeCreateFee", signature: "setNativeCreateFee(uint256)", selector: "0xa4433667", sources: ["floorAmm"] },
111
+ { name: "setPresetEnabled", signature: "setPresetEnabled(uint8,bool)", selector: "0x673fb9a9", sources: ["floorAmm"] },
112
+ { name: "setPriceUpdater", signature: "setPriceUpdater(address)", selector: "0x97c4a5f3", sources: ["floorAmm"] },
113
+ { name: "setQuoteCap", signature: "setQuoteCap(address,uint128)", selector: "0x42adf398", sources: ["floorAmm"] },
114
+ { name: "setQuotePrice", signature: "setQuotePrice(address,uint256)", selector: "0x3857ed9e", sources: ["floorAmm"] },
115
+ { name: "setReferralAuthority", signature: "setReferralAuthority(address)", selector: "0x46325d7a", sources: ["floorAmm"] },
116
+ { name: "setTimelock", signature: "setTimelock(address)", selector: "0xbdacb303", sources: ["floorAmm"] },
117
+ { name: "setTraderRef", signature: "setTraderRef(address,address[3],uint256,bytes,bytes)", selector: "0xd7426758", sources: ["floorAmm"] },
118
+ { name: "setTreasury", signature: "setTreasury(address)", selector: "0xf0f44260", sources: ["floorAmm"] },
119
+ { name: "simBuy", signature: "simBuy(uint256,uint256,address)", selector: "0xf69acbed", sources: ["floorAmmV2"] },
120
+ { name: "simSell", signature: "simSell(uint256,uint256,address)", selector: "0xd3536ecd", sources: ["floorAmmV2"] },
121
+ { name: "symbol", signature: "symbol()", selector: "0x95d89b41", sources: ["floorToken","floorTokenIndexed"] },
122
+ { name: "takeOwed", signature: "takeOwed(address)", selector: "0x5e9d234b", sources: ["floorTokenIndexed"] },
123
+ { name: "teamShareBuy", signature: "teamShareBuy(uint256,uint256,uint256,uint256)", selector: "0x5ca91374", sources: ["floorAmm","floorAmmV2"] },
124
+ { name: "teamShareBuyAndClaim", signature: "teamShareBuyAndClaim(uint256,uint256,uint256,uint256)", selector: "0xc7f1048c", sources: ["floorAmmViewsV2"] },
125
+ { name: "teamShareOf", signature: "teamShareOf(uint256,address)", selector: "0xb2280af2", sources: ["floorAmm","floorAmmViewsV2"] },
126
+ { name: "teamSlotAdd", signature: "teamSlotAdd(uint256,bytes32,uint8,uint256,bool)", selector: "0xd5402e81", sources: ["floorAmm","floorAmmClaimsV2"] },
127
+ { name: "teamSlotOf", signature: "teamSlotOf(uint256)", selector: "0x8744aded", sources: ["floorAmmViewsV2"] },
128
+ { name: "timelock", signature: "timelock()", selector: "0xd33219b4", sources: ["floorAmm"] },
129
+ { name: "TOKEN_SCALE", signature: "TOKEN_SCALE()", selector: "0xcae07d2a", sources: ["floorTokenIndexed"] },
130
+ { name: "tokenImplV2", signature: "tokenImplV2()", selector: "0x01b9b386", sources: ["floorAmmCreateV2"] },
131
+ { name: "TOTAL_SUPPLY", signature: "TOTAL_SUPPLY()", selector: "0x902d55a5", sources: ["floorTokenIndexed"] },
132
+ { name: "totalSupply", signature: "totalSupply()", selector: "0x18160ddd", sources: ["floorToken","floorTokenIndexed"] },
133
+ { name: "traderRef", signature: "traderRef(address)", selector: "0xcfc18291", sources: ["floorAmm","floorAmmViewsV2"] },
134
+ { name: "transfer", signature: "transfer(address,uint256)", selector: "0xa9059cbb", sources: ["floorToken","floorTokenIndexed"] },
135
+ { name: "transferAuthority", signature: "transferAuthority(address)", selector: "0x3078db6c", sources: ["floorAmm"] },
136
+ { name: "transferFrom", signature: "transferFrom(address,address,uint256)", selector: "0x23b872dd", sources: ["floorToken","floorTokenIndexed"] },
137
+ { name: "treasury", signature: "treasury()", selector: "0x61d027b3", sources: ["floorAmm"] },
138
+ { name: "unlockCreatorBuy", signature: "unlockCreatorBuy(uint256)", selector: "0xf03d6d5e", sources: ["floorAmm","floorAmmClaimsV2"] },
139
+ { name: "updatePreset", signature: "updatePreset(uint8,bytes)", selector: "0x005d9e72", sources: ["floorAmm"] },
140
+ { name: "updateQuote", signature: "updateQuote(address,bool,uint256,uint256)", selector: "0x21593d6e", sources: ["floorAmm"] },
141
+ { name: "UPGRADE_INTERFACE_VERSION", signature: "UPGRADE_INTERFACE_VERSION()", selector: "0xad3cb1cc", sources: ["floorAmmV2"] },
142
+ { name: "upgradeToAndCall", signature: "upgradeToAndCall(address,bytes)", selector: "0x4f1ef286", sources: ["floorAmmV2"] },
143
+ { name: "withdrawHolder", signature: "withdrawHolder(address,uint256)", selector: "0xfb90c8bf", sources: ["floorAmm","floorAmmCreateV2"] },
144
+ { name: "withdrawPlatform", signature: "withdrawPlatform(address,uint256)", selector: "0x7fe33965", sources: ["floorAmm","floorAmmCreateV2"] },
145
+ { name: "withdrawPlatformMany", signature: "withdrawPlatformMany(uint256[])", selector: "0x7c74681b", sources: ["floorAmmCreateV2"] },
146
+ ];
package/dist/handle.js ADDED
@@ -0,0 +1,22 @@
1
+
2
+
3
+ import { keccak256 } from "./evm/keccak.js";
4
+ import { hex } from "./codec.js";
5
+
6
+ export function handleKeyPreimage(platform , handle ) {
7
+ const p = platform.trim().toLowerCase();
8
+ if (!/^[a-z0-9]+$/.test(p)) throw new RangeError(`a platform is its lowercase short name (e.g. "x"): ${JSON.stringify(platform)}`);
9
+ let h = handle.trim();
10
+ if (h.startsWith("@")) h = h.slice(1);
11
+ h = h.toLowerCase();
12
+ if (h.length === 0 || /[\s@:]/u.test(h)) throw new RangeError(`a handle has no spaces, no ':' and no '@' but one leading: ${JSON.stringify(handle)}`);
13
+ return `${p}:${h}`;
14
+ }
15
+
16
+ export function teamSlotHandleKey(platform , handle ) {
17
+ return keccak256(new TextEncoder().encode(handleKeyPreimage(platform, handle)));
18
+ }
19
+
20
+ export function teamSlotHandleId(platform , handle ) {
21
+ return "0x" + hex(teamSlotHandleKey(platform, handle));
22
+ }
package/dist/index.js CHANGED
@@ -1,7 +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';
7
- //# sourceMappingURL=index.js.map
1
+
2
+
3
+ export * from "./v2/solanaSettle.js";
4
+ export * from "./v2/burnPreview.js";
5
+ export * from "./v2/evmReads.js";
6
+ export * from "./v2/presetRowEvm.js";
7
+
8
+ export * from "./v2/claimAllEvm.js";
9
+
10
+ export * as math from "./math/index.js";
11
+ export * as mathGenesis from "./math/genesis.js";
12
+ export * as codec from "./codec.js";
13
+ export * as quote from "./quote.js";
14
+ export * as solanaInstruction from "./solana/instruction.js";
15
+ export * as solanaPda from "./solana/pda.js";
16
+ export * as solanaTx from "./solana/tx.js";
17
+ export * as solanaAlt from "./solana/alt.js";
18
+ export * as handle from "./handle.js";
19
+ export * as burn from "./burn.js";
20
+ export * as evmKeccak from "./evm/keccak.js";
21
+ export * as evmAbi from "./evm/abi.js";
22
+ export * as evmItems from "./evm/items.js";
23
+ export * as evmZap from "./evm/zap.js";
24
+ export * as evmRouter from "./evm/router.js";
25
+ export * as evmChains from "./evm/chains.js";
26
+ export * as evmMulticall from "./evm/multicall.js";
27
+ export * as evmFloorAbiGen from "./evm/floor/abi.gen.js";
28
+ export * as evmFloorIface from "./evm/floor/iface.js";
29
+ export * as evmFloorCalls from "./evm/floor/calls.js";
30
+ export * as evmFloorEvents from "./evm/floor/events.js";
31
+ export * as solanaFloorProgram from "./solana/floor/program.js";
32
+ export * as solanaFloorAccounts from "./solana/floor/accounts.js";
33
+ export * as solanaFloorInstructions from "./solana/floor/instructions.js";
34
+ export * as solanaFloorCreate from "./solana/floor/create.js";
35
+ export * as solanaFloorEvents from "./solana/floor/events.js";
36
+ export * as solanaFloorRegistry from "./solana/floor/registry.js";
37
+ export * as solanaFloorMetadata from "./solana/floor/metadata.js";
38
+ export * as solanaFloorGenesis from "./solana/floor/genesis.js";
39
+ export * as solanaFloorMint from "./solana/floor/mint.js";
40
+ export * as indexerRead from "./indexer/read.js";
41
+ export * as indexerStream from "./indexer/stream.js";
42
+ export * as evmBalances from "./evm/balances.js";
43
+ export * as v2Circulating from "./v2/circulating.js";
44
+ export * as v2Dead from "./v2/dead.js";
45
+ export * as v2Layouts from "./v2/layouts.js";
46
+ export * as v2Solana from "./v2/solana.js";
47
+ export * as v2SolanaSettle from "./v2/solanaSettle.js";
48
+ export * as v2BurnPreview from "./v2/burnPreview.js";
49
+ export * as v2EvmReads from "./v2/evmReads.js";
50
+ export * as v2PresetRowEvm from "./v2/presetRowEvm.js";
51
+ export * as v2ClaimAllEvm from "./v2/claimAllEvm.js";
52
+ export * as v2QuoteMint from "./v2/quoteMint.js";
53
+ export * as v2Genesis from "./v2/genesis.js";
54
+ export * as v2Events from "./v2/events.js";
55
+ export * as v2Evm from "./v2/evm.js";
56
+ export * as v2Types from "./v2/types.js";
57
+ export * as mathV2Wide from "./math/v2/wide.js";
58
+ export * as mathV2Sqrt from "./math/v2/sqrt.js";
59
+ export * as mathV2Fees from "./math/v2/fees.js";
60
+ export * as mathV2Book from "./math/v2/book.js";
61
+ export * as mathV2Trade from "./math/v2/trade.js";
62
+ export * as mathV2Supply from "./math/v2/supply.js";
63
+ export * as mathV2Error from "./math/v2/error.js";
64
+ export * as mathV2Holders from "./math/v2/holders.js";
65
+ export * as mathV2Milestones from "./math/v2/milestones.js";
66
+ export * as mathV2Rows from "./math/v2/rows.js";
67
+ export * as mathV2Circulating from "./math/v2/circulating.js";
68
+ export * as mathV2Ask from "./math/v2/ask.js";
69
+ export * as mathV2Feasibility from "./math/v2/feasibility.js";
70
+ export * as v2Devbuy from "./v2/devbuy.js";
71
+ export * as v2Route from "./v2/route.js";
72
+ export * as mathV2Split from "./math/v2/split.js";
73
+ export * as mathV2Relay from "./math/v2/relay.js";
74
+ export * as mathV2Create from "./math/v2/create.js";
75
+ export * as mathV2Display from "./math/v2/display.js";
76
+ export * as v2MarketEvm from "./v2/market-evm.js";
77
+ export * as mathV2Team from "./math/v2/team.js";
78
+ export * as mathV2Receipt from "./math/v2/receipt.js";
79
+ export * as v2Claims from "./v2/claims.js";
80
+ export * as v2ClaimsEvm from "./v2/claims-evm.js";
81
+ export * as v2RouteAlt from "./v2/route-alt.js";
82
+ export * as v2Tx from "./v2/tx/index.js";
83
+ export * as events from "./events/index.js";
84
+ export * as abi from "./abi/index.js";
85
+ export * as v2Press from "./v2/press.js";
86
+ export * as v2ReceiptTx from "./v2/receipt-tx.js";
87
+ export * as config from "./config/index.js";
88
+ export * as fixtures from "./fixtures.js";
89
+ export * as client from "./client/index.js";
90
+ export * as errors from "./errors.js";
91
+ export * as generated from "./generated/index.js";