@exponent-labs/exponent-sdk 0.1.7 → 0.9.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 (1602) hide show
  1. package/build/CodamaEventDecoder.d.ts +49 -0
  2. package/build/CodamaEventDecoder.js +113 -0
  3. package/build/CodamaEventDecoder.js.map +1 -0
  4. package/build/addressLookupTableUtil.d.ts +31 -10
  5. package/build/addressLookupTableUtil.js +65 -5
  6. package/build/addressLookupTableUtil.js.map +1 -1
  7. package/build/client/clmm/accounts/lpPosition.d.ts +29 -0
  8. package/build/client/clmm/accounts/lpPosition.js +82 -0
  9. package/build/client/clmm/accounts/lpPosition.js.map +1 -0
  10. package/build/client/clmm/accounts/marketThree.d.ts +47 -0
  11. package/build/client/clmm/accounts/marketThree.js +139 -0
  12. package/build/client/clmm/accounts/marketThree.js.map +1 -0
  13. package/build/client/clmm/accounts/vault.d.ts +48 -0
  14. package/build/client/clmm/accounts/vault.js +128 -0
  15. package/build/client/clmm/accounts/vault.js.map +1 -0
  16. package/build/client/clmm/eventRegistry.d.ts +59 -0
  17. package/build/client/clmm/eventRegistry.js +58 -0
  18. package/build/client/clmm/eventRegistry.js.map +1 -0
  19. package/build/client/clmm/index.d.ts +78 -0
  20. package/build/client/clmm/index.js +96 -0
  21. package/build/client/clmm/index.js.map +1 -0
  22. package/build/client/clmm/instructions/addFarm.d.ts +19 -0
  23. package/build/client/clmm/instructions/addFarm.js +31 -0
  24. package/build/client/clmm/instructions/addFarm.js.map +1 -0
  25. package/build/client/clmm/instructions/addLiquidity.d.ts +26 -0
  26. package/build/client/clmm/instructions/addLiquidity.js +38 -0
  27. package/build/client/clmm/instructions/addLiquidity.js.map +1 -0
  28. package/build/client/clmm/instructions/addMarketEmission.d.ts +15 -0
  29. package/build/client/clmm/instructions/addMarketEmission.js +27 -0
  30. package/build/client/clmm/instructions/addMarketEmission.js.map +1 -0
  31. package/build/client/clmm/instructions/buyPt.d.ts +24 -0
  32. package/build/client/clmm/instructions/buyPt.js +36 -0
  33. package/build/client/clmm/instructions/buyPt.js.map +1 -0
  34. package/build/client/clmm/instructions/buyYt.d.ts +26 -0
  35. package/build/client/clmm/instructions/buyYt.js +42 -0
  36. package/build/client/clmm/instructions/buyYt.js.map +1 -0
  37. package/build/client/clmm/instructions/claimFarmEmission.d.ts +18 -0
  38. package/build/client/clmm/instructions/claimFarmEmission.js +30 -0
  39. package/build/client/clmm/instructions/claimFarmEmission.js.map +1 -0
  40. package/build/client/clmm/instructions/closeMarket.d.ts +17 -0
  41. package/build/client/clmm/instructions/closeMarket.js +26 -0
  42. package/build/client/clmm/instructions/closeMarket.js.map +1 -0
  43. package/build/client/clmm/instructions/depositLiquidity.d.ts +25 -0
  44. package/build/client/clmm/instructions/depositLiquidity.js +37 -0
  45. package/build/client/clmm/instructions/depositLiquidity.js.map +1 -0
  46. package/build/client/clmm/instructions/initializeMarket.d.ts +47 -0
  47. package/build/client/clmm/instructions/initializeMarket.js +63 -0
  48. package/build/client/clmm/instructions/initializeMarket.js.map +1 -0
  49. package/build/client/clmm/instructions/marketAccrueEmission.d.ts +13 -0
  50. package/build/client/clmm/instructions/marketAccrueEmission.js +22 -0
  51. package/build/client/clmm/instructions/marketAccrueEmission.js.map +1 -0
  52. package/build/client/clmm/instructions/marketCollectEmission.d.ts +18 -0
  53. package/build/client/clmm/instructions/marketCollectEmission.js +30 -0
  54. package/build/client/clmm/instructions/marketCollectEmission.js.map +1 -0
  55. package/build/client/clmm/instructions/modifyFarm.d.ts +17 -0
  56. package/build/client/clmm/instructions/modifyFarm.js +29 -0
  57. package/build/client/clmm/instructions/modifyFarm.js.map +1 -0
  58. package/build/client/clmm/instructions/modifyMarketSetting.d.ts +11 -0
  59. package/build/client/clmm/instructions/modifyMarketSetting.js +23 -0
  60. package/build/client/clmm/instructions/modifyMarketSetting.js.map +1 -0
  61. package/build/client/clmm/instructions/sellPt.d.ts +24 -0
  62. package/build/client/clmm/instructions/sellPt.js +36 -0
  63. package/build/client/clmm/instructions/sellPt.js.map +1 -0
  64. package/build/client/clmm/instructions/sellYt.d.ts +26 -0
  65. package/build/client/clmm/instructions/sellYt.js +42 -0
  66. package/build/client/clmm/instructions/sellYt.js.map +1 -0
  67. package/build/client/clmm/instructions/tradePt.d.ts +25 -0
  68. package/build/client/clmm/instructions/tradePt.js +37 -0
  69. package/build/client/clmm/instructions/tradePt.js.map +1 -0
  70. package/build/client/clmm/instructions/tradePtExactOut.d.ts +25 -0
  71. package/build/client/clmm/instructions/tradePtExactOut.js +37 -0
  72. package/build/client/clmm/instructions/tradePtExactOut.js.map +1 -0
  73. package/build/client/clmm/instructions/withdrawLiquidity.d.ts +23 -0
  74. package/build/client/clmm/instructions/withdrawLiquidity.js +35 -0
  75. package/build/client/clmm/instructions/withdrawLiquidity.js.map +1 -0
  76. package/build/client/clmm/instructions/wrapperBuyYt.d.ts +28 -0
  77. package/build/client/clmm/instructions/wrapperBuyYt.js +48 -0
  78. package/build/client/clmm/instructions/wrapperBuyYt.js.map +1 -0
  79. package/build/client/clmm/instructions/wrapperProvideLiquidity.d.ts +33 -0
  80. package/build/client/clmm/instructions/wrapperProvideLiquidity.js +53 -0
  81. package/build/client/clmm/instructions/wrapperProvideLiquidity.js.map +1 -0
  82. package/build/client/clmm/instructions/wrapperProvideLiquidityBase.d.ts +32 -0
  83. package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js +52 -0
  84. package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js.map +1 -0
  85. package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.d.ts +28 -0
  86. package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js +44 -0
  87. package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js.map +1 -0
  88. package/build/client/clmm/instructions/wrapperSellYt.d.ts +27 -0
  89. package/build/client/clmm/instructions/wrapperSellYt.js +47 -0
  90. package/build/client/clmm/instructions/wrapperSellYt.js.map +1 -0
  91. package/build/client/clmm/instructions/wrapperWithdrawLiquidity.d.ts +25 -0
  92. package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js +41 -0
  93. package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js.map +1 -0
  94. package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.d.ts +22 -0
  95. package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js +38 -0
  96. package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -0
  97. package/build/client/clmm/types/addFarmEvent.d.ts +35 -0
  98. package/build/client/clmm/types/addFarmEvent.js +24 -0
  99. package/build/client/clmm/types/addFarmEvent.js.map +1 -0
  100. package/build/client/clmm/types/amount.d.ts +33 -0
  101. package/build/client/clmm/types/amount.js +20 -0
  102. package/build/client/clmm/types/amount.js.map +1 -0
  103. package/build/client/clmm/types/buyPtEvent.d.ts +23 -0
  104. package/build/client/clmm/types/buyPtEvent.js +18 -0
  105. package/build/client/clmm/types/buyPtEvent.js.map +1 -0
  106. package/build/client/clmm/types/buyYtEvent.d.ts +56 -0
  107. package/build/client/clmm/types/buyYtEvent.js +36 -0
  108. package/build/client/clmm/types/buyYtEvent.js.map +1 -0
  109. package/build/client/clmm/types/claimFarmEmissionsEvent.d.ts +171 -0
  110. package/build/client/clmm/types/claimFarmEmissionsEvent.js +42 -0
  111. package/build/client/clmm/types/claimFarmEmissionsEvent.js.map +1 -0
  112. package/build/client/clmm/types/claimLimits.d.ts +22 -0
  113. package/build/client/clmm/types/claimLimits.js +11 -0
  114. package/build/client/clmm/types/claimLimits.js.map +1 -0
  115. package/build/client/clmm/types/closeMarketEvent.d.ts +23 -0
  116. package/build/client/clmm/types/closeMarketEvent.js +18 -0
  117. package/build/client/clmm/types/closeMarketEvent.js.map +1 -0
  118. package/build/client/clmm/types/configurationOptions.d.ts +34 -0
  119. package/build/client/clmm/types/configurationOptions.js +14 -0
  120. package/build/client/clmm/types/configurationOptions.js.map +1 -0
  121. package/build/client/clmm/types/cpiAccounts.d.ts +107 -0
  122. package/build/client/clmm/types/cpiAccounts.js +13 -0
  123. package/build/client/clmm/types/cpiAccounts.js.map +1 -0
  124. package/build/client/clmm/types/cpiCoreAccounts.d.ts +47 -0
  125. package/build/client/clmm/types/cpiCoreAccounts.js +10 -0
  126. package/build/client/clmm/types/cpiCoreAccounts.js.map +1 -0
  127. package/build/client/clmm/types/cpiInterfaceContext.d.ts +18 -0
  128. package/build/client/clmm/types/cpiInterfaceContext.js +10 -0
  129. package/build/client/clmm/types/cpiInterfaceContext.js.map +1 -0
  130. package/build/client/clmm/types/crossingSplit.d.ts +124 -0
  131. package/build/client/clmm/types/crossingSplit.js +20 -0
  132. package/build/client/clmm/types/crossingSplit.js.map +1 -0
  133. package/build/client/clmm/types/depositLiquidityEvent.d.ts +171 -0
  134. package/build/client/clmm/types/depositLiquidityEvent.js +42 -0
  135. package/build/client/clmm/types/depositLiquidityEvent.js.map +1 -0
  136. package/build/client/clmm/types/depositLiquidityReturnData.d.ts +67 -0
  137. package/build/client/clmm/types/depositLiquidityReturnData.js +38 -0
  138. package/build/client/clmm/types/depositLiquidityReturnData.js.map +1 -0
  139. package/build/client/clmm/types/emissionInfo.d.ts +36 -0
  140. package/build/client/clmm/types/emissionInfo.js +22 -0
  141. package/build/client/clmm/types/emissionInfo.js.map +1 -0
  142. package/build/client/clmm/types/farmEmission.d.ts +24 -0
  143. package/build/client/clmm/types/farmEmission.js +16 -0
  144. package/build/client/clmm/types/farmEmission.js.map +1 -0
  145. package/build/client/clmm/types/index.d.ts +48 -0
  146. package/build/client/clmm/types/index.js +65 -0
  147. package/build/client/clmm/types/index.js.map +1 -0
  148. package/build/client/clmm/types/liquidityNetBalanceLimits.d.ts +26 -0
  149. package/build/client/clmm/types/liquidityNetBalanceLimits.js +12 -0
  150. package/build/client/clmm/types/liquidityNetBalanceLimits.js.map +1 -0
  151. package/build/client/clmm/types/lpFarm.d.ts +35 -0
  152. package/build/client/clmm/types/lpFarm.js +10 -0
  153. package/build/client/clmm/types/lpFarm.js.map +1 -0
  154. package/build/client/clmm/types/marketAccrueEmissionEvent.d.ts +151 -0
  155. package/build/client/clmm/types/marketAccrueEmissionEvent.js +31 -0
  156. package/build/client/clmm/types/marketAccrueEmissionEvent.js.map +1 -0
  157. package/build/client/clmm/types/marketAdminAction.d.ts +359 -0
  158. package/build/client/clmm/types/marketAdminAction.js +72 -0
  159. package/build/client/clmm/types/marketAdminAction.js.map +1 -0
  160. package/build/client/clmm/types/marketCollectEmissionEvent.d.ts +163 -0
  161. package/build/client/clmm/types/marketCollectEmissionEvent.js +37 -0
  162. package/build/client/clmm/types/marketCollectEmissionEvent.js.map +1 -0
  163. package/build/client/clmm/types/marketEmission.d.ts +20 -0
  164. package/build/client/clmm/types/marketEmission.js +15 -0
  165. package/build/client/clmm/types/marketEmission.js.map +1 -0
  166. package/build/client/clmm/types/marketEmissions.d.ts +27 -0
  167. package/build/client/clmm/types/marketEmissions.js +9 -0
  168. package/build/client/clmm/types/marketEmissions.js.map +1 -0
  169. package/build/client/clmm/types/marketFinancials.d.ts +26 -0
  170. package/build/client/clmm/types/marketFinancials.js +12 -0
  171. package/build/client/clmm/types/marketFinancials.js.map +1 -0
  172. package/build/client/clmm/types/marketThreeInitEvent.d.ts +71 -0
  173. package/build/client/clmm/types/marketThreeInitEvent.js +42 -0
  174. package/build/client/clmm/types/marketThreeInitEvent.js.map +1 -0
  175. package/build/client/clmm/types/mergeEvent.d.ts +84 -0
  176. package/build/client/clmm/types/mergeEvent.js +55 -0
  177. package/build/client/clmm/types/mergeEvent.js.map +1 -0
  178. package/build/client/clmm/types/modifiedTick.d.ts +18 -0
  179. package/build/client/clmm/types/modifiedTick.js +10 -0
  180. package/build/client/clmm/types/modifiedTick.js.map +1 -0
  181. package/build/client/clmm/types/modifiedTicks.d.ts +43 -0
  182. package/build/client/clmm/types/modifiedTicks.js +13 -0
  183. package/build/client/clmm/types/modifiedTicks.js.map +1 -0
  184. package/build/client/clmm/types/modifyFarmEvent.d.ts +43 -0
  185. package/build/client/clmm/types/modifyFarmEvent.js +26 -0
  186. package/build/client/clmm/types/modifyFarmEvent.js.map +1 -0
  187. package/build/client/clmm/types/number.d.ts +2 -0
  188. package/build/client/clmm/types/number.js +8 -0
  189. package/build/client/clmm/types/number.js.map +1 -0
  190. package/build/client/clmm/types/personalYieldTracker.d.ts +15 -0
  191. package/build/client/clmm/types/personalYieldTracker.js +10 -0
  192. package/build/client/clmm/types/personalYieldTracker.js.map +1 -0
  193. package/build/client/clmm/types/personalYieldTrackers.d.ts +23 -0
  194. package/build/client/clmm/types/personalYieldTrackers.js +9 -0
  195. package/build/client/clmm/types/personalYieldTrackers.js.map +1 -0
  196. package/build/client/clmm/types/principalShare.d.ts +51 -0
  197. package/build/client/clmm/types/principalShare.js +14 -0
  198. package/build/client/clmm/types/principalShare.js.map +1 -0
  199. package/build/client/clmm/types/principalShareTrackers.d.ts +63 -0
  200. package/build/client/clmm/types/principalShareTrackers.js +9 -0
  201. package/build/client/clmm/types/principalShareTrackers.js.map +1 -0
  202. package/build/client/clmm/types/sellPtEvent.d.ts +23 -0
  203. package/build/client/clmm/types/sellPtEvent.js +18 -0
  204. package/build/client/clmm/types/sellPtEvent.js.map +1 -0
  205. package/build/client/clmm/types/sellYtEvent.d.ts +47 -0
  206. package/build/client/clmm/types/sellYtEvent.js +33 -0
  207. package/build/client/clmm/types/sellYtEvent.js.map +1 -0
  208. package/build/client/clmm/types/stripEvent.d.ts +84 -0
  209. package/build/client/clmm/types/stripEvent.js +58 -0
  210. package/build/client/clmm/types/stripEvent.js.map +1 -0
  211. package/build/client/clmm/types/swapDirection.d.ts +5 -0
  212. package/build/client/clmm/types/swapDirection.js +11 -0
  213. package/build/client/clmm/types/swapDirection.js.map +1 -0
  214. package/build/client/clmm/types/tradePtEvent.d.ts +110 -0
  215. package/build/client/clmm/types/tradePtEvent.js +37 -0
  216. package/build/client/clmm/types/tradePtEvent.js.map +1 -0
  217. package/build/client/clmm/types/withdrawLiquidityEvent.d.ts +183 -0
  218. package/build/client/clmm/types/withdrawLiquidityEvent.js +45 -0
  219. package/build/client/clmm/types/withdrawLiquidityEvent.js.map +1 -0
  220. package/build/client/clmm/types/withdrawLiquidityReturnData.d.ts +46 -0
  221. package/build/client/clmm/types/withdrawLiquidityReturnData.js +17 -0
  222. package/build/client/clmm/types/withdrawLiquidityReturnData.js.map +1 -0
  223. package/build/client/clmm/types/wrapperBuyYtEvent.d.ts +23 -0
  224. package/build/client/clmm/types/wrapperBuyYtEvent.js +18 -0
  225. package/build/client/clmm/types/wrapperBuyYtEvent.js.map +1 -0
  226. package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.d.ts +56 -0
  227. package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.js +30 -0
  228. package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.js.map +1 -0
  229. package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.d.ts +52 -0
  230. package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.js +29 -0
  231. package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.js.map +1 -0
  232. package/build/client/clmm/types/wrapperProvideLiquidityEvent.d.ts +56 -0
  233. package/build/client/clmm/types/wrapperProvideLiquidityEvent.js +30 -0
  234. package/build/client/clmm/types/wrapperProvideLiquidityEvent.js.map +1 -0
  235. package/build/client/clmm/types/wrapperSellYtEvent.d.ts +23 -0
  236. package/build/client/clmm/types/wrapperSellYtEvent.js +18 -0
  237. package/build/client/clmm/types/wrapperSellYtEvent.js.map +1 -0
  238. package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.d.ts +60 -0
  239. package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.js +31 -0
  240. package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.js.map +1 -0
  241. package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.d.ts +60 -0
  242. package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.js +31 -0
  243. package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.js.map +1 -0
  244. package/build/client/core/accounts/admin.d.ts +18 -0
  245. package/build/client/core/accounts/admin.js +71 -0
  246. package/build/client/core/accounts/admin.js.map +1 -0
  247. package/build/client/core/accounts/lpPosition.d.ts +20 -0
  248. package/build/client/core/accounts/lpPosition.js +73 -0
  249. package/build/client/core/accounts/lpPosition.js.map +1 -0
  250. package/build/client/core/accounts/marketTwo.d.ts +42 -0
  251. package/build/client/core/accounts/marketTwo.js +122 -0
  252. package/build/client/core/accounts/marketTwo.js.map +1 -0
  253. package/build/client/core/accounts/vault.d.ts +48 -0
  254. package/build/client/core/accounts/vault.js +128 -0
  255. package/build/client/core/accounts/vault.js.map +1 -0
  256. package/build/client/core/accounts/yieldTokenPosition.d.ts +20 -0
  257. package/build/client/core/accounts/yieldTokenPosition.js +74 -0
  258. package/build/client/core/accounts/yieldTokenPosition.js.map +1 -0
  259. package/build/client/core/eventRegistry.d.ts +87 -0
  260. package/build/client/core/eventRegistry.js +86 -0
  261. package/build/client/core/eventRegistry.js.map +1 -0
  262. package/build/client/core/index.d.ts +109 -0
  263. package/build/client/core/index.js +127 -0
  264. package/build/client/core/index.js.map +1 -0
  265. package/build/client/core/instructions/addEmission.d.ts +19 -0
  266. package/build/client/core/instructions/addEmission.js +35 -0
  267. package/build/client/core/instructions/addEmission.js.map +1 -0
  268. package/build/client/core/instructions/addFarm.d.ts +17 -0
  269. package/build/client/core/instructions/addFarm.js +29 -0
  270. package/build/client/core/instructions/addFarm.js.map +1 -0
  271. package/build/client/core/instructions/addLpTokensMetadata.d.ts +16 -0
  272. package/build/client/core/instructions/addLpTokensMetadata.js +32 -0
  273. package/build/client/core/instructions/addLpTokensMetadata.js.map +1 -0
  274. package/build/client/core/instructions/addMarketEmission.d.ts +16 -0
  275. package/build/client/core/instructions/addMarketEmission.js +28 -0
  276. package/build/client/core/instructions/addMarketEmission.js.map +1 -0
  277. package/build/client/core/instructions/buyYt.d.ts +28 -0
  278. package/build/client/core/instructions/buyYt.js +44 -0
  279. package/build/client/core/instructions/buyYt.js.map +1 -0
  280. package/build/client/core/instructions/claimFarmEmissions.d.ts +17 -0
  281. package/build/client/core/instructions/claimFarmEmissions.js +29 -0
  282. package/build/client/core/instructions/claimFarmEmissions.js.map +1 -0
  283. package/build/client/core/instructions/collectEmission.d.ts +21 -0
  284. package/build/client/core/instructions/collectEmission.js +37 -0
  285. package/build/client/core/instructions/collectEmission.js.map +1 -0
  286. package/build/client/core/instructions/collectInterest.d.ts +20 -0
  287. package/build/client/core/instructions/collectInterest.js +36 -0
  288. package/build/client/core/instructions/collectInterest.js.map +1 -0
  289. package/build/client/core/instructions/collectTreasuryEmission.d.ts +21 -0
  290. package/build/client/core/instructions/collectTreasuryEmission.js +33 -0
  291. package/build/client/core/instructions/collectTreasuryEmission.js.map +1 -0
  292. package/build/client/core/instructions/collectTreasuryInterest.d.ts +20 -0
  293. package/build/client/core/instructions/collectTreasuryInterest.js +32 -0
  294. package/build/client/core/instructions/collectTreasuryInterest.js.map +1 -0
  295. package/build/client/core/instructions/depositYt.d.ts +19 -0
  296. package/build/client/core/instructions/depositYt.js +31 -0
  297. package/build/client/core/instructions/depositYt.js.map +1 -0
  298. package/build/client/core/instructions/initLpPosition.d.ts +11 -0
  299. package/build/client/core/instructions/initLpPosition.js +20 -0
  300. package/build/client/core/instructions/initLpPosition.js.map +1 -0
  301. package/build/client/core/instructions/initMarketTwo.d.ts +37 -0
  302. package/build/client/core/instructions/initMarketTwo.js +53 -0
  303. package/build/client/core/instructions/initMarketTwo.js.map +1 -0
  304. package/build/client/core/instructions/initializeVault.d.ts +34 -0
  305. package/build/client/core/instructions/initializeVault.js +58 -0
  306. package/build/client/core/instructions/initializeVault.js.map +1 -0
  307. package/build/client/core/instructions/initializeYieldPosition.d.ts +10 -0
  308. package/build/client/core/instructions/initializeYieldPosition.js +19 -0
  309. package/build/client/core/instructions/initializeYieldPosition.js.map +1 -0
  310. package/build/client/core/instructions/marketCollectEmission.d.ts +17 -0
  311. package/build/client/core/instructions/marketCollectEmission.js +29 -0
  312. package/build/client/core/instructions/marketCollectEmission.js.map +1 -0
  313. package/build/client/core/instructions/marketDepositLp.d.ts +19 -0
  314. package/build/client/core/instructions/marketDepositLp.js +31 -0
  315. package/build/client/core/instructions/marketDepositLp.js.map +1 -0
  316. package/build/client/core/instructions/marketTwoDepositLiquidity.d.ts +22 -0
  317. package/build/client/core/instructions/marketTwoDepositLiquidity.js +34 -0
  318. package/build/client/core/instructions/marketTwoDepositLiquidity.js.map +1 -0
  319. package/build/client/core/instructions/marketTwoWithdrawLiquidity.d.ts +22 -0
  320. package/build/client/core/instructions/marketTwoWithdrawLiquidity.js +34 -0
  321. package/build/client/core/instructions/marketTwoWithdrawLiquidity.js.map +1 -0
  322. package/build/client/core/instructions/marketWithdrawLp.d.ts +19 -0
  323. package/build/client/core/instructions/marketWithdrawLp.js +31 -0
  324. package/build/client/core/instructions/marketWithdrawLp.js.map +1 -0
  325. package/build/client/core/instructions/merge.d.ts +22 -0
  326. package/build/client/core/instructions/merge.js +32 -0
  327. package/build/client/core/instructions/merge.js.map +1 -0
  328. package/build/client/core/instructions/modifyFarm.d.ts +15 -0
  329. package/build/client/core/instructions/modifyFarm.js +27 -0
  330. package/build/client/core/instructions/modifyFarm.js.map +1 -0
  331. package/build/client/core/instructions/modifyMarketSetting.d.ts +12 -0
  332. package/build/client/core/instructions/modifyMarketSetting.js +24 -0
  333. package/build/client/core/instructions/modifyMarketSetting.js.map +1 -0
  334. package/build/client/core/instructions/modifyVaultSetting.d.ts +12 -0
  335. package/build/client/core/instructions/modifyVaultSetting.js +24 -0
  336. package/build/client/core/instructions/modifyVaultSetting.js.map +1 -0
  337. package/build/client/core/instructions/reallocMarket.d.ts +12 -0
  338. package/build/client/core/instructions/reallocMarket.js +24 -0
  339. package/build/client/core/instructions/reallocMarket.js.map +1 -0
  340. package/build/client/core/instructions/sellYt.d.ts +28 -0
  341. package/build/client/core/instructions/sellYt.js +44 -0
  342. package/build/client/core/instructions/sellYt.js.map +1 -0
  343. package/build/client/core/instructions/stageYtYield.d.ts +13 -0
  344. package/build/client/core/instructions/stageYtYield.js +22 -0
  345. package/build/client/core/instructions/stageYtYield.js.map +1 -0
  346. package/build/client/core/instructions/strip.d.ts +22 -0
  347. package/build/client/core/instructions/strip.js +32 -0
  348. package/build/client/core/instructions/strip.js.map +1 -0
  349. package/build/client/core/instructions/tradePt.d.ts +20 -0
  350. package/build/client/core/instructions/tradePt.js +32 -0
  351. package/build/client/core/instructions/tradePt.js.map +1 -0
  352. package/build/client/core/instructions/withdrawYt.d.ts +20 -0
  353. package/build/client/core/instructions/withdrawYt.js +32 -0
  354. package/build/client/core/instructions/withdrawYt.js.map +1 -0
  355. package/build/client/core/instructions/wrapperBuyPt.d.ts +21 -0
  356. package/build/client/core/instructions/wrapperBuyPt.js +33 -0
  357. package/build/client/core/instructions/wrapperBuyPt.js.map +1 -0
  358. package/build/client/core/instructions/wrapperBuyYt.d.ts +32 -0
  359. package/build/client/core/instructions/wrapperBuyYt.js +52 -0
  360. package/build/client/core/instructions/wrapperBuyYt.js.map +1 -0
  361. package/build/client/core/instructions/wrapperCollectInterest.d.ts +19 -0
  362. package/build/client/core/instructions/wrapperCollectInterest.js +35 -0
  363. package/build/client/core/instructions/wrapperCollectInterest.js.map +1 -0
  364. package/build/client/core/instructions/wrapperMerge.d.ts +24 -0
  365. package/build/client/core/instructions/wrapperMerge.js +44 -0
  366. package/build/client/core/instructions/wrapperMerge.js.map +1 -0
  367. package/build/client/core/instructions/wrapperProvideLiquidity.d.ts +35 -0
  368. package/build/client/core/instructions/wrapperProvideLiquidity.js +59 -0
  369. package/build/client/core/instructions/wrapperProvideLiquidity.js.map +1 -0
  370. package/build/client/core/instructions/wrapperProvideLiquidityBase.d.ts +28 -0
  371. package/build/client/core/instructions/wrapperProvideLiquidityBase.js +44 -0
  372. package/build/client/core/instructions/wrapperProvideLiquidityBase.js.map +1 -0
  373. package/build/client/core/instructions/wrapperProvideLiquidityClassic.d.ts +26 -0
  374. package/build/client/core/instructions/wrapperProvideLiquidityClassic.js +42 -0
  375. package/build/client/core/instructions/wrapperProvideLiquidityClassic.js.map +1 -0
  376. package/build/client/core/instructions/wrapperSellPt.d.ts +21 -0
  377. package/build/client/core/instructions/wrapperSellPt.js +33 -0
  378. package/build/client/core/instructions/wrapperSellPt.js.map +1 -0
  379. package/build/client/core/instructions/wrapperSellYt.d.ts +29 -0
  380. package/build/client/core/instructions/wrapperSellYt.js +49 -0
  381. package/build/client/core/instructions/wrapperSellYt.js.map +1 -0
  382. package/build/client/core/instructions/wrapperStrip.d.ts +26 -0
  383. package/build/client/core/instructions/wrapperStrip.js +46 -0
  384. package/build/client/core/instructions/wrapperStrip.js.map +1 -0
  385. package/build/client/core/instructions/wrapperWithdrawLiquidity.d.ts +26 -0
  386. package/build/client/core/instructions/wrapperWithdrawLiquidity.js +42 -0
  387. package/build/client/core/instructions/wrapperWithdrawLiquidity.js.map +1 -0
  388. package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.d.ts +24 -0
  389. package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js +40 -0
  390. package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -0
  391. package/build/client/core/types/adminAction.d.ts +326 -0
  392. package/build/client/core/types/adminAction.js +87 -0
  393. package/build/client/core/types/adminAction.js.map +1 -0
  394. package/build/client/core/types/amount.d.ts +33 -0
  395. package/build/client/core/types/amount.js +20 -0
  396. package/build/client/core/types/amount.js.map +1 -0
  397. package/build/client/core/types/buyPtEvent.d.ts +27 -0
  398. package/build/client/core/types/buyPtEvent.js +19 -0
  399. package/build/client/core/types/buyPtEvent.js.map +1 -0
  400. package/build/client/core/types/buyYtEvent.d.ts +68 -0
  401. package/build/client/core/types/buyYtEvent.js +45 -0
  402. package/build/client/core/types/buyYtEvent.js.map +1 -0
  403. package/build/client/core/types/claimFarmEmissionsEvent.d.ts +43 -0
  404. package/build/client/core/types/claimFarmEmissionsEvent.js +35 -0
  405. package/build/client/core/types/claimFarmEmissionsEvent.js.map +1 -0
  406. package/build/client/core/types/claimFarmEmissionsEventV2.d.ts +98 -0
  407. package/build/client/core/types/claimFarmEmissionsEventV2.js +38 -0
  408. package/build/client/core/types/claimFarmEmissionsEventV2.js.map +1 -0
  409. package/build/client/core/types/claimLimits.d.ts +22 -0
  410. package/build/client/core/types/claimLimits.js +11 -0
  411. package/build/client/core/types/claimLimits.js.map +1 -0
  412. package/build/client/core/types/collectEmissionEvent.d.ts +35 -0
  413. package/build/client/core/types/collectEmissionEvent.js +24 -0
  414. package/build/client/core/types/collectEmissionEvent.js.map +1 -0
  415. package/build/client/core/types/collectEmissionEventV2.d.ts +68 -0
  416. package/build/client/core/types/collectEmissionEventV2.js +27 -0
  417. package/build/client/core/types/collectEmissionEventV2.js.map +1 -0
  418. package/build/client/core/types/collectInterestEvent.d.ts +31 -0
  419. package/build/client/core/types/collectInterestEvent.js +23 -0
  420. package/build/client/core/types/collectInterestEvent.js.map +1 -0
  421. package/build/client/core/types/collectInterestEventV2.d.ts +64 -0
  422. package/build/client/core/types/collectInterestEventV2.js +26 -0
  423. package/build/client/core/types/collectInterestEventV2.js.map +1 -0
  424. package/build/client/core/types/collectTreasuryEmissionKind.d.ts +5 -0
  425. package/build/client/core/types/collectTreasuryEmissionKind.js +11 -0
  426. package/build/client/core/types/collectTreasuryEmissionKind.js.map +1 -0
  427. package/build/client/core/types/collectTreasuryInterestKind.d.ts +5 -0
  428. package/build/client/core/types/collectTreasuryInterestKind.js +11 -0
  429. package/build/client/core/types/collectTreasuryInterestKind.js.map +1 -0
  430. package/build/client/core/types/cpiAccounts.d.ts +107 -0
  431. package/build/client/core/types/cpiAccounts.js +13 -0
  432. package/build/client/core/types/cpiAccounts.js.map +1 -0
  433. package/build/client/core/types/cpiInterfaceContext.d.ts +18 -0
  434. package/build/client/core/types/cpiInterfaceContext.js +10 -0
  435. package/build/client/core/types/cpiInterfaceContext.js.map +1 -0
  436. package/build/client/core/types/depositLiquidityEvent.d.ts +67 -0
  437. package/build/client/core/types/depositLiquidityEvent.js +47 -0
  438. package/build/client/core/types/depositLiquidityEvent.js.map +1 -0
  439. package/build/client/core/types/depositLpEvent.d.ts +43 -0
  440. package/build/client/core/types/depositLpEvent.js +35 -0
  441. package/build/client/core/types/depositLpEvent.js.map +1 -0
  442. package/build/client/core/types/depositLpEventV2.d.ts +98 -0
  443. package/build/client/core/types/depositLpEventV2.js +38 -0
  444. package/build/client/core/types/depositLpEventV2.js.map +1 -0
  445. package/build/client/core/types/depositYtEvent.d.ts +56 -0
  446. package/build/client/core/types/depositYtEvent.js +39 -0
  447. package/build/client/core/types/depositYtEvent.js.map +1 -0
  448. package/build/client/core/types/depositYtEventV2.d.ts +89 -0
  449. package/build/client/core/types/depositYtEventV2.js +42 -0
  450. package/build/client/core/types/depositYtEventV2.js.map +1 -0
  451. package/build/client/core/types/emissionInfo.d.ts +36 -0
  452. package/build/client/core/types/emissionInfo.js +22 -0
  453. package/build/client/core/types/emissionInfo.js.map +1 -0
  454. package/build/client/core/types/farmEmission.d.ts +24 -0
  455. package/build/client/core/types/farmEmission.js +16 -0
  456. package/build/client/core/types/farmEmission.js.map +1 -0
  457. package/build/client/core/types/index.d.ts +60 -0
  458. package/build/client/core/types/index.js +77 -0
  459. package/build/client/core/types/index.js.map +1 -0
  460. package/build/client/core/types/initLpPositionEvent.d.ts +35 -0
  461. package/build/client/core/types/initLpPositionEvent.js +27 -0
  462. package/build/client/core/types/initLpPositionEvent.js.map +1 -0
  463. package/build/client/core/types/initializeYieldPositionEvent.d.ts +23 -0
  464. package/build/client/core/types/initializeYieldPositionEvent.js +21 -0
  465. package/build/client/core/types/initializeYieldPositionEvent.js.map +1 -0
  466. package/build/client/core/types/liquidityNetBalanceLimits.d.ts +26 -0
  467. package/build/client/core/types/liquidityNetBalanceLimits.js +12 -0
  468. package/build/client/core/types/liquidityNetBalanceLimits.js.map +1 -0
  469. package/build/client/core/types/lpFarm.d.ts +35 -0
  470. package/build/client/core/types/lpFarm.js +10 -0
  471. package/build/client/core/types/lpFarm.js.map +1 -0
  472. package/build/client/core/types/marketAdminAction.d.ts +286 -0
  473. package/build/client/core/types/marketAdminAction.js +61 -0
  474. package/build/client/core/types/marketAdminAction.js.map +1 -0
  475. package/build/client/core/types/marketCollectEmissionEvent.d.ts +39 -0
  476. package/build/client/core/types/marketCollectEmissionEvent.js +31 -0
  477. package/build/client/core/types/marketCollectEmissionEvent.js.map +1 -0
  478. package/build/client/core/types/marketCollectEmissionEventV2.d.ts +94 -0
  479. package/build/client/core/types/marketCollectEmissionEventV2.js +34 -0
  480. package/build/client/core/types/marketCollectEmissionEventV2.js.map +1 -0
  481. package/build/client/core/types/marketEmission.d.ts +20 -0
  482. package/build/client/core/types/marketEmission.js +15 -0
  483. package/build/client/core/types/marketEmission.js.map +1 -0
  484. package/build/client/core/types/marketEmissions.d.ts +27 -0
  485. package/build/client/core/types/marketEmissions.js +9 -0
  486. package/build/client/core/types/marketEmissions.js.map +1 -0
  487. package/build/client/core/types/marketFinancials.d.ts +30 -0
  488. package/build/client/core/types/marketFinancials.js +13 -0
  489. package/build/client/core/types/marketFinancials.js.map +1 -0
  490. package/build/client/core/types/mergeEvent.d.ts +84 -0
  491. package/build/client/core/types/mergeEvent.js +55 -0
  492. package/build/client/core/types/mergeEvent.js.map +1 -0
  493. package/build/client/core/types/number.d.ts +2 -0
  494. package/build/client/core/types/number.js +8 -0
  495. package/build/client/core/types/number.js.map +1 -0
  496. package/build/client/core/types/personalYieldTracker.d.ts +15 -0
  497. package/build/client/core/types/personalYieldTracker.js +10 -0
  498. package/build/client/core/types/personalYieldTracker.js.map +1 -0
  499. package/build/client/core/types/personalYieldTrackers.d.ts +23 -0
  500. package/build/client/core/types/personalYieldTrackers.js +9 -0
  501. package/build/client/core/types/personalYieldTrackers.js.map +1 -0
  502. package/build/client/core/types/principleDetails.d.ts +11 -0
  503. package/build/client/core/types/principleDetails.js +12 -0
  504. package/build/client/core/types/principleDetails.js.map +1 -0
  505. package/build/client/core/types/principles.d.ts +79 -0
  506. package/build/client/core/types/principles.js +14 -0
  507. package/build/client/core/types/principles.js.map +1 -0
  508. package/build/client/core/types/sellPtEvent.d.ts +27 -0
  509. package/build/client/core/types/sellPtEvent.js +19 -0
  510. package/build/client/core/types/sellPtEvent.js.map +1 -0
  511. package/build/client/core/types/sellYtEvent.d.ts +59 -0
  512. package/build/client/core/types/sellYtEvent.js +42 -0
  513. package/build/client/core/types/sellYtEvent.js.map +1 -0
  514. package/build/client/core/types/stageYieldEvent.d.ts +44 -0
  515. package/build/client/core/types/stageYieldEvent.js +30 -0
  516. package/build/client/core/types/stageYieldEvent.js.map +1 -0
  517. package/build/client/core/types/stageYieldEventV2.d.ts +73 -0
  518. package/build/client/core/types/stageYieldEventV2.js +32 -0
  519. package/build/client/core/types/stageYieldEventV2.js.map +1 -0
  520. package/build/client/core/types/stripEvent.d.ts +84 -0
  521. package/build/client/core/types/stripEvent.js +58 -0
  522. package/build/client/core/types/stripEvent.js.map +1 -0
  523. package/build/client/core/types/tradePtEvent.d.ts +52 -0
  524. package/build/client/core/types/tradePtEvent.js +38 -0
  525. package/build/client/core/types/tradePtEvent.js.map +1 -0
  526. package/build/client/core/types/withdrawLiquidityEvent.d.ts +59 -0
  527. package/build/client/core/types/withdrawLiquidityEvent.js +45 -0
  528. package/build/client/core/types/withdrawLiquidityEvent.js.map +1 -0
  529. package/build/client/core/types/withdrawLpEvent.d.ts +43 -0
  530. package/build/client/core/types/withdrawLpEvent.js +35 -0
  531. package/build/client/core/types/withdrawLpEvent.js.map +1 -0
  532. package/build/client/core/types/withdrawLpEventV2.d.ts +98 -0
  533. package/build/client/core/types/withdrawLpEventV2.js +38 -0
  534. package/build/client/core/types/withdrawLpEventV2.js.map +1 -0
  535. package/build/client/core/types/withdrawYtEvent.d.ts +56 -0
  536. package/build/client/core/types/withdrawYtEvent.js +39 -0
  537. package/build/client/core/types/withdrawYtEvent.js.map +1 -0
  538. package/build/client/core/types/withdrawYtEventV2.d.ts +89 -0
  539. package/build/client/core/types/withdrawYtEventV2.js +42 -0
  540. package/build/client/core/types/withdrawYtEventV2.js.map +1 -0
  541. package/build/client/core/types/wrapperBuyYtEvent.d.ts +27 -0
  542. package/build/client/core/types/wrapperBuyYtEvent.js +19 -0
  543. package/build/client/core/types/wrapperBuyYtEvent.js.map +1 -0
  544. package/build/client/core/types/wrapperCollectInterestEvent.d.ts +23 -0
  545. package/build/client/core/types/wrapperCollectInterestEvent.js +18 -0
  546. package/build/client/core/types/wrapperCollectInterestEvent.js.map +1 -0
  547. package/build/client/core/types/wrapperMergeEvent.d.ts +27 -0
  548. package/build/client/core/types/wrapperMergeEvent.js +19 -0
  549. package/build/client/core/types/wrapperMergeEvent.js.map +1 -0
  550. package/build/client/core/types/wrapperProvideLiquidityBaseEvent.d.ts +35 -0
  551. package/build/client/core/types/wrapperProvideLiquidityBaseEvent.js +21 -0
  552. package/build/client/core/types/wrapperProvideLiquidityBaseEvent.js.map +1 -0
  553. package/build/client/core/types/wrapperProvideLiquidityClassicEvent.d.ts +31 -0
  554. package/build/client/core/types/wrapperProvideLiquidityClassicEvent.js +20 -0
  555. package/build/client/core/types/wrapperProvideLiquidityClassicEvent.js.map +1 -0
  556. package/build/client/core/types/wrapperProvideLiquidityEvent.d.ts +31 -0
  557. package/build/client/core/types/wrapperProvideLiquidityEvent.js +20 -0
  558. package/build/client/core/types/wrapperProvideLiquidityEvent.js.map +1 -0
  559. package/build/client/core/types/wrapperSellYtEvent.d.ts +27 -0
  560. package/build/client/core/types/wrapperSellYtEvent.js +19 -0
  561. package/build/client/core/types/wrapperSellYtEvent.js.map +1 -0
  562. package/build/client/core/types/wrapperStripEvent.d.ts +27 -0
  563. package/build/client/core/types/wrapperStripEvent.js +19 -0
  564. package/build/client/core/types/wrapperStripEvent.js.map +1 -0
  565. package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.d.ts +31 -0
  566. package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.js +20 -0
  567. package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.js.map +1 -0
  568. package/build/client/core/types/wrapperWithdrawLiquidityEvent.d.ts +27 -0
  569. package/build/client/core/types/wrapperWithdrawLiquidityEvent.js +19 -0
  570. package/build/client/core/types/wrapperWithdrawLiquidityEvent.js.map +1 -0
  571. package/build/client/core/types/yieldTokenTracker.d.ts +15 -0
  572. package/build/client/core/types/yieldTokenTracker.js +10 -0
  573. package/build/client/core/types/yieldTokenTracker.js.map +1 -0
  574. package/build/client/orderbook/accounts/cpiAccountsOrderbook.d.ts +18 -0
  575. package/build/client/orderbook/accounts/cpiAccountsOrderbook.js +66 -0
  576. package/build/client/orderbook/accounts/cpiAccountsOrderbook.js.map +1 -0
  577. package/build/client/orderbook/accounts/vault.d.ts +48 -0
  578. package/build/client/orderbook/accounts/vault.js +128 -0
  579. package/build/client/orderbook/accounts/vault.js.map +1 -0
  580. package/build/client/orderbook/eventRegistry.d.ts +45 -0
  581. package/build/client/orderbook/eventRegistry.js +44 -0
  582. package/build/client/orderbook/eventRegistry.js.map +1 -0
  583. package/build/client/orderbook/index.d.ts +51 -0
  584. package/build/client/orderbook/index.js +69 -0
  585. package/build/client/orderbook/index.js.map +1 -0
  586. package/build/client/orderbook/instructions/collectAdminEmission.d.ts +14 -0
  587. package/build/client/orderbook/instructions/collectAdminEmission.js +26 -0
  588. package/build/client/orderbook/instructions/collectAdminEmission.js.map +1 -0
  589. package/build/client/orderbook/instructions/collectAdminFee.d.ts +21 -0
  590. package/build/client/orderbook/instructions/collectAdminFee.js +34 -0
  591. package/build/client/orderbook/instructions/collectAdminFee.js.map +1 -0
  592. package/build/client/orderbook/instructions/collectInterest.d.ts +21 -0
  593. package/build/client/orderbook/instructions/collectInterest.js +37 -0
  594. package/build/client/orderbook/instructions/collectInterest.js.map +1 -0
  595. package/build/client/orderbook/instructions/initializeOrderbook.d.ts +36 -0
  596. package/build/client/orderbook/instructions/initializeOrderbook.js +52 -0
  597. package/build/client/orderbook/instructions/initializeOrderbook.js.map +1 -0
  598. package/build/client/orderbook/instructions/marketOffer.d.ts +30 -0
  599. package/build/client/orderbook/instructions/marketOffer.js +46 -0
  600. package/build/client/orderbook/instructions/marketOffer.js.map +1 -0
  601. package/build/client/orderbook/instructions/postOffer.d.ts +33 -0
  602. package/build/client/orderbook/instructions/postOffer.js +49 -0
  603. package/build/client/orderbook/instructions/postOffer.js.map +1 -0
  604. package/build/client/orderbook/instructions/reallocOrderbookAccount.d.ts +12 -0
  605. package/build/client/orderbook/instructions/reallocOrderbookAccount.js +24 -0
  606. package/build/client/orderbook/instructions/reallocOrderbookAccount.js.map +1 -0
  607. package/build/client/orderbook/instructions/removeExpiredOffers.d.ts +12 -0
  608. package/build/client/orderbook/instructions/removeExpiredOffers.js +21 -0
  609. package/build/client/orderbook/instructions/removeExpiredOffers.js.map +1 -0
  610. package/build/client/orderbook/instructions/removeOffer.d.ts +24 -0
  611. package/build/client/orderbook/instructions/removeOffer.js +40 -0
  612. package/build/client/orderbook/instructions/removeOffer.js.map +1 -0
  613. package/build/client/orderbook/instructions/setConfigurationOptions.d.ts +10 -0
  614. package/build/client/orderbook/instructions/setConfigurationOptions.js +22 -0
  615. package/build/client/orderbook/instructions/setConfigurationOptions.js.map +1 -0
  616. package/build/client/orderbook/instructions/withdrawFunds.d.ts +27 -0
  617. package/build/client/orderbook/instructions/withdrawFunds.js +43 -0
  618. package/build/client/orderbook/instructions/withdrawFunds.js.map +1 -0
  619. package/build/client/orderbook/instructions/wrapperCollectAdminFee.d.ts +24 -0
  620. package/build/client/orderbook/instructions/wrapperCollectAdminFee.js +40 -0
  621. package/build/client/orderbook/instructions/wrapperCollectAdminFee.js.map +1 -0
  622. package/build/client/orderbook/instructions/wrapperCollectInterest.d.ts +20 -0
  623. package/build/client/orderbook/instructions/wrapperCollectInterest.js +36 -0
  624. package/build/client/orderbook/instructions/wrapperCollectInterest.js.map +1 -0
  625. package/build/client/orderbook/instructions/wrapperMarketOffer.d.ts +32 -0
  626. package/build/client/orderbook/instructions/wrapperMarketOffer.js +48 -0
  627. package/build/client/orderbook/instructions/wrapperMarketOffer.js.map +1 -0
  628. package/build/client/orderbook/instructions/wrapperPostOffer.d.ts +34 -0
  629. package/build/client/orderbook/instructions/wrapperPostOffer.js +50 -0
  630. package/build/client/orderbook/instructions/wrapperPostOffer.js.map +1 -0
  631. package/build/client/orderbook/instructions/wrapperRemoveOffer.d.ts +25 -0
  632. package/build/client/orderbook/instructions/wrapperRemoveOffer.js +41 -0
  633. package/build/client/orderbook/instructions/wrapperRemoveOffer.js.map +1 -0
  634. package/build/client/orderbook/instructions/wrapperWithdrawFunds.d.ts +28 -0
  635. package/build/client/orderbook/instructions/wrapperWithdrawFunds.js +44 -0
  636. package/build/client/orderbook/instructions/wrapperWithdrawFunds.js.map +1 -0
  637. package/build/client/orderbook/types/amount.d.ts +33 -0
  638. package/build/client/orderbook/types/amount.js +20 -0
  639. package/build/client/orderbook/types/amount.js.map +1 -0
  640. package/build/client/orderbook/types/claimLimits.d.ts +22 -0
  641. package/build/client/orderbook/types/claimLimits.js +11 -0
  642. package/build/client/orderbook/types/claimLimits.js.map +1 -0
  643. package/build/client/orderbook/types/collectAdminEmissionEvent.d.ts +27 -0
  644. package/build/client/orderbook/types/collectAdminEmissionEvent.js +19 -0
  645. package/build/client/orderbook/types/collectAdminEmissionEvent.js.map +1 -0
  646. package/build/client/orderbook/types/collectAdminFeeEvent.d.ts +26 -0
  647. package/build/client/orderbook/types/collectAdminFeeEvent.js +12 -0
  648. package/build/client/orderbook/types/collectAdminFeeEvent.js.map +1 -0
  649. package/build/client/orderbook/types/collectEmissionEventV2.d.ts +68 -0
  650. package/build/client/orderbook/types/collectEmissionEventV2.js +27 -0
  651. package/build/client/orderbook/types/collectEmissionEventV2.js.map +1 -0
  652. package/build/client/orderbook/types/collectInterestEventV2.d.ts +64 -0
  653. package/build/client/orderbook/types/collectInterestEventV2.js +26 -0
  654. package/build/client/orderbook/types/collectInterestEventV2.js.map +1 -0
  655. package/build/client/orderbook/types/collectUserInterestEvent.d.ts +23 -0
  656. package/build/client/orderbook/types/collectUserInterestEvent.js +18 -0
  657. package/build/client/orderbook/types/collectUserInterestEvent.js.map +1 -0
  658. package/build/client/orderbook/types/cpiAccounts.d.ts +107 -0
  659. package/build/client/orderbook/types/cpiAccounts.js +13 -0
  660. package/build/client/orderbook/types/cpiAccounts.js.map +1 -0
  661. package/build/client/orderbook/types/cpiInterfaceContext.d.ts +18 -0
  662. package/build/client/orderbook/types/cpiInterfaceContext.js +10 -0
  663. package/build/client/orderbook/types/cpiInterfaceContext.js.map +1 -0
  664. package/build/client/orderbook/types/emissionInfo.d.ts +36 -0
  665. package/build/client/orderbook/types/emissionInfo.js +22 -0
  666. package/build/client/orderbook/types/emissionInfo.js.map +1 -0
  667. package/build/client/orderbook/types/exponentCoreCpiAccounts.d.ts +107 -0
  668. package/build/client/orderbook/types/exponentCoreCpiAccounts.js +13 -0
  669. package/build/client/orderbook/types/exponentCoreCpiAccounts.js.map +1 -0
  670. package/build/client/orderbook/types/filledOffersEvent.d.ts +30 -0
  671. package/build/client/orderbook/types/filledOffersEvent.js +13 -0
  672. package/build/client/orderbook/types/filledOffersEvent.js.map +1 -0
  673. package/build/client/orderbook/types/index.d.ts +30 -0
  674. package/build/client/orderbook/types/index.js +47 -0
  675. package/build/client/orderbook/types/index.js.map +1 -0
  676. package/build/client/orderbook/types/marketOfferEvent.d.ts +93 -0
  677. package/build/client/orderbook/types/marketOfferEvent.js +33 -0
  678. package/build/client/orderbook/types/marketOfferEvent.js.map +1 -0
  679. package/build/client/orderbook/types/mergeEvent.d.ts +84 -0
  680. package/build/client/orderbook/types/mergeEvent.js +55 -0
  681. package/build/client/orderbook/types/mergeEvent.js.map +1 -0
  682. package/build/client/orderbook/types/number.d.ts +2 -0
  683. package/build/client/orderbook/types/number.js +8 -0
  684. package/build/client/orderbook/types/number.js.map +1 -0
  685. package/build/client/orderbook/types/offerOptions.d.ts +24 -0
  686. package/build/client/orderbook/types/offerOptions.js +22 -0
  687. package/build/client/orderbook/types/offerOptions.js.map +1 -0
  688. package/build/client/orderbook/types/offerType.d.ts +5 -0
  689. package/build/client/orderbook/types/offerType.js +11 -0
  690. package/build/client/orderbook/types/offerType.js.map +1 -0
  691. package/build/client/orderbook/types/orderbookInitEvent.d.ts +39 -0
  692. package/build/client/orderbook/types/orderbookInitEvent.js +25 -0
  693. package/build/client/orderbook/types/orderbookInitEvent.js.map +1 -0
  694. package/build/client/orderbook/types/postOfferEvent.d.ts +118 -0
  695. package/build/client/orderbook/types/postOfferEvent.js +36 -0
  696. package/build/client/orderbook/types/postOfferEvent.js.map +1 -0
  697. package/build/client/orderbook/types/removeOfferEvent.d.ts +39 -0
  698. package/build/client/orderbook/types/removeOfferEvent.js +31 -0
  699. package/build/client/orderbook/types/removeOfferEvent.js.map +1 -0
  700. package/build/client/orderbook/types/setConfigurationOptionsEnum.d.ts +72 -0
  701. package/build/client/orderbook/types/setConfigurationOptionsEnum.js +34 -0
  702. package/build/client/orderbook/types/setConfigurationOptionsEnum.js.map +1 -0
  703. package/build/client/orderbook/types/stripEvent.d.ts +84 -0
  704. package/build/client/orderbook/types/stripEvent.js +58 -0
  705. package/build/client/orderbook/types/stripEvent.js.map +1 -0
  706. package/build/client/orderbook/types/withdrawFundsEvent.d.ts +39 -0
  707. package/build/client/orderbook/types/withdrawFundsEvent.js +31 -0
  708. package/build/client/orderbook/types/withdrawFundsEvent.js.map +1 -0
  709. package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.d.ts +18 -0
  710. package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.js +10 -0
  711. package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.js.map +1 -0
  712. package/build/client/orderbook/types/wrapperCollectInterestEvent.d.ts +15 -0
  713. package/build/client/orderbook/types/wrapperCollectInterestEvent.js +13 -0
  714. package/build/client/orderbook/types/wrapperCollectInterestEvent.js.map +1 -0
  715. package/build/client/orderbook/types/wrapperMarketOfferEvent.d.ts +19 -0
  716. package/build/client/orderbook/types/wrapperMarketOfferEvent.js +14 -0
  717. package/build/client/orderbook/types/wrapperMarketOfferEvent.js.map +1 -0
  718. package/build/client/orderbook/types/wrapperPostOfferEvent.d.ts +39 -0
  719. package/build/client/orderbook/types/wrapperPostOfferEvent.js +34 -0
  720. package/build/client/orderbook/types/wrapperPostOfferEvent.js.map +1 -0
  721. package/build/client/orderbook/types/wrapperRemoveOfferEvent.d.ts +15 -0
  722. package/build/client/orderbook/types/wrapperRemoveOfferEvent.js +13 -0
  723. package/build/client/orderbook/types/wrapperRemoveOfferEvent.js.map +1 -0
  724. package/build/client/orderbook/types/wrapperWithdrawFundsEvent.d.ts +27 -0
  725. package/build/client/orderbook/types/wrapperWithdrawFundsEvent.js +19 -0
  726. package/build/client/orderbook/types/wrapperWithdrawFundsEvent.js.map +1 -0
  727. package/build/client/orderbook/types/yieldTokenTracker.d.ts +15 -0
  728. package/build/client/orderbook/types/yieldTokenTracker.js +10 -0
  729. package/build/client/orderbook/types/yieldTokenTracker.js.map +1 -0
  730. package/build/client/vaults/accounts/actionProposal.d.ts +30 -0
  731. package/build/client/vaults/accounts/actionProposal.js +84 -0
  732. package/build/client/vaults/accounts/actionProposal.js.map +1 -0
  733. package/build/client/vaults/accounts/exponentStrategyVault.d.ts +39 -0
  734. package/build/client/vaults/accounts/exponentStrategyVault.js +113 -0
  735. package/build/client/vaults/accounts/exponentStrategyVault.js.map +1 -0
  736. package/build/client/vaults/accounts/programConfig.d.ts +19 -0
  737. package/build/client/vaults/accounts/programConfig.js +76 -0
  738. package/build/client/vaults/accounts/programConfig.js.map +1 -0
  739. package/build/client/vaults/accounts/voteAccount.d.ts +23 -0
  740. package/build/client/vaults/accounts/voteAccount.js +80 -0
  741. package/build/client/vaults/accounts/voteAccount.js.map +1 -0
  742. package/build/client/vaults/accounts/withdrawalAccount.d.ts +23 -0
  743. package/build/client/vaults/accounts/withdrawalAccount.js +78 -0
  744. package/build/client/vaults/accounts/withdrawalAccount.js.map +1 -0
  745. package/build/client/vaults/eventRegistry.d.ts +27 -0
  746. package/build/client/vaults/eventRegistry.js +27 -0
  747. package/build/client/vaults/eventRegistry.js.map +1 -0
  748. package/build/client/vaults/index.d.ts +106 -0
  749. package/build/client/vaults/index.js +125 -0
  750. package/build/client/vaults/index.js.map +1 -0
  751. package/build/client/vaults/instructions/activateProposal.d.ts +12 -0
  752. package/build/client/vaults/instructions/activateProposal.js +25 -0
  753. package/build/client/vaults/instructions/activateProposal.js.map +1 -0
  754. package/build/client/vaults/instructions/addPolicy.d.ts +16 -0
  755. package/build/client/vaults/instructions/addPolicy.js +33 -0
  756. package/build/client/vaults/instructions/addPolicy.js.map +1 -0
  757. package/build/client/vaults/instructions/appendProposalActions.d.ts +13 -0
  758. package/build/client/vaults/instructions/appendProposalActions.js +26 -0
  759. package/build/client/vaults/instructions/appendProposalActions.js.map +1 -0
  760. package/build/client/vaults/instructions/cancelProposal.d.ts +7 -0
  761. package/build/client/vaults/instructions/cancelProposal.js +17 -0
  762. package/build/client/vaults/instructions/cancelProposal.js.map +1 -0
  763. package/build/client/vaults/instructions/cancelWithdrawal.d.ts +10 -0
  764. package/build/client/vaults/instructions/cancelWithdrawal.js +20 -0
  765. package/build/client/vaults/instructions/cancelWithdrawal.js.map +1 -0
  766. package/build/client/vaults/instructions/collectManagementFee.d.ts +9 -0
  767. package/build/client/vaults/instructions/collectManagementFee.js +19 -0
  768. package/build/client/vaults/instructions/collectManagementFee.js.map +1 -0
  769. package/build/client/vaults/instructions/depositLiquidity.d.ts +20 -0
  770. package/build/client/vaults/instructions/depositLiquidity.js +33 -0
  771. package/build/client/vaults/instructions/depositLiquidity.js.map +1 -0
  772. package/build/client/vaults/instructions/executeProposal.d.ts +11 -0
  773. package/build/client/vaults/instructions/executeProposal.js +21 -0
  774. package/build/client/vaults/instructions/executeProposal.js.map +1 -0
  775. package/build/client/vaults/instructions/executeWithdrawal.d.ts +18 -0
  776. package/build/client/vaults/instructions/executeWithdrawal.js +31 -0
  777. package/build/client/vaults/instructions/executeWithdrawal.js.map +1 -0
  778. package/build/client/vaults/instructions/executeWithdrawalFromReserves.d.ts +22 -0
  779. package/build/client/vaults/instructions/executeWithdrawalFromReserves.js +35 -0
  780. package/build/client/vaults/instructions/executeWithdrawalFromReserves.js.map +1 -0
  781. package/build/client/vaults/instructions/fillWithdrawal.d.ts +17 -0
  782. package/build/client/vaults/instructions/fillWithdrawal.js +34 -0
  783. package/build/client/vaults/instructions/fillWithdrawal.js.map +1 -0
  784. package/build/client/vaults/instructions/finalizeProposal.d.ts +7 -0
  785. package/build/client/vaults/instructions/finalizeProposal.js +17 -0
  786. package/build/client/vaults/instructions/finalizeProposal.js.map +1 -0
  787. package/build/client/vaults/instructions/initProposal.d.ts +12 -0
  788. package/build/client/vaults/instructions/initProposal.js +25 -0
  789. package/build/client/vaults/instructions/initProposal.js.map +1 -0
  790. package/build/client/vaults/instructions/initializePrices.d.ts +7 -0
  791. package/build/client/vaults/instructions/initializePrices.js +17 -0
  792. package/build/client/vaults/instructions/initializePrices.js.map +1 -0
  793. package/build/client/vaults/instructions/initializeVault.d.ts +44 -0
  794. package/build/client/vaults/instructions/initializeVault.js +80 -0
  795. package/build/client/vaults/instructions/initializeVault.js.map +1 -0
  796. package/build/client/vaults/instructions/makeSentienelManager.d.ts +7 -0
  797. package/build/client/vaults/instructions/makeSentienelManager.js +17 -0
  798. package/build/client/vaults/instructions/makeSentienelManager.js.map +1 -0
  799. package/build/client/vaults/instructions/managePrices.d.ts +11 -0
  800. package/build/client/vaults/instructions/managePrices.js +24 -0
  801. package/build/client/vaults/instructions/managePrices.js.map +1 -0
  802. package/build/client/vaults/instructions/manageVaultSettings.d.ts +12 -0
  803. package/build/client/vaults/instructions/manageVaultSettings.js +25 -0
  804. package/build/client/vaults/instructions/manageVaultSettings.js.map +1 -0
  805. package/build/client/vaults/instructions/managerUpdatePosition.d.ts +12 -0
  806. package/build/client/vaults/instructions/managerUpdatePosition.js +25 -0
  807. package/build/client/vaults/instructions/managerUpdatePosition.js.map +1 -0
  808. package/build/client/vaults/instructions/proposeAction.d.ts +16 -0
  809. package/build/client/vaults/instructions/proposeAction.js +29 -0
  810. package/build/client/vaults/instructions/proposeAction.js.map +1 -0
  811. package/build/client/vaults/instructions/queueWithdrawal.d.ts +14 -0
  812. package/build/client/vaults/instructions/queueWithdrawal.js +27 -0
  813. package/build/client/vaults/instructions/queueWithdrawal.js.map +1 -0
  814. package/build/client/vaults/instructions/removePolicy.d.ts +13 -0
  815. package/build/client/vaults/instructions/removePolicy.js +27 -0
  816. package/build/client/vaults/instructions/removePolicy.js.map +1 -0
  817. package/build/client/vaults/instructions/sentinelSetVaultFlags.d.ts +10 -0
  818. package/build/client/vaults/instructions/sentinelSetVaultFlags.js +23 -0
  819. package/build/client/vaults/instructions/sentinelSetVaultFlags.js.map +1 -0
  820. package/build/client/vaults/instructions/stakeVote.d.ts +18 -0
  821. package/build/client/vaults/instructions/stakeVote.js +31 -0
  822. package/build/client/vaults/instructions/stakeVote.js.map +1 -0
  823. package/build/client/vaults/instructions/unstakeVote.d.ts +14 -0
  824. package/build/client/vaults/instructions/unstakeVote.js +24 -0
  825. package/build/client/vaults/instructions/unstakeVote.js.map +1 -0
  826. package/build/client/vaults/instructions/updatePolicy.d.ts +17 -0
  827. package/build/client/vaults/instructions/updatePolicy.js +34 -0
  828. package/build/client/vaults/instructions/updatePolicy.js.map +1 -0
  829. package/build/client/vaults/instructions/updatePolicyManager.d.ts +13 -0
  830. package/build/client/vaults/instructions/updatePolicyManager.js +27 -0
  831. package/build/client/vaults/instructions/updatePolicyManager.js.map +1 -0
  832. package/build/client/vaults/instructions/updatePrice.d.ts +9 -0
  833. package/build/client/vaults/instructions/updatePrice.js +22 -0
  834. package/build/client/vaults/instructions/updatePrice.js.map +1 -0
  835. package/build/client/vaults/instructions/validateInteractionHook.d.ts +16 -0
  836. package/build/client/vaults/instructions/validateInteractionHook.js +33 -0
  837. package/build/client/vaults/instructions/validateInteractionHook.js.map +1 -0
  838. package/build/client/vaults/instructions/wrapperAddPolicy.d.ts +16 -0
  839. package/build/client/vaults/instructions/wrapperAddPolicy.js +33 -0
  840. package/build/client/vaults/instructions/wrapperAddPolicy.js.map +1 -0
  841. package/build/client/vaults/instructions/wrapperExecuteWithdrawal.d.ts +27 -0
  842. package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js +40 -0
  843. package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js.map +1 -0
  844. package/build/client/vaults/instructions/wrapperManageVaultSettings.d.ts +12 -0
  845. package/build/client/vaults/instructions/wrapperManageVaultSettings.js +25 -0
  846. package/build/client/vaults/instructions/wrapperManageVaultSettings.js.map +1 -0
  847. package/build/client/vaults/instructions/wrapperManagerUpdatePosition.d.ts +12 -0
  848. package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js +25 -0
  849. package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js.map +1 -0
  850. package/build/client/vaults/instructions/wrapperRemovePolicy.d.ts +13 -0
  851. package/build/client/vaults/instructions/wrapperRemovePolicy.js +27 -0
  852. package/build/client/vaults/instructions/wrapperRemovePolicy.js.map +1 -0
  853. package/build/client/vaults/instructions/wrapperUpdatePolicy.d.ts +17 -0
  854. package/build/client/vaults/instructions/wrapperUpdatePolicy.js +34 -0
  855. package/build/client/vaults/instructions/wrapperUpdatePolicy.js.map +1 -0
  856. package/build/client/vaults/types/accountConstraint.d.ts +20 -0
  857. package/build/client/vaults/types/accountConstraint.js +16 -0
  858. package/build/client/vaults/types/accountConstraint.js.map +1 -0
  859. package/build/client/vaults/types/accountConstraintType.d.ts +18 -0
  860. package/build/client/vaults/types/accountConstraintType.js +38 -0
  861. package/build/client/vaults/types/accountConstraintType.js.map +1 -0
  862. package/build/client/vaults/types/allowedSettingsChange.d.ts +79 -0
  863. package/build/client/vaults/types/allowedSettingsChange.js +45 -0
  864. package/build/client/vaults/types/allowedSettingsChange.js.map +1 -0
  865. package/build/client/vaults/types/cancelProposalEvent.d.ts +27 -0
  866. package/build/client/vaults/types/cancelProposalEvent.js +23 -0
  867. package/build/client/vaults/types/cancelProposalEvent.js.map +1 -0
  868. package/build/client/vaults/types/clmmPositionEntry.d.ts +88 -0
  869. package/build/client/vaults/types/clmmPositionEntry.js +20 -0
  870. package/build/client/vaults/types/clmmPositionEntry.js.map +1 -0
  871. package/build/client/vaults/types/dataConstraint.d.ts +116 -0
  872. package/build/client/vaults/types/dataConstraint.js +13 -0
  873. package/build/client/vaults/types/dataConstraint.js.map +1 -0
  874. package/build/client/vaults/types/dataOperator.d.ts +9 -0
  875. package/build/client/vaults/types/dataOperator.js +16 -0
  876. package/build/client/vaults/types/dataOperator.js.map +1 -0
  877. package/build/client/vaults/types/dataValue.d.ts +104 -0
  878. package/build/client/vaults/types/dataValue.js +33 -0
  879. package/build/client/vaults/types/dataValue.js.map +1 -0
  880. package/build/client/vaults/types/depositLiquidityEvent.d.ts +55 -0
  881. package/build/client/vaults/types/depositLiquidityEvent.js +42 -0
  882. package/build/client/vaults/types/depositLiquidityEvent.js.map +1 -0
  883. package/build/client/vaults/types/executeProposalEvent.d.ts +27 -0
  884. package/build/client/vaults/types/executeProposalEvent.js +23 -0
  885. package/build/client/vaults/types/executeProposalEvent.js.map +1 -0
  886. package/build/client/vaults/types/executeWithdrawalEvent.d.ts +14 -0
  887. package/build/client/vaults/types/executeWithdrawalEvent.js +10 -0
  888. package/build/client/vaults/types/executeWithdrawalEvent.js.map +1 -0
  889. package/build/client/vaults/types/fillParam.d.ts +14 -0
  890. package/build/client/vaults/types/fillParam.js +10 -0
  891. package/build/client/vaults/types/fillParam.js.map +1 -0
  892. package/build/client/vaults/types/finalizeProposalEvent.d.ts +48 -0
  893. package/build/client/vaults/types/finalizeProposalEvent.js +26 -0
  894. package/build/client/vaults/types/finalizeProposalEvent.js.map +1 -0
  895. package/build/client/vaults/types/hook.d.ts +44 -0
  896. package/build/client/vaults/types/hook.js +18 -0
  897. package/build/client/vaults/types/hook.js.map +1 -0
  898. package/build/client/vaults/types/hookCompiledInstruction.d.ts +18 -0
  899. package/build/client/vaults/types/hookCompiledInstruction.js +11 -0
  900. package/build/client/vaults/types/hookCompiledInstruction.js.map +1 -0
  901. package/build/client/vaults/types/index.d.ts +65 -0
  902. package/build/client/vaults/types/index.js +83 -0
  903. package/build/client/vaults/types/index.js.map +1 -0
  904. package/build/client/vaults/types/instructionConstraint.d.ts +173 -0
  905. package/build/client/vaults/types/instructionConstraint.js +17 -0
  906. package/build/client/vaults/types/instructionConstraint.js.map +1 -0
  907. package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.d.ts +19 -0
  908. package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.js +18 -0
  909. package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.js.map +1 -0
  910. package/build/client/vaults/types/kaminoObligationEntry.d.ts +117 -0
  911. package/build/client/vaults/types/kaminoObligationEntry.js +23 -0
  912. package/build/client/vaults/types/kaminoObligationEntry.js.map +1 -0
  913. package/build/client/vaults/types/limitedQuantityConstraints.d.ts +10 -0
  914. package/build/client/vaults/types/limitedQuantityConstraints.js +9 -0
  915. package/build/client/vaults/types/limitedQuantityConstraints.js.map +1 -0
  916. package/build/client/vaults/types/limitedSpendingLimit.d.ts +105 -0
  917. package/build/client/vaults/types/limitedSpendingLimit.js +17 -0
  918. package/build/client/vaults/types/limitedSpendingLimit.js.map +1 -0
  919. package/build/client/vaults/types/limitedTimeConstraints.d.ts +67 -0
  920. package/build/client/vaults/types/limitedTimeConstraints.js +12 -0
  921. package/build/client/vaults/types/limitedTimeConstraints.js.map +1 -0
  922. package/build/client/vaults/types/loopscaleLoanEntry.d.ts +11 -0
  923. package/build/client/vaults/types/loopscaleLoanEntry.js +13 -0
  924. package/build/client/vaults/types/loopscaleLoanEntry.js.map +1 -0
  925. package/build/client/vaults/types/loopscaleStrategyEntry.d.ts +11 -0
  926. package/build/client/vaults/types/loopscaleStrategyEntry.js +13 -0
  927. package/build/client/vaults/types/loopscaleStrategyEntry.js.map +1 -0
  928. package/build/client/vaults/types/number.d.ts +2 -0
  929. package/build/client/vaults/types/number.js +9 -0
  930. package/build/client/vaults/types/number.js.map +1 -0
  931. package/build/client/vaults/types/obligationType.d.ts +13 -0
  932. package/build/client/vaults/types/obligationType.js +24 -0
  933. package/build/client/vaults/types/obligationType.js.map +1 -0
  934. package/build/client/vaults/types/orderbookEntry.d.ts +64 -0
  935. package/build/client/vaults/types/orderbookEntry.js +25 -0
  936. package/build/client/vaults/types/orderbookEntry.js.map +1 -0
  937. package/build/client/vaults/types/periodV2.d.ts +60 -0
  938. package/build/client/vaults/types/periodV2.js +24 -0
  939. package/build/client/vaults/types/periodV2.js.map +1 -0
  940. package/build/client/vaults/types/permissions.d.ts +10 -0
  941. package/build/client/vaults/types/permissions.js +7 -0
  942. package/build/client/vaults/types/permissions.js.map +1 -0
  943. package/build/client/vaults/types/policyAction.d.ts +61 -0
  944. package/build/client/vaults/types/policyAction.js +29 -0
  945. package/build/client/vaults/types/policyAction.js.map +1 -0
  946. package/build/client/vaults/types/policyConfig.d.ts +10 -0
  947. package/build/client/vaults/types/policyConfig.js +15 -0
  948. package/build/client/vaults/types/policyConfig.js.map +1 -0
  949. package/build/client/vaults/types/policyCreationPayload.d.ts +287 -0
  950. package/build/client/vaults/types/policyCreationPayload.js +50 -0
  951. package/build/client/vaults/types/policyCreationPayload.js.map +1 -0
  952. package/build/client/vaults/types/policyExpirationArgs.d.ts +33 -0
  953. package/build/client/vaults/types/policyExpirationArgs.js +21 -0
  954. package/build/client/vaults/types/policyExpirationArgs.js.map +1 -0
  955. package/build/client/vaults/types/positionUpdate.d.ts +45 -0
  956. package/build/client/vaults/types/positionUpdate.js +89 -0
  957. package/build/client/vaults/types/positionUpdate.js.map +1 -0
  958. package/build/client/vaults/types/priceId.d.ts +40 -0
  959. package/build/client/vaults/types/priceId.js +21 -0
  960. package/build/client/vaults/types/priceId.js.map +1 -0
  961. package/build/client/vaults/types/priceType.d.ts +19 -0
  962. package/build/client/vaults/types/priceType.js +26 -0
  963. package/build/client/vaults/types/priceType.js.map +1 -0
  964. package/build/client/vaults/types/programInteractionPolicyCreationPayload.d.ts +11 -0
  965. package/build/client/vaults/types/programInteractionPolicyCreationPayload.js +16 -0
  966. package/build/client/vaults/types/programInteractionPolicyCreationPayload.js.map +1 -0
  967. package/build/client/vaults/types/proposalAction.d.ts +226 -0
  968. package/build/client/vaults/types/proposalAction.js +40 -0
  969. package/build/client/vaults/types/proposalAction.js.map +1 -0
  970. package/build/client/vaults/types/proposalActionKind.d.ts +7 -0
  971. package/build/client/vaults/types/proposalActionKind.js +14 -0
  972. package/build/client/vaults/types/proposalActionKind.js.map +1 -0
  973. package/build/client/vaults/types/proposalStatus.d.ts +9 -0
  974. package/build/client/vaults/types/proposalStatus.js +16 -0
  975. package/build/client/vaults/types/proposalStatus.js.map +1 -0
  976. package/build/client/vaults/types/proposalVoteConfig.d.ts +46 -0
  977. package/build/client/vaults/types/proposalVoteConfig.js +18 -0
  978. package/build/client/vaults/types/proposalVoteConfig.js.map +1 -0
  979. package/build/client/vaults/types/proposeActionEvent.d.ts +48 -0
  980. package/build/client/vaults/types/proposeActionEvent.js +29 -0
  981. package/build/client/vaults/types/proposeActionEvent.js.map +1 -0
  982. package/build/client/vaults/types/quantityConstraints.d.ts +18 -0
  983. package/build/client/vaults/types/quantityConstraints.js +11 -0
  984. package/build/client/vaults/types/quantityConstraints.js.map +1 -0
  985. package/build/client/vaults/types/reservePriceMapping.d.ts +48 -0
  986. package/build/client/vaults/types/reservePriceMapping.js +15 -0
  987. package/build/client/vaults/types/reservePriceMapping.js.map +1 -0
  988. package/build/client/vaults/types/settingsChangePolicyCreationPayload.d.ts +81 -0
  989. package/build/client/vaults/types/settingsChangePolicyCreationPayload.js +10 -0
  990. package/build/client/vaults/types/settingsChangePolicyCreationPayload.js.map +1 -0
  991. package/build/client/vaults/types/spendingLimitPolicyCreationPayload.d.ts +142 -0
  992. package/build/client/vaults/types/spendingLimitPolicyCreationPayload.js +24 -0
  993. package/build/client/vaults/types/spendingLimitPolicyCreationPayload.js.map +1 -0
  994. package/build/client/vaults/types/stakeVoteEvent.d.ts +40 -0
  995. package/build/client/vaults/types/stakeVoteEvent.js +27 -0
  996. package/build/client/vaults/types/stakeVoteEvent.js.map +1 -0
  997. package/build/client/vaults/types/strategyPosition.d.ts +43 -0
  998. package/build/client/vaults/types/strategyPosition.js +54 -0
  999. package/build/client/vaults/types/strategyPosition.js.map +1 -0
  1000. package/build/client/vaults/types/timeConstraints.d.ts +71 -0
  1001. package/build/client/vaults/types/timeConstraints.js +13 -0
  1002. package/build/client/vaults/types/timeConstraints.js.map +1 -0
  1003. package/build/client/vaults/types/tokenAccountBalance.d.ts +52 -0
  1004. package/build/client/vaults/types/tokenAccountBalance.js +19 -0
  1005. package/build/client/vaults/types/tokenAccountBalance.js.map +1 -0
  1006. package/build/client/vaults/types/tokenAccountEntry.d.ts +72 -0
  1007. package/build/client/vaults/types/tokenAccountEntry.js +15 -0
  1008. package/build/client/vaults/types/tokenAccountEntry.js.map +1 -0
  1009. package/build/client/vaults/types/tokenEntry.d.ts +60 -0
  1010. package/build/client/vaults/types/tokenEntry.js +24 -0
  1011. package/build/client/vaults/types/tokenEntry.js.map +1 -0
  1012. package/build/client/vaults/types/unstakeVoteEvent.d.ts +36 -0
  1013. package/build/client/vaults/types/unstakeVoteEvent.js +26 -0
  1014. package/build/client/vaults/types/unstakeVoteEvent.js.map +1 -0
  1015. package/build/client/vaults/types/updatePriceAction.d.ts +174 -0
  1016. package/build/client/vaults/types/updatePriceAction.js +104 -0
  1017. package/build/client/vaults/types/updatePriceAction.js.map +1 -0
  1018. package/build/client/vaults/types/updatePriceInput.d.ts +14 -0
  1019. package/build/client/vaults/types/updatePriceInput.js +10 -0
  1020. package/build/client/vaults/types/updatePriceInput.js.map +1 -0
  1021. package/build/client/vaults/types/usageState.d.ts +14 -0
  1022. package/build/client/vaults/types/usageState.js +10 -0
  1023. package/build/client/vaults/types/usageState.js.map +1 -0
  1024. package/build/client/vaults/types/vaultConfig.d.ts +87 -0
  1025. package/build/client/vaults/types/vaultConfig.js +19 -0
  1026. package/build/client/vaults/types/vaultConfig.js.map +1 -0
  1027. package/build/client/vaults/types/vaultFinancials.d.ts +58 -0
  1028. package/build/client/vaults/types/vaultFinancials.js +21 -0
  1029. package/build/client/vaults/types/vaultFinancials.js.map +1 -0
  1030. package/build/client/vaults/types/vaultFlagAction.d.ts +56 -0
  1031. package/build/client/vaults/types/vaultFlagAction.js +22 -0
  1032. package/build/client/vaults/types/vaultFlagAction.js.map +1 -0
  1033. package/build/client/vaults/types/vaultFlagsUpdatedEvent.d.ts +23 -0
  1034. package/build/client/vaults/types/vaultFlagsUpdatedEvent.js +19 -0
  1035. package/build/client/vaults/types/vaultFlagsUpdatedEvent.js.map +1 -0
  1036. package/build/client/vaults/types/vaultRoleKind.d.ts +7 -0
  1037. package/build/client/vaults/types/vaultRoleKind.js +14 -0
  1038. package/build/client/vaults/types/vaultRoleKind.js.map +1 -0
  1039. package/build/client/vaults/types/vaultRoles.d.ts +23 -0
  1040. package/build/client/vaults/types/vaultRoles.js +25 -0
  1041. package/build/client/vaults/types/vaultRoles.js.map +1 -0
  1042. package/build/client/vaults/types/vaultSettingsAction.d.ts +109 -0
  1043. package/build/client/vaults/types/vaultSettingsAction.js +161 -0
  1044. package/build/client/vaults/types/vaultSettingsAction.js.map +1 -0
  1045. package/build/client/vaults/types/voteChoice.d.ts +5 -0
  1046. package/build/client/vaults/types/voteChoice.js +12 -0
  1047. package/build/client/vaults/types/voteChoice.js.map +1 -0
  1048. package/build/client/vaults/types/withdrawalPeriodSettings.d.ts +48 -0
  1049. package/build/client/vaults/types/withdrawalPeriodSettings.js +28 -0
  1050. package/build/client/vaults/types/withdrawalPeriodSettings.js.map +1 -0
  1051. package/build/client/vaults/types/withdrawalTokenFill.d.ts +19 -0
  1052. package/build/client/vaults/types/withdrawalTokenFill.js +18 -0
  1053. package/build/client/vaults/types/withdrawalTokenFill.js.map +1 -0
  1054. package/build/client/vaults/types/yieldPositionEntry.d.ts +52 -0
  1055. package/build/client/vaults/types/yieldPositionEntry.js +19 -0
  1056. package/build/client/vaults/types/yieldPositionEntry.js.map +1 -0
  1057. package/build/clmm/codamaEvents.d.ts +23 -0
  1058. package/build/clmm/codamaEvents.js +24 -0
  1059. package/build/clmm/codamaEvents.js.map +1 -0
  1060. package/build/clmm/index.d.ts +1 -0
  1061. package/build/clmm/index.js +18 -0
  1062. package/build/clmm/index.js.map +1 -0
  1063. package/build/codamaEvents.d.ts +18 -0
  1064. package/build/codamaEvents.js +21 -0
  1065. package/build/codamaEvents.js.map +1 -0
  1066. package/build/environment.d.ts +8 -7
  1067. package/build/environment.js +8 -7
  1068. package/build/environment.js.map +1 -1
  1069. package/build/exponentVaults/aumCalculator.d.ts +182 -0
  1070. package/build/exponentVaults/aumCalculator.js +778 -0
  1071. package/build/exponentVaults/aumCalculator.js.map +1 -0
  1072. package/build/exponentVaults/events.d.ts +8 -0
  1073. package/build/exponentVaults/events.js +12 -0
  1074. package/build/exponentVaults/events.js.map +1 -0
  1075. package/build/exponentVaults/index.d.ts +30 -0
  1076. package/build/exponentVaults/index.js +176 -0
  1077. package/build/exponentVaults/index.js.map +1 -0
  1078. package/build/exponentVaults/kamino-markets.d.ts +887 -0
  1079. package/build/exponentVaults/kamino-markets.js +345 -0
  1080. package/build/exponentVaults/kamino-markets.js.map +1 -0
  1081. package/build/exponentVaults/loopscale-client.d.ts +541 -0
  1082. package/build/exponentVaults/loopscale-client.js +732 -0
  1083. package/build/exponentVaults/loopscale-client.js.map +1 -0
  1084. package/build/exponentVaults/policyBuilders.d.ts +694 -0
  1085. package/build/exponentVaults/policyBuilders.js +1131 -0
  1086. package/build/exponentVaults/policyBuilders.js.map +1 -0
  1087. package/build/exponentVaults/policyMatcher.d.ts +82 -0
  1088. package/build/exponentVaults/policyMatcher.js +730 -0
  1089. package/build/exponentVaults/policyMatcher.js.map +1 -0
  1090. package/build/exponentVaults/scope-refresh.d.ts +10 -0
  1091. package/build/exponentVaults/scope-refresh.js +140 -0
  1092. package/build/exponentVaults/scope-refresh.js.map +1 -0
  1093. package/build/exponentVaults/squadsVaultTxnResolver/constants.d.ts +2 -0
  1094. package/build/exponentVaults/squadsVaultTxnResolver/constants.js +61 -0
  1095. package/build/exponentVaults/squadsVaultTxnResolver/constants.js.map +1 -0
  1096. package/build/exponentVaults/squadsVaultTxnResolver/helpers.d.ts +26 -0
  1097. package/build/exponentVaults/squadsVaultTxnResolver/helpers.js +268 -0
  1098. package/build/exponentVaults/squadsVaultTxnResolver/helpers.js.map +1 -0
  1099. package/build/exponentVaults/squadsVaultTxnResolver/index.d.ts +5 -0
  1100. package/build/exponentVaults/squadsVaultTxnResolver/index.js +15 -0
  1101. package/build/exponentVaults/squadsVaultTxnResolver/index.js.map +1 -0
  1102. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.d.ts +6 -0
  1103. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js +361 -0
  1104. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js.map +1 -0
  1105. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.d.ts +2 -0
  1106. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js +28 -0
  1107. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js.map +1 -0
  1108. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/index.d.ts +2 -0
  1109. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/index.js +25 -0
  1110. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/index.js.map +1 -0
  1111. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.d.ts +2 -0
  1112. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js +67 -0
  1113. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js.map +1 -0
  1114. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.d.ts +2 -0
  1115. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js +73 -0
  1116. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js.map +1 -0
  1117. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.d.ts +2 -0
  1118. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js +35 -0
  1119. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js.map +1 -0
  1120. package/build/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.d.ts +21 -0
  1121. package/build/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.js +64 -0
  1122. package/build/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.js.map +1 -0
  1123. package/build/exponentVaults/squadsVaultTxnResolver/types.d.ts +111 -0
  1124. package/build/exponentVaults/squadsVaultTxnResolver/types.js +92 -0
  1125. package/build/exponentVaults/squadsVaultTxnResolver/types.js.map +1 -0
  1126. package/build/exponentVaults/squadsVaultTxnResolver/utils.d.ts +3 -0
  1127. package/build/exponentVaults/squadsVaultTxnResolver/utils.js +8 -0
  1128. package/build/exponentVaults/squadsVaultTxnResolver/utils.js.map +1 -0
  1129. package/build/exponentVaults/syncTransaction.d.ts +84 -0
  1130. package/build/exponentVaults/syncTransaction.js +341 -0
  1131. package/build/exponentVaults/syncTransaction.js.map +1 -0
  1132. package/build/exponentVaults/titan-quote.d.ts +22 -0
  1133. package/build/exponentVaults/titan-quote.js +167 -0
  1134. package/build/exponentVaults/titan-quote.js.map +1 -0
  1135. package/build/exponentVaults/vault-interaction.d.ts +3475 -0
  1136. package/build/exponentVaults/vault-interaction.js +2251 -0
  1137. package/build/exponentVaults/vault-interaction.js.map +1 -0
  1138. package/build/exponentVaults/vault.d.ts +613 -0
  1139. package/build/exponentVaults/vault.js +1437 -0
  1140. package/build/exponentVaults/vault.js.map +1 -0
  1141. package/build/exponentVaults/vaultTransactionBuilder.d.ts +319 -0
  1142. package/build/exponentVaults/vaultTransactionBuilder.js +470 -0
  1143. package/build/exponentVaults/vaultTransactionBuilder.js.map +1 -0
  1144. package/build/flavors.d.ts +5 -3
  1145. package/build/flavors.js +195 -137
  1146. package/build/flavors.js.map +1 -1
  1147. package/build/index.d.ts +17 -4
  1148. package/build/index.js +33 -7
  1149. package/build/index.js.map +1 -1
  1150. package/build/lpPosition.d.ts +13 -15
  1151. package/build/lpPosition.js +6 -7
  1152. package/build/lpPosition.js.map +1 -1
  1153. package/build/market.d.ts +213 -228
  1154. package/build/market.js +331 -384
  1155. package/build/market.js.map +1 -1
  1156. package/build/marketThree.d.ts +798 -0
  1157. package/build/marketThree.js +1749 -0
  1158. package/build/marketThree.js.map +1 -0
  1159. package/build/marketThree.test.d.ts +1 -0
  1160. package/build/marketThree.test.js +166 -0
  1161. package/build/marketThree.test.js.map +1 -0
  1162. package/build/orderbook/codamaEvents.d.ts +19 -0
  1163. package/build/orderbook/codamaEvents.js +22 -0
  1164. package/build/orderbook/codamaEvents.js.map +1 -0
  1165. package/build/orderbook/index.d.ts +7 -0
  1166. package/build/orderbook/index.js +45 -0
  1167. package/build/orderbook/index.js.map +1 -0
  1168. package/build/orderbook/math.d.ts +28 -0
  1169. package/build/orderbook/math.js +123 -0
  1170. package/build/orderbook/math.js.map +1 -0
  1171. package/build/orderbook/orderbook.d.ts +253 -0
  1172. package/build/orderbook/orderbook.js +923 -0
  1173. package/build/orderbook/orderbook.js.map +1 -0
  1174. package/build/orderbook/types.d.ts +35 -0
  1175. package/build/orderbook/types.js +47 -0
  1176. package/build/orderbook/types.js.map +1 -0
  1177. package/build/orderbook/utils.d.ts +16 -0
  1178. package/build/orderbook/utils.js +66 -0
  1179. package/build/orderbook/utils.js.map +1 -0
  1180. package/build/router.d.ts +152 -0
  1181. package/build/router.js +544 -0
  1182. package/build/router.js.map +1 -0
  1183. package/build/syPosition.d.ts +2 -2
  1184. package/build/syPosition.js +13 -7
  1185. package/build/syPosition.js.map +1 -1
  1186. package/build/tokenUtil.d.ts +3 -3
  1187. package/build/tokenUtil.js.map +1 -1
  1188. package/build/utils/index.d.ts +5 -5
  1189. package/build/utils/index.js +2 -2
  1190. package/build/utils/index.js.map +1 -1
  1191. package/build/utils/ix.d.ts +2 -2
  1192. package/build/vault.d.ts +111 -222
  1193. package/build/vault.js +228 -149
  1194. package/build/vault.js.map +1 -1
  1195. package/build/ytPosition.d.ts +29 -35
  1196. package/build/ytPosition.js +89 -67
  1197. package/build/ytPosition.js.map +1 -1
  1198. package/package.json +59 -24
  1199. package/src/CodamaEventDecoder.ts +151 -0
  1200. package/src/addressLookupTableUtil.ts +85 -10
  1201. package/src/client/clmm/accounts/lpPosition.ts +143 -0
  1202. package/src/client/clmm/accounts/marketThree.ts +274 -0
  1203. package/src/client/clmm/accounts/vault.ts +234 -0
  1204. package/src/client/clmm/eventRegistry.ts +92 -0
  1205. package/src/client/clmm/index.ts +82 -0
  1206. package/src/client/clmm/instructions/addFarm.ts +57 -0
  1207. package/src/client/clmm/instructions/addLiquidity.ts +78 -0
  1208. package/src/client/clmm/instructions/addMarketEmission.ts +50 -0
  1209. package/src/client/clmm/instructions/buyPt.ts +73 -0
  1210. package/src/client/clmm/instructions/buyYt.ts +80 -0
  1211. package/src/client/clmm/instructions/claimFarmEmission.ts +56 -0
  1212. package/src/client/clmm/instructions/closeMarket.ts +47 -0
  1213. package/src/client/clmm/instructions/depositLiquidity.ts +71 -0
  1214. package/src/client/clmm/instructions/initializeMarket.ts +127 -0
  1215. package/src/client/clmm/instructions/marketAccrueEmission.ts +39 -0
  1216. package/src/client/clmm/instructions/marketCollectEmission.ts +57 -0
  1217. package/src/client/clmm/instructions/modifyFarm.ts +55 -0
  1218. package/src/client/clmm/instructions/modifyMarketSetting.ts +45 -0
  1219. package/src/client/clmm/instructions/sellPt.ts +73 -0
  1220. package/src/client/clmm/instructions/sellYt.ts +80 -0
  1221. package/src/client/clmm/instructions/tradePt.ts +73 -0
  1222. package/src/client/clmm/instructions/tradePtExactOut.ts +75 -0
  1223. package/src/client/clmm/instructions/withdrawLiquidity.ts +67 -0
  1224. package/src/client/clmm/instructions/wrapperBuyYt.ts +85 -0
  1225. package/src/client/clmm/instructions/wrapperProvideLiquidity.ts +100 -0
  1226. package/src/client/clmm/instructions/wrapperProvideLiquidityBase.ts +98 -0
  1227. package/src/client/clmm/instructions/wrapperProvideLiquidityClassic.ts +86 -0
  1228. package/src/client/clmm/instructions/wrapperSellYt.ts +83 -0
  1229. package/src/client/clmm/instructions/wrapperWithdrawLiquidity.ts +75 -0
  1230. package/src/client/clmm/instructions/wrapperWithdrawLiquidityClassic.ts +69 -0
  1231. package/src/client/clmm/types/addFarmEvent.ts +51 -0
  1232. package/src/client/clmm/types/amount.ts +51 -0
  1233. package/src/client/clmm/types/buyPtEvent.ts +36 -0
  1234. package/src/client/clmm/types/buyYtEvent.ts +74 -0
  1235. package/src/client/clmm/types/claimFarmEmissionsEvent.ts +94 -0
  1236. package/src/client/clmm/types/claimLimits.ts +15 -0
  1237. package/src/client/clmm/types/closeMarketEvent.ts +36 -0
  1238. package/src/client/clmm/types/configurationOptions.ts +29 -0
  1239. package/src/client/clmm/types/cpiAccounts.ts +21 -0
  1240. package/src/client/clmm/types/cpiCoreAccounts.ts +15 -0
  1241. package/src/client/clmm/types/cpiInterfaceContext.ts +13 -0
  1242. package/src/client/clmm/types/crossingSplit.ts +40 -0
  1243. package/src/client/clmm/types/depositLiquidityEvent.ts +93 -0
  1244. package/src/client/clmm/types/depositLiquidityReturnData.ts +81 -0
  1245. package/src/client/clmm/types/emissionInfo.ts +44 -0
  1246. package/src/client/clmm/types/farmEmission.ts +31 -0
  1247. package/src/client/clmm/types/index.ts +48 -0
  1248. package/src/client/clmm/types/liquidityNetBalanceLimits.ts +22 -0
  1249. package/src/client/clmm/types/lpFarm.ts +12 -0
  1250. package/src/client/clmm/types/marketAccrueEmissionEvent.ts +69 -0
  1251. package/src/client/clmm/types/marketAdminAction.ts +239 -0
  1252. package/src/client/clmm/types/marketCollectEmissionEvent.ts +83 -0
  1253. package/src/client/clmm/types/marketEmission.ts +28 -0
  1254. package/src/client/clmm/types/marketEmissions.ts +10 -0
  1255. package/src/client/clmm/types/marketFinancials.ts +17 -0
  1256. package/src/client/clmm/types/marketThreeInitEvent.ts +92 -0
  1257. package/src/client/clmm/types/mergeEvent.ts +118 -0
  1258. package/src/client/clmm/types/modifiedTick.ts +13 -0
  1259. package/src/client/clmm/types/modifiedTicks.ts +18 -0
  1260. package/src/client/clmm/types/modifyFarmEvent.ts +56 -0
  1261. package/src/client/clmm/types/number.ts +7 -0
  1262. package/src/client/clmm/types/personalYieldTracker.ts +12 -0
  1263. package/src/client/clmm/types/personalYieldTrackers.ts +13 -0
  1264. package/src/client/clmm/types/principalShare.ts +22 -0
  1265. package/src/client/clmm/types/principalShareTrackers.ts +10 -0
  1266. package/src/client/clmm/types/sellPtEvent.ts +36 -0
  1267. package/src/client/clmm/types/sellYtEvent.ts +69 -0
  1268. package/src/client/clmm/types/stripEvent.ts +124 -0
  1269. package/src/client/clmm/types/swapDirection.ts +8 -0
  1270. package/src/client/clmm/types/tradePtEvent.ts +76 -0
  1271. package/src/client/clmm/types/withdrawLiquidityEvent.ts +99 -0
  1272. package/src/client/clmm/types/withdrawLiquidityReturnData.ts +27 -0
  1273. package/src/client/clmm/types/wrapperBuyYtEvent.ts +36 -0
  1274. package/src/client/clmm/types/wrapperProvideLiquidityBaseEvent.ts +60 -0
  1275. package/src/client/clmm/types/wrapperProvideLiquidityClassicEvent.ts +58 -0
  1276. package/src/client/clmm/types/wrapperProvideLiquidityEvent.ts +60 -0
  1277. package/src/client/clmm/types/wrapperSellYtEvent.ts +36 -0
  1278. package/src/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.ts +62 -0
  1279. package/src/client/clmm/types/wrapperWithdrawLiquidityEvent.ts +62 -0
  1280. package/src/client/core/accounts/admin.ts +112 -0
  1281. package/src/client/core/accounts/lpPosition.ts +122 -0
  1282. package/src/client/core/accounts/marketTwo.ts +234 -0
  1283. package/src/client/core/accounts/vault.ts +234 -0
  1284. package/src/client/core/accounts/yieldTokenPosition.ts +126 -0
  1285. package/src/client/core/eventRegistry.ts +134 -0
  1286. package/src/client/core/index.ts +113 -0
  1287. package/src/client/core/instructions/addEmission.ts +62 -0
  1288. package/src/client/core/instructions/addFarm.ts +53 -0
  1289. package/src/client/core/instructions/addLpTokensMetadata.ts +62 -0
  1290. package/src/client/core/instructions/addMarketEmission.ts +52 -0
  1291. package/src/client/core/instructions/buyYt.ts +79 -0
  1292. package/src/client/core/instructions/claimFarmEmissions.ts +54 -0
  1293. package/src/client/core/instructions/collectEmission.ts +66 -0
  1294. package/src/client/core/instructions/collectInterest.ts +64 -0
  1295. package/src/client/core/instructions/collectTreasuryEmission.ts +64 -0
  1296. package/src/client/core/instructions/collectTreasuryInterest.ts +62 -0
  1297. package/src/client/core/instructions/depositYt.ts +59 -0
  1298. package/src/client/core/instructions/initLpPosition.ts +35 -0
  1299. package/src/client/core/instructions/initMarketTwo.ts +103 -0
  1300. package/src/client/core/instructions/initializeVault.ts +107 -0
  1301. package/src/client/core/instructions/initializeYieldPosition.ts +33 -0
  1302. package/src/client/core/instructions/marketCollectEmission.ts +55 -0
  1303. package/src/client/core/instructions/marketDepositLp.ts +59 -0
  1304. package/src/client/core/instructions/marketTwoDepositLiquidity.ts +65 -0
  1305. package/src/client/core/instructions/marketTwoWithdrawLiquidity.ts +65 -0
  1306. package/src/client/core/instructions/marketWithdrawLp.ts +59 -0
  1307. package/src/client/core/instructions/merge.ts +61 -0
  1308. package/src/client/core/instructions/modifyFarm.ts +51 -0
  1309. package/src/client/core/instructions/modifyMarketSetting.ts +47 -0
  1310. package/src/client/core/instructions/modifyVaultSetting.ts +44 -0
  1311. package/src/client/core/instructions/reallocMarket.ts +45 -0
  1312. package/src/client/core/instructions/sellYt.ts +79 -0
  1313. package/src/client/core/instructions/stageYtYield.ts +39 -0
  1314. package/src/client/core/instructions/strip.ts +61 -0
  1315. package/src/client/core/instructions/tradePt.ts +59 -0
  1316. package/src/client/core/instructions/withdrawYt.ts +61 -0
  1317. package/src/client/core/instructions/wrapperBuyPt.ts +63 -0
  1318. package/src/client/core/instructions/wrapperBuyYt.ts +93 -0
  1319. package/src/client/core/instructions/wrapperCollectInterest.ts +63 -0
  1320. package/src/client/core/instructions/wrapperMerge.ts +77 -0
  1321. package/src/client/core/instructions/wrapperProvideLiquidity.ts +103 -0
  1322. package/src/client/core/instructions/wrapperProvideLiquidityBase.ts +81 -0
  1323. package/src/client/core/instructions/wrapperProvideLiquidityClassic.ts +77 -0
  1324. package/src/client/core/instructions/wrapperSellPt.ts +63 -0
  1325. package/src/client/core/instructions/wrapperSellYt.ts +87 -0
  1326. package/src/client/core/instructions/wrapperStrip.ts +81 -0
  1327. package/src/client/core/instructions/wrapperWithdrawLiquidity.ts +77 -0
  1328. package/src/client/core/instructions/wrapperWithdrawLiquidityClassic.ts +73 -0
  1329. package/src/client/core/types/adminAction.ts +255 -0
  1330. package/src/client/core/types/amount.ts +51 -0
  1331. package/src/client/core/types/buyPtEvent.ts +39 -0
  1332. package/src/client/core/types/buyYtEvent.ts +95 -0
  1333. package/src/client/core/types/claimFarmEmissionsEvent.ts +75 -0
  1334. package/src/client/core/types/claimFarmEmissionsEventV2.ts +83 -0
  1335. package/src/client/core/types/claimLimits.ts +15 -0
  1336. package/src/client/core/types/collectEmissionEvent.ts +51 -0
  1337. package/src/client/core/types/collectEmissionEventV2.ts +60 -0
  1338. package/src/client/core/types/collectInterestEvent.ts +48 -0
  1339. package/src/client/core/types/collectInterestEventV2.ts +57 -0
  1340. package/src/client/core/types/collectTreasuryEmissionKind.ts +8 -0
  1341. package/src/client/core/types/collectTreasuryInterestKind.ts +8 -0
  1342. package/src/client/core/types/cpiAccounts.ts +21 -0
  1343. package/src/client/core/types/cpiInterfaceContext.ts +13 -0
  1344. package/src/client/core/types/depositLiquidityEvent.ts +101 -0
  1345. package/src/client/core/types/depositLpEvent.ts +75 -0
  1346. package/src/client/core/types/depositLpEventV2.ts +83 -0
  1347. package/src/client/core/types/depositYtEvent.ts +82 -0
  1348. package/src/client/core/types/depositYtEventV2.ts +91 -0
  1349. package/src/client/core/types/emissionInfo.ts +44 -0
  1350. package/src/client/core/types/farmEmission.ts +31 -0
  1351. package/src/client/core/types/index.ts +60 -0
  1352. package/src/client/core/types/initLpPositionEvent.ts +57 -0
  1353. package/src/client/core/types/initializeYieldPositionEvent.ts +43 -0
  1354. package/src/client/core/types/liquidityNetBalanceLimits.ts +22 -0
  1355. package/src/client/core/types/lpFarm.ts +12 -0
  1356. package/src/client/core/types/marketAdminAction.ts +212 -0
  1357. package/src/client/core/types/marketCollectEmissionEvent.ts +67 -0
  1358. package/src/client/core/types/marketCollectEmissionEventV2.ts +75 -0
  1359. package/src/client/core/types/marketEmission.ts +28 -0
  1360. package/src/client/core/types/marketEmissions.ts +10 -0
  1361. package/src/client/core/types/marketFinancials.ts +19 -0
  1362. package/src/client/core/types/mergeEvent.ts +118 -0
  1363. package/src/client/core/types/number.ts +7 -0
  1364. package/src/client/core/types/personalYieldTracker.ts +12 -0
  1365. package/src/client/core/types/personalYieldTrackers.ts +13 -0
  1366. package/src/client/core/types/principleDetails.ts +25 -0
  1367. package/src/client/core/types/principles.ts +23 -0
  1368. package/src/client/core/types/sellPtEvent.ts +39 -0
  1369. package/src/client/core/types/sellYtEvent.ts +90 -0
  1370. package/src/client/core/types/stageYieldEvent.ts +63 -0
  1371. package/src/client/core/types/stageYieldEventV2.ts +69 -0
  1372. package/src/client/core/types/stripEvent.ts +124 -0
  1373. package/src/client/core/types/tradePtEvent.ts +80 -0
  1374. package/src/client/core/types/withdrawLiquidityEvent.ts +97 -0
  1375. package/src/client/core/types/withdrawLpEvent.ts +75 -0
  1376. package/src/client/core/types/withdrawLpEventV2.ts +83 -0
  1377. package/src/client/core/types/withdrawYtEvent.ts +82 -0
  1378. package/src/client/core/types/withdrawYtEventV2.ts +91 -0
  1379. package/src/client/core/types/wrapperBuyYtEvent.ts +39 -0
  1380. package/src/client/core/types/wrapperCollectInterestEvent.ts +37 -0
  1381. package/src/client/core/types/wrapperMergeEvent.ts +38 -0
  1382. package/src/client/core/types/wrapperProvideLiquidityBaseEvent.ts +43 -0
  1383. package/src/client/core/types/wrapperProvideLiquidityClassicEvent.ts +41 -0
  1384. package/src/client/core/types/wrapperProvideLiquidityEvent.ts +41 -0
  1385. package/src/client/core/types/wrapperSellYtEvent.ts +39 -0
  1386. package/src/client/core/types/wrapperStripEvent.ts +38 -0
  1387. package/src/client/core/types/wrapperWithdrawLiquidityClassicEvent.ts +41 -0
  1388. package/src/client/core/types/wrapperWithdrawLiquidityEvent.ts +39 -0
  1389. package/src/client/core/types/yieldTokenTracker.ts +12 -0
  1390. package/src/client/orderbook/accounts/cpiAccountsOrderbook.ts +101 -0
  1391. package/src/client/orderbook/accounts/vault.ts +234 -0
  1392. package/src/client/orderbook/eventRegistry.ts +71 -0
  1393. package/src/client/orderbook/index.ts +55 -0
  1394. package/src/client/orderbook/instructions/collectAdminEmission.ts +48 -0
  1395. package/src/client/orderbook/instructions/collectAdminFee.ts +59 -0
  1396. package/src/client/orderbook/instructions/collectInterest.ts +66 -0
  1397. package/src/client/orderbook/instructions/initializeOrderbook.ts +104 -0
  1398. package/src/client/orderbook/instructions/marketOffer.ts +89 -0
  1399. package/src/client/orderbook/instructions/postOffer.ts +96 -0
  1400. package/src/client/orderbook/instructions/reallocOrderbookAccount.ts +45 -0
  1401. package/src/client/orderbook/instructions/removeExpiredOffers.ts +37 -0
  1402. package/src/client/orderbook/instructions/removeOffer.ts +73 -0
  1403. package/src/client/orderbook/instructions/setConfigurationOptions.ts +43 -0
  1404. package/src/client/orderbook/instructions/withdrawFunds.ts +78 -0
  1405. package/src/client/orderbook/instructions/wrapperCollectAdminFee.ts +73 -0
  1406. package/src/client/orderbook/instructions/wrapperCollectInterest.ts +65 -0
  1407. package/src/client/orderbook/instructions/wrapperMarketOffer.ts +94 -0
  1408. package/src/client/orderbook/instructions/wrapperPostOffer.ts +99 -0
  1409. package/src/client/orderbook/instructions/wrapperRemoveOffer.ts +75 -0
  1410. package/src/client/orderbook/instructions/wrapperWithdrawFunds.ts +80 -0
  1411. package/src/client/orderbook/types/amount.ts +51 -0
  1412. package/src/client/orderbook/types/claimLimits.ts +15 -0
  1413. package/src/client/orderbook/types/collectAdminEmissionEvent.ts +39 -0
  1414. package/src/client/orderbook/types/collectAdminFeeEvent.ts +17 -0
  1415. package/src/client/orderbook/types/collectEmissionEventV2.ts +60 -0
  1416. package/src/client/orderbook/types/collectInterestEventV2.ts +57 -0
  1417. package/src/client/orderbook/types/collectUserInterestEvent.ts +36 -0
  1418. package/src/client/orderbook/types/cpiAccounts.ts +21 -0
  1419. package/src/client/orderbook/types/cpiInterfaceContext.ts +13 -0
  1420. package/src/client/orderbook/types/emissionInfo.ts +44 -0
  1421. package/src/client/orderbook/types/exponentCoreCpiAccounts.ts +21 -0
  1422. package/src/client/orderbook/types/filledOffersEvent.ts +19 -0
  1423. package/src/client/orderbook/types/index.ts +30 -0
  1424. package/src/client/orderbook/types/marketOfferEvent.ts +72 -0
  1425. package/src/client/orderbook/types/mergeEvent.ts +118 -0
  1426. package/src/client/orderbook/types/number.ts +7 -0
  1427. package/src/client/orderbook/types/offerOptions.ts +56 -0
  1428. package/src/client/orderbook/types/offerType.ts +8 -0
  1429. package/src/client/orderbook/types/orderbookInitEvent.ts +54 -0
  1430. package/src/client/orderbook/types/postOfferEvent.ts +78 -0
  1431. package/src/client/orderbook/types/removeOfferEvent.ts +67 -0
  1432. package/src/client/orderbook/types/setConfigurationOptionsEnum.ts +116 -0
  1433. package/src/client/orderbook/types/stripEvent.ts +124 -0
  1434. package/src/client/orderbook/types/withdrawFundsEvent.ts +65 -0
  1435. package/src/client/orderbook/types/wrapperCollectAdminFeeEvent.ts +13 -0
  1436. package/src/client/orderbook/types/wrapperCollectInterestEvent.ts +25 -0
  1437. package/src/client/orderbook/types/wrapperMarketOfferEvent.ts +27 -0
  1438. package/src/client/orderbook/types/wrapperPostOfferEvent.ts +72 -0
  1439. package/src/client/orderbook/types/wrapperRemoveOfferEvent.ts +25 -0
  1440. package/src/client/orderbook/types/wrapperWithdrawFundsEvent.ts +38 -0
  1441. package/src/client/orderbook/types/yieldTokenTracker.ts +12 -0
  1442. package/src/client/vaults/accounts/actionProposal.ts +144 -0
  1443. package/src/client/vaults/accounts/exponentStrategyVault.ts +211 -0
  1444. package/src/client/vaults/accounts/programConfig.ts +123 -0
  1445. package/src/client/vaults/accounts/voteAccount.ts +132 -0
  1446. package/src/client/vaults/accounts/withdrawalAccount.ts +132 -0
  1447. package/src/client/vaults/eventRegistry.ts +45 -0
  1448. package/src/client/vaults/index.ts +111 -0
  1449. package/src/client/vaults/instructions/activateProposal.ts +46 -0
  1450. package/src/client/vaults/instructions/addPolicy.ts +57 -0
  1451. package/src/client/vaults/instructions/appendProposalActions.ts +47 -0
  1452. package/src/client/vaults/instructions/cancelProposal.ts +28 -0
  1453. package/src/client/vaults/instructions/cancelWithdrawal.ts +34 -0
  1454. package/src/client/vaults/instructions/collectManagementFee.ts +32 -0
  1455. package/src/client/vaults/instructions/depositLiquidity.ts +62 -0
  1456. package/src/client/vaults/instructions/executeProposal.ts +36 -0
  1457. package/src/client/vaults/instructions/executeWithdrawal.ts +58 -0
  1458. package/src/client/vaults/instructions/executeWithdrawalFromReserves.ts +66 -0
  1459. package/src/client/vaults/instructions/fillWithdrawal.ts +59 -0
  1460. package/src/client/vaults/instructions/finalizeProposal.ts +28 -0
  1461. package/src/client/vaults/instructions/initProposal.ts +46 -0
  1462. package/src/client/vaults/instructions/initializePrices.ts +28 -0
  1463. package/src/client/vaults/instructions/initializeVault.ts +148 -0
  1464. package/src/client/vaults/instructions/makeSentienelManager.ts +28 -0
  1465. package/src/client/vaults/instructions/managePrices.ts +46 -0
  1466. package/src/client/vaults/instructions/manageVaultSettings.ts +48 -0
  1467. package/src/client/vaults/instructions/managerUpdatePosition.ts +45 -0
  1468. package/src/client/vaults/instructions/queueWithdrawal.ts +50 -0
  1469. package/src/client/vaults/instructions/removePolicy.ts +44 -0
  1470. package/src/client/vaults/instructions/sentinelSetVaultFlags.ts +44 -0
  1471. package/src/client/vaults/instructions/stakeVote.ts +57 -0
  1472. package/src/client/vaults/instructions/unstakeVote.ts +42 -0
  1473. package/src/client/vaults/instructions/updatePolicy.ts +59 -0
  1474. package/src/client/vaults/instructions/updatePolicyManager.ts +44 -0
  1475. package/src/client/vaults/instructions/updatePrice.ts +42 -0
  1476. package/src/client/vaults/instructions/validateInteractionHook.ts +60 -0
  1477. package/src/client/vaults/instructions/wrapperAddPolicy.ts +57 -0
  1478. package/src/client/vaults/instructions/wrapperExecuteWithdrawal.ts +76 -0
  1479. package/src/client/vaults/instructions/wrapperManageVaultSettings.ts +48 -0
  1480. package/src/client/vaults/instructions/wrapperManagerUpdatePosition.ts +45 -0
  1481. package/src/client/vaults/instructions/wrapperRemovePolicy.ts +44 -0
  1482. package/src/client/vaults/instructions/wrapperUpdatePolicy.ts +59 -0
  1483. package/src/client/vaults/types/accountConstraint.ts +35 -0
  1484. package/src/client/vaults/types/accountConstraintType.ts +93 -0
  1485. package/src/client/vaults/types/allowedSettingsChange.ts +136 -0
  1486. package/src/client/vaults/types/cancelProposalEvent.ts +47 -0
  1487. package/src/client/vaults/types/clmmPositionEntry.ts +37 -0
  1488. package/src/client/vaults/types/dataConstraint.ts +16 -0
  1489. package/src/client/vaults/types/dataOperator.ts +13 -0
  1490. package/src/client/vaults/types/dataValue.ts +119 -0
  1491. package/src/client/vaults/types/depositLiquidityEvent.ts +89 -0
  1492. package/src/client/vaults/types/executeProposalEvent.ts +47 -0
  1493. package/src/client/vaults/types/executeWithdrawalEvent.ts +12 -0
  1494. package/src/client/vaults/types/fillParam.ts +12 -0
  1495. package/src/client/vaults/types/finalizeProposalEvent.ts +51 -0
  1496. package/src/client/vaults/types/hook.ts +40 -0
  1497. package/src/client/vaults/types/hookCompiledInstruction.ts +20 -0
  1498. package/src/client/vaults/types/index.ts +66 -0
  1499. package/src/client/vaults/types/instructionConstraint.ts +33 -0
  1500. package/src/client/vaults/types/internalFundTransferPolicyCreationPayload.ts +35 -0
  1501. package/src/client/vaults/types/kaminoObligationEntry.ts +48 -0
  1502. package/src/client/vaults/types/limitedQuantityConstraints.ts +10 -0
  1503. package/src/client/vaults/types/limitedSpendingLimit.ts +35 -0
  1504. package/src/client/vaults/types/limitedTimeConstraints.ts +15 -0
  1505. package/src/client/vaults/types/loopscaleLoanEntry.ts +23 -0
  1506. package/src/client/vaults/types/loopscaleStrategyEntry.ts +23 -0
  1507. package/src/client/vaults/types/number.ts +8 -0
  1508. package/src/client/vaults/types/obligationType.ts +63 -0
  1509. package/src/client/vaults/types/orderbookEntry.ts +50 -0
  1510. package/src/client/vaults/types/periodV2.ts +76 -0
  1511. package/src/client/vaults/types/permissions.ts +8 -0
  1512. package/src/client/vaults/types/policyAction.ts +74 -0
  1513. package/src/client/vaults/types/policyConfig.ts +32 -0
  1514. package/src/client/vaults/types/policyCreationPayload.ts +147 -0
  1515. package/src/client/vaults/types/policyExpirationArgs.ts +67 -0
  1516. package/src/client/vaults/types/positionUpdate.ts +251 -0
  1517. package/src/client/vaults/types/priceId.ts +57 -0
  1518. package/src/client/vaults/types/priceType.ts +23 -0
  1519. package/src/client/vaults/types/programInteractionPolicyCreationPayload.ts +32 -0
  1520. package/src/client/vaults/types/proposalAction.ts +100 -0
  1521. package/src/client/vaults/types/proposalActionKind.ts +11 -0
  1522. package/src/client/vaults/types/proposalStatus.ts +13 -0
  1523. package/src/client/vaults/types/proposalVoteConfig.ts +36 -0
  1524. package/src/client/vaults/types/proposeActionEvent.ts +62 -0
  1525. package/src/client/vaults/types/quantityConstraints.ts +14 -0
  1526. package/src/client/vaults/types/reservePriceMapping.ts +26 -0
  1527. package/src/client/vaults/types/settingsChangePolicyCreationPayload.ts +14 -0
  1528. package/src/client/vaults/types/spendingLimitPolicyCreationPayload.ts +54 -0
  1529. package/src/client/vaults/types/stakeVoteEvent.ts +54 -0
  1530. package/src/client/vaults/types/strategyPosition.ts +161 -0
  1531. package/src/client/vaults/types/timeConstraints.ts +22 -0
  1532. package/src/client/vaults/types/tokenAccountBalance.ts +35 -0
  1533. package/src/client/vaults/types/tokenAccountEntry.ts +30 -0
  1534. package/src/client/vaults/types/tokenEntry.ts +48 -0
  1535. package/src/client/vaults/types/unstakeVoteEvent.ts +53 -0
  1536. package/src/client/vaults/types/updatePriceAction.ts +268 -0
  1537. package/src/client/vaults/types/updatePriceInput.ts +12 -0
  1538. package/src/client/vaults/types/usageState.ts +12 -0
  1539. package/src/client/vaults/types/vaultConfig.ts +38 -0
  1540. package/src/client/vaults/types/vaultFinancials.ts +40 -0
  1541. package/src/client/vaults/types/vaultFlagAction.ts +75 -0
  1542. package/src/client/vaults/types/vaultFlagsUpdatedEvent.ts +37 -0
  1543. package/src/client/vaults/types/vaultRoleKind.ts +11 -0
  1544. package/src/client/vaults/types/vaultRoles.ts +59 -0
  1545. package/src/client/vaults/types/vaultSettingsAction.ts +533 -0
  1546. package/src/client/vaults/types/voteChoice.ts +9 -0
  1547. package/src/client/vaults/types/withdrawalPeriodSettings.ts +83 -0
  1548. package/src/client/vaults/types/withdrawalTokenFill.ts +35 -0
  1549. package/src/client/vaults/types/yieldPositionEntry.ts +35 -0
  1550. package/src/clmm/codamaEvents.ts +34 -0
  1551. package/src/clmm/index.ts +1 -0
  1552. package/src/codamaEvents.ts +27 -0
  1553. package/src/environment.ts +15 -13
  1554. package/src/exponentVaults/aumCalculator.ts +1013 -0
  1555. package/src/exponentVaults/events.ts +15 -0
  1556. package/src/exponentVaults/index.ts +298 -0
  1557. package/src/exponentVaults/kamino-markets.ts +363 -0
  1558. package/src/exponentVaults/loopscale-client.ts +1373 -0
  1559. package/src/exponentVaults/policyBuilders.ts +1559 -0
  1560. package/src/exponentVaults/policyMatcher.ts +895 -0
  1561. package/src/exponentVaults/scope-refresh.ts +169 -0
  1562. package/src/exponentVaults/squadsVaultTxnResolver/constants.ts +59 -0
  1563. package/src/exponentVaults/squadsVaultTxnResolver/helpers.ts +355 -0
  1564. package/src/exponentVaults/squadsVaultTxnResolver/index.ts +16 -0
  1565. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.ts +472 -0
  1566. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.ts +33 -0
  1567. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/index.ts +38 -0
  1568. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.ts +83 -0
  1569. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.ts +94 -0
  1570. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/titan.ts +41 -0
  1571. package/src/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.ts +91 -0
  1572. package/src/exponentVaults/squadsVaultTxnResolver/types.ts +171 -0
  1573. package/src/exponentVaults/squadsVaultTxnResolver/utils.ts +3 -0
  1574. package/src/exponentVaults/syncTransaction.ts +495 -0
  1575. package/src/exponentVaults/titan-quote.ts +260 -0
  1576. package/src/exponentVaults/vault-interaction.ts +3479 -0
  1577. package/src/exponentVaults/vault.ts +2256 -0
  1578. package/src/exponentVaults/vaultTransactionBuilder.ts +785 -0
  1579. package/src/flavors.ts +192 -121
  1580. package/src/index.ts +19 -4
  1581. package/src/lpPosition.ts +17 -19
  1582. package/src/market.ts +532 -546
  1583. package/src/marketThree.test.ts +210 -0
  1584. package/src/marketThree.ts +2853 -0
  1585. package/src/orderbook/codamaEvents.ts +28 -0
  1586. package/src/orderbook/index.ts +13 -0
  1587. package/src/orderbook/math.ts +138 -0
  1588. package/src/orderbook/orderbook.ts +1354 -0
  1589. package/src/orderbook/types.ts +40 -0
  1590. package/src/orderbook/utils.ts +66 -0
  1591. package/src/router.ts +810 -0
  1592. package/src/syPosition.ts +19 -16
  1593. package/src/tokenUtil.ts +4 -4
  1594. package/src/utils/index.ts +6 -7
  1595. package/src/utils/ix.ts +2 -2
  1596. package/src/vault.ts +365 -372
  1597. package/src/ytPosition.ts +100 -122
  1598. package/tsconfig.json +9 -1
  1599. package/build/events.d.ts +0 -372
  1600. package/build/events.js +0 -252
  1601. package/build/events.js.map +0 -1
  1602. package/src/events.ts +0 -668
