@whetstone-research/doppler-sdk 0.0.24 → 1.0.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 (445) hide show
  1. package/README.md +69 -0
  2. package/dist/chunk-LIXSTCMM.js +974 -0
  3. package/dist/chunk-LIXSTCMM.js.map +1 -0
  4. package/dist/chunk-PZ5AY32C.js +9 -0
  5. package/dist/{chunk-4XN6DQBW.js.map → chunk-PZ5AY32C.js.map} +1 -1
  6. package/dist/chunk-T46KDO65.js +322 -0
  7. package/dist/chunk-T46KDO65.js.map +1 -0
  8. package/dist/evm/index.d.ts +8533 -0
  9. package/dist/evm/index.js +15230 -0
  10. package/dist/evm/index.js.map +1 -0
  11. package/dist/oracle-B2LV97ff.d.ts +826 -0
  12. package/dist/pda-LKHUH6JK.js +4 -0
  13. package/dist/pda-LKHUH6JK.js.map +1 -0
  14. package/dist/solana/index.d.ts +2534 -0
  15. package/dist/solana/index.js +2298 -0
  16. package/dist/solana/index.js.map +1 -0
  17. package/dist/solana/react/index.d.ts +1046 -0
  18. package/dist/solana/react/index.js +1436 -0
  19. package/dist/solana/react/index.js.map +1 -0
  20. package/package.json +36 -20
  21. package/dist/DopplerSDK.d.mts +0 -106
  22. package/dist/DopplerSDK.d.ts +0 -106
  23. package/dist/DopplerSDK.js +0 -53
  24. package/dist/DopplerSDK.js.map +0 -1
  25. package/dist/DopplerSDK.mjs +0 -44
  26. package/dist/DopplerSDK.mjs.map +0 -1
  27. package/dist/abis/bytecodes/derc20.d.mts +0 -3
  28. package/dist/abis/bytecodes/derc20.d.ts +0 -3
  29. package/dist/abis/bytecodes/derc20.js +0 -9
  30. package/dist/abis/bytecodes/derc20.js.map +0 -1
  31. package/dist/abis/bytecodes/derc20.mjs +0 -3
  32. package/dist/abis/bytecodes/derc20.mjs.map +0 -1
  33. package/dist/abis/bytecodes/derc2080.d.mts +0 -3
  34. package/dist/abis/bytecodes/derc2080.d.ts +0 -3
  35. package/dist/abis/bytecodes/derc2080.js +0 -9
  36. package/dist/abis/bytecodes/derc2080.js.map +0 -1
  37. package/dist/abis/bytecodes/derc2080.mjs +0 -3
  38. package/dist/abis/bytecodes/derc2080.mjs.map +0 -1
  39. package/dist/abis/bytecodes/doppler.d.mts +0 -3
  40. package/dist/abis/bytecodes/doppler.d.ts +0 -3
  41. package/dist/abis/bytecodes/doppler.js +0 -9
  42. package/dist/abis/bytecodes/doppler.js.map +0 -1
  43. package/dist/abis/bytecodes/doppler.mjs +0 -3
  44. package/dist/abis/bytecodes/doppler.mjs.map +0 -1
  45. package/dist/abis/bytecodes/dopplerDN404.d.mts +0 -3
  46. package/dist/abis/bytecodes/dopplerDN404.d.ts +0 -3
  47. package/dist/abis/bytecodes/dopplerDN404.js +0 -9
  48. package/dist/abis/bytecodes/dopplerDN404.js.map +0 -1
  49. package/dist/abis/bytecodes/dopplerDN404.mjs +0 -3
  50. package/dist/abis/bytecodes/dopplerDN404.mjs.map +0 -1
  51. package/dist/abis/bytecodes/stateView.d.mts +0 -3
  52. package/dist/abis/bytecodes/stateView.d.ts +0 -3
  53. package/dist/abis/bytecodes/stateView.js +0 -9
  54. package/dist/abis/bytecodes/stateView.js.map +0 -1
  55. package/dist/abis/bytecodes/stateView.mjs +0 -3
  56. package/dist/abis/bytecodes/stateView.mjs.map +0 -1
  57. package/dist/abis/bytecodes.d.mts +0 -5
  58. package/dist/abis/bytecodes.d.ts +0 -5
  59. package/dist/abis/bytecodes.js +0 -33
  60. package/dist/abis/bytecodes.js.map +0 -1
  61. package/dist/abis/bytecodes.mjs +0 -8
  62. package/dist/abis/bytecodes.mjs.map +0 -1
  63. package/dist/abis/index.d.mts +0 -3871
  64. package/dist/abis/index.d.ts +0 -3871
  65. package/dist/abis/index.js +0 -130
  66. package/dist/abis/index.js.map +0 -1
  67. package/dist/abis/index.mjs +0 -9
  68. package/dist/abis/index.mjs.map +0 -1
  69. package/dist/addresses.d.mts +0 -69
  70. package/dist/addresses.d.ts +0 -69
  71. package/dist/addresses.js +0 -29
  72. package/dist/addresses.js.map +0 -1
  73. package/dist/addresses.mjs +0 -4
  74. package/dist/addresses.mjs.map +0 -1
  75. package/dist/builders/DynamicAuctionBuilder.d.mts +0 -138
  76. package/dist/builders/DynamicAuctionBuilder.d.ts +0 -138
  77. package/dist/builders/DynamicAuctionBuilder.js +0 -35
  78. package/dist/builders/DynamicAuctionBuilder.js.map +0 -1
  79. package/dist/builders/DynamicAuctionBuilder.mjs +0 -26
  80. package/dist/builders/DynamicAuctionBuilder.mjs.map +0 -1
  81. package/dist/builders/MulticurveBuilder.d.mts +0 -196
  82. package/dist/builders/MulticurveBuilder.d.ts +0 -196
  83. package/dist/builders/MulticurveBuilder.js +0 -35
  84. package/dist/builders/MulticurveBuilder.js.map +0 -1
  85. package/dist/builders/MulticurveBuilder.mjs +0 -26
  86. package/dist/builders/MulticurveBuilder.mjs.map +0 -1
  87. package/dist/builders/StaticAuctionBuilder.d.mts +0 -131
  88. package/dist/builders/StaticAuctionBuilder.d.ts +0 -131
  89. package/dist/builders/StaticAuctionBuilder.js +0 -35
  90. package/dist/builders/StaticAuctionBuilder.js.map +0 -1
  91. package/dist/builders/StaticAuctionBuilder.mjs +0 -26
  92. package/dist/builders/StaticAuctionBuilder.mjs.map +0 -1
  93. package/dist/builders/index.d.mts +0 -8
  94. package/dist/builders/index.d.ts +0 -8
  95. package/dist/builders/index.js +0 -62
  96. package/dist/builders/index.js.map +0 -1
  97. package/dist/builders/index.mjs +0 -29
  98. package/dist/builders/index.mjs.map +0 -1
  99. package/dist/builders/shared.d.mts +0 -115
  100. package/dist/builders/shared.d.ts +0 -115
  101. package/dist/builders/shared.js +0 -46
  102. package/dist/builders/shared.js.map +0 -1
  103. package/dist/builders/shared.mjs +0 -25
  104. package/dist/builders/shared.mjs.map +0 -1
  105. package/dist/chunk-25GEBO3B.mjs +0 -219
  106. package/dist/chunk-25GEBO3B.mjs.map +0 -1
  107. package/dist/chunk-2A3B3NVB.js +0 -737
  108. package/dist/chunk-2A3B3NVB.js.map +0 -1
  109. package/dist/chunk-3NMGCQJ4.mjs +0 -6
  110. package/dist/chunk-3NMGCQJ4.mjs.map +0 -1
  111. package/dist/chunk-44CYUEPG.js +0 -377
  112. package/dist/chunk-44CYUEPG.js.map +0 -1
  113. package/dist/chunk-4VWQNNNW.js +0 -233
  114. package/dist/chunk-4VWQNNNW.js.map +0 -1
  115. package/dist/chunk-4XN6DQBW.js +0 -4
  116. package/dist/chunk-5GQJRNFL.mjs +0 -40
  117. package/dist/chunk-5GQJRNFL.mjs.map +0 -1
  118. package/dist/chunk-5JHXBDZD.js +0 -265
  119. package/dist/chunk-5JHXBDZD.js.map +0 -1
  120. package/dist/chunk-5TQOT6CW.js +0 -8
  121. package/dist/chunk-5TQOT6CW.js.map +0 -1
  122. package/dist/chunk-65CESA3J.js +0 -46
  123. package/dist/chunk-65CESA3J.js.map +0 -1
  124. package/dist/chunk-6BQY5EPB.js +0 -144
  125. package/dist/chunk-6BQY5EPB.js.map +0 -1
  126. package/dist/chunk-6H6X3VTZ.js +0 -18
  127. package/dist/chunk-6H6X3VTZ.js.map +0 -1
  128. package/dist/chunk-7A4DBBXA.js +0 -311
  129. package/dist/chunk-7A4DBBXA.js.map +0 -1
  130. package/dist/chunk-7M57PU6V.js +0 -28
  131. package/dist/chunk-7M57PU6V.js.map +0 -1
  132. package/dist/chunk-7ZUV6WPX.mjs +0 -3
  133. package/dist/chunk-7ZUV6WPX.mjs.map +0 -1
  134. package/dist/chunk-A2CJYRRQ.js +0 -330
  135. package/dist/chunk-A2CJYRRQ.js.map +0 -1
  136. package/dist/chunk-ABT6AT7C.mjs +0 -16
  137. package/dist/chunk-ABT6AT7C.mjs.map +0 -1
  138. package/dist/chunk-BK3S6SVR.js +0 -2707
  139. package/dist/chunk-BK3S6SVR.js.map +0 -1
  140. package/dist/chunk-BQZTELUX.js +0 -45
  141. package/dist/chunk-BQZTELUX.js.map +0 -1
  142. package/dist/chunk-CFAAYL5M.mjs +0 -26
  143. package/dist/chunk-CFAAYL5M.mjs.map +0 -1
  144. package/dist/chunk-CFXXUZJY.js +0 -275
  145. package/dist/chunk-CFXXUZJY.js.map +0 -1
  146. package/dist/chunk-CWTGQAOG.mjs +0 -72
  147. package/dist/chunk-CWTGQAOG.mjs.map +0 -1
  148. package/dist/chunk-DCWF3EMP.js +0 -171
  149. package/dist/chunk-DCWF3EMP.js.map +0 -1
  150. package/dist/chunk-DOUF6NON.mjs +0 -3
  151. package/dist/chunk-DOUF6NON.mjs.map +0 -1
  152. package/dist/chunk-DQJXCZU2.mjs +0 -318
  153. package/dist/chunk-DQJXCZU2.mjs.map +0 -1
  154. package/dist/chunk-DSYPZETD.js +0 -4
  155. package/dist/chunk-DSYPZETD.js.map +0 -1
  156. package/dist/chunk-F2BYG63D.mjs +0 -145
  157. package/dist/chunk-F2BYG63D.mjs.map +0 -1
  158. package/dist/chunk-FNUBKONK.js +0 -291
  159. package/dist/chunk-FNUBKONK.js.map +0 -1
  160. package/dist/chunk-FOESYJP3.mjs +0 -3
  161. package/dist/chunk-FOESYJP3.mjs.map +0 -1
  162. package/dist/chunk-FXTGIKQG.mjs +0 -3
  163. package/dist/chunk-FXTGIKQG.mjs.map +0 -1
  164. package/dist/chunk-GSBQIVME.mjs +0 -278
  165. package/dist/chunk-GSBQIVME.mjs.map +0 -1
  166. package/dist/chunk-H3B54PFV.mjs +0 -17
  167. package/dist/chunk-H3B54PFV.mjs.map +0 -1
  168. package/dist/chunk-HJFVRV47.js +0 -120
  169. package/dist/chunk-HJFVRV47.js.map +0 -1
  170. package/dist/chunk-IIM2CSDQ.js +0 -147
  171. package/dist/chunk-IIM2CSDQ.js.map +0 -1
  172. package/dist/chunk-IUTIHSLH.mjs +0 -295
  173. package/dist/chunk-IUTIHSLH.mjs.map +0 -1
  174. package/dist/chunk-IUZ3BBQP.mjs +0 -117
  175. package/dist/chunk-IUZ3BBQP.mjs.map +0 -1
  176. package/dist/chunk-IWJOPXYN.mjs +0 -96
  177. package/dist/chunk-IWJOPXYN.mjs.map +0 -1
  178. package/dist/chunk-IX4V4UGW.mjs +0 -141
  179. package/dist/chunk-IX4V4UGW.mjs.map +0 -1
  180. package/dist/chunk-J62YDWIK.js +0 -8
  181. package/dist/chunk-J62YDWIK.js.map +0 -1
  182. package/dist/chunk-JIKAD4YL.js +0 -4
  183. package/dist/chunk-JIKAD4YL.js.map +0 -1
  184. package/dist/chunk-JLUOFAE4.mjs +0 -2531
  185. package/dist/chunk-JLUOFAE4.mjs.map +0 -1
  186. package/dist/chunk-KAZQJ24E.mjs +0 -59
  187. package/dist/chunk-KAZQJ24E.mjs.map +0 -1
  188. package/dist/chunk-KHUE77HC.js +0 -81
  189. package/dist/chunk-KHUE77HC.js.map +0 -1
  190. package/dist/chunk-KOAC3BBP.mjs +0 -11
  191. package/dist/chunk-KOAC3BBP.mjs.map +0 -1
  192. package/dist/chunk-LW3CYA27.mjs +0 -2705
  193. package/dist/chunk-LW3CYA27.mjs.map +0 -1
  194. package/dist/chunk-MEA2C5YX.js +0 -143
  195. package/dist/chunk-MEA2C5YX.js.map +0 -1
  196. package/dist/chunk-MU56HCUI.js +0 -2556
  197. package/dist/chunk-MU56HCUI.js.map +0 -1
  198. package/dist/chunk-OCIY7QEJ.mjs +0 -169
  199. package/dist/chunk-OCIY7QEJ.mjs.map +0 -1
  200. package/dist/chunk-OHA5KJ2M.mjs +0 -6
  201. package/dist/chunk-OHA5KJ2M.mjs.map +0 -1
  202. package/dist/chunk-P25HBGP5.mjs +0 -3
  203. package/dist/chunk-P25HBGP5.mjs.map +0 -1
  204. package/dist/chunk-P563HTVU.js +0 -164
  205. package/dist/chunk-P563HTVU.js.map +0 -1
  206. package/dist/chunk-P7CHGWY7.js +0 -4
  207. package/dist/chunk-P7CHGWY7.js.map +0 -1
  208. package/dist/chunk-PGYTMRP3.js +0 -277
  209. package/dist/chunk-PGYTMRP3.js.map +0 -1
  210. package/dist/chunk-QAPQGDWK.js +0 -8
  211. package/dist/chunk-QAPQGDWK.js.map +0 -1
  212. package/dist/chunk-QHBKRUBY.mjs +0 -328
  213. package/dist/chunk-QHBKRUBY.mjs.map +0 -1
  214. package/dist/chunk-QOYI7WCH.js +0 -120
  215. package/dist/chunk-QOYI7WCH.js.map +0 -1
  216. package/dist/chunk-QRTABC4Z.js +0 -8
  217. package/dist/chunk-QRTABC4Z.js.map +0 -1
  218. package/dist/chunk-QSQGLWNY.mjs +0 -3
  219. package/dist/chunk-QSQGLWNY.mjs.map +0 -1
  220. package/dist/chunk-QUBD6HUZ.mjs +0 -735
  221. package/dist/chunk-QUBD6HUZ.mjs.map +0 -1
  222. package/dist/chunk-RDTIXP6S.mjs +0 -263
  223. package/dist/chunk-RDTIXP6S.mjs.map +0 -1
  224. package/dist/chunk-RLOZWHRR.js +0 -320
  225. package/dist/chunk-RLOZWHRR.js.map +0 -1
  226. package/dist/chunk-RV64M4Q6.mjs +0 -3
  227. package/dist/chunk-RV64M4Q6.mjs.map +0 -1
  228. package/dist/chunk-SWWLOD7Q.mjs +0 -6
  229. package/dist/chunk-SWWLOD7Q.mjs.map +0 -1
  230. package/dist/chunk-T3UA4MJL.js +0 -4
  231. package/dist/chunk-T3UA4MJL.js.map +0 -1
  232. package/dist/chunk-TEWAXP5C.mjs +0 -162
  233. package/dist/chunk-TEWAXP5C.mjs.map +0 -1
  234. package/dist/chunk-THEIRDGE.mjs +0 -273
  235. package/dist/chunk-THEIRDGE.mjs.map +0 -1
  236. package/dist/chunk-U3GOWK6J.mjs +0 -6
  237. package/dist/chunk-U3GOWK6J.mjs.map +0 -1
  238. package/dist/chunk-UPVKABAV.js +0 -19
  239. package/dist/chunk-UPVKABAV.js.map +0 -1
  240. package/dist/chunk-VEIVYUYF.js +0 -4
  241. package/dist/chunk-VEIVYUYF.js.map +0 -1
  242. package/dist/chunk-VKSD3KXF.mjs +0 -275
  243. package/dist/chunk-VKSD3KXF.mjs.map +0 -1
  244. package/dist/chunk-VYSOAGRU.mjs +0 -6
  245. package/dist/chunk-VYSOAGRU.mjs.map +0 -1
  246. package/dist/chunk-WDC53TM7.mjs +0 -305
  247. package/dist/chunk-WDC53TM7.mjs.map +0 -1
  248. package/dist/chunk-WKWP42TD.mjs +0 -39
  249. package/dist/chunk-WKWP42TD.mjs.map +0 -1
  250. package/dist/chunk-WNUB3UTT.js +0 -241
  251. package/dist/chunk-WNUB3UTT.js.map +0 -1
  252. package/dist/chunk-WNWK2QMU.mjs +0 -375
  253. package/dist/chunk-WNWK2QMU.mjs.map +0 -1
  254. package/dist/chunk-WQHTNL5L.js +0 -4
  255. package/dist/chunk-WQHTNL5L.js.map +0 -1
  256. package/dist/chunk-WZF5XNBC.js +0 -297
  257. package/dist/chunk-WZF5XNBC.js.map +0 -1
  258. package/dist/chunk-X3UMAHOJ.js +0 -4
  259. package/dist/chunk-X3UMAHOJ.js.map +0 -1
  260. package/dist/chunk-XMFOZYNI.js +0 -8
  261. package/dist/chunk-XMFOZYNI.js.map +0 -1
  262. package/dist/chunk-XNMXN5SZ.mjs +0 -3
  263. package/dist/chunk-XNMXN5SZ.mjs.map +0 -1
  264. package/dist/chunk-XSJTASPK.js +0 -13
  265. package/dist/chunk-XSJTASPK.js.map +0 -1
  266. package/dist/chunk-YBK6EBA5.mjs +0 -239
  267. package/dist/chunk-YBK6EBA5.mjs.map +0 -1
  268. package/dist/chunk-YYLD3AJ7.js +0 -61
  269. package/dist/chunk-YYLD3AJ7.js.map +0 -1
  270. package/dist/chunk-ZEDJUNC6.mjs +0 -115
  271. package/dist/chunk-ZEDJUNC6.mjs.map +0 -1
  272. package/dist/constants.d.mts +0 -91
  273. package/dist/constants.d.ts +0 -91
  274. package/dist/constants.js +0 -196
  275. package/dist/constants.js.map +0 -1
  276. package/dist/constants.mjs +0 -3
  277. package/dist/constants.mjs.map +0 -1
  278. package/dist/deployments.generated.d.mts +0 -275
  279. package/dist/deployments.generated.d.ts +0 -275
  280. package/dist/deployments.generated.js +0 -12
  281. package/dist/deployments.generated.js.map +0 -1
  282. package/dist/deployments.generated.mjs +0 -3
  283. package/dist/deployments.generated.mjs.map +0 -1
  284. package/dist/entities/DopplerFactory.d.mts +0 -272
  285. package/dist/entities/DopplerFactory.d.ts +0 -272
  286. package/dist/entities/DopplerFactory.js +0 -34
  287. package/dist/entities/DopplerFactory.js.map +0 -1
  288. package/dist/entities/DopplerFactory.mjs +0 -25
  289. package/dist/entities/DopplerFactory.mjs.map +0 -1
  290. package/dist/entities/auction/DynamicAuction.d.mts +0 -72
  291. package/dist/entities/auction/DynamicAuction.d.ts +0 -72
  292. package/dist/entities/auction/DynamicAuction.js +0 -21
  293. package/dist/entities/auction/DynamicAuction.js.map +0 -1
  294. package/dist/entities/auction/DynamicAuction.mjs +0 -12
  295. package/dist/entities/auction/DynamicAuction.mjs.map +0 -1
  296. package/dist/entities/auction/MulticurvePool.d.mts +0 -78
  297. package/dist/entities/auction/MulticurvePool.d.ts +0 -78
  298. package/dist/entities/auction/MulticurvePool.js +0 -24
  299. package/dist/entities/auction/MulticurvePool.js.map +0 -1
  300. package/dist/entities/auction/MulticurvePool.mjs +0 -15
  301. package/dist/entities/auction/MulticurvePool.mjs.map +0 -1
  302. package/dist/entities/auction/RehypeDopplerHook.d.mts +0 -57
  303. package/dist/entities/auction/RehypeDopplerHook.d.ts +0 -57
  304. package/dist/entities/auction/RehypeDopplerHook.js +0 -34
  305. package/dist/entities/auction/RehypeDopplerHook.js.map +0 -1
  306. package/dist/entities/auction/RehypeDopplerHook.mjs +0 -25
  307. package/dist/entities/auction/RehypeDopplerHook.mjs.map +0 -1
  308. package/dist/entities/auction/RehypeDopplerHookMigrator.d.mts +0 -48
  309. package/dist/entities/auction/RehypeDopplerHookMigrator.d.ts +0 -48
  310. package/dist/entities/auction/RehypeDopplerHookMigrator.js +0 -34
  311. package/dist/entities/auction/RehypeDopplerHookMigrator.js.map +0 -1
  312. package/dist/entities/auction/RehypeDopplerHookMigrator.mjs +0 -25
  313. package/dist/entities/auction/RehypeDopplerHookMigrator.mjs.map +0 -1
  314. package/dist/entities/auction/StaticAuction.d.mts +0 -44
  315. package/dist/entities/auction/StaticAuction.d.ts +0 -44
  316. package/dist/entities/auction/StaticAuction.js +0 -21
  317. package/dist/entities/auction/StaticAuction.js.map +0 -1
  318. package/dist/entities/auction/StaticAuction.mjs +0 -12
  319. package/dist/entities/auction/StaticAuction.mjs.map +0 -1
  320. package/dist/entities/auction/index.d.mts +0 -9
  321. package/dist/entities/auction/index.d.ts +0 -9
  322. package/dist/entities/auction/index.js +0 -55
  323. package/dist/entities/auction/index.js.map +0 -1
  324. package/dist/entities/auction/index.mjs +0 -30
  325. package/dist/entities/auction/index.mjs.map +0 -1
  326. package/dist/entities/quoter/Quoter.d.mts +0 -150
  327. package/dist/entities/quoter/Quoter.d.ts +0 -150
  328. package/dist/entities/quoter/Quoter.js +0 -21
  329. package/dist/entities/quoter/Quoter.js.map +0 -1
  330. package/dist/entities/quoter/Quoter.mjs +0 -12
  331. package/dist/entities/quoter/Quoter.mjs.map +0 -1
  332. package/dist/entities/quoter/index.d.mts +0 -5
  333. package/dist/entities/quoter/index.d.ts +0 -5
  334. package/dist/entities/quoter/index.js +0 -22
  335. package/dist/entities/quoter/index.js.map +0 -1
  336. package/dist/entities/quoter/index.mjs +0 -13
  337. package/dist/entities/quoter/index.mjs.map +0 -1
  338. package/dist/entities/token/derc20/Derc20.d.mts +0 -102
  339. package/dist/entities/token/derc20/Derc20.d.ts +0 -102
  340. package/dist/entities/token/derc20/Derc20.js +0 -19
  341. package/dist/entities/token/derc20/Derc20.js.map +0 -1
  342. package/dist/entities/token/derc20/Derc20.mjs +0 -10
  343. package/dist/entities/token/derc20/Derc20.mjs.map +0 -1
  344. package/dist/entities/token/derc20/index.d.mts +0 -5
  345. package/dist/entities/token/derc20/index.d.ts +0 -5
  346. package/dist/entities/token/derc20/index.js +0 -20
  347. package/dist/entities/token/derc20/index.js.map +0 -1
  348. package/dist/entities/token/derc20/index.mjs +0 -11
  349. package/dist/entities/token/derc20/index.mjs.map +0 -1
  350. package/dist/entities/token/eth/Eth.d.mts +0 -54
  351. package/dist/entities/token/eth/Eth.d.ts +0 -54
  352. package/dist/entities/token/eth/Eth.js +0 -12
  353. package/dist/entities/token/eth/Eth.js.map +0 -1
  354. package/dist/entities/token/eth/Eth.mjs +0 -3
  355. package/dist/entities/token/eth/Eth.mjs.map +0 -1
  356. package/dist/entities/token/eth/index.d.mts +0 -5
  357. package/dist/entities/token/eth/index.d.ts +0 -5
  358. package/dist/entities/token/eth/index.js +0 -13
  359. package/dist/entities/token/eth/index.js.map +0 -1
  360. package/dist/entities/token/eth/index.mjs +0 -4
  361. package/dist/entities/token/eth/index.mjs.map +0 -1
  362. package/dist/entities/token/index.d.mts +0 -6
  363. package/dist/entities/token/index.d.ts +0 -6
  364. package/dist/entities/token/index.js +0 -27
  365. package/dist/entities/token/index.js.map +0 -1
  366. package/dist/entities/token/index.mjs +0 -14
  367. package/dist/entities/token/index.mjs.map +0 -1
  368. package/dist/index.d.mts +0 -39
  369. package/dist/index.d.ts +0 -39
  370. package/dist/index.js +0 -587
  371. package/dist/index.js.map +0 -1
  372. package/dist/index.mjs +0 -49
  373. package/dist/index.mjs.map +0 -1
  374. package/dist/types.d.mts +0 -662
  375. package/dist/types.d.ts +0 -662
  376. package/dist/types.js +0 -34
  377. package/dist/types.js.map +0 -1
  378. package/dist/types.mjs +0 -5
  379. package/dist/types.mjs.map +0 -1
  380. package/dist/utils/airlock.d.mts +0 -11
  381. package/dist/utils/airlock.d.ts +0 -11
  382. package/dist/utils/airlock.js +0 -26
  383. package/dist/utils/airlock.js.map +0 -1
  384. package/dist/utils/airlock.mjs +0 -5
  385. package/dist/utils/airlock.mjs.map +0 -1
  386. package/dist/utils/balanceDelta.d.mts +0 -10
  387. package/dist/utils/balanceDelta.d.ts +0 -10
  388. package/dist/utils/balanceDelta.js +0 -12
  389. package/dist/utils/balanceDelta.js.map +0 -1
  390. package/dist/utils/balanceDelta.mjs +0 -3
  391. package/dist/utils/balanceDelta.mjs.map +0 -1
  392. package/dist/utils/computeOptimalGamma.d.mts +0 -7
  393. package/dist/utils/computeOptimalGamma.d.ts +0 -7
  394. package/dist/utils/computeOptimalGamma.js +0 -12
  395. package/dist/utils/computeOptimalGamma.js.map +0 -1
  396. package/dist/utils/computeOptimalGamma.mjs +0 -3
  397. package/dist/utils/computeOptimalGamma.mjs.map +0 -1
  398. package/dist/utils/dopplerHookMigrator.d.mts +0 -18
  399. package/dist/utils/dopplerHookMigrator.d.ts +0 -18
  400. package/dist/utils/dopplerHookMigrator.js +0 -20
  401. package/dist/utils/dopplerHookMigrator.js.map +0 -1
  402. package/dist/utils/dopplerHookMigrator.mjs +0 -7
  403. package/dist/utils/dopplerHookMigrator.mjs.map +0 -1
  404. package/dist/utils/index.d.mts +0 -14
  405. package/dist/utils/index.d.ts +0 -14
  406. package/dist/utils/index.js +0 -197
  407. package/dist/utils/index.js.map +0 -1
  408. package/dist/utils/index.mjs +0 -24
  409. package/dist/utils/index.mjs.map +0 -1
  410. package/dist/utils/isToken0Expected.d.mts +0 -13
  411. package/dist/utils/isToken0Expected.d.ts +0 -13
  412. package/dist/utils/isToken0Expected.js +0 -12
  413. package/dist/utils/isToken0Expected.js.map +0 -1
  414. package/dist/utils/isToken0Expected.mjs +0 -3
  415. package/dist/utils/isToken0Expected.mjs.map +0 -1
  416. package/dist/utils/marketCapHelpers.d.mts +0 -259
  417. package/dist/utils/marketCapHelpers.d.ts +0 -259
  418. package/dist/utils/marketCapHelpers.js +0 -58
  419. package/dist/utils/marketCapHelpers.js.map +0 -1
  420. package/dist/utils/marketCapHelpers.mjs +0 -5
  421. package/dist/utils/marketCapHelpers.mjs.map +0 -1
  422. package/dist/utils/poolKey.d.mts +0 -17
  423. package/dist/utils/poolKey.d.ts +0 -17
  424. package/dist/utils/poolKey.js +0 -12
  425. package/dist/utils/poolKey.js.map +0 -1
  426. package/dist/utils/poolKey.mjs +0 -3
  427. package/dist/utils/poolKey.mjs.map +0 -1
  428. package/dist/utils/priceHelpers.d.mts +0 -86
  429. package/dist/utils/priceHelpers.d.ts +0 -86
  430. package/dist/utils/priceHelpers.js +0 -41
  431. package/dist/utils/priceHelpers.js.map +0 -1
  432. package/dist/utils/priceHelpers.mjs +0 -4
  433. package/dist/utils/priceHelpers.mjs.map +0 -1
  434. package/dist/utils/tickMath.d.mts +0 -72
  435. package/dist/utils/tickMath.d.ts +0 -72
  436. package/dist/utils/tickMath.js +0 -60
  437. package/dist/utils/tickMath.js.map +0 -1
  438. package/dist/utils/tickMath.mjs +0 -3
  439. package/dist/utils/tickMath.mjs.map +0 -1
  440. package/dist/utils/tokenAddressMiner.d.mts +0 -37
  441. package/dist/utils/tokenAddressMiner.d.ts +0 -37
  442. package/dist/utils/tokenAddressMiner.js +0 -19
  443. package/dist/utils/tokenAddressMiner.js.map +0 -1
  444. package/dist/utils/tokenAddressMiner.mjs +0 -10
  445. package/dist/utils/tokenAddressMiner.mjs.map +0 -1
@@ -0,0 +1,974 @@
1
+ import { MAX_SENTINEL_ALLOWLIST, MAX_ORACLE_OBSERVATIONS, ACCOUNT_DISCRIMINATORS, PROGRAM_ID, Q64_ONE, BPS_DENOM, TOKEN_PROGRAM_ID, INSTRUCTION_DISCRIMINATORS, ACCOUNT_ROLE_WRITABLE, ACCOUNT_ROLE_SIGNER, ACCOUNT_ROLE_READONLY, getPoolAddress, sortMints, getPositionAddress, getOracleAddress } from './chunk-T46KDO65.js';
2
+ import { getAddressCodec, getBooleanCodec, getU8Codec, getU16Codec, getU32Codec, getU64Codec, getU128Codec, transformCodec, getArrayCodec, fixCodecSize, getBytesCodec, getStructCodec, getHiddenPrefixDecoder, getConstantDecoder, getOptionCodec, unwrapOption, mergeBytes } from '@solana/kit';
3
+
4
+ var addressCodec = getAddressCodec();
5
+ var boolCodec = getBooleanCodec();
6
+ var u8Codec = getU8Codec();
7
+ var u16Codec = getU16Codec();
8
+ var u32Codec = getU32Codec();
9
+ var u64Codec = getU64Codec();
10
+ var u128Codec = getU128Codec();
11
+ var u256Codec = transformCodec(
12
+ getArrayCodec(u64Codec, { size: 4 }),
13
+ (value) => {
14
+ if (value < 0n) {
15
+ throw new Error("u256 cannot be negative");
16
+ }
17
+ if (value >> 256n !== 0n) {
18
+ throw new Error("u256 overflow");
19
+ }
20
+ const mask = (1n << 64n) - 1n;
21
+ return [
22
+ value & mask,
23
+ value >> 64n & mask,
24
+ value >> 128n & mask,
25
+ value >> 192n & mask
26
+ ];
27
+ },
28
+ (value) => {
29
+ let out = 0n;
30
+ for (let i = 0; i < 4; i += 1) {
31
+ out |= value[i] << 64n * BigInt(i);
32
+ }
33
+ return out;
34
+ }
35
+ );
36
+ var reservedBytesCodec = transformCodec(
37
+ fixCodecSize(getBytesCodec(), 7),
38
+ (value) => value,
39
+ (value) => new Uint8Array(value)
40
+ );
41
+ var observationCodec = getStructCodec([
42
+ ["timestamp", u32Codec],
43
+ ["price0Cumulative", u256Codec],
44
+ ["price1Cumulative", u256Codec]
45
+ ]);
46
+ var ammConfigDataCodec = getStructCodec([
47
+ ["admin", addressCodec],
48
+ ["paused", boolCodec],
49
+ ["numeraireMint", addressCodec],
50
+ ["sentinelAllowlistLen", u8Codec],
51
+ [
52
+ "sentinelAllowlist",
53
+ getArrayCodec(addressCodec, { size: MAX_SENTINEL_ALLOWLIST })
54
+ ],
55
+ ["maxSwapFeeBps", u16Codec],
56
+ ["maxFeeSplitBps", u16Codec],
57
+ ["maxRouteHops", u8Codec],
58
+ ["protocolFeeEnabled", boolCodec],
59
+ ["protocolFeeBps", u16Codec],
60
+ ["version", u8Codec],
61
+ ["reserved", reservedBytesCodec]
62
+ ]);
63
+ var poolDataCodec = getStructCodec([
64
+ ["config", addressCodec],
65
+ ["token0Mint", addressCodec],
66
+ ["token1Mint", addressCodec],
67
+ ["vault0", addressCodec],
68
+ ["vault1", addressCodec],
69
+ ["authority", addressCodec],
70
+ ["bump", u8Codec],
71
+ ["reserve0", u64Codec],
72
+ ["reserve1", u64Codec],
73
+ ["totalShares", u128Codec],
74
+ ["swapFeeBps", u16Codec],
75
+ ["feeSplitBps", u16Codec],
76
+ ["feeGrowthGlobal0Q64", u128Codec],
77
+ ["feeGrowthGlobal1Q64", u128Codec],
78
+ ["feesUnclaimed0", u64Codec],
79
+ ["feesUnclaimed1", u64Codec],
80
+ ["sentinelProgram", addressCodec],
81
+ ["sentinelFlags", u32Codec],
82
+ ["numeraireMint", addressCodec],
83
+ ["liquidityMeasureSide", u8Codec],
84
+ ["routeNextPool", addressCodec],
85
+ ["routeBridgeMint", addressCodec],
86
+ ["kLast", u128Codec],
87
+ ["protocolPosition", addressCodec],
88
+ ["locked", u8Codec],
89
+ ["version", u8Codec],
90
+ ["reserved", reservedBytesCodec]
91
+ ]);
92
+ var positionDataCodec = getStructCodec([
93
+ ["pool", addressCodec],
94
+ ["owner", addressCodec],
95
+ ["positionId", u64Codec],
96
+ ["shares", u128Codec],
97
+ ["feeGrowthLast0Q64", u128Codec],
98
+ ["feeGrowthLast1Q64", u128Codec],
99
+ ["feeOwed0", u64Codec],
100
+ ["feeOwed1", u64Codec],
101
+ ["version", u8Codec],
102
+ ["reserved", reservedBytesCodec]
103
+ ]);
104
+ var oracleStateDataCodec = getStructCodec([
105
+ ["pool", addressCodec],
106
+ ["initialized", boolCodec],
107
+ ["maxPriceChangeRatioQ64", u128Codec],
108
+ ["lastSlot", u64Codec],
109
+ ["truncPrice0Q64", u128Codec],
110
+ ["truncPrice1Q64", u128Codec],
111
+ ["deviation0Q64", u128Codec],
112
+ ["deviation1Q64", u128Codec],
113
+ ["price0Cumulative", u256Codec],
114
+ ["price1Cumulative", u256Codec],
115
+ ["lastTimestamp", u32Codec],
116
+ ["lastObservationTimestamp", u32Codec],
117
+ ["observationIntervalSec", u32Codec],
118
+ ["observationIndex", u16Codec],
119
+ [
120
+ "observations",
121
+ getArrayCodec(observationCodec, { size: MAX_ORACLE_OBSERVATIONS })
122
+ ],
123
+ ["version", u8Codec],
124
+ ["reserved", reservedBytesCodec]
125
+ ]);
126
+ var ammConfigDecoder = getHiddenPrefixDecoder(ammConfigDataCodec, [
127
+ getConstantDecoder(ACCOUNT_DISCRIMINATORS.AmmConfig)
128
+ ]);
129
+ var poolDecoder = getHiddenPrefixDecoder(poolDataCodec, [
130
+ getConstantDecoder(ACCOUNT_DISCRIMINATORS.Pool)
131
+ ]);
132
+ var positionDecoder = getHiddenPrefixDecoder(positionDataCodec, [
133
+ getConstantDecoder(ACCOUNT_DISCRIMINATORS.Position)
134
+ ]);
135
+ var oracleStateDecoder = getHiddenPrefixDecoder(oracleStateDataCodec, [
136
+ getConstantDecoder(ACCOUNT_DISCRIMINATORS.OracleState)
137
+ ]);
138
+ function decodeAmmConfig(data) {
139
+ return ammConfigDecoder.decode(data);
140
+ }
141
+ function decodePool(data) {
142
+ return poolDecoder.decode(data);
143
+ }
144
+ function decodePosition(data) {
145
+ return positionDecoder.decode(data);
146
+ }
147
+ function decodeOracleState(data) {
148
+ return oracleStateDecoder.decode(data);
149
+ }
150
+ function encodeInstructionData(discriminator, codec, args) {
151
+ const encodedArgs = (() => {
152
+ if (!codec) {
153
+ return new Uint8Array();
154
+ }
155
+ if (args === void 0) {
156
+ throw new Error("Instruction args are required for codec encoders");
157
+ }
158
+ return new Uint8Array(codec.encode(args));
159
+ })();
160
+ return mergeBytes([discriminator, encodedArgs]);
161
+ }
162
+ var optionAddressCodec = transformCodec(
163
+ getOptionCodec(addressCodec, { prefix: u8Codec }),
164
+ (value) => value,
165
+ (value) => unwrapOption(value)
166
+ );
167
+ var swapExactInArgsCodec = getStructCodec([
168
+ ["amountIn", u64Codec],
169
+ ["minAmountOut", u64Codec],
170
+ ["direction", u8Codec],
171
+ ["updateOracle", boolCodec]
172
+ ]);
173
+ var addLiquidityArgsWithOracleCodec = getStructCodec([
174
+ ["amount0Max", u64Codec],
175
+ ["amount1Max", u64Codec],
176
+ ["minSharesOut", u128Codec],
177
+ ["updateOracle", boolCodec]
178
+ ]);
179
+ transformCodec(
180
+ addLiquidityArgsWithOracleCodec,
181
+ (value) => ({
182
+ ...value,
183
+ updateOracle: value.updateOracle ?? false
184
+ }),
185
+ (value) => value
186
+ );
187
+ var removeLiquidityArgsCodec = getStructCodec([
188
+ ["sharesIn", u128Codec],
189
+ ["minAmount0Out", u64Codec],
190
+ ["minAmount1Out", u64Codec],
191
+ ["updateOracle", boolCodec]
192
+ ]);
193
+ var collectFeesArgsCodec = getStructCodec([
194
+ ["max0", u64Codec],
195
+ ["max1", u64Codec]
196
+ ]);
197
+ var collectProtocolFeesArgsCodec = getStructCodec([
198
+ ["max0", u64Codec],
199
+ ["max1", u64Codec]
200
+ ]);
201
+ var createPositionArgsCodec = getStructCodec([["positionId", u64Codec]]);
202
+ var initializeConfigArgsCodec = getStructCodec([
203
+ ["admin", addressCodec],
204
+ ["numeraireMint", addressCodec],
205
+ ["maxSwapFeeBps", u16Codec],
206
+ ["maxFeeSplitBps", u16Codec],
207
+ ["maxRouteHops", u8Codec],
208
+ ["protocolFeeEnabled", boolCodec],
209
+ ["protocolFeeBps", u16Codec],
210
+ ["sentinelAllowlist", getArrayCodec(addressCodec, { size: u32Codec })]
211
+ ]);
212
+ var initializePoolArgsCodec = getStructCodec([
213
+ ["mintA", addressCodec],
214
+ ["mintB", addressCodec],
215
+ ["initialSwapFeeBps", u16Codec],
216
+ ["initialFeeSplitBps", u16Codec],
217
+ ["liquidityMeasureSide", u8Codec],
218
+ ["numeraireMintOverride", optionAddressCodec]
219
+ ]);
220
+ var initializeOracleArgsCodec = getStructCodec([
221
+ ["maxPriceChangeRatioQ64", u128Codec],
222
+ ["observationIntervalSec", u32Codec],
223
+ ["numObservations", u16Codec]
224
+ ]);
225
+ var setSentinelArgsCodec = getStructCodec([
226
+ ["sentinelProgram", addressCodec],
227
+ ["sentinelFlags", u32Codec]
228
+ ]);
229
+ var setFeesArgsCodec = getStructCodec([
230
+ ["swapFeeBps", u16Codec],
231
+ ["feeSplitBps", u16Codec]
232
+ ]);
233
+ var setRouteArgsCodec = getStructCodec([
234
+ ["routeNextPool", addressCodec],
235
+ ["routeBridgeMint", addressCodec]
236
+ ]);
237
+ var transferAdminArgsCodec = getStructCodec([
238
+ ["newAdmin", addressCodec]
239
+ ]);
240
+ var oracleConsultArgsCodec = getStructCodec([
241
+ ["windowSeconds", u32Codec]
242
+ ]);
243
+ var quoteToNumeraireArgsCodec = getStructCodec([
244
+ ["amount", u128Codec],
245
+ ["side", u8Codec],
246
+ ["maxHops", u8Codec],
247
+ ["useTwap", boolCodec],
248
+ ["windowSeconds", u32Codec]
249
+ ]);
250
+
251
+ // src/solana/core/math.ts
252
+ function q64ToNumber(q64) {
253
+ const intPart = q64 >> 64n;
254
+ const fracPart = q64 & (1n << 64n) - 1n;
255
+ return Number(intPart) + Number(fracPart) / Number(Q64_ONE);
256
+ }
257
+ function numberToQ64(n) {
258
+ const intPart = Math.floor(n);
259
+ const fracPart = n - intPart;
260
+ return (BigInt(intPart) << 64n) + BigInt(Math.round(fracPart * Number(Q64_ONE)));
261
+ }
262
+ function q64Mul(a, b) {
263
+ return a * b >> 64n;
264
+ }
265
+ function q64Div(a, b) {
266
+ return (a << 64n) / b;
267
+ }
268
+ function computePrice0Q64(reserve0, reserve1) {
269
+ if (reserve0 === 0n) return 0n;
270
+ return (reserve1 << 64n) / reserve0;
271
+ }
272
+ function computePrice1Q64(reserve0, reserve1) {
273
+ if (reserve1 === 0n) return 0n;
274
+ return (reserve0 << 64n) / reserve1;
275
+ }
276
+ function isqrt(n) {
277
+ if (n < 0n) throw new Error("isqrt: negative input");
278
+ if (n === 0n) return 0n;
279
+ let x = n;
280
+ let y = (x + 1n) / 2n;
281
+ while (y < x) {
282
+ x = y;
283
+ y = (x + n / x) / 2n;
284
+ }
285
+ return x;
286
+ }
287
+ function ceilDiv(a, b) {
288
+ return (a + b - 1n) / b;
289
+ }
290
+ function minBigInt(a, b) {
291
+ return a < b ? a : b;
292
+ }
293
+ function maxBigInt(a, b) {
294
+ return a > b ? a : b;
295
+ }
296
+ function ratioToNumber(numerator, denominator) {
297
+ if (denominator === 0n) return 0;
298
+ const q64 = (numerator << 64n) / denominator;
299
+ return q64ToNumber(q64);
300
+ }
301
+ function getSwapQuote(pool, amountIn, direction) {
302
+ if (amountIn === 0n) {
303
+ return {
304
+ amountOut: 0n,
305
+ feeTotal: 0n,
306
+ feeDist: 0n,
307
+ feeComp: 0n,
308
+ priceImpact: 0,
309
+ executionPrice: 0
310
+ };
311
+ }
312
+ const [reserveIn, reserveOut] = direction === 0 ? [pool.reserve0, pool.reserve1] : [pool.reserve1, pool.reserve0];
313
+ if (reserveIn === 0n || reserveOut === 0n) {
314
+ throw new Error("Pool has zero liquidity");
315
+ }
316
+ const feeTotal = amountIn * BigInt(pool.swapFeeBps) / BPS_DENOM;
317
+ const feeDist = feeTotal * BigInt(pool.feeSplitBps) / BPS_DENOM;
318
+ const feeComp = feeTotal - feeDist;
319
+ const amountInEff = amountIn - feeTotal;
320
+ const amountOut = amountInEff * reserveOut / (reserveIn + amountInEff);
321
+ const spotPrice = ratioToNumber(reserveOut, reserveIn);
322
+ const executionPrice = ratioToNumber(amountOut, amountIn);
323
+ const priceImpact = spotPrice === 0 ? 0 : Math.abs(spotPrice - executionPrice) / spotPrice;
324
+ return {
325
+ amountOut,
326
+ feeTotal,
327
+ feeDist,
328
+ feeComp,
329
+ priceImpact,
330
+ executionPrice
331
+ };
332
+ }
333
+ function getSwapQuoteExactOut(pool, amountOut, direction) {
334
+ const [reserveIn, reserveOut] = direction === 0 ? [pool.reserve0, pool.reserve1] : [pool.reserve1, pool.reserve0];
335
+ if (reserveIn === 0n || reserveOut === 0n) {
336
+ throw new Error("Pool has zero liquidity");
337
+ }
338
+ if (amountOut >= reserveOut) {
339
+ throw new Error("Insufficient liquidity for output amount");
340
+ }
341
+ const amountInEff = ceilDiv(amountOut * reserveIn, reserveOut - amountOut);
342
+ const amountIn = ceilDiv(
343
+ amountInEff * BPS_DENOM,
344
+ BPS_DENOM - BigInt(pool.swapFeeBps)
345
+ );
346
+ const feeTotal = amountIn - amountInEff;
347
+ return { amountIn, feeTotal };
348
+ }
349
+ function getAddLiquidityQuote(pool, amount0Max, amount1Max) {
350
+ if (pool.totalShares === 0n) {
351
+ const rawShares = isqrt(amount0Max * amount1Max);
352
+ if (rawShares === 0n) {
353
+ throw new Error("Initial liquidity too small");
354
+ }
355
+ const sharesOut2 = rawShares;
356
+ return {
357
+ sharesOut: sharesOut2,
358
+ amount0: amount0Max,
359
+ amount1: amount1Max,
360
+ poolShare: ratioToNumber(sharesOut2, rawShares)
361
+ };
362
+ }
363
+ if (pool.reserve0 === 0n || pool.reserve1 === 0n) {
364
+ throw new Error("Invalid pool state: zero reserves with non-zero shares");
365
+ }
366
+ const shares0 = amount0Max * pool.totalShares / pool.reserve0;
367
+ const shares1 = amount1Max * pool.totalShares / pool.reserve1;
368
+ const sharesOut = minBigInt(shares0, shares1);
369
+ const amount0 = ceilDiv(sharesOut * pool.reserve0, pool.totalShares);
370
+ const amount1 = ceilDiv(sharesOut * pool.reserve1, pool.totalShares);
371
+ const newTotalShares = pool.totalShares + sharesOut;
372
+ const poolShare = ratioToNumber(sharesOut, newTotalShares);
373
+ return {
374
+ sharesOut,
375
+ amount0,
376
+ amount1,
377
+ poolShare
378
+ };
379
+ }
380
+ function getRemoveLiquidityQuote(pool, sharesIn) {
381
+ if (pool.totalShares === 0n) {
382
+ throw new Error("Pool has no shares");
383
+ }
384
+ if (sharesIn > pool.totalShares) {
385
+ throw new Error("Shares exceed total supply");
386
+ }
387
+ const amount0 = sharesIn * pool.reserve0 / pool.totalShares;
388
+ const amount1 = sharesIn * pool.reserve1 / pool.totalShares;
389
+ return { amount0, amount1 };
390
+ }
391
+ function calculateAccruedFees(shares, feeGrowthLastQ64, feeGrowthGlobalQ64) {
392
+ const delta = feeGrowthGlobalQ64 - feeGrowthLastQ64;
393
+ return shares * delta >> 64n;
394
+ }
395
+ function getPendingFees(pool, position) {
396
+ const accrued0 = calculateAccruedFees(
397
+ position.shares,
398
+ position.feeGrowthLast0Q64,
399
+ pool.feeGrowthGlobal0Q64
400
+ );
401
+ const accrued1 = calculateAccruedFees(
402
+ position.shares,
403
+ position.feeGrowthLast1Q64,
404
+ pool.feeGrowthGlobal1Q64
405
+ );
406
+ return {
407
+ pending0: position.feeOwed0 + accrued0,
408
+ pending1: position.feeOwed1 + accrued1
409
+ };
410
+ }
411
+ function getSpotPrice0(pool) {
412
+ if (pool.reserve0 === 0n) return 0;
413
+ return q64ToNumber(computePrice0Q64(pool.reserve0, pool.reserve1));
414
+ }
415
+ function getSpotPrice1(pool) {
416
+ if (pool.reserve1 === 0n) return 0;
417
+ return q64ToNumber(computePrice1Q64(pool.reserve0, pool.reserve1));
418
+ }
419
+ function getK(pool) {
420
+ return pool.reserve0 * pool.reserve1;
421
+ }
422
+ function getTvl(pool, side = 0) {
423
+ if (side === 0) {
424
+ return 2n * pool.reserve0;
425
+ } else {
426
+ return 2n * pool.reserve1;
427
+ }
428
+ }
429
+ function calculateTwap(cumulativeStart, cumulativeEnd, timestampStart, timestampEnd) {
430
+ const dt = BigInt(timestampEnd - timestampStart);
431
+ if (dt === 0n) return 0n;
432
+ const cumulativeDiff = cumulativeEnd >= cumulativeStart ? cumulativeEnd - cumulativeStart : (1n << 256n) - cumulativeStart + cumulativeEnd;
433
+ return cumulativeDiff / dt;
434
+ }
435
+ function calculateTwapNumber(cumulativeStart, cumulativeEnd, timestampStart, timestampEnd) {
436
+ const twapQ64 = calculateTwap(
437
+ cumulativeStart,
438
+ cumulativeEnd,
439
+ timestampStart,
440
+ timestampEnd
441
+ );
442
+ return q64ToNumber(twapQ64);
443
+ }
444
+
445
+ // src/solana/instructions/collectFees.ts
446
+ function createCollectFeesInstruction(accounts, args, programId = PROGRAM_ID) {
447
+ const {
448
+ pool,
449
+ position,
450
+ owner,
451
+ authority,
452
+ vault0,
453
+ vault1,
454
+ token0Mint,
455
+ token1Mint,
456
+ user0,
457
+ user1,
458
+ tokenProgram = TOKEN_PROGRAM_ID
459
+ } = accounts;
460
+ const keys = [
461
+ { address: pool, role: ACCOUNT_ROLE_WRITABLE },
462
+ { address: position, role: ACCOUNT_ROLE_WRITABLE },
463
+ { address: owner, role: ACCOUNT_ROLE_SIGNER },
464
+ { address: authority, role: ACCOUNT_ROLE_READONLY },
465
+ { address: vault0, role: ACCOUNT_ROLE_WRITABLE },
466
+ { address: vault1, role: ACCOUNT_ROLE_WRITABLE },
467
+ { address: token0Mint, role: ACCOUNT_ROLE_READONLY },
468
+ { address: token1Mint, role: ACCOUNT_ROLE_READONLY },
469
+ { address: user0, role: ACCOUNT_ROLE_WRITABLE },
470
+ { address: user1, role: ACCOUNT_ROLE_WRITABLE },
471
+ { address: tokenProgram, role: ACCOUNT_ROLE_READONLY }
472
+ ];
473
+ const data = encodeInstructionData(
474
+ INSTRUCTION_DISCRIMINATORS.collectFees,
475
+ collectFeesArgsCodec,
476
+ args
477
+ );
478
+ return {
479
+ programAddress: programId,
480
+ accounts: keys,
481
+ data
482
+ };
483
+ }
484
+ var MAX_FEE_AMOUNT = BigInt("18446744073709551615");
485
+
486
+ // src/solana/client/pool.ts
487
+ function bytesToBase64(bytes) {
488
+ let binary = "";
489
+ for (let i = 0; i < bytes.length; i++) {
490
+ binary += String.fromCharCode(bytes[i]);
491
+ }
492
+ return btoa(binary);
493
+ }
494
+ function base64ToBytes(base64) {
495
+ const binary = atob(base64);
496
+ const bytes = new Uint8Array(binary.length);
497
+ for (let i = 0; i < binary.length; i++) {
498
+ bytes[i] = binary.charCodeAt(i);
499
+ }
500
+ return bytes;
501
+ }
502
+ async function fetchPool(rpc, address, config) {
503
+ const response = await rpc.getAccountInfo(address, {
504
+ encoding: "base64",
505
+ commitment: config?.commitment
506
+ }).send();
507
+ if (!response.value) {
508
+ return null;
509
+ }
510
+ return decodePool(base64ToBytes(response.value.data[0]));
511
+ }
512
+ async function fetchAllPools(rpc, config) {
513
+ const programId = config?.programId ?? PROGRAM_ID;
514
+ const discriminatorFilter = {
515
+ memcmp: {
516
+ offset: 0n,
517
+ bytes: bytesToBase64(ACCOUNT_DISCRIMINATORS.Pool),
518
+ encoding: "base64"
519
+ }
520
+ };
521
+ const response = await rpc.getProgramAccounts(programId, {
522
+ encoding: "base64",
523
+ commitment: config?.commitment,
524
+ filters: [discriminatorFilter]
525
+ }).send();
526
+ const accounts = Array.isArray(response) ? response : response.value;
527
+ const pools = [];
528
+ for (const account of accounts) {
529
+ try {
530
+ const pool = decodePool(base64ToBytes(account.account.data[0]));
531
+ pools.push({
532
+ address: account.pubkey,
533
+ account: pool
534
+ });
535
+ } catch {
536
+ console.warn(`Failed to decode pool account: ${account.pubkey}`);
537
+ }
538
+ }
539
+ return pools;
540
+ }
541
+ async function getPoolByMints(rpc, mint0, mint1, config) {
542
+ const programId = config?.programId ?? PROGRAM_ID;
543
+ const [poolAddress] = await getPoolAddress(mint0, mint1, programId);
544
+ const pool = await fetchPool(rpc, poolAddress, config);
545
+ if (!pool) {
546
+ return null;
547
+ }
548
+ return {
549
+ address: poolAddress,
550
+ account: pool
551
+ };
552
+ }
553
+ async function fetchPoolsBatch(rpc, addresses, config) {
554
+ const pools = /* @__PURE__ */ new Map();
555
+ const results = await Promise.all(
556
+ addresses.map((addr) => fetchPool(rpc, addr, config))
557
+ );
558
+ for (let i = 0; i < addresses.length; i++) {
559
+ const pool = results[i];
560
+ if (pool) {
561
+ pools.set(addresses[i], pool);
562
+ }
563
+ }
564
+ return pools;
565
+ }
566
+ async function poolExists(rpc, mint0, mint1, config) {
567
+ const result = await getPoolByMints(rpc, mint0, mint1, config);
568
+ return result !== null;
569
+ }
570
+ async function getPoolAddressFromMints(mint0, mint1, programId = PROGRAM_ID) {
571
+ const [token0, token1] = sortMints(mint0, mint1);
572
+ const [poolAddress] = await getPoolAddress(mint0, mint1, programId);
573
+ return {
574
+ poolAddress,
575
+ token0,
576
+ token1
577
+ };
578
+ }
579
+ function filterPoolsByMint(pools, mint) {
580
+ return pools.filter(
581
+ ({ account }) => account.token0Mint === mint || account.token1Mint === mint
582
+ );
583
+ }
584
+ function sortPoolsByReserves(pools, descending = true) {
585
+ return [...pools].sort((a, b) => {
586
+ const totalA = a.account.reserve0 + a.account.reserve1;
587
+ const totalB = b.account.reserve0 + b.account.reserve1;
588
+ const cmp = totalA < totalB ? -1 : totalA > totalB ? 1 : 0;
589
+ return descending ? -cmp : cmp;
590
+ });
591
+ }
592
+
593
+ // src/solana/client/position.ts
594
+ function bytesToBase642(bytes) {
595
+ let binary = "";
596
+ for (let i = 0; i < bytes.length; i++) {
597
+ binary += String.fromCharCode(bytes[i]);
598
+ }
599
+ return btoa(binary);
600
+ }
601
+ function base64ToBytes2(base64) {
602
+ const binary = atob(base64);
603
+ const bytes = new Uint8Array(binary.length);
604
+ for (let i = 0; i < binary.length; i++) {
605
+ bytes[i] = binary.charCodeAt(i);
606
+ }
607
+ return bytes;
608
+ }
609
+ async function fetchPosition(rpc, address, config) {
610
+ const response = await rpc.getAccountInfo(address, {
611
+ encoding: "base64",
612
+ commitment: config?.commitment
613
+ }).send();
614
+ if (!response.value) {
615
+ return null;
616
+ }
617
+ return decodePosition(base64ToBytes2(response.value.data[0]));
618
+ }
619
+ async function fetchUserPositions(rpc, owner, pool, config) {
620
+ const programId = config?.programId ?? PROGRAM_ID;
621
+ const filters = [
622
+ // Discriminator filter (first 8 bytes)
623
+ {
624
+ memcmp: {
625
+ offset: 0n,
626
+ bytes: bytesToBase642(
627
+ ACCOUNT_DISCRIMINATORS.Position
628
+ ),
629
+ encoding: "base64"
630
+ }
631
+ },
632
+ // Owner filter (after 8-byte discriminator + 32-byte pool = offset 40)
633
+ {
634
+ memcmp: {
635
+ offset: 40n,
636
+ bytes: owner,
637
+ encoding: "base58"
638
+ }
639
+ }
640
+ ];
641
+ if (pool) {
642
+ filters.push({
643
+ memcmp: {
644
+ offset: 8n,
645
+ bytes: pool,
646
+ encoding: "base58"
647
+ }
648
+ });
649
+ }
650
+ const response = await rpc.getProgramAccounts(programId, {
651
+ encoding: "base64",
652
+ commitment: config?.commitment,
653
+ filters
654
+ }).send();
655
+ const accounts = Array.isArray(response) ? response : response.value;
656
+ const positions = [];
657
+ for (const account of accounts) {
658
+ try {
659
+ const position = decodePosition(base64ToBytes2(account.account.data[0]));
660
+ positions.push({
661
+ address: account.pubkey,
662
+ account: position
663
+ });
664
+ } catch {
665
+ console.warn(`Failed to decode position account: ${account.pubkey}`);
666
+ }
667
+ }
668
+ return positions;
669
+ }
670
+ async function fetchPoolPositions(rpc, pool, config) {
671
+ const programId = config?.programId ?? PROGRAM_ID;
672
+ const filters = [
673
+ // Discriminator filter
674
+ {
675
+ memcmp: {
676
+ offset: 0n,
677
+ bytes: bytesToBase642(
678
+ ACCOUNT_DISCRIMINATORS.Position
679
+ ),
680
+ encoding: "base64"
681
+ }
682
+ },
683
+ // Pool filter (after 8-byte discriminator = offset 8)
684
+ {
685
+ memcmp: {
686
+ offset: 8n,
687
+ bytes: pool,
688
+ encoding: "base58"
689
+ }
690
+ }
691
+ ];
692
+ const response = await rpc.getProgramAccounts(programId, {
693
+ encoding: "base64",
694
+ commitment: config?.commitment,
695
+ filters
696
+ }).send();
697
+ const accounts = Array.isArray(response) ? response : response.value;
698
+ const positions = [];
699
+ for (const account of accounts) {
700
+ try {
701
+ const position = decodePosition(base64ToBytes2(account.account.data[0]));
702
+ positions.push({
703
+ address: account.pubkey,
704
+ account: position
705
+ });
706
+ } catch {
707
+ console.warn(`Failed to decode position account: ${account.pubkey}`);
708
+ }
709
+ }
710
+ return positions;
711
+ }
712
+ function getPositionValue(pool, position) {
713
+ if (pool.totalShares === 0n) {
714
+ return {
715
+ amount0: 0n,
716
+ amount1: 0n,
717
+ pendingFees0: 0n,
718
+ pendingFees1: 0n,
719
+ totalValue0: 0n,
720
+ totalValue1: 0n,
721
+ poolShare: 0
722
+ };
723
+ }
724
+ const amount0 = position.shares * pool.reserve0 / pool.totalShares;
725
+ const amount1 = position.shares * pool.reserve1 / pool.totalShares;
726
+ const { pending0, pending1 } = getPendingFees(pool, position);
727
+ const poolShare = ratioToNumber(position.shares, pool.totalShares);
728
+ return {
729
+ amount0,
730
+ amount1,
731
+ pendingFees0: pending0,
732
+ pendingFees1: pending1,
733
+ totalValue0: amount0 + pending0,
734
+ totalValue1: amount1 + pending1,
735
+ poolShare
736
+ };
737
+ }
738
+ async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
739
+ const programId = config?.programId ?? PROGRAM_ID;
740
+ const [address] = await getPositionAddress(
741
+ pool,
742
+ owner,
743
+ positionId,
744
+ programId
745
+ );
746
+ const position = await fetchPosition(rpc, address, config);
747
+ if (!position) {
748
+ return null;
749
+ }
750
+ return {
751
+ address,
752
+ account: position
753
+ };
754
+ }
755
+ async function getPositionAddressFromParams(pool, owner, positionId, programId = PROGRAM_ID) {
756
+ const [address] = await getPositionAddress(
757
+ pool,
758
+ owner,
759
+ positionId,
760
+ programId
761
+ );
762
+ return address;
763
+ }
764
+ async function fetchPositionsBatch(rpc, addresses, config) {
765
+ const positions = /* @__PURE__ */ new Map();
766
+ const results = await Promise.all(
767
+ addresses.map((addr) => fetchPosition(rpc, addr, config))
768
+ );
769
+ for (let i = 0; i < addresses.length; i++) {
770
+ const position = results[i];
771
+ if (position) {
772
+ positions.set(addresses[i], position);
773
+ }
774
+ }
775
+ return positions;
776
+ }
777
+ function filterActivePositions(positions) {
778
+ return positions.filter(({ account }) => account.shares > 0n);
779
+ }
780
+ function sortPositionsByShares(positions, descending = true) {
781
+ return [...positions].sort((a, b) => {
782
+ const cmp = a.account.shares < b.account.shares ? -1 : a.account.shares > b.account.shares ? 1 : 0;
783
+ return descending ? -cmp : cmp;
784
+ });
785
+ }
786
+
787
+ // src/solana/client/oracle.ts
788
+ function base64ToBytes3(base64) {
789
+ const binary = atob(base64);
790
+ const bytes = new Uint8Array(binary.length);
791
+ for (let i = 0; i < binary.length; i++) {
792
+ bytes[i] = binary.charCodeAt(i);
793
+ }
794
+ return bytes;
795
+ }
796
+ async function fetchOracle(rpc, address, config) {
797
+ const response = await rpc.getAccountInfo(address, {
798
+ encoding: "base64",
799
+ commitment: config?.commitment
800
+ }).send();
801
+ if (!response.value) {
802
+ return null;
803
+ }
804
+ return decodeOracleState(base64ToBytes3(response.value.data[0]));
805
+ }
806
+ async function getOracleForPool(rpc, pool, config) {
807
+ const programId = config?.programId ?? PROGRAM_ID;
808
+ const [oracleAddress] = await getOracleAddress(pool, programId);
809
+ const oracle = await fetchOracle(rpc, oracleAddress, config);
810
+ if (!oracle) {
811
+ return null;
812
+ }
813
+ return {
814
+ address: oracleAddress,
815
+ account: oracle
816
+ };
817
+ }
818
+ async function getOracleAddressFromPool(pool, programId = PROGRAM_ID) {
819
+ const [address] = await getOracleAddress(pool, programId);
820
+ return address;
821
+ }
822
+ function consultTwap(oracle, windowSeconds, currentTimestamp) {
823
+ if (!oracle.initialized || oracle.lastTimestamp === 0) {
824
+ return null;
825
+ }
826
+ const nowTs = Math.max(0, Math.floor(currentTimestamp ?? Date.now() / 1e3));
827
+ const dtSinceLast = Math.max(0, nowTs - oracle.lastTimestamp);
828
+ const cum0Now = oracle.price0Cumulative + oracle.truncPrice0Q64 * BigInt(dtSinceLast);
829
+ const cum1Now = oracle.price1Cumulative + oracle.truncPrice1Q64 * BigInt(dtSinceLast);
830
+ if (windowSeconds === 0) {
831
+ return {
832
+ price0Q64: oracle.truncPrice0Q64,
833
+ price1Q64: oracle.truncPrice1Q64,
834
+ price0: q64ToNumber(oracle.truncPrice0Q64),
835
+ price1: q64ToNumber(oracle.truncPrice1Q64)
836
+ };
837
+ }
838
+ const targetTs = Math.max(0, nowTs - windowSeconds);
839
+ const sample = selectSample(oracle, targetTs);
840
+ if (!sample) {
841
+ return null;
842
+ }
843
+ const dt = Math.max(0, nowTs - sample.timestamp);
844
+ if (dt === 0) {
845
+ return null;
846
+ }
847
+ const price0Q64 = (cum0Now - sample.price0Cumulative) / BigInt(dt);
848
+ const price1Q64 = (cum1Now - sample.price1Cumulative) / BigInt(dt);
849
+ return {
850
+ price0Q64,
851
+ price1Q64,
852
+ price0: q64ToNumber(price0Q64),
853
+ price1: q64ToNumber(price1Q64)
854
+ };
855
+ }
856
+ function selectSample(oracle, targetTimestamp) {
857
+ let best = null;
858
+ const base = {
859
+ timestamp: oracle.lastTimestamp,
860
+ price0Cumulative: oracle.price0Cumulative,
861
+ price1Cumulative: oracle.price1Cumulative
862
+ };
863
+ if (base.timestamp !== 0 && base.timestamp <= targetTimestamp) {
864
+ best = base;
865
+ }
866
+ for (const obs of oracle.observations) {
867
+ if (obs.timestamp === 0) {
868
+ continue;
869
+ }
870
+ if (obs.timestamp <= targetTimestamp) {
871
+ if (!best || obs.timestamp > best.timestamp) {
872
+ best = obs;
873
+ }
874
+ }
875
+ }
876
+ if (best) {
877
+ return best;
878
+ }
879
+ let oldest = base.timestamp !== 0 ? base : null;
880
+ for (const obs of oracle.observations) {
881
+ if (obs.timestamp === 0) {
882
+ continue;
883
+ }
884
+ if (!oldest || obs.timestamp < oldest.timestamp) {
885
+ oldest = obs;
886
+ }
887
+ }
888
+ return oldest;
889
+ }
890
+ function getOracleSpotPrices(oracle) {
891
+ return {
892
+ price0Q64: oracle.truncPrice0Q64,
893
+ price1Q64: oracle.truncPrice1Q64,
894
+ price0: q64ToNumber(oracle.truncPrice0Q64),
895
+ price1: q64ToNumber(oracle.truncPrice1Q64)
896
+ };
897
+ }
898
+ function getOracleDeviation(oracle) {
899
+ return {
900
+ deviation0Q64: oracle.deviation0Q64,
901
+ deviation1Q64: oracle.deviation1Q64,
902
+ deviation0: q64ToNumber(oracle.deviation0Q64),
903
+ deviation1: q64ToNumber(oracle.deviation1Q64)
904
+ };
905
+ }
906
+ function getOracleAge(oracle, currentTimestamp) {
907
+ const now = currentTimestamp ?? Math.floor(Date.now() / 1e3);
908
+ return now - oracle.lastTimestamp;
909
+ }
910
+ function isOracleStale(oracle, maxAgeSeconds, currentTimestamp) {
911
+ return getOracleAge(oracle, currentTimestamp) > maxAgeSeconds;
912
+ }
913
+ function getOracleBufferStats(oracle) {
914
+ const observations = oracle.observations;
915
+ const capacity = observations.length;
916
+ const currentIndex = oracle.observationIndex;
917
+ let filledCount = 0;
918
+ let oldestTimestamp = 0;
919
+ let newestTimestamp = 0;
920
+ for (let i = 0; i < capacity; i++) {
921
+ const obs = observations[i];
922
+ if (obs.timestamp > 0) {
923
+ filledCount++;
924
+ if (oldestTimestamp === 0 || obs.timestamp < oldestTimestamp) {
925
+ oldestTimestamp = obs.timestamp;
926
+ }
927
+ if (obs.timestamp > newestTimestamp) {
928
+ newestTimestamp = obs.timestamp;
929
+ }
930
+ }
931
+ }
932
+ return {
933
+ capacity,
934
+ filledCount,
935
+ currentIndex,
936
+ oldestTimestamp,
937
+ newestTimestamp,
938
+ timeSpanSeconds: newestTimestamp > oldestTimestamp ? newestTimestamp - oldestTimestamp : 0
939
+ };
940
+ }
941
+ async function fetchOraclesBatch(rpc, pools, config) {
942
+ const programId = config?.programId ?? PROGRAM_ID;
943
+ const oracles = /* @__PURE__ */ new Map();
944
+ const oracleAddresses = await Promise.all(
945
+ pools.map((pool) => getOracleAddress(pool, programId))
946
+ );
947
+ const results = await Promise.all(
948
+ oracleAddresses.map(([addr]) => fetchOracle(rpc, addr, config))
949
+ );
950
+ for (let i = 0; i < pools.length; i++) {
951
+ const oracle = results[i];
952
+ if (oracle) {
953
+ oracles.set(pools[i], {
954
+ address: oracleAddresses[i][0],
955
+ account: oracle
956
+ });
957
+ }
958
+ }
959
+ return oracles;
960
+ }
961
+ function comparePoolAndOraclePrices(pool, oracle) {
962
+ const poolPrice0 = pool.reserve0 > 0n ? Number(pool.reserve1) / Number(pool.reserve0) : 0;
963
+ const oraclePrice0 = q64ToNumber(oracle.truncPrice0Q64);
964
+ const divergencePct = oraclePrice0 > 0 ? (poolPrice0 - oraclePrice0) / oraclePrice0 * 100 : 0;
965
+ return {
966
+ poolPrice0,
967
+ oraclePrice0,
968
+ divergencePct
969
+ };
970
+ }
971
+
972
+ export { MAX_FEE_AMOUNT, calculateAccruedFees, calculateTwap, calculateTwapNumber, ceilDiv, collectProtocolFeesArgsCodec, comparePoolAndOraclePrices, computePrice0Q64, computePrice1Q64, consultTwap, createCollectFeesInstruction, createPositionArgsCodec, decodeAmmConfig, decodeOracleState, decodePool, decodePosition, encodeInstructionData, fetchAllPools, fetchOracle, fetchOraclesBatch, fetchPool, fetchPoolPositions, fetchPoolsBatch, fetchPosition, fetchPositionByParams, fetchPositionsBatch, fetchUserPositions, filterActivePositions, filterPoolsByMint, getAddLiquidityQuote, getK, getOracleAddressFromPool, getOracleAge, getOracleBufferStats, getOracleDeviation, getOracleForPool, getOracleSpotPrices, getPendingFees, getPoolAddressFromMints, getPoolByMints, getPositionAddressFromParams, getPositionValue, getRemoveLiquidityQuote, getSpotPrice0, getSpotPrice1, getSwapQuote, getSwapQuoteExactOut, getTvl, initializeConfigArgsCodec, initializeOracleArgsCodec, initializePoolArgsCodec, isOracleStale, isqrt, maxBigInt, minBigInt, numberToQ64, oracleConsultArgsCodec, poolExists, q64Div, q64Mul, q64ToNumber, quoteToNumeraireArgsCodec, ratioToNumber, removeLiquidityArgsCodec, setFeesArgsCodec, setRouteArgsCodec, setSentinelArgsCodec, sortPoolsByReserves, sortPositionsByShares, swapExactInArgsCodec, transferAdminArgsCodec };
973
+ //# sourceMappingURL=chunk-LIXSTCMM.js.map
974
+ //# sourceMappingURL=chunk-LIXSTCMM.js.map