@@ -0,0 +1,2853 @@
1
+ import {
2
+ TOKEN_PROGRAM_ID,
3
+ createAssociatedTokenAccountIdempotentInstruction,
4
+ getAccount,
5
+ getAssociatedTokenAddressSync,
6
+ } from "@solana/spl-token"
7
+ import bs58 from "bs58"
8
+ import Decimal from "decimal.js"
9
+
10
+ import { ExponentCLMMPDA } from "@exponent-labs/exponent-clmm-pda"
11
+ import {
12
+ ExponentFetcher,
13
+ LiquidityNetBalanceLimits,
14
+ LpFarm,
15
+ LpPositionCLMM,
16
+ MarketConfigurationOptions,
17
+ MarketThreeFinancials,
18
+ Ticks,
19
+ } from "@exponent-labs/exponent-fetcher"
20
+ import { ExponentPDA } from "@exponent-labs/exponent-pda"
21
+ import {
22
+ AnchorizedPNum,
23
+ CpiAccountsRaw,
24
+ ExponentCoreCpiAccountsRaw,
25
+ Flavor,
26
+ SyPosition,
27
+ } from "@exponent-labs/exponent-types"
28
+ import { LiquidityAdd } from "@exponent-labs/market-math"
29
+ import {
30
+ EffSnap,
31
+ calcDepositSyAndPtFromBaseAmount,
32
+ calcPtPriceInAsset,
33
+ computeLiquidityTargetAndTokenNeeds,
34
+ getPtAndSyOnWithdrawLiquidity,
35
+ normalizedTimeRemaining,
36
+ } from "@exponent-labs/market-three-math"
37
+
38
+ import {
39
+ fetchAddressLookupTable,
40
+ makeCpiAccountMetaLists,
41
+ makeMarketCoreCpiAccountMetaLists,
42
+ } from "./addressLookupTableUtil"
43
+ import { Environment } from "./environment"
44
+ import {
45
+ makeFlavorGenericSync,
46
+ makeFlavorJitoRestakingSync,
47
+ makeFlavorKaminoSync,
48
+ makeFlavorMarginfiSync,
49
+ makeFlavorPerenaSync,
50
+ } from "./flavors"
51
+ import { makeSyPosition } from "./syPosition"
52
+ import { emitEventAuthority, uniqueRemainingAccounts } from "./utils"
53
+ import { Vault } from "./vault"
54
+ import { Connection, Keypair, PublicKey, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionInstruction } from "@solana/web3.js"
55
+ import * as exponentClmm from './client/clmm'
56
+ import { SwapDirection } from './client/clmm'
57
+ import * as exponentCore from './client/core'
58
+
59
+ export { LiquidityAdd }
60
+
61
+ const SECONDS_PER_YEAR = 365 * 24 * 60 * 60
62
+
63
+ interface Emission {
64
+ /** Token account that holds emission tokens */
65
+ escrowAccountAddress: PublicKey
66
+
67
+ /** Mint for the emission token */
68
+ mint: PublicKey
69
+
70
+ /** Token program ID for the emission token */
71
+ tokenProgramAddress: PublicKey
72
+
73
+ /** How many emissions have been claimed by SY holders */
74
+ totalClaimed: bigint
75
+
76
+ /** How many emissions have been earned by the SY robot over its lifetime */
77
+ lastSeenTotalAccruedEmissions: bigint
78
+
79
+ /** Global index for sharing out rewards to SY holders */
80
+ index: AnchorizedPNum
81
+ }
82
+
83
+ export type MarketAdminAction = exponentClmm.MarketAdminAction
84
+
85
+ export { SwapDirection } from './client/clmm'
86
+
87
+ interface MarketThreeLoadOptions {
88
+ syConfig?: {
89
+ skipWrap?: boolean
90
+ }
91
+ }
92
+
93
+ type MarketThreeArgs = {
94
+ admin: PublicKey
95
+ addressLookupTable: PublicKey
96
+ mintPt: PublicKey
97
+ mintYt: PublicKey
98
+ mintSy: PublicKey
99
+ vault: Vault
100
+ tokenPtEscrow: PublicKey
101
+ tokenSyEscrow: PublicKey
102
+ tokenYtEscrow: PublicKey
103
+ tokenFeeTreasurySy: PublicKey
104
+ tokenFeeTreasuryPt: PublicKey
105
+ syProgram: PublicKey
106
+ selfAddress: PublicKey
107
+ statusFlags: number
108
+ configurationOptions: MarketConfigurationOptions
109
+ financials: MarketThreeFinancials
110
+ cpiSyAccounts: CpiAccountsRaw
111
+ cpiCoreAccounts: ExponentCoreCpiAccountsRaw
112
+ isCurrentFlashSwap: boolean
113
+ lpFarm: LpFarm
114
+ flavor: Flavor
115
+ emissions: {
116
+ trackers: {
117
+ tokenEscrow: PublicKey
118
+ lpShareIndex: number
119
+ lastSeenStaged: number
120
+ }[]
121
+ }
122
+ liquidityNetBalanceLimits: LiquidityNetBalanceLimits
123
+ ticksAccount: PublicKey
124
+ ticks: Ticks
125
+ syPosition: SyPosition
126
+ treasuryFeeOwner: PublicKey
127
+ }
128
+
129
+ /**
130
+ * CLMM (Concentrated Liquidity Market Maker) market client for the Exponent protocol.
131
+ *
132
+ * Provides instruction builders for trading PT/YT tokens, managing concentrated liquidity positions,
133
+ * and administering market settings. Each `ix*` method returns one or more Solana `TransactionInstruction`s
134
+ * ready to be included in a transaction.
135
+ *
136
+ * "Wrapper" methods (e.g. `ixWrapperBuyPt`) combine a base-asset mint/redeem step with the
137
+ * underlying trade so the caller can operate directly with the base asset rather than SY.
138
+ */
139
+ export class MarketThree {
140
+ xponPda: ExponentPDA
141
+ pda: ExponentCLMMPDA
142
+
143
+ constructor(
144
+ public state: MarketThreeArgs,
145
+ public selfAddress: PublicKey,
146
+ public env: Environment,
147
+ public connection: Connection,
148
+ ) {
149
+ this.xponPda = new ExponentPDA(env.coreProgramId)
150
+ this.pda = new ExponentCLMMPDA()
151
+ }
152
+ /**
153
+ * Build the modify_market_setting instruction without loading the full market.
154
+ * Use this when the market's ALT is invalid/unset (e.g. repair flow) to avoid fetching the ALT.
155
+ */
156
+ static buildModifyMarketSettingIx(
157
+ connection: Connection,
158
+ marketAddress: PublicKey,
159
+ { signer, adminAction }: { signer: PublicKey; adminAction: MarketAdminAction },
160
+ ): TransactionInstruction {
161
+ return exponentClmm
162
+ .createModifyMarketSettingInstruction(
163
+ {
164
+ market: marketAddress,
165
+ signer,
166
+ systemProgram: SystemProgram.programId,
167
+ },
168
+ {'action': adminAction}
169
+ );
170
+ }
171
+ /**
172
+ * Load a MarketThree instance from on-chain state.
173
+ *
174
+ * Fetches the market account, its address lookup table, vault, and ticks data in parallel.
175
+ * Pre-loaded vault/ticks can be passed to avoid redundant fetches.
176
+ *
177
+ * @param env - Environment configuration (program IDs, cluster)
178
+ * @param connection - Solana RPC connection
179
+ * @param address - On-chain address of the market account
180
+ * @param vault - Optional pre-loaded vault (fetched automatically if omitted)
181
+ * @param ticks - Optional pre-loaded ticks data (fetched automatically if omitted)
182
+ * @param options - Optional load options (e.g. SY config overrides)
183
+ */
184
+ static async load(
185
+ env: Environment,
186
+ connection: Connection,
187
+ address: PublicKey,
188
+ vault?: Vault,
189
+ ticks?: Ticks,
190
+ options: MarketThreeLoadOptions = {},
191
+ ): Promise<MarketThree> {
192
+ const fetcher = new ExponentFetcher({ connection })
193
+ const fetchedMarket = await fetcher.fetchMarketThree(address)
194
+ const [alt, loadedVault, loadedTicks] = await Promise.all([
195
+ fetchAddressLookupTable(connection, fetchedMarket.addressLookupTable),
196
+ vault || Vault.load(env, connection, fetchedMarket.vault, options),
197
+ ticks || fetcher.fetchMarketThreeTicks(fetchedMarket.ticks),
198
+ ])
199
+ const cpiSyAccounts = makeCpiAccountMetaLists(alt, fetchedMarket.cpiSyAccounts)
200
+ const cpiCoreAccounts = makeMarketCoreCpiAccountMetaLists(alt, fetchedMarket.cpiCoreAccounts)
201
+
202
+ const flavor = (() => {
203
+ switch (loadedVault.flavor.flavor) {
204
+ case "marginfi":
205
+ return makeFlavorMarginfiSync(loadedVault.flavor)
206
+ case "kamino":
207
+ return makeFlavorKaminoSync(loadedVault.flavor)
208
+ case "jitoRestaking":
209
+ return makeFlavorJitoRestakingSync(loadedVault.flavor)
210
+ case "perena":
211
+ return makeFlavorPerenaSync(loadedVault.flavor)
212
+ case "generic":
213
+ return makeFlavorGenericSync(loadedVault.flavor, options.syConfig)
214
+ default:
215
+ throw new Error(`Unknown flavor: ${loadedVault.flavor}`)
216
+ }
217
+ })()
218
+
219
+ const syPosition = await makeSyPosition(fetcher, flavor, fetchedMarket.syProgram, address)
220
+
221
+ //? Assuming that the owner is the same for both accounts feeAccounts
222
+ const treasuryFeeOwner = await MarketThree.fetchTreasuryFeeOwner(fetchedMarket.tokenFeeTreasuryPt, connection)
223
+
224
+ const state: MarketThreeArgs = {
225
+ ...fetchedMarket,
226
+ vault: loadedVault,
227
+ flavor,
228
+ ticks: loadedTicks,
229
+ syPosition,
230
+ cpiSyAccounts,
231
+ cpiCoreAccounts,
232
+ ticksAccount: fetchedMarket.ticks,
233
+ treasuryFeeOwner,
234
+ }
235
+ return new MarketThree(state, address, env, connection)
236
+ }
237
+
238
+ async reload(connection: Connection = this.connection) {
239
+ const market = await MarketThree.load(this.env, connection, this.selfAddress)
240
+ this.state = market.state
241
+ return market
242
+ }
243
+
244
+ get vault() {
245
+ return this.state.vault
246
+ }
247
+
248
+ get flavor() {
249
+ return this.state.flavor
250
+ }
251
+
252
+ get lpBalance() {
253
+ return this.state.financials.liquidityBalance
254
+ }
255
+
256
+ get syBalance() {
257
+ return this.state.financials.syBalance
258
+ }
259
+
260
+ get ptBalance() {
261
+ return this.state.financials.ptBalance
262
+ }
263
+
264
+ get mintSy() {
265
+ return this.state.mintSy
266
+ }
267
+
268
+ get mintPt() {
269
+ return this.state.mintPt
270
+ }
271
+
272
+ get statusFlags() {
273
+ return this.state.statusFlags
274
+ }
275
+
276
+ get mintYt() {
277
+ return this.state.mintYt
278
+ }
279
+
280
+ get addressLookupTable() {
281
+ return this.state.addressLookupTable
282
+ }
283
+
284
+ get syProgram() {
285
+ return this.state.syProgram
286
+ }
287
+
288
+ get cpiSyAccounts() {
289
+ return this.state.cpiSyAccounts
290
+ }
291
+
292
+ get cpiCoreAccounts() {
293
+ return this.state.cpiCoreAccounts
294
+ }
295
+
296
+ get marketEmissions() {
297
+ return this.state.emissions
298
+ }
299
+
300
+ get ticksKey() {
301
+ return this.state.ticksAccount
302
+ }
303
+
304
+ get corePda() {
305
+ return new ExponentPDA()
306
+ }
307
+
308
+ get coreEventAuthority() {
309
+ return emitEventAuthority(exponentCore.EXPONENTCORE_PROGRAM_ID)
310
+ }
311
+
312
+ get emissions(): Emission[] {
313
+ if (this.flavor.flavor === "marginfi") {
314
+ return this.flavor.mfiSyState.account.emissions.map((e) => ({
315
+ escrowAccountAddress: e.escrowAccount,
316
+ mint: e.mint,
317
+ tokenProgramAddress: e.tokenProgram,
318
+ totalClaimed: BigInt(e.totalClaimedEmissions.toString()),
319
+ lastSeenTotalAccruedEmissions: BigInt(e.lastSeenTotalAccruedEmissions.toString()),
320
+ index: e.index,
321
+ }))
322
+ }
323
+ if (this.flavor.flavor === "kamino") {
324
+ return this.flavor.kaminoSyState.account.emissions.map((e) => ({
325
+ escrowAccountAddress: e.escrowAccount,
326
+ mint: e.mint,
327
+ tokenProgramAddress: e.tokenProgram,
328
+ totalClaimed: BigInt(e.totalClaimedEmissions.toString()),
329
+ lastSeenTotalAccruedEmissions: BigInt(e.lastSeenTotalAccruedEmissions.toString()),
330
+ index: e.index,
331
+ }))
332
+ }
333
+ if (this.flavor.flavor === "jitoRestaking") {
334
+ return this.flavor.jitoSyState.account.emissions.map((e) => ({
335
+ escrowAccountAddress: e.escrowAccount,
336
+ mint: e.mint,
337
+ tokenProgramAddress: e.tokenProgram,
338
+ totalClaimed: BigInt(e.totalClaimedEmissions.toString()),
339
+ lastSeenTotalAccruedEmissions: BigInt(e.lastSeenTotalAccruedEmissions.toString()),
340
+ index: e.index,
341
+ }))
342
+ }
343
+ if (this.flavor.flavor === "perena") {
344
+ return this.flavor.perenaSyState.account.emissions.map((e) => ({
345
+ escrowAccountAddress: e.escrowAccount,
346
+ mint: e.mint,
347
+ tokenProgramAddress: e.tokenProgram,
348
+ totalClaimed: BigInt(e.totalClaimedEmissions.toString()),
349
+ lastSeenTotalAccruedEmissions: BigInt(e.lastSeenTotalAccruedEmissions.toString()),
350
+ index: e.index,
351
+ }))
352
+ }
353
+ if (this.flavor.flavor === "generic") {
354
+ return this.flavor.genericSyState.account.emissions.map((e) => ({
355
+ escrowAccountAddress: e.escrowAccount,
356
+ mint: e.mint,
357
+ tokenProgramAddress: e.tokenProgram,
358
+ totalClaimed: BigInt(e.totalClaimedEmissions.toString()),
359
+ lastSeenTotalAccruedEmissions: BigInt(e.lastSeenTotalAccruedEmissions.toString()),
360
+ index: e.index,
361
+ }))
362
+ }
363
+ throw new Error("Unknown flavor")
364
+ }
365
+
366
+ /** Get the escrow token account addresses for the emissions, in order */
367
+ get emissionTokenAccounts(): PublicKey[] {
368
+ return this.emissions.map((e) => e.escrowAccountAddress)
369
+ }
370
+
371
+ /** Pass-through SY account owned by the market */
372
+ get tokenSyEscrow(): PublicKey {
373
+ return this.state.tokenSyEscrow
374
+ }
375
+
376
+ /** Pass-through YT account owned by the market */
377
+ get tokenYtEscrow(): PublicKey {
378
+ return this.state.tokenYtEscrow
379
+ }
380
+
381
+ /** SY account that holds treasury SY fees from PT trading */
382
+ get tokenFeeTreasurySy(): PublicKey {
383
+ return this.state.tokenFeeTreasurySy
384
+ }
385
+
386
+ /** PT account that holds treasury PT fees from PT trading */
387
+ get tokenFeeTreasuryPt(): PublicKey {
388
+ return this.state.tokenFeeTreasuryPt
389
+ }
390
+
391
+ /** Market liquidity for PT */
392
+ get tokenPtEscrow(): PublicKey {
393
+ return this.state.tokenPtEscrow
394
+ }
395
+
396
+ get currentSyExchangeRate(): number {
397
+ return this.flavor.currentSyExchangeRate
398
+ }
399
+
400
+ /** Special account for event emit self-cpi */
401
+ get eventAuthority(): PublicKey {
402
+ return emitEventAuthority(exponentClmm.EXPONENTCLMM_PROGRAM_ID)
403
+ }
404
+
405
+ get secondsRemaining(): number {
406
+ const timeNow = Date.now() / 1000
407
+ return Math.max(0, Math.round(Number(this.state.financials.expirationTs) - timeNow))
408
+ }
409
+
410
+ /** Annualize a rate given the number of seconds remaining until maturity */
411
+ static annualize(rate: number, secondsRemaining: number) {
412
+ return (rate * SECONDS_PER_YEAR) / secondsRemaining
413
+ }
414
+
415
+ static annualizeApy(rate: number, secondsRemaining: number) {
416
+ return (1 + rate) ** (SECONDS_PER_YEAR / secondsRemaining) - 1
417
+ }
418
+
419
+ /** The fee rate taken off of trade fees (typically around 20%) expressed as a BPS number */
420
+ get feeTreasuryBps(): number {
421
+ return this.state.configurationOptions.treasuryFeeBps
422
+ }
423
+
424
+ /** The fee rate taken off of trade fees (typically around 20%) expressed as a rational number */
425
+ get feeTreasuryRate(): number {
426
+ return this.feeTreasuryBps / 10_000
427
+ }
428
+
429
+ /** Get the owner of the treasury fee accounts: tokenFeeTreasuryPt & tokenFeeTreasurySy */
430
+ static async fetchTreasuryFeeOwner(
431
+ tokenFeeTreasury: PublicKey,
432
+ connection: Connection,
433
+ ): Promise<PublicKey> {
434
+ const { owner } = await getAccount(connection, tokenFeeTreasury)
435
+ return owner
436
+ }
437
+
438
+ /** Deposit a pair of tokens as liquidity to the market
439
+ * Adds PT & SY from the `depositor` to the market
440
+ *
441
+ * Due to unforeseeable slippage, the PT & SY amounts intended are effectively the maximum amounts
442
+ * The minimum LP tokens to receive is specified by `minLpOut`
443
+ *
444
+ * The token accounts themselves are optional, and will be derived from the depositor's wallet if not provided
445
+ */
446
+ ixDepositLiquidity({
447
+ ptInIntent,
448
+ syInIntent,
449
+ depositor,
450
+ lowerTickKey,
451
+ upperTickKey,
452
+ ptSrc: ptSrcParam,
453
+ sySrc: sySrcParam,
454
+ lpPosition: lpPositionParam,
455
+ }: {
456
+ /** Intended (maximum) amount of PT in */
457
+ ptInIntent: bigint
458
+ /** Intended (maximum) amount of SY in */
459
+ syInIntent: bigint
460
+ /** Lower tick key */
461
+ lowerTickKey: number
462
+ /** Upper tick key */
463
+ upperTickKey: number
464
+ depositor: PublicKey
465
+ ptSrc?: PublicKey
466
+ sySrc?: PublicKey
467
+ lpPosition?: Keypair
468
+ }) {
469
+ const sySrc = sySrcParam || getAssociatedTokenAddressSync(this.mintSy, depositor, true, TOKEN_PROGRAM_ID)
470
+ const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, depositor, true, TOKEN_PROGRAM_ID)
471
+
472
+ const lpPosition = lpPositionParam || Keypair.generate()
473
+ const remainingAccounts = uniqueRemainingAccounts([
474
+ ...this.cpiSyAccounts.depositSy,
475
+ ...this.cpiSyAccounts.getPositionState,
476
+ ])
477
+
478
+ const ix = exponentClmm.createDepositLiquidityInstruction(
479
+ {
480
+ depositor,
481
+ market: this.selfAddress,
482
+ ticks: this.ticksKey,
483
+ lpPosition: lpPosition.publicKey,
484
+ tokenPtSrc: ptSrc,
485
+ tokenSySrc: sySrc,
486
+ tokenPtEscrow: this.tokenPtEscrow,
487
+ tokenSyEscrow: this.tokenSyEscrow,
488
+ addressLookupTable: this.addressLookupTable,
489
+ tokenProgram: TOKEN_PROGRAM_ID,
490
+ syProgram: this.syProgram,
491
+ instructionsSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
492
+ systemProgram: SystemProgram.programId,
493
+ eventAuthority: this.eventAuthority,
494
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
495
+ },
496
+ {
497
+ lowerTickKey: convertApyToApyBp(lowerTickKey),
498
+ upperTickKey: convertApyToApyBp(upperTickKey),
499
+ maxPtIn: ptInIntent,
500
+ maxSyIn: syInIntent,
501
+ },
502
+ )
503
+ ix.keys.push(...remainingAccounts)
504
+
505
+ return {
506
+ ix,
507
+ signers: lpPosition,
508
+ }
509
+ }
510
+
511
+ /**
512
+ * Redeem LP tokens for PT & SY (liquidity removal)
513
+ *
514
+ * The lpIn is exactly the amount of LP tokens to burn
515
+ * The minimum PT & SY out are specified by minPtOut & minSyOut
516
+ * The transaction may fail due to unforeseeable slippage on the redemption rate
517
+ *
518
+ * The token accounts themselves are optional, and will be derived from the withdrawer's wallet if not provided
519
+ */
520
+ ixWithdrawLiquidity({
521
+ lpIn,
522
+ withdrawer,
523
+ lpPosition,
524
+ minPtOut,
525
+ minSyOut,
526
+ ptDst: ptDstParam,
527
+ syDst: syDstParam,
528
+ }: {
529
+ lpIn: bigint
530
+ withdrawer: PublicKey
531
+ lpPosition: PublicKey
532
+ minPtOut: bigint
533
+ minSyOut: bigint
534
+ ptDst?: PublicKey
535
+ syDst?: PublicKey
536
+ lnImpliedApyLimit?: number
537
+ }) {
538
+ const ptDst = ptDstParam || getAssociatedTokenAddressSync(this.mintPt, withdrawer, true, TOKEN_PROGRAM_ID)
539
+ const syDst = syDstParam || getAssociatedTokenAddressSync(this.mintSy, withdrawer, true, TOKEN_PROGRAM_ID)
540
+ const ptDstAtaIx = createAssociatedTokenAccountIdempotentInstruction(withdrawer, ptDst, withdrawer, this.mintPt)
541
+ const syDstAtaIx = createAssociatedTokenAccountIdempotentInstruction(withdrawer, syDst, withdrawer, this.mintSy)
542
+ const remainingAccounts = uniqueRemainingAccounts([
543
+ ...this.cpiSyAccounts.withdrawSy,
544
+ ...this.cpiSyAccounts.getPositionState,
545
+ ])
546
+
547
+ const ix = exponentClmm.createWithdrawLiquidityInstruction(
548
+ {
549
+ owner: withdrawer,
550
+ market: this.selfAddress,
551
+ lpPosition,
552
+ ticks: this.ticksKey,
553
+ tokenPtDst: ptDst,
554
+ tokenSyDst: syDst,
555
+ tokenPtEscrow: this.tokenPtEscrow,
556
+ tokenSyEscrow: this.tokenSyEscrow,
557
+ addressLookupTable: this.addressLookupTable,
558
+ tokenProgram: TOKEN_PROGRAM_ID,
559
+ syProgram: this.syProgram,
560
+ systemProgram: SystemProgram.programId,
561
+ eventAuthority: this.eventAuthority,
562
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
563
+ },
564
+ {
565
+ liquidityToRemove: lpIn,
566
+ minPtOut,
567
+ minSyOut,
568
+ },
569
+ )
570
+ ix.keys.push(...remainingAccounts)
571
+
572
+ return { ixs: [ix], setupIxs: [ptDstAtaIx, syDstAtaIx] }
573
+ }
574
+
575
+ /**
576
+ * Swap PT <-> SY on the CLMM.
577
+ *
578
+ * Low-level instruction — prefer {@link ixBuyPt} / {@link ixSellPt} for directional trades.
579
+ *
580
+ * @param trader - Wallet signing the transaction
581
+ * @param traderAmount - Amount of the input token
582
+ * @param outConstraint - Minimum output amount (slippage protection)
583
+ * @param swapDirection - `SwapDirection.SyToPt` or `SwapDirection.PtToSy`
584
+ * @param lnImpliedApyLimit - Optional price limit (ln implied APY)
585
+ */
586
+ ixTradePt({
587
+ trader,
588
+ traderAmount,
589
+ outConstraint,
590
+ swapDirection,
591
+ tokenPt: tokenPtParam,
592
+ tokenSy: tokenSyParam,
593
+ lnImpliedApyLimit,
594
+ }: {
595
+ trader: PublicKey
596
+ traderAmount: bigint
597
+ outConstraint: bigint
598
+ swapDirection: SwapDirection
599
+ tokenPt?: PublicKey
600
+ tokenSy?: PublicKey
601
+ lnImpliedApyLimit?: number
602
+ }) {
603
+ const tokenPt = tokenPtParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
604
+ const tokenSy = tokenSyParam || getAssociatedTokenAddressSync(this.mintSy, trader, true, TOKEN_PROGRAM_ID)
605
+
606
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, tokenSy, trader, this.mintSy)
607
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, tokenPt, trader, this.mintPt)
608
+
609
+ const remainingAccounts = uniqueRemainingAccounts([
610
+ ...this.cpiSyAccounts.getSyState,
611
+ ...this.cpiSyAccounts.getPositionState,
612
+ ...this.cpiSyAccounts.depositSy,
613
+ ...this.cpiSyAccounts.withdrawSy,
614
+ ])
615
+
616
+ const ix = exponentClmm.createTradePtInstruction(
617
+ {
618
+ trader,
619
+ market: this.selfAddress,
620
+ ticks: this.ticksKey,
621
+ tokenSyTrader: tokenSy,
622
+ tokenPtTrader: tokenPt,
623
+ tokenSyEscrow: this.tokenSyEscrow,
624
+ tokenPtEscrow: this.tokenPtEscrow,
625
+ addressLookupTable: this.addressLookupTable,
626
+ tokenProgram: TOKEN_PROGRAM_ID,
627
+ syProgram: this.syProgram,
628
+ tokenFeeTreasurySy: this.tokenFeeTreasurySy,
629
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
630
+ eventAuthority: this.eventAuthority,
631
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
632
+ },
633
+ {
634
+ amountIn: traderAmount,
635
+ swapDirection,
636
+ amountOutConstraint: outConstraint || null,
637
+ priceSpotLimit: lnImpliedApyLimit ?? null,
638
+ },
639
+ )
640
+ ix.keys.push(...remainingAccounts)
641
+
642
+ return { ixs: [ix], setupIxs: [tokenPtAtaIx, tokenSyAtaIx] }
643
+ }
644
+
645
+ /**
646
+ * Swap PT <-> SY specifying the exact output amount.
647
+ *
648
+ * Inverse of {@link ixTradePt} — the caller specifies how much they want to *receive*
649
+ * rather than how much they want to *spend*.
650
+ *
651
+ * @param trader - Wallet signing the transaction
652
+ * @param amountOut - Exact amount of the output token to receive
653
+ * @param swapDirection - `SwapDirection.SyToPt` or `SwapDirection.PtToSy`
654
+ * @param amountInConstraint - Maximum input amount (slippage protection)
655
+ * @param lnImpliedApyLimit - Optional price limit (ln implied APY)
656
+ */
657
+ ixTradePtExactOut({
658
+ trader,
659
+ amountOut,
660
+ swapDirection,
661
+ amountInConstraint,
662
+ tokenPt: tokenPtParam,
663
+ tokenSy: tokenSyParam,
664
+ lnImpliedApyLimit,
665
+ }: {
666
+ trader: PublicKey
667
+ amountOut: bigint
668
+ swapDirection: SwapDirection
669
+ amountInConstraint?: bigint
670
+ tokenPt?: PublicKey
671
+ tokenSy?: PublicKey
672
+ lnImpliedApyLimit?: number
673
+ }) {
674
+ const tokenPt = tokenPtParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
675
+ const tokenSy = tokenSyParam || getAssociatedTokenAddressSync(this.mintSy, trader, true, TOKEN_PROGRAM_ID)
676
+
677
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, tokenSy, trader, this.mintSy)
678
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, tokenPt, trader, this.mintPt)
679
+
680
+ const remainingAccounts = uniqueRemainingAccounts([
681
+ ...this.cpiSyAccounts.getSyState,
682
+ ...this.cpiSyAccounts.getPositionState,
683
+ ...this.cpiSyAccounts.depositSy,
684
+ ...this.cpiSyAccounts.withdrawSy,
685
+ ])
686
+
687
+ const ix = exponentClmm.createTradePtExactOutInstruction(
688
+ {
689
+ trader,
690
+ market: this.selfAddress,
691
+ ticks: this.ticksKey,
692
+ tokenSyTrader: tokenSy,
693
+ tokenPtTrader: tokenPt,
694
+ tokenSyEscrow: this.tokenSyEscrow,
695
+ tokenPtEscrow: this.tokenPtEscrow,
696
+ addressLookupTable: this.addressLookupTable,
697
+ tokenProgram: TOKEN_PROGRAM_ID,
698
+ syProgram: this.syProgram,
699
+ tokenFeeTreasurySy: this.tokenFeeTreasurySy,
700
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
701
+ eventAuthority: this.eventAuthority,
702
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
703
+ },
704
+ {
705
+ amountOut,
706
+ swapDirection,
707
+ amountInConstraint: amountInConstraint ?? null,
708
+ priceSpotLimit: lnImpliedApyLimit ?? null,
709
+ },
710
+ )
711
+ ix.keys.push(...remainingAccounts)
712
+
713
+ return { ixs: [ix], setupIxs: [tokenPtAtaIx, tokenSyAtaIx] }
714
+ }
715
+
716
+ /** Buy PT with SY
717
+ *
718
+ * The trader is the account that sends the SY
719
+ * The amountPt is the exact amount of PT the trader intends to buy
720
+ * The syConstraint is the maximum amount of SY the trader is willing to spend
721
+ *
722
+ * The token accounts themselves are optional, and will be derived from the trader's wallet if not provided
723
+ */
724
+ ixBuyPt({
725
+ trader,
726
+ amountSy,
727
+ outConstraint,
728
+ tokenPt,
729
+ tokenSy,
730
+ lnImpliedApyLimit,
731
+ }: {
732
+ trader: PublicKey
733
+ amountSy: bigint
734
+ outConstraint: bigint
735
+ tokenPt?: PublicKey
736
+ tokenSy?: PublicKey
737
+ lnImpliedApyLimit?: number
738
+ }) {
739
+ return this.ixTradePt({
740
+ trader,
741
+ traderAmount: amountSy,
742
+ outConstraint: outConstraint,
743
+ swapDirection: SwapDirection.SyToPt,
744
+ tokenPt,
745
+ tokenSy,
746
+ lnImpliedApyLimit,
747
+ })
748
+ }
749
+
750
+ /**
751
+ * Sell PT for SY
752
+ * The trader is the account that sends the PT
753
+ * The amountPt is the exact amount of PT the trader intends to sell
754
+ * The minSyReceive is the minimum amount of SY the trader is willing to receive
755
+ *
756
+ * The token accounts themselves are optional, and will be derived from the trader's wallet if not provided
757
+ */
758
+ ixSellPt({
759
+ trader,
760
+ amountPt,
761
+ outConstraint,
762
+ tokenPt,
763
+ tokenSy,
764
+ lnImpliedApyLimit,
765
+ }: {
766
+ trader: PublicKey
767
+ amountPt: bigint
768
+ outConstraint: bigint
769
+ tokenPt?: PublicKey
770
+ tokenSy?: PublicKey
771
+ lnImpliedApyLimit?: number
772
+ }) {
773
+ return this.ixTradePt({
774
+ trader,
775
+ traderAmount: amountPt,
776
+ outConstraint: outConstraint,
777
+ swapDirection: SwapDirection.PtToSy,
778
+ tokenPt,
779
+ tokenSy,
780
+ lnImpliedApyLimit,
781
+ })
782
+ }
783
+
784
+ /**
785
+ * Buy exact amount of PT with SY
786
+ *
787
+ * The trader specifies the exact amount of PT they want to receive
788
+ * The maxSyIn is the maximum amount of SY the trader is willing to spend
789
+ */
790
+ ixBuyPtExactOut({
791
+ trader,
792
+ amountPt,
793
+ maxSyIn,
794
+ tokenPt,
795
+ tokenSy,
796
+ lnImpliedApyLimit,
797
+ }: {
798
+ trader: PublicKey
799
+ amountPt: bigint
800
+ maxSyIn?: bigint
801
+ tokenPt?: PublicKey
802
+ tokenSy?: PublicKey
803
+ lnImpliedApyLimit?: number
804
+ }) {
805
+ return this.ixTradePtExactOut({
806
+ trader,
807
+ amountOut: amountPt,
808
+ amountInConstraint: maxSyIn,
809
+ swapDirection: SwapDirection.SyToPt,
810
+ tokenPt,
811
+ tokenSy,
812
+ lnImpliedApyLimit,
813
+ })
814
+ }
815
+
816
+ /**
817
+ * Sell PT for exact amount of SY
818
+ *
819
+ * The trader specifies the exact amount of SY they want to receive
820
+ * The maxPtIn is the maximum amount of PT the trader is willing to spend
821
+ */
822
+ ixSellPtExactOut({
823
+ trader,
824
+ amountSy,
825
+ maxPtIn,
826
+ tokenPt,
827
+ tokenSy,
828
+ lnImpliedApyLimit,
829
+ }: {
830
+ trader: PublicKey
831
+ amountSy: bigint
832
+ maxPtIn?: bigint
833
+ tokenPt?: PublicKey
834
+ tokenSy?: PublicKey
835
+ lnImpliedApyLimit?: number
836
+ }) {
837
+ return this.ixTradePtExactOut({
838
+ trader,
839
+ amountOut: amountSy,
840
+ amountInConstraint: maxPtIn,
841
+ swapDirection: SwapDirection.PtToSy,
842
+ tokenPt,
843
+ tokenSy,
844
+ lnImpliedApyLimit,
845
+ })
846
+ }
847
+
848
+ /** Buy YT with SY
849
+ *
850
+ * The trader is the account that sends the SY
851
+ *
852
+ * The ytOut is the exact amount of YT the trader intends to buy
853
+ *
854
+ * The maxSyIn is the maximum amount of SY the trader is willing to spend
855
+ *
856
+ * The token accounts themselves are optional, and will be derived from the trader's wallet if not provided
857
+ */
858
+ ixBuyYt({
859
+ trader,
860
+ ytOut,
861
+ maxSyIn,
862
+ ytTrader: ytTraderParam,
863
+ ptTrader: ptTraderParam,
864
+ syTrader: syTraderParam,
865
+ lnImpliedApyLimit,
866
+ }: {
867
+ trader: PublicKey
868
+ ytOut: bigint
869
+ maxSyIn: bigint
870
+ ytTrader?: PublicKey
871
+ ptTrader?: PublicKey
872
+ syTrader?: PublicKey
873
+ lnImpliedApyLimit?: number
874
+ }) {
875
+ const syTrader = syTraderParam || getAssociatedTokenAddressSync(this.mintSy, trader, true, TOKEN_PROGRAM_ID)
876
+ const ptTrader = ptTraderParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
877
+ const ytTrader = ytTraderParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
878
+
879
+ const syTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, syTrader, trader, this.mintSy)
880
+ const ptTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, ptTrader, trader, this.mintPt)
881
+ const ytTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(trader, ytTrader, trader, this.mintYt)
882
+
883
+ const stripAccounts = this.cpiCoreAccounts.stripSy
884
+
885
+ const remainingAccounts = uniqueRemainingAccounts([
886
+ ...this.cpiSyAccounts.getSyState,
887
+ ...this.cpiSyAccounts.withdrawSy,
888
+ ...this.cpiSyAccounts.depositSy,
889
+ ...stripAccounts,
890
+ ])
891
+
892
+ const ix = exponentClmm.createBuyYtInstruction(
893
+ {
894
+ trader,
895
+ market: this.selfAddress,
896
+ ticks: this.ticksKey,
897
+ tokenSyTrader: syTrader,
898
+ tokenYtTrader: ytTrader,
899
+ tokenPtTrader: ptTrader,
900
+ tokenSyEscrow: this.tokenSyEscrow,
901
+ tokenPtEscrow: this.tokenPtEscrow,
902
+ tokenYtEscrow: this.tokenYtEscrow,
903
+ tokenFeeTreasurySy: this.tokenFeeTreasurySy,
904
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
905
+ tokenProgram: TOKEN_PROGRAM_ID,
906
+ addressLookupTable: this.addressLookupTable,
907
+ syProgram: this.syProgram,
908
+ exponentCoreProgram: exponentCore.EXPONENTCORE_PROGRAM_ID,
909
+ eventAuthority: this.eventAuthority,
910
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
911
+ },
912
+ {
913
+ syIn: maxSyIn,
914
+ minYtOut: ytOut,
915
+ priceSpotLimit: lnImpliedApyLimit ?? null,
916
+ },
917
+ )
918
+ ix.keys.push(...remainingAccounts)
919
+
920
+ return { ixs: [ix], setupIxs: [syTraderAtaIx, ptTraderAtaIx, ytTraderAtaIx] }
921
+ }
922
+
923
+ /** Sell YT for SY
924
+ *
925
+ * The trader is the account that sends the YT
926
+ *
927
+ * The amountYt is the exact amount of YT the trader intends to sell
928
+ *
929
+ * The minSyOut is the minimum amount of SY the trader is willing to receive
930
+ *
931
+ * The token accounts themselves are optional, and will be derived from the trader's wallet if not provided
932
+ */
933
+ ixSellYt({
934
+ trader,
935
+ ytIn,
936
+ minSyOut,
937
+ ytSrc: ytSrcParam,
938
+ ptSrc: ptSrcParam,
939
+ syDst: syDstParam,
940
+ lnImpliedApyLimit,
941
+ }: {
942
+ trader: PublicKey
943
+ ytIn: bigint
944
+ minSyOut: bigint
945
+ ytSrc?: PublicKey
946
+ ptSrc?: PublicKey
947
+ syDst?: PublicKey
948
+ lnImpliedApyLimit?: number
949
+ }) {
950
+ const syDst = syDstParam || getAssociatedTokenAddressSync(this.mintSy, trader, true, TOKEN_PROGRAM_ID)
951
+ const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
952
+ const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
953
+
954
+ const syDstAtaIxs = createAssociatedTokenAccountIdempotentInstruction(trader, syDst, trader, this.mintSy)
955
+ const ptSrcAtaIxs = createAssociatedTokenAccountIdempotentInstruction(trader, ptSrc, trader, this.mintPt)
956
+ const ytSrcAtaIxs = createAssociatedTokenAccountIdempotentInstruction(trader, ytSrc, trader, this.mintYt)
957
+
958
+ const mergeAccounts = this.cpiCoreAccounts.mergeSy
959
+ const remainingAccounts = uniqueRemainingAccounts([
960
+ ...this.cpiSyAccounts.getSyState,
961
+ ...this.cpiSyAccounts.getPositionState,
962
+ ...this.cpiSyAccounts.depositSy,
963
+ ...mergeAccounts,
964
+ ])
965
+
966
+ const ix = exponentClmm.createSellYtInstruction(
967
+ {
968
+ trader,
969
+ market: this.selfAddress,
970
+ ticks: this.ticksKey,
971
+ tokenYtTrader: ytSrc,
972
+ tokenPtTrader: ptSrc,
973
+ tokenSyTrader: syDst,
974
+ tokenSyEscrow: this.tokenSyEscrow,
975
+ tokenPtEscrow: this.tokenPtEscrow,
976
+ tokenYtEscrow: this.tokenYtEscrow,
977
+ addressLookupTable: this.addressLookupTable,
978
+ tokenFeeTreasurySy: this.tokenFeeTreasurySy,
979
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
980
+ tokenProgram: TOKEN_PROGRAM_ID,
981
+ syProgram: this.syProgram,
982
+ exponentCoreProgram: exponentCore.EXPONENTCORE_PROGRAM_ID,
983
+ eventAuthority: this.eventAuthority,
984
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
985
+ },
986
+ {
987
+ ytIn,
988
+ minSyOut,
989
+ priceSpotLimit: lnImpliedApyLimit ?? null,
990
+ },
991
+ )
992
+ ix.keys.push(...remainingAccounts)
993
+
994
+ return { ixs: [ix], setupIxs: [syDstAtaIxs, ptSrcAtaIxs, ytSrcAtaIxs] }
995
+ }
996
+
997
+ /** Apply an admin action to the market (e.g. change status, fees, tick spacing). */
998
+ ixModifyMarketSetting({ signer, adminAction }: { signer: PublicKey; adminAction: MarketAdminAction }) {
999
+ return exponentClmm.createModifyMarketSettingInstruction(
1000
+ {
1001
+ market: this.selfAddress,
1002
+ signer,
1003
+ systemProgram: SystemProgram.programId,
1004
+ },
1005
+ { action: adminAction },
1006
+ )
1007
+ }
1008
+
1009
+ /**
1010
+ * Add a new farm to the market to distribute rewards to LP holders
1011
+ *
1012
+ * @param signer - The admin address that signs the transaction
1013
+ * @param farmMint - The mint address of the farm reward token
1014
+ * @param farmTokenProgram - The token program for the farm reward token
1015
+ * @param emissionsRate - The rate of emissions per second (in token smallest units)
1016
+ * @param untilTimestamp - Unix timestamp when the farm emissions should end
1017
+ * @param farmTokenSrc - Optional source token account for the farm rewards (derived from signer if not provided)
1018
+ * @param feePayer - Optional fee payer for account reallocation (defaults to signer)
1019
+ */
1020
+ ixAddFarm({
1021
+ signer,
1022
+ farmMint,
1023
+ farmTokenProgram,
1024
+ emissionsRate,
1025
+ untilTimestamp,
1026
+ farmTokenSrc: farmTokenSrcParam,
1027
+ feePayer: feePayerParam,
1028
+ }: {
1029
+ signer: PublicKey
1030
+ farmMint: PublicKey
1031
+ farmTokenProgram: PublicKey
1032
+ emissionsRate: bigint
1033
+ untilTimestamp: number
1034
+ farmTokenSrc?: PublicKey
1035
+ feePayer?: PublicKey
1036
+ }) {
1037
+ const feePayer = feePayerParam || signer
1038
+ const farmTokenEscrow = getAssociatedTokenAddressSync(farmMint, this.selfAddress, true, farmTokenProgram)
1039
+ const farmTokenSrc = farmTokenSrcParam || getAssociatedTokenAddressSync(farmMint, signer, true, farmTokenProgram)
1040
+
1041
+ const farmTokenEscrowAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1042
+ feePayer,
1043
+ farmTokenEscrow,
1044
+ this.selfAddress,
1045
+ farmMint,
1046
+ farmTokenProgram,
1047
+ )
1048
+
1049
+ const ix = exponentClmm.createAddFarmInstruction(
1050
+ {
1051
+ market: this.selfAddress,
1052
+ ticks: this.ticksKey,
1053
+ signer,
1054
+ feePayer,
1055
+ mintNew: farmMint,
1056
+ tokenSource: farmTokenSrc,
1057
+ tokenFarm: farmTokenEscrow,
1058
+ tokenProgram: farmTokenProgram,
1059
+ systemProgram: SystemProgram.programId,
1060
+ eventAuthority: this.eventAuthority,
1061
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1062
+ },
1063
+ {
1064
+ tokenRate: emissionsRate,
1065
+ untilTimestamp,
1066
+ },
1067
+ )
1068
+
1069
+ return {
1070
+ ixs: [ix],
1071
+ setupIxs: [farmTokenEscrowAtaIx],
1072
+ }
1073
+ }
1074
+
1075
+ /**
1076
+ * Modify an existing farm's emissions rate and/or expiration timestamp
1077
+ *
1078
+ * If the new parameters require more tokens than previously undistributed,
1079
+ * additional tokens will be transferred from the signer's token account.
1080
+ * If fewer tokens are needed, the surplus will be returned to the signer.
1081
+ *
1082
+ * @param signer - The admin address that signs the transaction
1083
+ * @param farmMint - The mint address of the farm reward token
1084
+ * @param farmTokenProgram - The token program for the farm reward token
1085
+ * @param newRate - The new rate of emissions per second (in token smallest units)
1086
+ * @param untilTimestamp - New unix timestamp when the farm emissions should end
1087
+ * @param farmTokenSrc - Optional source/destination token account (derived from signer if not provided)
1088
+ */
1089
+ ixModifyFarm({
1090
+ signer,
1091
+ farmMint,
1092
+ farmTokenProgram,
1093
+ newRate,
1094
+ untilTimestamp,
1095
+ farmTokenSrc: farmTokenSrcParam,
1096
+ }: {
1097
+ signer: PublicKey
1098
+ farmMint: PublicKey
1099
+ farmTokenProgram: PublicKey
1100
+ newRate: bigint
1101
+ untilTimestamp: number
1102
+ farmTokenSrc?: PublicKey
1103
+ }) {
1104
+ const farmTokenEscrow = getAssociatedTokenAddressSync(farmMint, this.selfAddress, true, farmTokenProgram)
1105
+ const farmTokenSrc = farmTokenSrcParam || getAssociatedTokenAddressSync(farmMint, signer, true, farmTokenProgram)
1106
+
1107
+ const ix = exponentClmm.createModifyFarmInstruction(
1108
+ {
1109
+ market: this.selfAddress,
1110
+ ticks: this.ticksKey,
1111
+ signer,
1112
+ mint: farmMint,
1113
+ tokenSource: farmTokenSrc,
1114
+ tokenFarm: farmTokenEscrow,
1115
+ tokenProgram: farmTokenProgram,
1116
+ eventAuthority: this.eventAuthority,
1117
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1118
+ },
1119
+ {
1120
+ newExpirationTimestamp: untilTimestamp,
1121
+ newRate,
1122
+ },
1123
+ )
1124
+
1125
+ return {
1126
+ ixs: [ix],
1127
+ }
1128
+ }
1129
+
1130
+ /**
1131
+ * Buy PT directly from the base asset (e.g. SOL, USDC).
1132
+ *
1133
+ * Wraps a mint-SY step (via the flavor) with a buy-PT swap in a single instruction.
1134
+ * The program mints SY from the base asset, then swaps SY -> PT on the CLMM.
1135
+ *
1136
+ * @param owner - Wallet signing the transaction
1137
+ * @param baseIn - Amount of base asset to spend
1138
+ * @param minPtOut - Minimum PT to receive (slippage protection)
1139
+ * @param lnImpliedApyLimit - Optional price limit (ln implied APY)
1140
+ */
1141
+ async ixWrapperBuyPt({
1142
+ owner,
1143
+ minPtOut,
1144
+ baseIn,
1145
+ tokenSyTrader: tokenSyTraderParam,
1146
+ tokenPtTrader: tokenPtTraderParam,
1147
+ tokenBaseTrader: tokenBaseTraderParam,
1148
+ lnImpliedApyLimit,
1149
+ }: {
1150
+ owner: PublicKey
1151
+ minPtOut: bigint
1152
+ baseIn: bigint
1153
+ tokenSyTrader?: PublicKey
1154
+ tokenPtTrader?: PublicKey
1155
+ tokenBaseTrader?: PublicKey
1156
+ lnImpliedApyLimit?: number
1157
+ }) {
1158
+ const tokenSyTrader =
1159
+ tokenSyTraderParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
1160
+ const tokenPtTrader =
1161
+ tokenPtTraderParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
1162
+ const tokenBaseTrader =
1163
+ tokenBaseTraderParam ||
1164
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
1165
+
1166
+ const tokenSyTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1167
+ owner,
1168
+ tokenSyTrader,
1169
+ owner,
1170
+ this.mintSy,
1171
+ )
1172
+ const tokenPtTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1173
+ owner,
1174
+ tokenPtTrader,
1175
+ owner,
1176
+ this.mintPt,
1177
+ )
1178
+ const tokenBaseTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1179
+ owner,
1180
+ tokenBaseTrader,
1181
+ owner,
1182
+ this.flavor.mintBase,
1183
+ )
1184
+
1185
+ const mintSyIx = await this.flavor.ixMintSy({
1186
+ amountBase: "0",
1187
+ depositor: owner,
1188
+ depositorBaseTokenAccount: tokenBaseTrader,
1189
+ depositorSyTokenAccount: tokenSyTrader,
1190
+ })
1191
+
1192
+ const mintSyRemAccounts = mintSyIx.keys
1193
+
1194
+ const remainingAccounts = uniqueRemainingAccounts([
1195
+ ...this.cpiSyAccounts.getSyState,
1196
+ ...this.cpiSyAccounts.depositSy,
1197
+ ...this.cpiSyAccounts.getPositionState,
1198
+ ])
1199
+
1200
+ const ix = exponentClmm.createBuyPtInstruction(
1201
+ {
1202
+ buyer: owner,
1203
+ market: this.selfAddress,
1204
+ tokenSyTrader,
1205
+ tokenPtTrader,
1206
+ tokenSyEscrow: this.tokenSyEscrow,
1207
+ tokenPtEscrow: this.tokenPtEscrow,
1208
+ addressLookupTable: this.addressLookupTable,
1209
+ tokenProgram: TOKEN_PROGRAM_ID,
1210
+ syProgram: this.syProgram,
1211
+ ticks: this.ticksKey,
1212
+ tokenFeeTreasurySy: this.state.tokenFeeTreasurySy,
1213
+ tokenFeeTreasuryPt: this.state.tokenFeeTreasuryPt,
1214
+ eventAuthority: this.eventAuthority,
1215
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1216
+ },
1217
+ {
1218
+ minPtAmount: minPtOut,
1219
+ baseAmount: baseIn,
1220
+ priceSpotLimit: lnImpliedApyLimit ?? null,
1221
+ mintSyRemAccountsUntil: mintSyRemAccounts.length,
1222
+ },
1223
+ )
1224
+ ix.keys.push(...mintSyRemAccounts, ...remainingAccounts)
1225
+
1226
+ return {
1227
+ ixs: [...(await this.flavor.preIxs({ signer: owner })), ix, ...(await this.flavor.postIxs({ signer: owner }))],
1228
+ setupIxs: [tokenSyTraderAtaIx, tokenPtTraderAtaIx, tokenBaseTraderAtaIx],
1229
+ }
1230
+ }
1231
+
1232
+ /**
1233
+ * Sell PT and receive the base asset (e.g. SOL, USDC).
1234
+ *
1235
+ * Wraps a PT -> SY swap with a redeem-SY step (via the flavor) in a single instruction.
1236
+ * The program swaps PT -> SY on the CLMM, then redeems SY for the base asset.
1237
+ *
1238
+ * @param owner - Wallet signing the transaction
1239
+ * @param amount - Amount of PT to sell
1240
+ * @param minBaseOut - Minimum base asset to receive (slippage protection)
1241
+ * @param lnImpliedApyLimit - Optional price limit (ln implied APY)
1242
+ */
1243
+ async ixWrapperSellPt({
1244
+ owner,
1245
+ amount,
1246
+ minBaseOut,
1247
+ tokenSyTrader: tokenSyTraderParam,
1248
+ tokenPtTrader: tokenPtTraderParam,
1249
+ tokenBaseTrader: tokenBaseTraderParam,
1250
+ lnImpliedApyLimit,
1251
+ }: {
1252
+ owner: PublicKey
1253
+ amount: bigint
1254
+ minBaseOut: bigint
1255
+ tokenSyTrader?: PublicKey
1256
+ tokenPtTrader?: PublicKey
1257
+ tokenBaseTrader?: PublicKey
1258
+ lnImpliedApyLimit?: number
1259
+ }) {
1260
+ const tokenSyTrader =
1261
+ tokenSyTraderParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
1262
+ const tokenPtTrader =
1263
+ tokenPtTraderParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
1264
+ const tokenBaseTrader =
1265
+ tokenBaseTraderParam ||
1266
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
1267
+
1268
+ const tokenSyTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1269
+ owner,
1270
+ tokenSyTrader,
1271
+ owner,
1272
+ this.mintSy,
1273
+ )
1274
+ const tokenPtTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1275
+ owner,
1276
+ tokenPtTrader,
1277
+ owner,
1278
+ this.mintPt,
1279
+ )
1280
+ const tokenBaseTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1281
+ owner,
1282
+ tokenBaseTrader,
1283
+ owner,
1284
+ this.flavor.mintBase,
1285
+ )
1286
+
1287
+ const redeemSyIx = await this.flavor.ixRedeemSy({
1288
+ amountSy: "0",
1289
+ redeemer: owner,
1290
+ redeemerBaseTokenAccount: tokenBaseTrader,
1291
+ redeemerSyTokenAccount: tokenSyTrader,
1292
+ })
1293
+
1294
+ const redeemSyRemAccounts = redeemSyIx.keys
1295
+
1296
+ const remainingAccounts = uniqueRemainingAccounts([
1297
+ ...this.cpiSyAccounts.getSyState,
1298
+ ...this.cpiSyAccounts.getPositionState,
1299
+ ...this.cpiSyAccounts.withdrawSy,
1300
+ ])
1301
+
1302
+ const ix = exponentClmm.createSellPtInstruction(
1303
+ {
1304
+ seller: owner,
1305
+ market: this.selfAddress,
1306
+ tokenSyTrader,
1307
+ tokenPtTrader,
1308
+ tokenSyEscrow: this.tokenSyEscrow,
1309
+ tokenPtEscrow: this.tokenPtEscrow,
1310
+ addressLookupTable: this.addressLookupTable,
1311
+ tokenProgram: TOKEN_PROGRAM_ID,
1312
+ syProgram: this.syProgram,
1313
+ tokenFeeTreasurySy: this.state.tokenFeeTreasurySy,
1314
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
1315
+ ticks: this.ticksKey,
1316
+ eventAuthority: this.eventAuthority,
1317
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1318
+ },
1319
+ {
1320
+ amountPt: amount,
1321
+ minBaseAmount: minBaseOut,
1322
+ priceSpotLimit: lnImpliedApyLimit ?? null,
1323
+ redeemSyRemAccountsUntil: redeemSyRemAccounts.length,
1324
+ },
1325
+ )
1326
+ ix.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
1327
+
1328
+ return {
1329
+ ixs: [...(await this.flavor.preIxs({ signer: owner })), ix, ...(await this.flavor.postIxs({ signer: owner }))],
1330
+ setupIxs: [tokenSyTraderAtaIx, tokenPtTraderAtaIx, tokenBaseTraderAtaIx],
1331
+ }
1332
+ }
1333
+
1334
+ /**
1335
+ * Buy YT directly from the base asset.
1336
+ *
1337
+ * Wraps a mint-SY step with a buy-YT swap. The program mints SY from the base asset,
1338
+ * then strips SY into PT+YT and executes the trade.
1339
+ *
1340
+ * @param owner - Wallet signing the transaction
1341
+ * @param ytOut - Amount of YT to buy
1342
+ * @param maxBaseIn - Maximum base asset to spend (slippage protection)
1343
+ */
1344
+ async ixWrapperBuyYt({
1345
+ owner,
1346
+ ytOut,
1347
+ maxBaseIn,
1348
+ tokenSyTrader: tokenSyTraderParam,
1349
+ tokenPtTrader: tokenPtTraderParam,
1350
+ tokenYtTrader: tokenYtTraderParam,
1351
+ tokenBaseTrader: tokenBaseTraderParam,
1352
+ }: {
1353
+ owner: PublicKey
1354
+ ytOut: bigint
1355
+ maxBaseIn: bigint
1356
+ tokenSyTrader?: PublicKey
1357
+ tokenPtTrader?: PublicKey
1358
+ tokenYtTrader?: PublicKey
1359
+ tokenBaseTrader?: PublicKey
1360
+ }) {
1361
+ const tokenSyTrader =
1362
+ tokenSyTraderParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
1363
+ const tokenPtTrader =
1364
+ tokenPtTraderParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
1365
+ const tokenYtTrader =
1366
+ tokenYtTraderParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
1367
+ const tokenBaseTrader =
1368
+ tokenBaseTraderParam ||
1369
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
1370
+
1371
+ const tokenSyTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1372
+ owner,
1373
+ tokenSyTrader,
1374
+ owner,
1375
+ this.mintSy,
1376
+ )
1377
+ const tokenPtTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1378
+ owner,
1379
+ tokenPtTrader,
1380
+ owner,
1381
+ this.mintPt,
1382
+ )
1383
+ const tokenYtTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1384
+ owner,
1385
+ tokenYtTrader,
1386
+ owner,
1387
+ this.mintYt,
1388
+ )
1389
+
1390
+ const mintSyIx = await this.flavor.ixMintSy({
1391
+ amountBase: "0",
1392
+ depositor: owner,
1393
+ depositorBaseTokenAccount: tokenBaseTrader,
1394
+ depositorSyTokenAccount: tokenSyTrader,
1395
+ })
1396
+
1397
+ const depositYtAccounts = this.depositYtAccounts({
1398
+ owner,
1399
+ ytSrc: tokenYtTrader,
1400
+ })
1401
+
1402
+ const mintSyRemAccounts = mintSyIx.keys
1403
+
1404
+ const remainingAccounts = uniqueRemainingAccounts([
1405
+ ...this.cpiSyAccounts.getSyState,
1406
+ ...this.cpiSyAccounts.getPositionState,
1407
+ ...this.cpiSyAccounts.withdrawSy,
1408
+ ...this.cpiCoreAccounts.stripSy,
1409
+ ...this.cpiSyAccounts.getPositionState,
1410
+ ])
1411
+
1412
+ const depositYtAccounts_until = mintSyRemAccounts.length + depositYtAccounts.keys.length
1413
+ const allRemainingAccounts = mintSyRemAccounts.concat(depositYtAccounts.keys).concat(remainingAccounts)
1414
+
1415
+ const ix1 = exponentClmm.createWrapperBuyYtInstruction(
1416
+ {
1417
+ buyer: owner,
1418
+ market: this.selfAddress,
1419
+ tokenSyTrader,
1420
+ tokenYtTrader,
1421
+ tokenPtTrader,
1422
+ tokenSyEscrow: this.tokenSyEscrow,
1423
+ tokenPtEscrow: this.tokenPtEscrow,
1424
+ tokenYtEscrow: this.tokenYtEscrow,
1425
+ marketAddressLookupTable: this.addressLookupTable,
1426
+ tokenProgram: TOKEN_PROGRAM_ID,
1427
+ syProgram: this.syProgram,
1428
+ systemProgram: SystemProgram.programId,
1429
+ tokenFeeTreasurySy: this.state.tokenFeeTreasurySy,
1430
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
1431
+ ticks: this.ticksKey,
1432
+ exponentCoreProgram: exponentCore.EXPONENTCORE_PROGRAM_ID,
1433
+ eventAuthority: this.eventAuthority,
1434
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1435
+ },
1436
+ {
1437
+ ytOut,
1438
+ maxBaseAmount: maxBaseIn,
1439
+ mintSyAccountsLength: mintSyRemAccounts.length,
1440
+ depositYtAccountsUntil: depositYtAccounts_until,
1441
+ },
1442
+ )
1443
+ ix1.keys.push(...allRemainingAccounts)
1444
+
1445
+ return {
1446
+ ixs: [...(await this.flavor.preIxs({ signer: owner })), ix1],
1447
+ setupIxs: [tokenSyTraderAtaIx, tokenPtTraderAtaIx, tokenYtTraderAtaIx],
1448
+ }
1449
+ }
1450
+
1451
+ /**
1452
+ * Sell YT and receive the base asset.
1453
+ *
1454
+ * Wraps a YT -> SY swap with a redeem-SY step. The program merges YT+PT back into SY,
1455
+ * executes the trade, then redeems SY for the base asset.
1456
+ *
1457
+ * @param owner - Wallet signing the transaction
1458
+ * @param amount - Amount of YT to sell
1459
+ * @param minBaseOut - Minimum base asset to receive (slippage protection)
1460
+ */
1461
+ async ixWrapperSellYt({
1462
+ owner,
1463
+ amount,
1464
+ minBaseOut,
1465
+ tokenBaseTrader: tokenBaseTraderParam,
1466
+ tokenSyTrader: tokenSyTraderParam,
1467
+ tokenYtTrader: tokenYtTraderParam,
1468
+ tokenPtTrader: tokenPtTraderParam,
1469
+ }: {
1470
+ owner: PublicKey
1471
+ amount: bigint
1472
+ minBaseOut: bigint
1473
+ tokenBaseTrader?: PublicKey
1474
+ tokenSyTrader?: PublicKey
1475
+ tokenYtTrader?: PublicKey
1476
+ tokenPtTrader?: PublicKey
1477
+ }) {
1478
+ const tokenBaseTrader =
1479
+ tokenBaseTraderParam ||
1480
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
1481
+ const tokenSyTrader =
1482
+ tokenSyTraderParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
1483
+ const tokenYtTrader =
1484
+ tokenYtTraderParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
1485
+ const tokenPtTrader =
1486
+ tokenPtTraderParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
1487
+
1488
+ const tokenSyTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1489
+ owner,
1490
+ tokenSyTrader,
1491
+ owner,
1492
+ this.mintSy,
1493
+ )
1494
+ const tokenPtTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1495
+ owner,
1496
+ tokenPtTrader,
1497
+ owner,
1498
+ this.mintPt,
1499
+ )
1500
+ const tokenYtTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1501
+ owner,
1502
+ tokenYtTrader,
1503
+ owner,
1504
+ this.mintYt,
1505
+ )
1506
+ const tokenBaseTraderAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1507
+ owner,
1508
+ tokenBaseTrader,
1509
+ owner,
1510
+ this.flavor.mintBase,
1511
+ )
1512
+
1513
+ const redeemSyIx = await this.flavor.ixRedeemSy({
1514
+ amountSy: "0",
1515
+ redeemer: owner,
1516
+ redeemerBaseTokenAccount: tokenBaseTrader,
1517
+ redeemerSyTokenAccount: tokenSyTrader,
1518
+ })
1519
+
1520
+ const redeemSyRemAccounts = redeemSyIx.keys
1521
+
1522
+ const withdrawYtAccounts = this.withdrawYtAccounts({
1523
+ owner,
1524
+ ytDst: tokenYtTrader,
1525
+ })
1526
+
1527
+ const remainingAccounts = uniqueRemainingAccounts([
1528
+ ...this.cpiSyAccounts.getSyState,
1529
+ ...this.cpiSyAccounts.getPositionState,
1530
+ ...this.cpiCoreAccounts.mergeSy,
1531
+ ...this.cpiSyAccounts.withdrawSy,
1532
+ ...this.cpiSyAccounts.depositSy,
1533
+ ])
1534
+
1535
+ const withdrawYtAccountsUntil = redeemSyRemAccounts.length + withdrawYtAccounts.keys.length
1536
+
1537
+ const ix1 = exponentClmm.createWrapperSellYtInstruction(
1538
+ {
1539
+ seller: owner,
1540
+ market: this.selfAddress,
1541
+ tokenSyTrader,
1542
+ tokenYtTrader,
1543
+ tokenPtTrader,
1544
+ tokenSyEscrow: this.tokenSyEscrow,
1545
+ tokenYtEscrow: this.tokenYtEscrow,
1546
+ tokenPtEscrow: this.tokenPtEscrow,
1547
+ marketAddressLookupTable: this.addressLookupTable,
1548
+ tokenProgram: TOKEN_PROGRAM_ID,
1549
+ syProgram: this.syProgram,
1550
+ tokenFeeTreasurySy: this.state.tokenFeeTreasurySy,
1551
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
1552
+ ticks: this.ticksKey,
1553
+ exponentCoreProgram: exponentCore.EXPONENTCORE_PROGRAM_ID,
1554
+ eventAuthority: this.eventAuthority,
1555
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1556
+ },
1557
+ {
1558
+ ytAmount: amount,
1559
+ minBaseAmount: minBaseOut,
1560
+ redeemSyAccountsUntil: redeemSyRemAccounts.length,
1561
+ withdrawYtAccountsUntil,
1562
+ },
1563
+ )
1564
+ ix1.keys.push(...redeemSyRemAccounts, ...withdrawYtAccounts.keys, ...remainingAccounts)
1565
+
1566
+ return {
1567
+ ixs: [ix1, ...(await this.flavor.preIxs({ signer: owner }))],
1568
+ setupIxs: [tokenSyTraderAtaIx, tokenPtTraderAtaIx, tokenYtTraderAtaIx, tokenBaseTraderAtaIx],
1569
+ }
1570
+ }
1571
+
1572
+ /**
1573
+ * Provide concentrated liquidity from the base asset, receiving LP and YT tokens.
1574
+ *
1575
+ * Wraps a mint-SY step with a deposit-liquidity operation. The program mints SY from the
1576
+ * base asset, strips some into PT, deposits PT+SY as liquidity in the specified tick range,
1577
+ * and returns the leftover YT to the depositor.
1578
+ *
1579
+ * @param depositor - Wallet signing the transaction
1580
+ * @param amountBase - Amount of base asset to deposit
1581
+ * @param minLpOut - Minimum LP tokens to receive (slippage protection)
1582
+ * @param lowerTickApy - Lower APY bound for the liquidity range
1583
+ * @param upperTickApy - Upper APY bound for the liquidity range
1584
+ * @param lpPosition - Optional existing LP position keypair/address (new one generated if omitted)
1585
+ */
1586
+ async ixWrapperProvideLiquidity({
1587
+ depositor,
1588
+ amountBase,
1589
+ minLpOut,
1590
+ lowerTickApy,
1591
+ upperTickApy,
1592
+ tokenSyDepositor: tokenSyDepositorParam,
1593
+ tokenYtDepositor: tokenYtDepositorParam,
1594
+ tokenPtDepositor: tokenPtDepositorParam,
1595
+ tokenBaseDepositor: tokenBaseDepositorParam,
1596
+ lpPosition: lpPositionParam,
1597
+ }: {
1598
+ depositor: PublicKey
1599
+ amountBase: bigint
1600
+ minLpOut: bigint
1601
+ lowerTickApy: number
1602
+ upperTickApy: number
1603
+ tokenSyDepositor?: PublicKey
1604
+ tokenYtDepositor?: PublicKey
1605
+ tokenPtDepositor?: PublicKey
1606
+ tokenBaseDepositor?: PublicKey
1607
+ lpPosition?: Keypair | PublicKey
1608
+ }) {
1609
+ const tokenSyDepositor =
1610
+ tokenSyDepositorParam || getAssociatedTokenAddressSync(this.mintSy, depositor, true, TOKEN_PROGRAM_ID)
1611
+ const tokenYtDepositor =
1612
+ tokenYtDepositorParam || getAssociatedTokenAddressSync(this.mintYt, depositor, true, TOKEN_PROGRAM_ID)
1613
+ const tokenPtDepositor =
1614
+ tokenPtDepositorParam || getAssociatedTokenAddressSync(this.mintPt, depositor, true, TOKEN_PROGRAM_ID)
1615
+ const tokenBaseDepositor =
1616
+ tokenBaseDepositorParam ||
1617
+ getAssociatedTokenAddressSync(this.flavor.mintBase, depositor, true, this.flavor.baseTokenProgram)
1618
+
1619
+ const lpPosition = lpPositionParam || Keypair.generate()
1620
+
1621
+ const tokenSyDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1622
+ depositor,
1623
+ tokenSyDepositor,
1624
+ depositor,
1625
+ this.mintSy,
1626
+ )
1627
+ const tokenYtDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1628
+ depositor,
1629
+ tokenYtDepositor,
1630
+ depositor,
1631
+ this.mintYt,
1632
+ )
1633
+ const tokenPtDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1634
+ depositor,
1635
+ tokenPtDepositor,
1636
+ depositor,
1637
+ this.mintPt,
1638
+ )
1639
+
1640
+ const mintSyIx = await this.flavor.ixMintSy({
1641
+ // argument does not matter - since we are just getting the keys
1642
+ amountBase: "0",
1643
+ depositor,
1644
+ depositorBaseTokenAccount: tokenBaseDepositor,
1645
+ depositorSyTokenAccount: tokenSyDepositor,
1646
+ })
1647
+
1648
+ const mintSyRemAccounts = mintSyIx.keys
1649
+
1650
+ const unorderedRemainingAccounts = uniqueRemainingAccounts([
1651
+ ...this.cpiSyAccounts.getSyState,
1652
+ ...this.cpiSyAccounts.getPositionState,
1653
+ ...this.cpiCoreAccounts.stripSy,
1654
+ ...this.cpiSyAccounts.depositSy,
1655
+ ])
1656
+
1657
+ const depositYtAccounts = this.depositYtAccounts({
1658
+ owner: depositor,
1659
+ ytSrc: tokenYtDepositor,
1660
+ })
1661
+ const depositAccountsUntil = mintSyRemAccounts.length + depositYtAccounts.keys.length
1662
+ const allRemainingAccounts = [...mintSyRemAccounts, ...depositYtAccounts.keys, ...unorderedRemainingAccounts]
1663
+
1664
+ const ix = exponentClmm.createWrapperProvideLiquidityInstruction(
1665
+ {
1666
+ depositor,
1667
+ market: this.selfAddress,
1668
+ ticks: this.ticksKey,
1669
+ tokenPtEscrow: this.tokenPtEscrow,
1670
+ tokenYtEscrow: this.tokenYtEscrow,
1671
+ tokenSyEscrow: this.tokenSyEscrow,
1672
+ tokenSyDepositor,
1673
+ tokenYtDepositor,
1674
+ tokenPtDepositor,
1675
+ mintYt: this.vault.mintYt,
1676
+ mintPt: this.vault.mintPt,
1677
+ tokenProgram: TOKEN_PROGRAM_ID,
1678
+ marketAddressLookupTable: this.addressLookupTable,
1679
+ syProgram: this.syProgram,
1680
+ exponentCoreProgram: exponentCore.EXPONENTCORE_PROGRAM_ID,
1681
+ lpPosition: lpPosition instanceof Keypair ? lpPosition.publicKey : lpPosition,
1682
+ instructionsSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
1683
+ systemProgram: SystemProgram.programId,
1684
+ rent: SYSVAR_RENT_PUBKEY,
1685
+ eventAuthority: this.eventAuthority,
1686
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1687
+ },
1688
+ {
1689
+ lowerTick: convertApyToApyBp(lowerTickApy),
1690
+ upperTick: convertApyToApyBp(upperTickApy),
1691
+ amountBase,
1692
+ minLpOut,
1693
+ mintSyRemAccountsUntil: mintSyRemAccounts.length,
1694
+ depositYtAccountsUntil: depositAccountsUntil,
1695
+ },
1696
+ )
1697
+ ix.keys.push(...allRemainingAccounts)
1698
+
1699
+ if (lpPosition instanceof Keypair) {
1700
+ ix.keys.find((k) => k.pubkey.equals(lpPosition.publicKey))!.isSigner = true
1701
+ }
1702
+
1703
+ return {
1704
+ ixs: [
1705
+ ...(await this.flavor.preIxs({ signer: depositor })),
1706
+ ix,
1707
+ ...(await this.flavor.postIxs({ signer: depositor })),
1708
+ ],
1709
+ signers: lpPosition instanceof Keypair ? [lpPosition] : [],
1710
+ setupIxs: [tokenSyDepositorAtaIx, tokenYtDepositorAtaIx, tokenPtDepositorAtaIx],
1711
+ }
1712
+ }
1713
+
1714
+ /**
1715
+ * Provide concentrated liquidity from a base asset plus existing PT tokens ("classic" mode).
1716
+ *
1717
+ * Unlike {@link ixWrapperProvideLiquidity}, this allows the depositor to supply PT they already
1718
+ * hold instead of having the program strip SY into PT+YT. Useful when the depositor has leftover
1719
+ * PT from a previous trade or wants finer control over token composition.
1720
+ *
1721
+ * @param depositor - Wallet signing the transaction
1722
+ * @param amountBase - Amount of base asset to deposit (converted to SY internally)
1723
+ * @param amountPt - Amount of PT to deposit alongside the base asset
1724
+ * @param minLpOut - Minimum LP tokens to receive (slippage protection)
1725
+ * @param lowerTickApy - Lower APY bound for the liquidity range
1726
+ * @param upperTickApy - Upper APY bound for the liquidity range
1727
+ */
1728
+ async ixProvideLiquidityClassic({
1729
+ depositor,
1730
+ amountBase,
1731
+ amountPt,
1732
+ minLpOut,
1733
+ lowerTickApy,
1734
+ upperTickApy,
1735
+ tokenSyDepositor: tokenSyDepositorParam,
1736
+ tokenYtDepositor: tokenYtDepositorParam,
1737
+ tokenPtDepositor: tokenPtDepositorParam,
1738
+ tokenBaseDepositor: tokenBaseDepositorParam,
1739
+ lpPositionParam,
1740
+ }: {
1741
+ depositor: PublicKey
1742
+ amountBase: bigint
1743
+ amountPt: bigint
1744
+ minLpOut: bigint
1745
+ lowerTickApy: number
1746
+ upperTickApy: number
1747
+ tokenSyDepositor?: PublicKey
1748
+ tokenYtDepositor?: PublicKey
1749
+ tokenPtDepositor?: PublicKey
1750
+ tokenBaseDepositor?: PublicKey
1751
+ lpPositionParam?: Keypair | PublicKey
1752
+ }) {
1753
+ const tokenSyDepositor =
1754
+ tokenSyDepositorParam || getAssociatedTokenAddressSync(this.mintSy, depositor, true, TOKEN_PROGRAM_ID)
1755
+ const tokenYtDepositor =
1756
+ tokenYtDepositorParam || getAssociatedTokenAddressSync(this.mintYt, depositor, true, TOKEN_PROGRAM_ID)
1757
+ const tokenPtDepositor =
1758
+ tokenPtDepositorParam || getAssociatedTokenAddressSync(this.mintPt, depositor, true, TOKEN_PROGRAM_ID)
1759
+ const tokenBaseDepositor =
1760
+ tokenBaseDepositorParam ||
1761
+ getAssociatedTokenAddressSync(this.flavor.mintBase, depositor, true, this.flavor.baseTokenProgram)
1762
+
1763
+ const lpPosition = lpPositionParam || Keypair.generate()
1764
+
1765
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1766
+ depositor,
1767
+ tokenSyDepositor,
1768
+ depositor,
1769
+ this.mintSy,
1770
+ )
1771
+ const tokenYtAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1772
+ depositor,
1773
+ tokenYtDepositor,
1774
+ depositor,
1775
+ this.mintYt,
1776
+ )
1777
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1778
+ depositor,
1779
+ tokenPtDepositor,
1780
+ depositor,
1781
+ this.mintPt,
1782
+ )
1783
+ const tokenBaseAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1784
+ depositor,
1785
+ tokenBaseDepositor,
1786
+ depositor,
1787
+ this.flavor.mintBase,
1788
+ this.flavor.baseTokenProgram,
1789
+ )
1790
+
1791
+ const remainingAccounts = uniqueRemainingAccounts([
1792
+ ...this.cpiSyAccounts.depositSy,
1793
+ ...this.cpiSyAccounts.withdrawSy,
1794
+ ...this.cpiCoreAccounts.stripSy,
1795
+ ...this.cpiSyAccounts.getPositionState,
1796
+ ])
1797
+
1798
+ const mintSyIx = await this.flavor.ixMintSy({
1799
+ amountBase: "0",
1800
+ depositor,
1801
+ depositorBaseTokenAccount: tokenBaseDepositor,
1802
+ depositorSyTokenAccount: tokenSyDepositor,
1803
+ })
1804
+
1805
+ const mintSyRemAccounts = mintSyIx.keys
1806
+
1807
+ const ix = exponentClmm.createWrapperProvideLiquidityClassicInstruction(
1808
+ {
1809
+ depositor,
1810
+ market: this.selfAddress,
1811
+ ticks: this.ticksKey,
1812
+ tokenPtEscrow: this.tokenPtEscrow,
1813
+ tokenSyEscrow: this.tokenSyEscrow,
1814
+ tokenSyDepositor,
1815
+ tokenPtDepositor,
1816
+ tokenProgram: TOKEN_PROGRAM_ID,
1817
+ marketAddressLookupTable: this.addressLookupTable,
1818
+ syProgram: this.syProgram,
1819
+ lpPosition: lpPosition instanceof Keypair ? lpPosition.publicKey : lpPosition,
1820
+ instructionsSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
1821
+ systemProgram: SystemProgram.programId,
1822
+ rent: SYSVAR_RENT_PUBKEY,
1823
+ eventAuthority: this.eventAuthority,
1824
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1825
+ },
1826
+ {
1827
+ lowerTick: convertApyToApyBp(lowerTickApy),
1828
+ upperTick: convertApyToApyBp(upperTickApy),
1829
+ amountBase,
1830
+ amountPt,
1831
+ minLpOut,
1832
+ mintSyAccountsUntil: mintSyRemAccounts.length,
1833
+ },
1834
+ )
1835
+ ix.keys.push(...mintSyRemAccounts, ...remainingAccounts)
1836
+
1837
+ if (lpPosition instanceof Keypair) {
1838
+ ix.keys.find((k) => k.pubkey.equals(lpPosition.publicKey))!.isSigner = true
1839
+ }
1840
+
1841
+ return {
1842
+ ixs: [
1843
+ ...(await this.flavor.preIxs({ signer: depositor })),
1844
+ ix,
1845
+ ...(await this.flavor.postIxs({ signer: depositor })),
1846
+ ],
1847
+ signers: lpPosition instanceof Keypair ? [lpPosition] : [],
1848
+ setupIxs: [tokenSyAtaIx, tokenYtAtaIx, tokenPtAtaIx, tokenBaseAtaIx],
1849
+ }
1850
+ }
1851
+
1852
+ async ixProvideLiquidityBase({
1853
+ depositor,
1854
+ externalPtToBuy,
1855
+ externalSyConstraint,
1856
+ minLpOut,
1857
+ lowerTickApy,
1858
+ upperTickApy,
1859
+ tokenSyDepositor: tokenSyDepositorParam,
1860
+ tokenYtDepositor: tokenYtDepositorParam,
1861
+ tokenPtDepositor: tokenPtDepositorParam,
1862
+ tokenBaseDepositor: tokenBaseDepositorParam,
1863
+ lpPositionParam,
1864
+ }: {
1865
+ depositor: PublicKey
1866
+ externalPtToBuy: bigint
1867
+ externalSyConstraint: bigint
1868
+ minLpOut: bigint
1869
+ lowerTickApy: number
1870
+ upperTickApy: number
1871
+ tokenSyDepositor?: PublicKey
1872
+ tokenYtDepositor?: PublicKey
1873
+ tokenPtDepositor?: PublicKey
1874
+ tokenBaseDepositor?: PublicKey
1875
+ lpPositionParam?: Keypair | PublicKey
1876
+ }) {
1877
+ const tokenSyDepositor =
1878
+ tokenSyDepositorParam || getAssociatedTokenAddressSync(this.mintSy, depositor, true, TOKEN_PROGRAM_ID)
1879
+ const tokenYtDepositor =
1880
+ tokenYtDepositorParam || getAssociatedTokenAddressSync(this.mintYt, depositor, true, TOKEN_PROGRAM_ID)
1881
+ const tokenPtDepositor =
1882
+ tokenPtDepositorParam || getAssociatedTokenAddressSync(this.mintPt, depositor, true, TOKEN_PROGRAM_ID)
1883
+ const tokenBaseDepositor =
1884
+ tokenBaseDepositorParam ||
1885
+ getAssociatedTokenAddressSync(this.flavor.mintBase, depositor, true, this.flavor.baseTokenProgram)
1886
+
1887
+ const lpPosition = lpPositionParam || Keypair.generate()
1888
+
1889
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1890
+ depositor,
1891
+ tokenSyDepositor,
1892
+ depositor,
1893
+ this.mintSy,
1894
+ )
1895
+ const tokenYtAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1896
+ depositor,
1897
+ tokenYtDepositor,
1898
+ depositor,
1899
+ this.mintYt,
1900
+ )
1901
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1902
+ depositor,
1903
+ tokenPtDepositor,
1904
+ depositor,
1905
+ this.mintPt,
1906
+ )
1907
+ const tokenBaseAtaIx = createAssociatedTokenAccountIdempotentInstruction(
1908
+ depositor,
1909
+ tokenBaseDepositor,
1910
+ depositor,
1911
+ this.flavor.mintBase,
1912
+ this.flavor.baseTokenProgram,
1913
+ )
1914
+
1915
+ const remainingAccounts = uniqueRemainingAccounts([
1916
+ ...this.cpiSyAccounts.depositSy,
1917
+ ...this.cpiSyAccounts.withdrawSy,
1918
+ ...this.cpiCoreAccounts.stripSy,
1919
+ ...this.cpiSyAccounts.getPositionState,
1920
+ ])
1921
+
1922
+ const mintSyIx = await this.flavor.ixMintSy({
1923
+ amountBase: "0",
1924
+ depositor,
1925
+ depositorBaseTokenAccount: tokenBaseDepositor,
1926
+ depositorSyTokenAccount: tokenSyDepositor,
1927
+ })
1928
+
1929
+ const mintSyRemAccounts = mintSyIx.keys
1930
+
1931
+ const ix = exponentClmm.createWrapperProvideLiquidityBaseInstruction(
1932
+ {
1933
+ depositor,
1934
+ market: this.selfAddress,
1935
+ ticks: this.ticksKey,
1936
+ tokenPtEscrow: this.tokenPtEscrow,
1937
+ tokenSyEscrow: this.tokenSyEscrow,
1938
+ tokenSyDepositor,
1939
+ tokenPtDepositor,
1940
+ tokenFeeTreasurySy: this.tokenFeeTreasurySy,
1941
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
1942
+ mintPt: this.mintPt,
1943
+ tokenProgram: TOKEN_PROGRAM_ID,
1944
+ marketAddressLookupTable: this.addressLookupTable,
1945
+ syProgram: this.syProgram,
1946
+ exponentCoreProgram: exponentCore.EXPONENTCORE_PROGRAM_ID,
1947
+ lpPosition: lpPosition instanceof Keypair ? lpPosition.publicKey : lpPosition,
1948
+ instructionsSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
1949
+ systemProgram: SystemProgram.programId,
1950
+ rent: SYSVAR_RENT_PUBKEY,
1951
+ eventAuthority: this.eventAuthority,
1952
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
1953
+ },
1954
+ {
1955
+ lowerTickKey: convertApyToApyBp(lowerTickApy),
1956
+ upperTickKey: convertApyToApyBp(upperTickApy),
1957
+ minLpOut,
1958
+ mintSyAccountsUntil: mintSyRemAccounts.length,
1959
+ externalPtToBuy,
1960
+ externalSyConstraint,
1961
+ },
1962
+ )
1963
+ ix.keys.push(...mintSyRemAccounts, ...remainingAccounts)
1964
+
1965
+ if (lpPosition instanceof Keypair) {
1966
+ ix.keys.find((k) => k.pubkey.equals(lpPosition.publicKey))!.isSigner = true
1967
+ }
1968
+
1969
+ return {
1970
+ ixs: [
1971
+ ...(await this.flavor.preIxs({ signer: depositor })),
1972
+ ix,
1973
+ ...(await this.flavor.postIxs({ signer: depositor })),
1974
+ ],
1975
+ signers: lpPosition instanceof Keypair ? [lpPosition] : [],
1976
+ setupIxs: [tokenSyAtaIx, tokenYtAtaIx, tokenPtAtaIx, tokenBaseAtaIx],
1977
+ }
1978
+ }
1979
+
1980
+ async ixWithdrawLiquidityToBase({
1981
+ owner,
1982
+ amountLp,
1983
+ minBaseOut,
1984
+ lpPosition,
1985
+ tokenSyWithdrawer: tokenSyWithdrawerParam,
1986
+ tokenYtWithdrawer: tokenYtWithdrawerParam,
1987
+ tokenPtWithdrawer: tokenPtWithdrawerParam,
1988
+ tokenBaseWithdrawer: tokenBaseWithdrawerParam,
1989
+ }: {
1990
+ owner: PublicKey
1991
+ amountLp: bigint
1992
+ minBaseOut: bigint
1993
+ lpPosition: PublicKey
1994
+ tokenSyWithdrawer?: PublicKey
1995
+ tokenYtWithdrawer?: PublicKey
1996
+ tokenPtWithdrawer?: PublicKey
1997
+ tokenBaseWithdrawer?: PublicKey
1998
+ }) {
1999
+ const tokenSyWithdrawer =
2000
+ tokenSyWithdrawerParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
2001
+ const tokenYtWithdrawer =
2002
+ tokenYtWithdrawerParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
2003
+ const tokenPtWithdrawer =
2004
+ tokenPtWithdrawerParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
2005
+ const tokenBaseWithdrawer =
2006
+ tokenBaseWithdrawerParam ||
2007
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
2008
+
2009
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenSyWithdrawer, owner, this.mintSy)
2010
+ const tokenYtAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenYtWithdrawer, owner, this.mintYt)
2011
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenPtWithdrawer, owner, this.mintPt)
2012
+ const tokenBaseAtaIx = createAssociatedTokenAccountIdempotentInstruction(
2013
+ owner,
2014
+ tokenBaseWithdrawer,
2015
+ owner,
2016
+ this.flavor.mintBase,
2017
+ this.flavor.baseTokenProgram,
2018
+ )
2019
+
2020
+ const remainingAccounts = uniqueRemainingAccounts([
2021
+ ...this.cpiSyAccounts.withdrawSy,
2022
+ ...this.cpiSyAccounts.getPositionState,
2023
+ ])
2024
+
2025
+ const redeemSyIx = await this.flavor.ixRedeemSy({
2026
+ amountSy: "0",
2027
+ redeemer: owner,
2028
+ redeemerBaseTokenAccount: tokenBaseWithdrawer,
2029
+ redeemerSyTokenAccount: tokenSyWithdrawer,
2030
+ })
2031
+
2032
+ const redeemSyRemAccounts = redeemSyIx.keys
2033
+
2034
+ const minSyOut = Number(minBaseOut) / this.currentSyExchangeRate
2035
+
2036
+ const ix = exponentClmm.createWrapperWithdrawLiquidityInstruction(
2037
+ {
2038
+ withdrawer: owner,
2039
+ market: this.selfAddress,
2040
+ ticks: this.ticksKey,
2041
+ tokenPtEscrow: this.tokenPtEscrow,
2042
+ tokenSyEscrow: this.tokenSyEscrow,
2043
+ tokenSyWithdrawer,
2044
+ tokenPtWithdrawer,
2045
+ tokenProgram: TOKEN_PROGRAM_ID,
2046
+ marketAddressLookupTable: this.addressLookupTable,
2047
+ syProgram: this.syProgram,
2048
+ tokenFeeTreasurySy: this.state.tokenFeeTreasurySy,
2049
+ tokenFeeTreasuryPt: this.tokenFeeTreasuryPt,
2050
+ lpPosition,
2051
+ systemProgram: SystemProgram.programId,
2052
+ eventAuthority: this.eventAuthority,
2053
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
2054
+ },
2055
+ {
2056
+ amountLp,
2057
+ syConstraint: BigInt(minSyOut.toFixed(0)),
2058
+ redeemSyAccountsLength: redeemSyRemAccounts.length,
2059
+ },
2060
+ )
2061
+ ix.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
2062
+
2063
+ return {
2064
+ ixs: [...(await this.flavor.preIxs({ signer: owner })), ix, ...(await this.flavor.postIxs({ signer: owner }))],
2065
+ setupIxs: [tokenSyAtaIx, tokenYtAtaIx, tokenPtAtaIx, tokenBaseAtaIx],
2066
+ }
2067
+ }
2068
+
2069
+ async ixWithdrawLiquidityClassic({
2070
+ owner,
2071
+ amountLp,
2072
+ lpPosition,
2073
+ tokenSyWithdrawer: tokenSyWithdrawerParam,
2074
+ tokenYtWithdrawer: tokenYtWithdrawerParam,
2075
+ tokenPtWithdrawer: tokenPtWithdrawerParam,
2076
+ tokenBaseWithdrawer: tokenBaseWithdrawerParam,
2077
+ }: {
2078
+ owner: PublicKey
2079
+ amountLp: bigint
2080
+ lpPosition: PublicKey
2081
+ tokenSyWithdrawer?: PublicKey
2082
+ tokenYtWithdrawer?: PublicKey
2083
+ tokenPtWithdrawer?: PublicKey
2084
+ tokenBaseWithdrawer?: PublicKey
2085
+ }) {
2086
+ const tokenSyWithdrawer =
2087
+ tokenSyWithdrawerParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
2088
+ const tokenYtWithdrawer =
2089
+ tokenYtWithdrawerParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
2090
+ const tokenPtWithdrawer =
2091
+ tokenPtWithdrawerParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
2092
+ const tokenBaseWithdrawer =
2093
+ tokenBaseWithdrawerParam ||
2094
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
2095
+
2096
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenSyWithdrawer, owner, this.mintSy)
2097
+ const tokenYtAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenYtWithdrawer, owner, this.mintYt)
2098
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenPtWithdrawer, owner, this.mintPt)
2099
+ const tokenBaseAtaIx = createAssociatedTokenAccountIdempotentInstruction(
2100
+ owner,
2101
+ tokenBaseWithdrawer,
2102
+ owner,
2103
+ this.flavor.mintBase,
2104
+ this.flavor.baseTokenProgram,
2105
+ )
2106
+
2107
+ const remainingAccounts = uniqueRemainingAccounts([
2108
+ ...this.cpiSyAccounts.withdrawSy,
2109
+ ...this.cpiSyAccounts.getPositionState,
2110
+ ])
2111
+
2112
+ const redeemSyIx = await this.flavor.ixRedeemSy({
2113
+ amountSy: "0",
2114
+ redeemer: owner,
2115
+ redeemerBaseTokenAccount: tokenBaseWithdrawer,
2116
+ redeemerSyTokenAccount: tokenSyWithdrawer,
2117
+ })
2118
+
2119
+ const redeemSyRemAccounts = redeemSyIx.keys
2120
+
2121
+ const ixn = exponentClmm.createWrapperWithdrawLiquidityClassicInstruction(
2122
+ {
2123
+ withdrawer: owner,
2124
+ market: this.selfAddress,
2125
+ ticks: this.ticksKey,
2126
+ tokenPtEscrow: this.tokenPtEscrow,
2127
+ tokenSyEscrow: this.tokenSyEscrow,
2128
+ tokenSyWithdrawer,
2129
+ tokenPtWithdrawer,
2130
+ tokenProgram: TOKEN_PROGRAM_ID,
2131
+ marketAddressLookupTable: this.addressLookupTable,
2132
+ syProgram: this.syProgram,
2133
+ lpPosition,
2134
+ systemProgram: SystemProgram.programId,
2135
+ eventAuthority: this.eventAuthority,
2136
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
2137
+ },
2138
+ {
2139
+ amountLp,
2140
+ redeemSyAccountsLength: redeemSyRemAccounts.length,
2141
+ },
2142
+ )
2143
+ ixn.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
2144
+
2145
+ return {
2146
+ ixs: [...(await this.flavor.preIxs({ signer: owner })), ixn, ...(await this.flavor.postIxs({ signer: owner }))],
2147
+ setupIxs: [tokenSyAtaIx, tokenYtAtaIx, tokenPtAtaIx, tokenBaseAtaIx],
2148
+ }
2149
+ }
2150
+
2151
+ async ixAddLiquidity({
2152
+ owner,
2153
+ ptInIntent,
2154
+ syInIntent,
2155
+ tokenSyDepositor: tokenSyDepositorParam,
2156
+ tokenYtDepositor: tokenYtDepositorParam,
2157
+ tokenPtDepositor: tokenPtDepositorParam,
2158
+ tokenBaseDepositor: tokenBaseDepositorParam,
2159
+ lpPosition,
2160
+ }: {
2161
+ owner: PublicKey
2162
+ /** Intended (maximum) amount of PT in */
2163
+ ptInIntent: bigint
2164
+ /** Intended (maximum) amount of SY in */
2165
+ syInIntent: bigint
2166
+ tokenSyDepositor?: PublicKey
2167
+ tokenYtDepositor?: PublicKey
2168
+ tokenPtDepositor?: PublicKey
2169
+ tokenBaseDepositor?: PublicKey
2170
+ lpPosition: PublicKey
2171
+ }) {
2172
+ const tokenSyDepositor =
2173
+ tokenSyDepositorParam || getAssociatedTokenAddressSync(this.mintSy, owner, true, TOKEN_PROGRAM_ID)
2174
+ const tokenYtDepositor =
2175
+ tokenYtDepositorParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
2176
+ const tokenPtDepositor =
2177
+ tokenPtDepositorParam || getAssociatedTokenAddressSync(this.mintPt, owner, true, TOKEN_PROGRAM_ID)
2178
+ const tokenBaseDepositor =
2179
+ tokenBaseDepositorParam ||
2180
+ getAssociatedTokenAddressSync(this.flavor.mintBase, owner, true, this.flavor.baseTokenProgram)
2181
+
2182
+ const tokenSyAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenSyDepositor, owner, this.mintSy)
2183
+ const tokenYtAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenYtDepositor, owner, this.mintYt)
2184
+ const tokenPtAtaIx = createAssociatedTokenAccountIdempotentInstruction(owner, tokenPtDepositor, owner, this.mintPt)
2185
+ const tokenBaseAtaIx = createAssociatedTokenAccountIdempotentInstruction(
2186
+ owner,
2187
+ tokenBaseDepositor,
2188
+ owner,
2189
+ this.flavor.mintBase,
2190
+ this.flavor.baseTokenProgram,
2191
+ )
2192
+
2193
+ const remainingAccounts = uniqueRemainingAccounts([
2194
+ ...this.cpiSyAccounts.depositSy,
2195
+ ...this.cpiSyAccounts.withdrawSy,
2196
+ ...this.cpiCoreAccounts.stripSy,
2197
+ ...this.cpiSyAccounts.getPositionState,
2198
+ ])
2199
+
2200
+ const ix = exponentClmm.createAddLiquidityInstruction(
2201
+ {
2202
+ owner,
2203
+ market: this.selfAddress,
2204
+ ticks: this.ticksKey,
2205
+ lpPosition: lpPosition instanceof Keypair ? lpPosition.publicKey : lpPosition,
2206
+ tokenPtSrc: tokenPtDepositor,
2207
+ tokenSySrc: tokenSyDepositor,
2208
+ tokenPtEscrow: this.tokenPtEscrow,
2209
+ tokenSyEscrow: this.tokenSyEscrow,
2210
+ addressLookupTable: this.addressLookupTable,
2211
+ tokenProgram: TOKEN_PROGRAM_ID,
2212
+ syProgram: this.syProgram,
2213
+ instructionsSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
2214
+ systemProgram: SystemProgram.programId,
2215
+ rent: SYSVAR_RENT_PUBKEY,
2216
+ eventAuthority: this.eventAuthority,
2217
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
2218
+ },
2219
+ {
2220
+ maxSyInToAdd: syInIntent,
2221
+ maxPtInToAdd: ptInIntent,
2222
+ lowerTickKeyOptional: null,
2223
+ upperTickKeyOptional: null,
2224
+ },
2225
+ )
2226
+ ix.keys.push(...remainingAccounts)
2227
+
2228
+ return {
2229
+ ixs: [...(await this.flavor.preIxs({ signer: owner })), ix, ...(await this.flavor.postIxs({ signer: owner }))],
2230
+ signers: lpPosition instanceof Keypair ? [lpPosition] : [],
2231
+ setupIxs: [tokenSyAtaIx, tokenYtAtaIx, tokenPtAtaIx, tokenBaseAtaIx],
2232
+ }
2233
+ }
2234
+
2235
+ async getUserLpPositions(owner: PublicKey, market: PublicKey) {
2236
+ const LP_POSITION_DISCRIMINATOR = Buffer.from([105, 241, 37, 200, 224, 2, 252, 90])
2237
+
2238
+ const accounts = await this.connection.getProgramAccounts(
2239
+ exponentClmm.EXPONENTCLMM_PROGRAM_ID,
2240
+ {
2241
+ filters: [
2242
+ { memcmp: { offset: 0, bytes: bs58.encode(LP_POSITION_DISCRIMINATOR) } },
2243
+ { memcmp: { offset: 8, bytes: owner.toBase58() } },
2244
+ { memcmp: { offset: 40, bytes: market.toBase58() } },
2245
+ ],
2246
+ },
2247
+ )
2248
+
2249
+ const lpPositions = accounts.map(({ pubkey, account }) => ({
2250
+ publicKey: pubkey,
2251
+ account: exponentClmm.deserializeLpPositionAccount(account.data),
2252
+ }))
2253
+
2254
+ return {
2255
+ lpPositions: [lpPositions],
2256
+ }
2257
+ }
2258
+
2259
+ ixMarketAccureEmissions({ owner, lpPosition }: { owner: PublicKey; lpPosition: PublicKey }) {
2260
+ const remainingAccounts = uniqueRemainingAccounts([...this.cpiSyAccounts.getPositionState])
2261
+ const ixn = exponentClmm.createMarketAccrueEmissionInstruction({
2262
+ owner,
2263
+ market: this.selfAddress,
2264
+ ticks: this.ticksKey,
2265
+ lpPosition,
2266
+ addressLookupTable: this.addressLookupTable,
2267
+ syProgram: this.syProgram,
2268
+ systemProgram: SystemProgram.programId,
2269
+ eventAuthority: this.eventAuthority,
2270
+ program: exponentClmm.EXPONENTCLMM_PROGRAM_ID,
2271
+ })
2272
+ ixn.keys.push(...remainingAccounts)
2273
+
2274
+ return {
2275
+ ixs: [ixn],
2276
+ }
2277
+ }
2278
+
2279
+ /**
2280
+ * Calculate the current price per unit of liquidity (principal only) for a tick range.
2281
+ * Mirrors the on-chain `liquidity_unit_price_in_asset` helper but performs the
2282
+ * principal aggregation client-side using the fetched ticks account.
2283
+ *
2284
+ * @param lowerTickKey - Inclusive tick key (APY in parts-per-million) for the left boundary
2285
+ * @param upperTickKey - Exclusive tick key for the right boundary
2286
+ * @param ticksOverride - Optional ticks account (defaults to the instance state)
2287
+ * @param syExchangeRateOverride - Optional SY exchange rate (defaults to current flavor rate)
2288
+ * @returns Price per unit of liquidity in underlying asset terms (principal only)
2289
+ */
2290
+ liquidityUnitPriceInAsset({
2291
+ lowerTickKey,
2292
+ upperTickKey,
2293
+ ticksOverride,
2294
+ syExchangeRateOverride,
2295
+ }: {
2296
+ lowerTickKey: number
2297
+ upperTickKey: number
2298
+ ticksOverride?: Ticks
2299
+ syExchangeRateOverride?: number
2300
+ }): number {
2301
+ if (lowerTickKey >= upperTickKey) {
2302
+ throw new Error("lowerTickKey must be less than upperTickKey")
2303
+ }
2304
+
2305
+ const ticksAccount = ticksOverride ?? this.state.ticks
2306
+ if (!ticksAccount) {
2307
+ throw new Error("Ticks account data is unavailable")
2308
+ }
2309
+
2310
+ const relevantIntervals = ticksAccount.ticksTree.filter(
2311
+ (tick) => tick.apyBasePoints >= lowerTickKey && tick.apyBasePoints < upperTickKey,
2312
+ )
2313
+
2314
+ if (relevantIntervals.length === 0) {
2315
+ return 0
2316
+ }
2317
+
2318
+ let totalPrincipalPt = 0n
2319
+ let totalPrincipalSy = 0n
2320
+ let totalShareSupply = 0n
2321
+
2322
+ for (const interval of relevantIntervals) {
2323
+ totalPrincipalPt += interval.principalPt
2324
+ totalPrincipalSy += interval.principalSy
2325
+ totalShareSupply += interval.principalShareSupply
2326
+ }
2327
+
2328
+ if (totalShareSupply === 0n) {
2329
+ return 0
2330
+ }
2331
+
2332
+ const timeFactor = this.secondsRemaining / SECONDS_PER_YEAR
2333
+ const ptAssetValuePerToken = Math.exp(-timeFactor * ticksAccount.currentSpotPrice)
2334
+ const syExchangeRate = syExchangeRateOverride ?? this.currentSyExchangeRate
2335
+
2336
+ const principalPtValue = new Decimal(totalPrincipalPt.toString()).mul(ptAssetValuePerToken)
2337
+ const principalSyValue = new Decimal(totalPrincipalSy.toString()).mul(syExchangeRate)
2338
+ const principalValue = principalPtValue.plus(principalSyValue)
2339
+
2340
+ return principalValue.div(new Decimal(totalShareSupply.toString())).toNumber()
2341
+ }
2342
+
2343
+ /**
2344
+ * Compute fee growth inside a tick range using Uniswap V3 formula
2345
+ *
2346
+ * @param lowerTick - Lower tick boundary
2347
+ * @param upperTick - Upper tick boundary
2348
+ * @param feeGlobalPt - Optional: Override global PT fees (for historical calculations)
2349
+ * @param feeGlobalSy - Optional: Override global SY fees (for historical calculations)
2350
+ * @returns Object with inside_sy and inside_pt fee growth values
2351
+ */
2352
+ static computeFeeInsideForRange({
2353
+ currentTickPrice,
2354
+ lowerTickPrice,
2355
+ upperTickPrice,
2356
+ feeGrowthIndexGlobalPt,
2357
+ feeGrowthIndexGlobalSy,
2358
+ lowerTickOutsidePt,
2359
+ lowerTickOutsideSy,
2360
+ upperTickOutsidePt,
2361
+ upperTickOutsideSy,
2362
+ }: {
2363
+ currentTickPrice: number
2364
+ lowerTickPrice: number
2365
+ upperTickPrice: number
2366
+ feeGrowthIndexGlobalPt: bigint
2367
+ feeGrowthIndexGlobalSy: bigint
2368
+ lowerTickOutsidePt: bigint
2369
+ lowerTickOutsideSy: bigint
2370
+ upperTickOutsidePt: bigint
2371
+ upperTickOutsideSy: bigint
2372
+ }): { insideSy: bigint; insidePt: bigint } {
2373
+ // Uniswap V3 formula for computing fee inside a range
2374
+ let insideSy: bigint
2375
+ let insidePt: bigint
2376
+
2377
+ if (currentTickPrice < lowerTickPrice) {
2378
+ // Price below range: inside = outside(lower) - outside(upper)
2379
+ insideSy = lowerTickOutsideSy - upperTickOutsideSy
2380
+ insidePt = lowerTickOutsidePt - upperTickOutsidePt
2381
+ } else if (currentTickPrice >= upperTickPrice) {
2382
+ // Price above range: inside = outside(upper) - outside(lower)
2383
+ insideSy = upperTickOutsideSy - lowerTickOutsideSy
2384
+ insidePt = upperTickOutsidePt - lowerTickOutsidePt
2385
+ } else {
2386
+ // Price in range: inside = global - outside(lower) - outside(upper)
2387
+ insideSy = feeGrowthIndexGlobalSy - lowerTickOutsideSy - upperTickOutsideSy
2388
+ insidePt = feeGrowthIndexGlobalPt - lowerTickOutsidePt - upperTickOutsidePt
2389
+ }
2390
+
2391
+ return { insideSy, insidePt }
2392
+ }
2393
+
2394
+ /**
2395
+ * Calculate claimable fees for a position
2396
+ * Uses Q64.64 fixed-point math: tokens = floor((L * Δindex) >> 64)
2397
+ *
2398
+ * @param lpBalance - Position's liquidity balance
2399
+ * @param feeInsideLastSy - Last snapshot of inside SY fee growth
2400
+ * @param feeInsideLastPt - Last snapshot of inside PT fee growth
2401
+ * @param currentInsideSy - Current inside SY fee growth
2402
+ * @param currentInsidePt - Current inside PT fee growth
2403
+ * @param tokensOwedSy - Previously owed SY fees
2404
+ * @param tokensOwedPt - Previously owed PT fees
2405
+ * @returns Object with claimable and total fees
2406
+ */
2407
+ static calculateClaimableFees({
2408
+ lpBalance,
2409
+ feeInsideLastSy,
2410
+ feeInsideLastPt,
2411
+ currentInsideSy,
2412
+ currentInsidePt,
2413
+ tokensOwedSy,
2414
+ tokensOwedPt,
2415
+ }: {
2416
+ lpBalance: bigint
2417
+ feeInsideLastSy: bigint
2418
+ feeInsideLastPt: bigint
2419
+ currentInsideSy: bigint
2420
+ currentInsidePt: bigint
2421
+ tokensOwedSy: bigint
2422
+ tokensOwedPt: bigint
2423
+ }): {
2424
+ claimableSy: bigint
2425
+ claimablePt: bigint
2426
+ tokensOwedSy: bigint
2427
+ tokensOwedPt: bigint
2428
+ totalSy: bigint
2429
+ totalPt: bigint
2430
+ } {
2431
+ // Calculate delta (growth since last snapshot)
2432
+ const deltaSy = currentInsideSy > feeInsideLastSy ? currentInsideSy - feeInsideLastSy : 0n
2433
+ const deltaPt = currentInsidePt > feeInsideLastPt ? currentInsidePt - feeInsideLastPt : 0n
2434
+
2435
+ // Calculate claimable fees using Q64.64 math: tokens = floor((L * Δindex) >> 64)
2436
+ const claimableSy = (lpBalance * deltaSy) >> 64n
2437
+ const claimablePt = (lpBalance * deltaPt) >> 64n
2438
+
2439
+ //? TotalPt and TotalSy don't make sense here because tokensOwedSy and tokensOwedPt are always 0
2440
+ // Calculate totals
2441
+ const totalSy = claimableSy + tokensOwedSy
2442
+ const totalPt = claimablePt + tokensOwedPt
2443
+
2444
+ return {
2445
+ claimableSy,
2446
+ claimablePt,
2447
+ tokensOwedSy,
2448
+ tokensOwedPt,
2449
+ totalSy,
2450
+ totalPt,
2451
+ }
2452
+ }
2453
+
2454
+ /**
2455
+ * Calculate historical fee APY for a tick range
2456
+ *
2457
+ * @param feeGrowthDeltaSy - Change in global SY fee growth over period
2458
+ * @param feeGrowthDeltaPt - Change in global PT fee growth over period
2459
+ * @param avgLiquidity - Average liquidity in the range during period
2460
+ * @param hoursElapsed - Number of hours in the period
2461
+ * @returns Object with fee APY metrics
2462
+ */
2463
+ static calculateHistoricalFeeApy({
2464
+ feeGrowthDeltaSy,
2465
+ feeGrowthDeltaPt,
2466
+ avgLiquidity,
2467
+ hoursElapsed,
2468
+ }: {
2469
+ feeGrowthDeltaSy: bigint
2470
+ feeGrowthDeltaPt: bigint
2471
+ avgLiquidity: bigint
2472
+ hoursElapsed: number
2473
+ }): {
2474
+ feeApySy: number
2475
+ feeApyPt: number
2476
+ feeApyTotal: number
2477
+ totalFeesSy: bigint
2478
+ totalFeesPt: bigint
2479
+ } {
2480
+ if (avgLiquidity === 0n || hoursElapsed === 0) {
2481
+ return {
2482
+ feeApySy: 0,
2483
+ feeApyPt: 0,
2484
+ feeApyTotal: 0,
2485
+ totalFeesSy: 0n,
2486
+ totalFeesPt: 0n,
2487
+ }
2488
+ }
2489
+
2490
+ // Calculate total fees earned in the period using Q64.64 math
2491
+ const totalFeesSy = (feeGrowthDeltaSy * avgLiquidity) >> 64n
2492
+ const totalFeesPt = (feeGrowthDeltaPt * avgLiquidity) >> 64n
2493
+
2494
+ // Annualization factor (hours in a year / hours elapsed)
2495
+ const hoursPerYear = 8760
2496
+ const annualizationFactor = hoursPerYear / hoursElapsed
2497
+
2498
+ // Calculate APY as: (fees / avg_liquidity) * annualization_factor * 100
2499
+ const feeApySy = (Number((totalFeesSy * 10000n) / avgLiquidity) / 100) * annualizationFactor
2500
+ const feeApyPt = (Number((totalFeesPt * 10000n) / avgLiquidity) / 100) * annualizationFactor
2501
+ const feeApyTotal = feeApySy + feeApyPt
2502
+
2503
+ return {
2504
+ feeApySy,
2505
+ feeApyPt,
2506
+ feeApyTotal,
2507
+ totalFeesSy,
2508
+ totalFeesPt,
2509
+ }
2510
+ }
2511
+
2512
+ depositYtAccounts({
2513
+ owner,
2514
+ ytSrc: ytSrcParam,
2515
+ }: {
2516
+ owner: PublicKey
2517
+ ytSrc?: PublicKey
2518
+ }): TransactionInstruction {
2519
+ const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
2520
+ const userYieldPosition = this.corePda.yieldPosition({ vault: this.state.vault.selfAddress, owner })
2521
+ const yieldPosition = this.corePda.vaultYieldPosition({ vault: this.state.vault.selfAddress })
2522
+ const escrowYt = this.corePda.escrowYt({ vault: this.state.vault.selfAddress })
2523
+ const mainAccounts = {
2524
+ depositor: owner,
2525
+ ytSrc,
2526
+ vault: this.state.vault.selfAddress,
2527
+ userYieldPosition,
2528
+ escrowYt,
2529
+ tokenProgram: TOKEN_PROGRAM_ID,
2530
+ syProgram: this.state.syProgram,
2531
+ addressLookupTable: this.vault.addressLookupTable,
2532
+ yieldPosition,
2533
+ systemProgram: SystemProgram.programId,
2534
+ eventAuthority: this.coreEventAuthority,
2535
+ program: exponentCore.EXPONENTCORE_PROGRAM_ID,
2536
+ }
2537
+ const remainingAccounts = this.cpiSyAccounts.getSyState
2538
+
2539
+ const depositIx = exponentCore.createDepositYtInstruction(mainAccounts, { amount: 0n })
2540
+ depositIx.keys.push(...remainingAccounts)
2541
+
2542
+ return depositIx
2543
+ }
2544
+
2545
+ withdrawYtAccounts({
2546
+ owner,
2547
+ ytDst: ytDstParam,
2548
+ }: {
2549
+ owner: PublicKey
2550
+ ytDst?: PublicKey
2551
+ }): TransactionInstruction {
2552
+ const ytDst = ytDstParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
2553
+ const userYieldPosition = this.corePda.yieldPosition({ vault: this.state.vault.selfAddress, owner })
2554
+ const yieldPosition = this.corePda.vaultYieldPosition({ vault: this.state.vault.selfAddress })
2555
+ const escrowYt = this.corePda.escrowYt({ vault: this.state.vault.selfAddress })
2556
+ const mainAccounts = {
2557
+ owner,
2558
+ vault: this.state.vault.selfAddress,
2559
+ userYieldPosition,
2560
+ ytDst,
2561
+ escrowYt,
2562
+ tokenProgram: TOKEN_PROGRAM_ID,
2563
+ authority: this.vault.authority,
2564
+ syProgram: this.state.syProgram,
2565
+ addressLookupTable: this.vault.addressLookupTable,
2566
+ yieldPosition,
2567
+ systemProgram: SystemProgram.programId,
2568
+ eventAuthority: this.coreEventAuthority,
2569
+ program: exponentCore.EXPONENTCORE_PROGRAM_ID,
2570
+ }
2571
+ const remainingAccounts = this.cpiSyAccounts.getSyState
2572
+
2573
+ const withdrawIx = exponentCore.createWithdrawYtInstruction(mainAccounts, { amount: 0n })
2574
+ withdrawIx.keys.push(...remainingAccounts)
2575
+
2576
+ return withdrawIx
2577
+ }
2578
+
2579
+ /**
2580
+ * Estimate the yield (fees + emissions) a hypothetical LP position would have earned
2581
+ * between two market snapshots.
2582
+ *
2583
+ * @param marketSnapshotDataCurrent - The more recent market snapshot
2584
+ * @param marketSnapshotDataHistory - The older market snapshot (defines the look-back window)
2585
+ * @param lowerPricePercentage - Lower price bound as a percentage (e.g. 5 for 5%)
2586
+ * @param upperPricePercentage - Upper price bound as a percentage
2587
+ * @param baseTokenAmount - Amount of base tokens in the hypothetical position
2588
+ */
2589
+ static calcEstimatedYieldForPosition(
2590
+ marketSnapshotDataCurrent: MarketSnapshotData,
2591
+ marketSnapshotDataHistory: MarketSnapshotData,
2592
+ lowerPricePercentage: number,
2593
+ upperPricePercentage: number,
2594
+ baseTokenAmount: number,
2595
+ ) {
2596
+ //? Prices in format of 1 + percentage / 100
2597
+ const lowerPrice = 1 + lowerPricePercentage / 100
2598
+ //? Prices in format of 1 + percentage / 100
2599
+ const upperPrice = 1 + upperPricePercentage / 100
2600
+
2601
+ const { syNeeded: userSyProvided, ptNeeded: userPtProvided } = calcDepositSyAndPtFromBaseAmount({
2602
+ expirationTs:
2603
+ Number(marketSnapshotDataCurrent.financials.expirationTs) - marketSnapshotDataCurrent.snapshotTimeUnix,
2604
+ currentSpotPrice: marketSnapshotDataCurrent.currentSpotPrice,
2605
+ syExchangeRate: marketSnapshotDataCurrent.syExchangeRate,
2606
+ lowerPrice,
2607
+ upperPrice,
2608
+ baseTokenAmount: baseTokenAmount,
2609
+ })
2610
+
2611
+ const [lowerFeeGrowthOutsidePtHistory, lowerFeeGrowthOutsideSyHistory] =
2612
+ lowerPrice <= marketSnapshotDataHistory.currentSpotPrice
2613
+ ? [marketSnapshotDataHistory.feeGrowthIndexGlobalPt, marketSnapshotDataHistory.feeGrowthIndexGlobalSy]
2614
+ : [0n, 0n]
2615
+
2616
+ const [upperFeeGrowthOutsidePtHistory, upperFeeGrowthOutsideSyHistory] =
2617
+ upperPrice <= marketSnapshotDataHistory.currentSpotPrice
2618
+ ? [marketSnapshotDataHistory.feeGrowthIndexGlobalPt, marketSnapshotDataHistory.feeGrowthIndexGlobalSy]
2619
+ : [0n, 0n]
2620
+
2621
+ const { insideSy: insideSyHistory, insidePt: insidePtHistory } = MarketThree.computeFeeInsideForRange({
2622
+ currentTickPrice: marketSnapshotDataHistory.currentSpotPrice,
2623
+ lowerTickPrice: lowerPrice,
2624
+ upperTickPrice: upperPrice,
2625
+ feeGrowthIndexGlobalPt: marketSnapshotDataHistory.feeGrowthIndexGlobalPt,
2626
+ feeGrowthIndexGlobalSy: marketSnapshotDataHistory.feeGrowthIndexGlobalSy,
2627
+ lowerTickOutsidePt: lowerFeeGrowthOutsidePtHistory,
2628
+ lowerTickOutsideSy: lowerFeeGrowthOutsideSyHistory,
2629
+ upperTickOutsidePt: upperFeeGrowthOutsidePtHistory,
2630
+ upperTickOutsideSy: upperFeeGrowthOutsideSyHistory,
2631
+ })
2632
+
2633
+ const {
2634
+ liquidityTarget: liquidityTargetCurrent,
2635
+ syNeeded,
2636
+ ptNeeded,
2637
+ } = computeLiquidityTargetAndTokenNeedsForSnapshot(marketSnapshotDataCurrent, {
2638
+ lowerPrice,
2639
+ upperPrice,
2640
+ maxSy: userSyProvided,
2641
+ maxPt: userPtProvided,
2642
+ })
2643
+
2644
+ const { insideSy: insideSyCurrent, insidePt: insidePtCurrent } = MarketThree.computeFeeInsideForRange({
2645
+ currentTickPrice: marketSnapshotDataCurrent.currentSpotPrice,
2646
+ lowerTickPrice: lowerPrice,
2647
+ upperTickPrice: upperPrice,
2648
+ feeGrowthIndexGlobalPt: BigInt(marketSnapshotDataCurrent.feeGrowthIndexGlobalPt),
2649
+ feeGrowthIndexGlobalSy: BigInt(marketSnapshotDataCurrent.feeGrowthIndexGlobalSy),
2650
+ lowerTickOutsidePt: BigInt(lowerFeeGrowthOutsidePtHistory),
2651
+ lowerTickOutsideSy: BigInt(lowerFeeGrowthOutsideSyHistory),
2652
+ upperTickOutsidePt: BigInt(upperFeeGrowthOutsidePtHistory),
2653
+ upperTickOutsideSy: BigInt(upperFeeGrowthOutsideSyHistory),
2654
+ })
2655
+
2656
+ //? Single invocation
2657
+ const { claimablePt: ptExpectedFees, claimableSy: syExpectedFees } = MarketThree.calculateClaimableFees({
2658
+ lpBalance: BigInt(liquidityTargetCurrent),
2659
+ feeInsideLastSy: insideSyHistory,
2660
+ feeInsideLastPt: insidePtHistory,
2661
+ currentInsideSy: insideSyCurrent,
2662
+ currentInsidePt: insidePtCurrent,
2663
+ tokensOwedSy: 0n,
2664
+ tokensOwedPt: 0n,
2665
+ })
2666
+
2667
+ //? As we don't have autocompounding, use 1 as annualization factor
2668
+ const ANNUALIZATION_FACTOR = 1
2669
+
2670
+ //? Convert SY amounts to baseToken: baseToken = syAmount / syExchangeRate
2671
+ const syNeededBaseToken = syNeeded > 0 ? syNeeded * marketSnapshotDataCurrent.syExchangeRate : 0
2672
+ const syExpectedFeesBaseToken =
2673
+ syExpectedFees > 0n ? Number(syExpectedFees) * marketSnapshotDataCurrent.syExchangeRate : 0
2674
+
2675
+ const ptPriceInBaseToken = calcPtPriceInAsset(
2676
+ marketSnapshotDataCurrent.currentSpotPrice,
2677
+ Number(marketSnapshotDataCurrent.financials.expirationTs) - marketSnapshotDataCurrent.snapshotTimeUnix,
2678
+ )
2679
+
2680
+ const ptNeededBaseToken = ptNeeded * ptPriceInBaseToken
2681
+ const ptExpectedFeesBaseToken = Number(ptExpectedFees) * ptPriceInBaseToken
2682
+
2683
+ //? Calculate total baseToken value of the position
2684
+ const totalPositionValueBaseToken = syNeededBaseToken + ptNeededBaseToken
2685
+
2686
+ //? Calculate total fees earned in baseToken
2687
+ const totalFeesBaseToken = syExpectedFeesBaseToken + ptExpectedFeesBaseToken
2688
+
2689
+ //? Calculate unified fee rate: total fees / total position value
2690
+ const totalFeeRate = totalPositionValueBaseToken > 0 ? totalFeesBaseToken / totalPositionValueBaseToken : 0
2691
+
2692
+ //? Annualize the fee rate
2693
+ const totalFeeRateAnnualized = totalFeeRate * ANNUALIZATION_FACTOR
2694
+
2695
+ return {
2696
+ totalFeeRate: totalFeeRateAnnualized,
2697
+ ptExpectedFees,
2698
+ syExpectedFees,
2699
+ expectedFeesBaseToken: totalFeesBaseToken,
2700
+ }
2701
+ }
2702
+
2703
+ /**
2704
+ * Calculate TVL (Total Value Locked) in baseToken for a market
2705
+ *
2706
+ * @param currentSpotPrice - Current spot price in format of 1 + percentage / 100
2707
+ * @param financials - Market financials containing balances and expiration timestamp
2708
+ * @param syExchangeRate - SY exchange rate
2709
+ * @param timestampUnix - Timestamp in seconds (defaults to current time)
2710
+ * @returns Object with TVL breakdown: total TVL, PT liquidity, and SY liquidity in baseToken
2711
+ */
2712
+ static calcTvlInBaseToken(params: {
2713
+ financials: MarketThreeFinancials
2714
+ currentSpotPrice: number
2715
+ syExchangeRate: number
2716
+ timestampUnix?: number
2717
+ }): {
2718
+ tvlInBaseToken: number
2719
+ ptLiquidityInBaseToken: number
2720
+ syLiquidityInBaseToken: number
2721
+ } {
2722
+ const { financials, currentSpotPrice, syExchangeRate, timestampUnix = Date.now() / 1000 } = params
2723
+
2724
+ const secondsRemaining = Math.max(0, Number(financials.expirationTs) - timestampUnix)
2725
+
2726
+ const ptPriceInBaseToken = calcPtPriceInAsset(currentSpotPrice, secondsRemaining)
2727
+
2728
+ const ptLiquidityInBaseToken = Number(financials.ptBalance) * ptPriceInBaseToken
2729
+ const syLiquidityInBaseToken = Number(financials.syBalance) * syExchangeRate
2730
+ const tvlInBaseToken = ptLiquidityInBaseToken + syLiquidityInBaseToken
2731
+
2732
+ return {
2733
+ tvlInBaseToken: Math.round(tvlInBaseToken),
2734
+ ptLiquidityInBaseToken: Math.round(ptLiquidityInBaseToken),
2735
+ syLiquidityInBaseToken: Math.round(syLiquidityInBaseToken),
2736
+ }
2737
+ }
2738
+
2739
+ static calcGlobalFeeRate(
2740
+ marketSnapshotDataCurrent: MarketSnapshotData,
2741
+ marketSnapshotDataHistory: MarketSnapshotData,
2742
+ ) {
2743
+ const {
2744
+ financials: financialsCurrent,
2745
+ feeGrowthIndexGlobalPt: feeGrowthIndexGlobalPtCurrent,
2746
+ feeGrowthIndexGlobalSy: feeGrowthIndexGlobalSyCurrent,
2747
+ currentSpotPrice,
2748
+ currentPrefixSum,
2749
+ syExchangeRate,
2750
+ } = marketSnapshotDataCurrent
2751
+
2752
+ const {
2753
+ feeGrowthIndexGlobalPt: feeGrowthIndexGlobalPtHistory,
2754
+ feeGrowthIndexGlobalSy: feeGrowthIndexGlobalSyHistory,
2755
+ } = marketSnapshotDataHistory
2756
+
2757
+ const ptPriceInBaseToken = calcPtPriceInAsset(
2758
+ currentSpotPrice,
2759
+ Number(financialsCurrent.expirationTs) - marketSnapshotDataCurrent.snapshotTimeUnix,
2760
+ )
2761
+
2762
+ const feePt = Number(feeGrowthIndexGlobalPtCurrent - feeGrowthIndexGlobalPtHistory) / Number(currentPrefixSum)
2763
+ const feePtInBaseToken = feePt * ptPriceInBaseToken
2764
+
2765
+ const feeSy = Number(feeGrowthIndexGlobalSyCurrent - feeGrowthIndexGlobalSyHistory) / Number(currentPrefixSum)
2766
+ const feeSyInBaseToken = feeSy * syExchangeRate
2767
+
2768
+ const totalFeesInBaseToken = feePtInBaseToken + feeSyInBaseToken
2769
+
2770
+ const ptLiquidityInBaseToken = Number(financialsCurrent.ptBalance) * ptPriceInBaseToken
2771
+ const syLiquidityInBaseToken = Number(financialsCurrent.syBalance) * syExchangeRate
2772
+ const tvlInBaseToken = ptLiquidityInBaseToken + syLiquidityInBaseToken
2773
+
2774
+ const totalFeeRate = totalFeesInBaseToken / tvlInBaseToken
2775
+
2776
+ return {
2777
+ totalFeeRate,
2778
+ totalFeesInBaseToken,
2779
+ tvlInBaseToken,
2780
+ }
2781
+ }
2782
+
2783
+ /**
2784
+ * Returns PT and SY amounts that will be received on liquidity removal from a position
2785
+ * If liquidityToRemove is not provided, assume that the full position balance will be removed
2786
+ */
2787
+ getPtAndSyOnWithdrawLiquidity(position: LpPositionCLMM, liquidityToRemove?: bigint) {
2788
+ const { ticks, emissions } = this.state
2789
+
2790
+ return getPtAndSyOnWithdrawLiquidity(emissions, ticks, position, liquidityToRemove ?? position.lpBalance)
2791
+ }
2792
+ }
2793
+
2794
+ /**
2795
+ * Convert apy percents to input format
2796
+ */
2797
+ function convertApyToApyBp(price: number): number {
2798
+ return price * 1e4
2799
+ }
2800
+
2801
+ /** Market snapshot data for CLMM market */
2802
+ export type MarketSnapshotData = {
2803
+ syExchangeRate: number
2804
+ /** Current spot price in format of 1 + percentage / 100 */
2805
+ currentSpotPrice: number
2806
+ financials: MarketThreeFinancials
2807
+ feeGrowthIndexGlobalPt: bigint
2808
+ feeGrowthIndexGlobalSy: bigint
2809
+ currentPrefixSum: bigint
2810
+ snapshotTimeUnix: number
2811
+ }
2812
+
2813
+ /** Wrapper for computeLiquidityTargetAndTokenNeeds that takes a MarketSnapshotData as input */
2814
+ function computeLiquidityTargetAndTokenNeedsForSnapshot(
2815
+ marketSnapshotData: MarketSnapshotData,
2816
+ params: {
2817
+ /** lowerPrice in format of 1 + percentage / 100 */
2818
+ lowerPrice: number
2819
+ /** lowerPrice in format of 1 + percentage / 100 */
2820
+ upperPrice: number
2821
+ maxSy: number
2822
+ maxPt: number
2823
+ },
2824
+ ) {
2825
+ const EPSILON_CLAMP = 1e-18
2826
+
2827
+ const { lowerPrice, upperPrice, maxSy, maxPt } = params
2828
+ const { financials, currentSpotPrice, syExchangeRate, snapshotTimeUnix } = marketSnapshotData
2829
+
2830
+ const expirationTsNumber = Number(financials.expirationTs)
2831
+
2832
+ const secondsRemaining = Math.max(0, expirationTsNumber - snapshotTimeUnix)
2833
+
2834
+ const effSnap = new EffSnap(normalizedTimeRemaining(secondsRemaining), syExchangeRate)
2835
+
2836
+ const priceEffLower = effSnap.getEffectivePrice(lowerPrice)
2837
+ const priceEffUpper = effSnap.getEffectivePrice(upperPrice)
2838
+
2839
+ return computeLiquidityTargetAndTokenNeeds(
2840
+ effSnap,
2841
+ currentSpotPrice,
2842
+ priceEffLower,
2843
+ priceEffUpper,
2844
+ lowerPrice,
2845
+ upperPrice,
2846
+ 0,
2847
+ 0,
2848
+ 0,
2849
+ maxSy,
2850
+ maxPt,
2851
+ EPSILON_CLAMP,
2852
+ )
2853
+ }