@exponent-labs/exponent-sdk 0.9.1 → 0.9.3

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 (1117) hide show
  1. package/build/addressLookupTableUtil.d.ts +13 -13
  2. package/build/addressLookupTableUtil.js +5 -5
  3. package/build/addressLookupTableUtil.js.map +1 -1
  4. package/build/client/clmm/accounts/lpPosition.js +5 -6
  5. package/build/client/clmm/accounts/lpPosition.js.map +1 -1
  6. package/build/client/clmm/accounts/marketThree.js +5 -6
  7. package/build/client/clmm/accounts/marketThree.js.map +1 -1
  8. package/build/client/clmm/accounts/vault.js +5 -6
  9. package/build/client/clmm/accounts/vault.js.map +1 -1
  10. package/build/client/clmm/index.d.ts +1 -2
  11. package/build/client/clmm/instructions/addFarm.js +1 -2
  12. package/build/client/clmm/instructions/addFarm.js.map +1 -1
  13. package/build/client/clmm/instructions/addLiquidity.js +1 -2
  14. package/build/client/clmm/instructions/addLiquidity.js.map +1 -1
  15. package/build/client/clmm/instructions/addMarketEmission.js +1 -2
  16. package/build/client/clmm/instructions/addMarketEmission.js.map +1 -1
  17. package/build/client/clmm/instructions/buyPt.js +1 -2
  18. package/build/client/clmm/instructions/buyPt.js.map +1 -1
  19. package/build/client/clmm/instructions/buyYt.js +1 -2
  20. package/build/client/clmm/instructions/buyYt.js.map +1 -1
  21. package/build/client/clmm/instructions/claimFarmEmission.js +1 -2
  22. package/build/client/clmm/instructions/claimFarmEmission.js.map +1 -1
  23. package/build/client/clmm/instructions/closeMarket.js +1 -2
  24. package/build/client/clmm/instructions/closeMarket.js.map +1 -1
  25. package/build/client/clmm/instructions/depositLiquidity.js +1 -2
  26. package/build/client/clmm/instructions/depositLiquidity.js.map +1 -1
  27. package/build/client/clmm/instructions/initializeMarket.js +1 -2
  28. package/build/client/clmm/instructions/initializeMarket.js.map +1 -1
  29. package/build/client/clmm/instructions/marketAccrueEmission.js +1 -2
  30. package/build/client/clmm/instructions/marketAccrueEmission.js.map +1 -1
  31. package/build/client/clmm/instructions/marketCollectEmission.js +1 -2
  32. package/build/client/clmm/instructions/marketCollectEmission.js.map +1 -1
  33. package/build/client/clmm/instructions/modifyFarm.js +1 -2
  34. package/build/client/clmm/instructions/modifyFarm.js.map +1 -1
  35. package/build/client/clmm/instructions/modifyMarketSetting.js +1 -2
  36. package/build/client/clmm/instructions/modifyMarketSetting.js.map +1 -1
  37. package/build/client/clmm/instructions/sellPt.js +1 -2
  38. package/build/client/clmm/instructions/sellPt.js.map +1 -1
  39. package/build/client/clmm/instructions/sellYt.js +1 -2
  40. package/build/client/clmm/instructions/sellYt.js.map +1 -1
  41. package/build/client/clmm/instructions/tradePt.js +1 -2
  42. package/build/client/clmm/instructions/tradePt.js.map +1 -1
  43. package/build/client/clmm/instructions/tradePtExactOut.js +1 -2
  44. package/build/client/clmm/instructions/tradePtExactOut.js.map +1 -1
  45. package/build/client/clmm/instructions/withdrawLiquidity.js +1 -2
  46. package/build/client/clmm/instructions/withdrawLiquidity.js.map +1 -1
  47. package/build/client/clmm/instructions/wrapperBuyYt.js +1 -2
  48. package/build/client/clmm/instructions/wrapperBuyYt.js.map +1 -1
  49. package/build/client/clmm/instructions/wrapperProvideLiquidity.js +1 -2
  50. package/build/client/clmm/instructions/wrapperProvideLiquidity.js.map +1 -1
  51. package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js +1 -2
  52. package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js.map +1 -1
  53. package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js +1 -2
  54. package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js.map +1 -1
  55. package/build/client/clmm/instructions/wrapperSellYt.js +1 -2
  56. package/build/client/clmm/instructions/wrapperSellYt.js.map +1 -1
  57. package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js +1 -2
  58. package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js.map +1 -1
  59. package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js +1 -2
  60. package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -1
  61. package/build/client/clmm/types/addFarmEvent.d.ts +1 -25
  62. package/build/client/clmm/types/amount.d.ts +1 -19
  63. package/build/client/clmm/types/amount.js +3 -3
  64. package/build/client/clmm/types/amount.js.map +1 -1
  65. package/build/client/clmm/types/buyPtEvent.d.ts +1 -16
  66. package/build/client/clmm/types/buyYtEvent.d.ts +1 -40
  67. package/build/client/clmm/types/claimFarmEmissionsEvent.d.ts +1 -149
  68. package/build/client/clmm/types/claimLimits.d.ts +1 -16
  69. package/build/client/clmm/types/closeMarketEvent.d.ts +1 -16
  70. package/build/client/clmm/types/configurationOptions.d.ts +1 -25
  71. package/build/client/clmm/types/cpiAccounts.d.ts +1 -99
  72. package/build/client/clmm/types/cpiCoreAccounts.d.ts +1 -42
  73. package/build/client/clmm/types/cpiInterfaceContext.d.ts +1 -13
  74. package/build/client/clmm/types/crossingSplit.d.ts +1 -109
  75. package/build/client/clmm/types/depositLiquidityEvent.d.ts +1 -149
  76. package/build/client/clmm/types/depositLiquidityReturnData.d.ts +1 -49
  77. package/build/client/clmm/types/emissionInfo.d.ts +1 -25
  78. package/build/client/clmm/types/farmEmission.d.ts +1 -16
  79. package/build/client/clmm/types/liquidityNetBalanceLimits.d.ts +1 -19
  80. package/build/client/clmm/types/lpFarm.d.ts +1 -30
  81. package/build/client/clmm/types/marketAccrueEmissionEvent.d.ts +1 -134
  82. package/build/client/clmm/types/marketAdminAction.d.ts +1 -306
  83. package/build/client/clmm/types/marketAdminAction.js +3 -3
  84. package/build/client/clmm/types/marketAdminAction.js.map +1 -1
  85. package/build/client/clmm/types/marketCollectEmissionEvent.d.ts +1 -143
  86. package/build/client/clmm/types/marketEmission.d.ts +1 -13
  87. package/build/client/clmm/types/marketEmissions.d.ts +1 -23
  88. package/build/client/clmm/types/marketFinancials.d.ts +1 -19
  89. package/build/client/clmm/types/marketThreeInitEvent.d.ts +1 -52
  90. package/build/client/clmm/types/mergeEvent.d.ts +1 -61
  91. package/build/client/clmm/types/modifiedTick.d.ts +1 -13
  92. package/build/client/clmm/types/modifiedTicks.d.ts +1 -35
  93. package/build/client/clmm/types/modifyFarmEvent.d.ts +1 -31
  94. package/build/client/clmm/types/number.d.ts +1 -1
  95. package/build/client/clmm/types/personalYieldTracker.d.ts +1 -10
  96. package/build/client/clmm/types/personalYieldTrackers.d.ts +1 -19
  97. package/build/client/clmm/types/principalShare.d.ts +1 -42
  98. package/build/client/clmm/types/principalShareTrackers.d.ts +1 -59
  99. package/build/client/clmm/types/sellPtEvent.d.ts +1 -16
  100. package/build/client/clmm/types/sellYtEvent.d.ts +1 -34
  101. package/build/client/clmm/types/stripEvent.d.ts +1 -61
  102. package/build/client/clmm/types/swapDirection.d.ts +1 -1
  103. package/build/client/clmm/types/tradePtEvent.d.ts +1 -90
  104. package/build/client/clmm/types/withdrawLiquidityEvent.d.ts +1 -158
  105. package/build/client/clmm/types/withdrawLiquidityReturnData.d.ts +1 -34
  106. package/build/client/clmm/types/wrapperBuyYtEvent.d.ts +1 -16
  107. package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.d.ts +1 -40
  108. package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.d.ts +1 -37
  109. package/build/client/clmm/types/wrapperProvideLiquidityEvent.d.ts +1 -40
  110. package/build/client/clmm/types/wrapperSellYtEvent.d.ts +1 -16
  111. package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.d.ts +1 -43
  112. package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.d.ts +1 -43
  113. package/build/client/core/accounts/admin.js +5 -6
  114. package/build/client/core/accounts/admin.js.map +1 -1
  115. package/build/client/core/accounts/lpPosition.js +5 -6
  116. package/build/client/core/accounts/lpPosition.js.map +1 -1
  117. package/build/client/core/accounts/marketTwo.js +5 -6
  118. package/build/client/core/accounts/marketTwo.js.map +1 -1
  119. package/build/client/core/accounts/vault.js +5 -6
  120. package/build/client/core/accounts/vault.js.map +1 -1
  121. package/build/client/core/accounts/yieldTokenPosition.js +5 -6
  122. package/build/client/core/accounts/yieldTokenPosition.js.map +1 -1
  123. package/build/client/core/index.d.ts +1 -2
  124. package/build/client/core/instructions/addEmission.js +1 -2
  125. package/build/client/core/instructions/addEmission.js.map +1 -1
  126. package/build/client/core/instructions/addFarm.js +1 -2
  127. package/build/client/core/instructions/addFarm.js.map +1 -1
  128. package/build/client/core/instructions/addLpTokensMetadata.js +1 -2
  129. package/build/client/core/instructions/addLpTokensMetadata.js.map +1 -1
  130. package/build/client/core/instructions/addMarketEmission.js +1 -2
  131. package/build/client/core/instructions/addMarketEmission.js.map +1 -1
  132. package/build/client/core/instructions/buyYt.js +1 -2
  133. package/build/client/core/instructions/buyYt.js.map +1 -1
  134. package/build/client/core/instructions/claimFarmEmissions.js +1 -2
  135. package/build/client/core/instructions/claimFarmEmissions.js.map +1 -1
  136. package/build/client/core/instructions/collectEmission.js +1 -2
  137. package/build/client/core/instructions/collectEmission.js.map +1 -1
  138. package/build/client/core/instructions/collectInterest.js +1 -2
  139. package/build/client/core/instructions/collectInterest.js.map +1 -1
  140. package/build/client/core/instructions/collectTreasuryEmission.js +1 -2
  141. package/build/client/core/instructions/collectTreasuryEmission.js.map +1 -1
  142. package/build/client/core/instructions/collectTreasuryInterest.js +1 -2
  143. package/build/client/core/instructions/collectTreasuryInterest.js.map +1 -1
  144. package/build/client/core/instructions/depositYt.js +1 -2
  145. package/build/client/core/instructions/depositYt.js.map +1 -1
  146. package/build/client/core/instructions/initLpPosition.js +1 -2
  147. package/build/client/core/instructions/initLpPosition.js.map +1 -1
  148. package/build/client/core/instructions/initMarketTwo.js +1 -2
  149. package/build/client/core/instructions/initMarketTwo.js.map +1 -1
  150. package/build/client/core/instructions/initializeVault.js +1 -2
  151. package/build/client/core/instructions/initializeVault.js.map +1 -1
  152. package/build/client/core/instructions/initializeYieldPosition.js +1 -2
  153. package/build/client/core/instructions/initializeYieldPosition.js.map +1 -1
  154. package/build/client/core/instructions/marketCollectEmission.js +1 -2
  155. package/build/client/core/instructions/marketCollectEmission.js.map +1 -1
  156. package/build/client/core/instructions/marketDepositLp.js +1 -2
  157. package/build/client/core/instructions/marketDepositLp.js.map +1 -1
  158. package/build/client/core/instructions/marketTwoDepositLiquidity.js +1 -2
  159. package/build/client/core/instructions/marketTwoDepositLiquidity.js.map +1 -1
  160. package/build/client/core/instructions/marketTwoWithdrawLiquidity.js +1 -2
  161. package/build/client/core/instructions/marketTwoWithdrawLiquidity.js.map +1 -1
  162. package/build/client/core/instructions/marketWithdrawLp.js +1 -2
  163. package/build/client/core/instructions/marketWithdrawLp.js.map +1 -1
  164. package/build/client/core/instructions/merge.js +1 -2
  165. package/build/client/core/instructions/merge.js.map +1 -1
  166. package/build/client/core/instructions/modifyFarm.js +1 -2
  167. package/build/client/core/instructions/modifyFarm.js.map +1 -1
  168. package/build/client/core/instructions/modifyMarketSetting.js +1 -2
  169. package/build/client/core/instructions/modifyMarketSetting.js.map +1 -1
  170. package/build/client/core/instructions/modifyVaultSetting.js +1 -2
  171. package/build/client/core/instructions/modifyVaultSetting.js.map +1 -1
  172. package/build/client/core/instructions/reallocMarket.js +1 -2
  173. package/build/client/core/instructions/reallocMarket.js.map +1 -1
  174. package/build/client/core/instructions/sellYt.js +1 -2
  175. package/build/client/core/instructions/sellYt.js.map +1 -1
  176. package/build/client/core/instructions/stageYtYield.js +1 -2
  177. package/build/client/core/instructions/stageYtYield.js.map +1 -1
  178. package/build/client/core/instructions/strip.js +1 -2
  179. package/build/client/core/instructions/strip.js.map +1 -1
  180. package/build/client/core/instructions/tradePt.js +1 -2
  181. package/build/client/core/instructions/tradePt.js.map +1 -1
  182. package/build/client/core/instructions/withdrawYt.js +1 -2
  183. package/build/client/core/instructions/withdrawYt.js.map +1 -1
  184. package/build/client/core/instructions/wrapperBuyPt.js +1 -2
  185. package/build/client/core/instructions/wrapperBuyPt.js.map +1 -1
  186. package/build/client/core/instructions/wrapperBuyYt.js +1 -2
  187. package/build/client/core/instructions/wrapperBuyYt.js.map +1 -1
  188. package/build/client/core/instructions/wrapperCollectInterest.js +1 -2
  189. package/build/client/core/instructions/wrapperCollectInterest.js.map +1 -1
  190. package/build/client/core/instructions/wrapperMerge.js +1 -2
  191. package/build/client/core/instructions/wrapperMerge.js.map +1 -1
  192. package/build/client/core/instructions/wrapperProvideLiquidity.js +1 -2
  193. package/build/client/core/instructions/wrapperProvideLiquidity.js.map +1 -1
  194. package/build/client/core/instructions/wrapperProvideLiquidityBase.js +1 -2
  195. package/build/client/core/instructions/wrapperProvideLiquidityBase.js.map +1 -1
  196. package/build/client/core/instructions/wrapperProvideLiquidityClassic.js +1 -2
  197. package/build/client/core/instructions/wrapperProvideLiquidityClassic.js.map +1 -1
  198. package/build/client/core/instructions/wrapperSellPt.js +1 -2
  199. package/build/client/core/instructions/wrapperSellPt.js.map +1 -1
  200. package/build/client/core/instructions/wrapperSellYt.js +1 -2
  201. package/build/client/core/instructions/wrapperSellYt.js.map +1 -1
  202. package/build/client/core/instructions/wrapperStrip.js +1 -2
  203. package/build/client/core/instructions/wrapperStrip.js.map +1 -1
  204. package/build/client/core/instructions/wrapperWithdrawLiquidity.js +1 -2
  205. package/build/client/core/instructions/wrapperWithdrawLiquidity.js.map +1 -1
  206. package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js +1 -2
  207. package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -1
  208. package/build/client/core/types/adminAction.d.ts +1 -269
  209. package/build/client/core/types/adminAction.js +3 -3
  210. package/build/client/core/types/adminAction.js.map +1 -1
  211. package/build/client/core/types/amount.d.ts +1 -19
  212. package/build/client/core/types/amount.js +3 -3
  213. package/build/client/core/types/amount.js.map +1 -1
  214. package/build/client/core/types/buyPtEvent.d.ts +1 -19
  215. package/build/client/core/types/buyYtEvent.d.ts +1 -49
  216. package/build/client/core/types/claimFarmEmissionsEvent.d.ts +1 -31
  217. package/build/client/core/types/claimFarmEmissionsEventV2.d.ts +1 -83
  218. package/build/client/core/types/claimLimits.d.ts +1 -16
  219. package/build/client/core/types/collectEmissionEvent.d.ts +1 -25
  220. package/build/client/core/types/collectEmissionEventV2.d.ts +1 -55
  221. package/build/client/core/types/collectInterestEvent.d.ts +1 -22
  222. package/build/client/core/types/collectInterestEventV2.d.ts +1 -52
  223. package/build/client/core/types/collectTreasuryEmissionKind.d.ts +1 -1
  224. package/build/client/core/types/collectTreasuryInterestKind.d.ts +1 -1
  225. package/build/client/core/types/cpiAccounts.d.ts +1 -99
  226. package/build/client/core/types/cpiInterfaceContext.d.ts +1 -13
  227. package/build/client/core/types/depositLiquidityEvent.d.ts +1 -49
  228. package/build/client/core/types/depositLpEvent.d.ts +1 -31
  229. package/build/client/core/types/depositLpEventV2.d.ts +1 -83
  230. package/build/client/core/types/depositYtEvent.d.ts +1 -40
  231. package/build/client/core/types/depositYtEventV2.d.ts +1 -70
  232. package/build/client/core/types/emissionInfo.d.ts +1 -25
  233. package/build/client/core/types/farmEmission.d.ts +1 -16
  234. package/build/client/core/types/initLpPositionEvent.d.ts +1 -25
  235. package/build/client/core/types/initializeYieldPositionEvent.d.ts +1 -16
  236. package/build/client/core/types/liquidityNetBalanceLimits.d.ts +1 -19
  237. package/build/client/core/types/lpFarm.d.ts +1 -30
  238. package/build/client/core/types/marketAdminAction.d.ts +1 -239
  239. package/build/client/core/types/marketAdminAction.js +3 -3
  240. package/build/client/core/types/marketAdminAction.js.map +1 -1
  241. package/build/client/core/types/marketCollectEmissionEvent.d.ts +1 -28
  242. package/build/client/core/types/marketCollectEmissionEventV2.d.ts +1 -80
  243. package/build/client/core/types/marketEmission.d.ts +1 -13
  244. package/build/client/core/types/marketEmissions.d.ts +1 -23
  245. package/build/client/core/types/marketFinancials.d.ts +1 -22
  246. package/build/client/core/types/mergeEvent.d.ts +1 -61
  247. package/build/client/core/types/number.d.ts +1 -1
  248. package/build/client/core/types/personalYieldTracker.d.ts +1 -10
  249. package/build/client/core/types/personalYieldTrackers.d.ts +1 -19
  250. package/build/client/core/types/principleDetails.d.ts +1 -7
  251. package/build/client/core/types/principles.d.ts +1 -70
  252. package/build/client/core/types/sellPtEvent.d.ts +1 -19
  253. package/build/client/core/types/sellYtEvent.d.ts +1 -43
  254. package/build/client/core/types/stageYieldEvent.d.ts +1 -31
  255. package/build/client/core/types/stageYieldEventV2.d.ts +1 -58
  256. package/build/client/core/types/stripEvent.d.ts +1 -61
  257. package/build/client/core/types/tradePtEvent.d.ts +1 -37
  258. package/build/client/core/types/withdrawLiquidityEvent.d.ts +1 -43
  259. package/build/client/core/types/withdrawLpEvent.d.ts +1 -31
  260. package/build/client/core/types/withdrawLpEventV2.d.ts +1 -83
  261. package/build/client/core/types/withdrawYtEvent.d.ts +1 -40
  262. package/build/client/core/types/withdrawYtEventV2.d.ts +1 -70
  263. package/build/client/core/types/wrapperBuyYtEvent.d.ts +1 -19
  264. package/build/client/core/types/wrapperCollectInterestEvent.d.ts +1 -16
  265. package/build/client/core/types/wrapperMergeEvent.d.ts +1 -19
  266. package/build/client/core/types/wrapperProvideLiquidityBaseEvent.d.ts +1 -25
  267. package/build/client/core/types/wrapperProvideLiquidityClassicEvent.d.ts +1 -22
  268. package/build/client/core/types/wrapperProvideLiquidityEvent.d.ts +1 -22
  269. package/build/client/core/types/wrapperSellYtEvent.d.ts +1 -19
  270. package/build/client/core/types/wrapperStripEvent.d.ts +1 -19
  271. package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.d.ts +1 -22
  272. package/build/client/core/types/wrapperWithdrawLiquidityEvent.d.ts +1 -19
  273. package/build/client/core/types/yieldTokenTracker.d.ts +1 -10
  274. package/build/client/orderbook/accounts/cpiAccountsOrderbook.js +5 -6
  275. package/build/client/orderbook/accounts/cpiAccountsOrderbook.js.map +1 -1
  276. package/build/client/orderbook/accounts/vault.js +5 -6
  277. package/build/client/orderbook/accounts/vault.js.map +1 -1
  278. package/build/client/orderbook/index.d.ts +1 -2
  279. package/build/client/orderbook/instructions/collectAdminEmission.js +1 -2
  280. package/build/client/orderbook/instructions/collectAdminEmission.js.map +1 -1
  281. package/build/client/orderbook/instructions/collectAdminFee.js +1 -2
  282. package/build/client/orderbook/instructions/collectAdminFee.js.map +1 -1
  283. package/build/client/orderbook/instructions/collectInterest.js +1 -2
  284. package/build/client/orderbook/instructions/collectInterest.js.map +1 -1
  285. package/build/client/orderbook/instructions/initializeOrderbook.js +1 -2
  286. package/build/client/orderbook/instructions/initializeOrderbook.js.map +1 -1
  287. package/build/client/orderbook/instructions/marketOffer.js +1 -2
  288. package/build/client/orderbook/instructions/marketOffer.js.map +1 -1
  289. package/build/client/orderbook/instructions/postOffer.js +1 -2
  290. package/build/client/orderbook/instructions/postOffer.js.map +1 -1
  291. package/build/client/orderbook/instructions/reallocOrderbookAccount.js +1 -2
  292. package/build/client/orderbook/instructions/reallocOrderbookAccount.js.map +1 -1
  293. package/build/client/orderbook/instructions/removeExpiredOffers.js +1 -2
  294. package/build/client/orderbook/instructions/removeExpiredOffers.js.map +1 -1
  295. package/build/client/orderbook/instructions/removeOffer.js +1 -2
  296. package/build/client/orderbook/instructions/removeOffer.js.map +1 -1
  297. package/build/client/orderbook/instructions/setConfigurationOptions.js +1 -2
  298. package/build/client/orderbook/instructions/setConfigurationOptions.js.map +1 -1
  299. package/build/client/orderbook/instructions/withdrawFunds.js +1 -2
  300. package/build/client/orderbook/instructions/withdrawFunds.js.map +1 -1
  301. package/build/client/orderbook/instructions/wrapperCollectAdminFee.js +1 -2
  302. package/build/client/orderbook/instructions/wrapperCollectAdminFee.js.map +1 -1
  303. package/build/client/orderbook/instructions/wrapperCollectInterest.js +1 -2
  304. package/build/client/orderbook/instructions/wrapperCollectInterest.js.map +1 -1
  305. package/build/client/orderbook/instructions/wrapperMarketOffer.js +1 -2
  306. package/build/client/orderbook/instructions/wrapperMarketOffer.js.map +1 -1
  307. package/build/client/orderbook/instructions/wrapperPostOffer.js +1 -2
  308. package/build/client/orderbook/instructions/wrapperPostOffer.js.map +1 -1
  309. package/build/client/orderbook/instructions/wrapperRemoveOffer.js +1 -2
  310. package/build/client/orderbook/instructions/wrapperRemoveOffer.js.map +1 -1
  311. package/build/client/orderbook/instructions/wrapperWithdrawFunds.js +1 -2
  312. package/build/client/orderbook/instructions/wrapperWithdrawFunds.js.map +1 -1
  313. package/build/client/orderbook/types/amount.d.ts +1 -19
  314. package/build/client/orderbook/types/amount.js +3 -3
  315. package/build/client/orderbook/types/amount.js.map +1 -1
  316. package/build/client/orderbook/types/claimLimits.d.ts +1 -16
  317. package/build/client/orderbook/types/collectAdminEmissionEvent.d.ts +1 -19
  318. package/build/client/orderbook/types/collectAdminFeeEvent.d.ts +1 -19
  319. package/build/client/orderbook/types/collectEmissionEventV2.d.ts +1 -55
  320. package/build/client/orderbook/types/collectInterestEventV2.d.ts +1 -52
  321. package/build/client/orderbook/types/collectUserInterestEvent.d.ts +1 -16
  322. package/build/client/orderbook/types/cpiAccounts.d.ts +1 -99
  323. package/build/client/orderbook/types/cpiInterfaceContext.d.ts +1 -13
  324. package/build/client/orderbook/types/emissionInfo.d.ts +1 -25
  325. package/build/client/orderbook/types/exponentCoreCpiAccounts.d.ts +1 -99
  326. package/build/client/orderbook/types/filledOffersEvent.d.ts +1 -22
  327. package/build/client/orderbook/types/marketOfferEvent.d.ts +1 -74
  328. package/build/client/orderbook/types/mergeEvent.d.ts +1 -61
  329. package/build/client/orderbook/types/number.d.ts +1 -1
  330. package/build/client/orderbook/types/offerOptions.d.ts +1 -13
  331. package/build/client/orderbook/types/offerOptions.js +3 -3
  332. package/build/client/orderbook/types/offerOptions.js.map +1 -1
  333. package/build/client/orderbook/types/offerType.d.ts +1 -1
  334. package/build/client/orderbook/types/orderbookInitEvent.d.ts +1 -28
  335. package/build/client/orderbook/types/postOfferEvent.d.ts +1 -96
  336. package/build/client/orderbook/types/removeOfferEvent.d.ts +1 -28
  337. package/build/client/orderbook/types/setConfigurationOptionsEnum.d.ts +1 -49
  338. package/build/client/orderbook/types/setConfigurationOptionsEnum.js +3 -3
  339. package/build/client/orderbook/types/setConfigurationOptionsEnum.js.map +1 -1
  340. package/build/client/orderbook/types/stripEvent.d.ts +1 -61
  341. package/build/client/orderbook/types/withdrawFundsEvent.d.ts +1 -28
  342. package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.d.ts +1 -13
  343. package/build/client/orderbook/types/wrapperCollectInterestEvent.d.ts +1 -10
  344. package/build/client/orderbook/types/wrapperMarketOfferEvent.d.ts +1 -13
  345. package/build/client/orderbook/types/wrapperPostOfferEvent.d.ts +1 -28
  346. package/build/client/orderbook/types/wrapperRemoveOfferEvent.d.ts +1 -10
  347. package/build/client/orderbook/types/wrapperWithdrawFundsEvent.d.ts +1 -19
  348. package/build/client/orderbook/types/yieldTokenTracker.d.ts +1 -10
  349. package/build/client/vaults/accounts/actionProposal.js +5 -6
  350. package/build/client/vaults/accounts/actionProposal.js.map +1 -1
  351. package/build/client/vaults/accounts/exponentStrategyVault.js +5 -6
  352. package/build/client/vaults/accounts/exponentStrategyVault.js.map +1 -1
  353. package/build/client/vaults/accounts/programConfig.js +5 -6
  354. package/build/client/vaults/accounts/programConfig.js.map +1 -1
  355. package/build/client/vaults/accounts/voteAccount.js +5 -6
  356. package/build/client/vaults/accounts/voteAccount.js.map +1 -1
  357. package/build/client/vaults/accounts/withdrawalAccount.js +5 -6
  358. package/build/client/vaults/accounts/withdrawalAccount.js.map +1 -1
  359. package/build/client/vaults/eventRegistry.d.ts +8 -2
  360. package/build/client/vaults/eventRegistry.js +6 -0
  361. package/build/client/vaults/eventRegistry.js.map +1 -1
  362. package/build/client/vaults/index.d.ts +4 -2
  363. package/build/client/vaults/index.js +3 -0
  364. package/build/client/vaults/index.js.map +1 -1
  365. package/build/client/vaults/instructions/activateProposal.d.ts +2 -0
  366. package/build/client/vaults/instructions/activateProposal.js +3 -2
  367. package/build/client/vaults/instructions/activateProposal.js.map +1 -1
  368. package/build/client/vaults/instructions/addPolicy.js +1 -2
  369. package/build/client/vaults/instructions/addPolicy.js.map +1 -1
  370. package/build/client/vaults/instructions/appendProposalActions.js +1 -2
  371. package/build/client/vaults/instructions/appendProposalActions.js.map +1 -1
  372. package/build/client/vaults/instructions/cancelProposal.d.ts +2 -0
  373. package/build/client/vaults/instructions/cancelProposal.js +3 -2
  374. package/build/client/vaults/instructions/cancelProposal.js.map +1 -1
  375. package/build/client/vaults/instructions/cancelWithdrawal.d.ts +2 -0
  376. package/build/client/vaults/instructions/cancelWithdrawal.js +3 -2
  377. package/build/client/vaults/instructions/cancelWithdrawal.js.map +1 -1
  378. package/build/client/vaults/instructions/collectManagementFee.js +1 -2
  379. package/build/client/vaults/instructions/collectManagementFee.js.map +1 -1
  380. package/build/client/vaults/instructions/depositLiquidity.js +1 -2
  381. package/build/client/vaults/instructions/depositLiquidity.js.map +1 -1
  382. package/build/client/vaults/instructions/executeProposal.d.ts +2 -0
  383. package/build/client/vaults/instructions/executeProposal.js +3 -2
  384. package/build/client/vaults/instructions/executeProposal.js.map +1 -1
  385. package/build/client/vaults/instructions/executeWithdrawal.js +1 -2
  386. package/build/client/vaults/instructions/executeWithdrawal.js.map +1 -1
  387. package/build/client/vaults/instructions/executeWithdrawalFromReserves.d.ts +2 -0
  388. package/build/client/vaults/instructions/executeWithdrawalFromReserves.js +3 -2
  389. package/build/client/vaults/instructions/executeWithdrawalFromReserves.js.map +1 -1
  390. package/build/client/vaults/instructions/fillWithdrawal.js +1 -2
  391. package/build/client/vaults/instructions/fillWithdrawal.js.map +1 -1
  392. package/build/client/vaults/instructions/finalizeProposal.d.ts +2 -0
  393. package/build/client/vaults/instructions/finalizeProposal.js +3 -2
  394. package/build/client/vaults/instructions/finalizeProposal.js.map +1 -1
  395. package/build/client/vaults/instructions/initProposal.js +1 -2
  396. package/build/client/vaults/instructions/initProposal.js.map +1 -1
  397. package/build/client/vaults/instructions/initializePrices.js +1 -2
  398. package/build/client/vaults/instructions/initializePrices.js.map +1 -1
  399. package/build/client/vaults/instructions/initializeVault.js +1 -2
  400. package/build/client/vaults/instructions/initializeVault.js.map +1 -1
  401. package/build/client/vaults/instructions/makeSentienelManager.js +1 -2
  402. package/build/client/vaults/instructions/makeSentienelManager.js.map +1 -1
  403. package/build/client/vaults/instructions/managePrices.js +1 -2
  404. package/build/client/vaults/instructions/managePrices.js.map +1 -1
  405. package/build/client/vaults/instructions/manageVaultSettings.js +1 -2
  406. package/build/client/vaults/instructions/manageVaultSettings.js.map +1 -1
  407. package/build/client/vaults/instructions/managerUpdatePosition.js +1 -2
  408. package/build/client/vaults/instructions/managerUpdatePosition.js.map +1 -1
  409. package/build/client/vaults/instructions/queueWithdrawal.d.ts +2 -0
  410. package/build/client/vaults/instructions/queueWithdrawal.js +3 -2
  411. package/build/client/vaults/instructions/queueWithdrawal.js.map +1 -1
  412. package/build/client/vaults/instructions/removePolicy.js +1 -2
  413. package/build/client/vaults/instructions/removePolicy.js.map +1 -1
  414. package/build/client/vaults/instructions/sentinelSetVaultFlags.d.ts +2 -0
  415. package/build/client/vaults/instructions/sentinelSetVaultFlags.js +3 -2
  416. package/build/client/vaults/instructions/sentinelSetVaultFlags.js.map +1 -1
  417. package/build/client/vaults/instructions/stakeVote.d.ts +2 -0
  418. package/build/client/vaults/instructions/stakeVote.js +3 -2
  419. package/build/client/vaults/instructions/stakeVote.js.map +1 -1
  420. package/build/client/vaults/instructions/unstakeVote.js +1 -2
  421. package/build/client/vaults/instructions/unstakeVote.js.map +1 -1
  422. package/build/client/vaults/instructions/updatePolicy.js +1 -2
  423. package/build/client/vaults/instructions/updatePolicy.js.map +1 -1
  424. package/build/client/vaults/instructions/updatePolicyManager.js +1 -2
  425. package/build/client/vaults/instructions/updatePolicyManager.js.map +1 -1
  426. package/build/client/vaults/instructions/updatePrice.js +1 -2
  427. package/build/client/vaults/instructions/updatePrice.js.map +1 -1
  428. package/build/client/vaults/instructions/validateInteractionHook.js +1 -2
  429. package/build/client/vaults/instructions/validateInteractionHook.js.map +1 -1
  430. package/build/client/vaults/instructions/wrapperAddPolicy.js +1 -2
  431. package/build/client/vaults/instructions/wrapperAddPolicy.js.map +1 -1
  432. package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js +1 -2
  433. package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js.map +1 -1
  434. package/build/client/vaults/instructions/wrapperManageVaultSettings.js +1 -2
  435. package/build/client/vaults/instructions/wrapperManageVaultSettings.js.map +1 -1
  436. package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js +1 -2
  437. package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js.map +1 -1
  438. package/build/client/vaults/instructions/wrapperRemovePolicy.js +1 -2
  439. package/build/client/vaults/instructions/wrapperRemovePolicy.js.map +1 -1
  440. package/build/client/vaults/instructions/wrapperUpdatePolicy.js +1 -2
  441. package/build/client/vaults/instructions/wrapperUpdatePolicy.js.map +1 -1
  442. package/build/client/vaults/types/accountConstraint.d.ts +1 -13
  443. package/build/client/vaults/types/accountConstraintType.d.ts +1 -1
  444. package/build/client/vaults/types/accountConstraintType.js +3 -3
  445. package/build/client/vaults/types/accountConstraintType.js.map +1 -1
  446. package/build/client/vaults/types/allowedSettingsChange.d.ts +1 -54
  447. package/build/client/vaults/types/allowedSettingsChange.js +3 -3
  448. package/build/client/vaults/types/allowedSettingsChange.js.map +1 -1
  449. package/build/client/vaults/types/cancelProposalEvent.d.ts +1 -19
  450. package/build/client/vaults/types/cancelWithdrawalEvent.d.ts +12 -0
  451. package/build/client/vaults/types/cancelWithdrawalEvent.js +29 -0
  452. package/build/client/vaults/types/cancelWithdrawalEvent.js.map +1 -0
  453. package/build/client/vaults/types/clmmPositionEntry.d.ts +1 -80
  454. package/build/client/vaults/types/dataConstraint.d.ts +1 -109
  455. package/build/client/vaults/types/dataOperator.d.ts +1 -1
  456. package/build/client/vaults/types/dataValue.d.ts +1 -73
  457. package/build/client/vaults/types/dataValue.js +3 -3
  458. package/build/client/vaults/types/dataValue.js.map +1 -1
  459. package/build/client/vaults/types/depositLiquidityEvent.d.ts +1 -40
  460. package/build/client/vaults/types/executeProposalEvent.d.ts +1 -19
  461. package/build/client/vaults/types/executeWithdrawalEvent.d.ts +8 -10
  462. package/build/client/vaults/types/executeWithdrawalEvent.js +19 -0
  463. package/build/client/vaults/types/executeWithdrawalEvent.js.map +1 -1
  464. package/build/client/vaults/types/executeWithdrawalFromReservesEvent.d.ts +19 -0
  465. package/build/client/vaults/types/executeWithdrawalFromReservesEvent.js +48 -0
  466. package/build/client/vaults/types/executeWithdrawalFromReservesEvent.js.map +1 -0
  467. package/build/client/vaults/types/fillParam.d.ts +1 -10
  468. package/build/client/vaults/types/finalizeProposalEvent.d.ts +1 -34
  469. package/build/client/vaults/types/hook.d.ts +1 -35
  470. package/build/client/vaults/types/hookCompiledInstruction.d.ts +1 -13
  471. package/build/client/vaults/types/index.d.ts +3 -0
  472. package/build/client/vaults/types/index.js +3 -0
  473. package/build/client/vaults/types/index.js.map +1 -1
  474. package/build/client/vaults/types/instructionConstraint.d.ts +1 -165
  475. package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.d.ts +1 -13
  476. package/build/client/vaults/types/kaminoFarmEntry.d.ts +1 -10
  477. package/build/client/vaults/types/kaminoObligationEntry.d.ts +1 -122
  478. package/build/client/vaults/types/limitedQuantityConstraints.d.ts +1 -7
  479. package/build/client/vaults/types/limitedSpendingLimit.d.ts +1 -97
  480. package/build/client/vaults/types/limitedTimeConstraints.d.ts +1 -61
  481. package/build/client/vaults/types/loopscaleLoanEntry.d.ts +1 -7
  482. package/build/client/vaults/types/loopscaleStrategyEntry.d.ts +1 -7
  483. package/build/client/vaults/types/number.d.ts +1 -1
  484. package/build/client/vaults/types/obligationType.js +3 -3
  485. package/build/client/vaults/types/obligationType.js.map +1 -1
  486. package/build/client/vaults/types/orderbookEntry.d.ts +1 -54
  487. package/build/client/vaults/types/periodV2.d.ts +1 -37
  488. package/build/client/vaults/types/periodV2.js +3 -3
  489. package/build/client/vaults/types/periodV2.js.map +1 -1
  490. package/build/client/vaults/types/permissions.d.ts +1 -7
  491. package/build/client/vaults/types/policyAction.d.ts +1 -40
  492. package/build/client/vaults/types/policyAction.js +3 -3
  493. package/build/client/vaults/types/policyAction.js.map +1 -1
  494. package/build/client/vaults/types/policyCreationPayload.d.ts +1 -260
  495. package/build/client/vaults/types/policyCreationPayload.js +3 -3
  496. package/build/client/vaults/types/policyCreationPayload.js.map +1 -1
  497. package/build/client/vaults/types/policyExpirationArgs.d.ts +1 -19
  498. package/build/client/vaults/types/policyExpirationArgs.js +3 -3
  499. package/build/client/vaults/types/policyExpirationArgs.js.map +1 -1
  500. package/build/client/vaults/types/positionUpdate.js +3 -3
  501. package/build/client/vaults/types/positionUpdate.js.map +1 -1
  502. package/build/client/vaults/types/priceId.d.ts +1 -25
  503. package/build/client/vaults/types/priceId.js +3 -3
  504. package/build/client/vaults/types/priceId.js.map +1 -1
  505. package/build/client/vaults/types/priceType.d.ts +1 -1
  506. package/build/client/vaults/types/proposalAction.d.ts +2 -204
  507. package/build/client/vaults/types/proposalAction.js +6 -3
  508. package/build/client/vaults/types/proposalAction.js.map +1 -1
  509. package/build/client/vaults/types/proposalActionKind.d.ts +1 -1
  510. package/build/client/vaults/types/proposalStatus.d.ts +1 -1
  511. package/build/client/vaults/types/proposalVoteConfig.d.ts +1 -34
  512. package/build/client/vaults/types/proposeActionEvent.d.ts +1 -34
  513. package/build/client/vaults/types/quantityConstraints.d.ts +1 -13
  514. package/build/client/vaults/types/queueWithdrawalEvent.d.ts +11 -0
  515. package/build/client/vaults/types/queueWithdrawalEvent.js +31 -0
  516. package/build/client/vaults/types/queueWithdrawalEvent.js.map +1 -0
  517. package/build/client/vaults/types/reserveFarmMapping.d.ts +1 -13
  518. package/build/client/vaults/types/reservePriceMapping.d.ts +1 -42
  519. package/build/client/vaults/types/settingsChangePolicyCreationPayload.d.ts +1 -77
  520. package/build/client/vaults/types/spendingLimitPolicyCreationPayload.d.ts +1 -130
  521. package/build/client/vaults/types/stakeVoteEvent.d.ts +1 -28
  522. package/build/client/vaults/types/strategyPosition.js +3 -3
  523. package/build/client/vaults/types/strategyPosition.js.map +1 -1
  524. package/build/client/vaults/types/timeConstraints.d.ts +1 -64
  525. package/build/client/vaults/types/tokenAccountBalance.d.ts +1 -45
  526. package/build/client/vaults/types/tokenAccountEntry.d.ts +1 -66
  527. package/build/client/vaults/types/tokenEntry.d.ts +1 -51
  528. package/build/client/vaults/types/unstakeVoteEvent.d.ts +1 -25
  529. package/build/client/vaults/types/updatePriceAction.d.ts +1 -124
  530. package/build/client/vaults/types/updatePriceAction.js +3 -3
  531. package/build/client/vaults/types/updatePriceAction.js.map +1 -1
  532. package/build/client/vaults/types/updatePriceInput.d.ts +1 -10
  533. package/build/client/vaults/types/usageState.d.ts +1 -10
  534. package/build/client/vaults/types/vaultConfig.d.ts +1 -74
  535. package/build/client/vaults/types/vaultFinancials.d.ts +1 -43
  536. package/build/client/vaults/types/vaultFlagAction.d.ts +1 -37
  537. package/build/client/vaults/types/vaultFlagAction.js +3 -3
  538. package/build/client/vaults/types/vaultFlagAction.js.map +1 -1
  539. package/build/client/vaults/types/vaultFlagsUpdatedEvent.d.ts +1 -16
  540. package/build/client/vaults/types/vaultRoleKind.d.ts +1 -1
  541. package/build/client/vaults/types/vaultRoles.d.ts +1 -16
  542. package/build/client/vaults/types/vaultSettingsAction.js +3 -3
  543. package/build/client/vaults/types/vaultSettingsAction.js.map +1 -1
  544. package/build/client/vaults/types/voteChoice.d.ts +1 -1
  545. package/build/client/vaults/types/withdrawalPeriodSettings.d.ts +1 -31
  546. package/build/client/vaults/types/withdrawalPeriodSettings.js +3 -3
  547. package/build/client/vaults/types/withdrawalPeriodSettings.js.map +1 -1
  548. package/build/client/vaults/types/withdrawalTokenFill.d.ts +1 -13
  549. package/build/client/vaults/types/yieldPositionEntry.d.ts +1 -45
  550. package/build/clmm/codamaEvents.d.ts +1 -2
  551. package/build/codamaEvents.d.ts +1 -2
  552. package/build/exponentVaults/aumCalculator.d.ts +0 -2
  553. package/build/exponentVaults/aumCalculator.js +20 -10
  554. package/build/exponentVaults/aumCalculator.js.map +1 -1
  555. package/build/exponentVaults/events.d.ts +1 -2
  556. package/build/exponentVaults/fetcher.js +4 -4
  557. package/build/exponentVaults/fetcher.js.map +1 -1
  558. package/build/exponentVaults/index.d.ts +1 -1
  559. package/build/exponentVaults/index.js +20 -9
  560. package/build/exponentVaults/index.js.map +1 -1
  561. package/build/exponentVaults/kamino-farms.d.ts +0 -2
  562. package/build/exponentVaults/kamino-farms.js +14 -14
  563. package/build/exponentVaults/kamino-farms.js.map +1 -1
  564. package/build/exponentVaults/kamino-markets.d.ts +394 -394
  565. package/build/exponentVaults/kamino-markets.js +2 -2
  566. package/build/exponentVaults/kamino-markets.js.map +1 -1
  567. package/build/exponentVaults/loopscale/helpers.js +6 -7
  568. package/build/exponentVaults/loopscale/helpers.js.map +1 -1
  569. package/build/exponentVaults/loopscale/prepared-transactions.js +1 -2
  570. package/build/exponentVaults/loopscale/prepared-transactions.js.map +1 -1
  571. package/build/exponentVaults/policyBuilders.d.ts +73 -75
  572. package/build/exponentVaults/policyBuilders.js +26 -27
  573. package/build/exponentVaults/policyBuilders.js.map +1 -1
  574. package/build/exponentVaults/policyMatcher.js +6 -7
  575. package/build/exponentVaults/policyMatcher.js.map +1 -1
  576. package/build/exponentVaults/pricePathResolver.js +7 -8
  577. package/build/exponentVaults/pricePathResolver.js.map +1 -1
  578. package/build/exponentVaults/scope-refresh.js +1 -2
  579. package/build/exponentVaults/scope-refresh.js.map +1 -1
  580. package/build/exponentVaults/squadsVaultTxnResolver/helpers.js +6 -7
  581. package/build/exponentVaults/squadsVaultTxnResolver/helpers.js.map +1 -1
  582. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js +5 -6
  583. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js.map +1 -1
  584. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js +1 -2
  585. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js.map +1 -1
  586. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js +1 -2
  587. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js.map +1 -1
  588. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js +1 -2
  589. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js.map +1 -1
  590. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js +1 -2
  591. package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js.map +1 -1
  592. package/build/exponentVaults/squadsVaultTxnResolver/utils.d.ts +1 -3
  593. package/build/exponentVaults/squadsVaultTxnResolver/utils.js +1 -2
  594. package/build/exponentVaults/squadsVaultTxnResolver/utils.js.map +1 -1
  595. package/build/exponentVaults/syncTransaction.d.ts +1 -1
  596. package/build/exponentVaults/syncTransaction.js +4 -4
  597. package/build/exponentVaults/syncTransaction.js.map +1 -1
  598. package/build/exponentVaults/titan-quote.js +1 -2
  599. package/build/exponentVaults/titan-quote.js.map +1 -1
  600. package/build/exponentVaults/vault-instruction-types.d.ts +1 -1
  601. package/build/exponentVaults/vault-interaction.d.ts +58 -2576
  602. package/build/exponentVaults/vault-interaction.js +325 -75
  603. package/build/exponentVaults/vault-interaction.js.map +1 -1
  604. package/build/exponentVaults/vault.d.ts +9 -25
  605. package/build/exponentVaults/vault.js +28 -12
  606. package/build/exponentVaults/vault.js.map +1 -1
  607. package/build/exponentVaults/vaultTransactionBuilder.js +35 -30
  608. package/build/exponentVaults/vaultTransactionBuilder.js.map +1 -1
  609. package/build/flavors.js +19 -20
  610. package/build/flavors.js.map +1 -1
  611. package/build/index.js +17 -7
  612. package/build/index.js.map +1 -1
  613. package/build/market.d.ts +31 -31
  614. package/build/market.js +17 -7
  615. package/build/market.js.map +1 -1
  616. package/build/marketThree.d.ts +42 -48
  617. package/build/marketThree.js +20 -8
  618. package/build/marketThree.js.map +1 -1
  619. package/build/orderbook/codamaEvents.d.ts +1 -2
  620. package/build/orderbook/index.js +17 -7
  621. package/build/orderbook/index.js.map +1 -1
  622. package/build/orderbook/math.d.ts +4 -4
  623. package/build/orderbook/math.js +13 -13
  624. package/build/orderbook/math.js.map +1 -1
  625. package/build/orderbook/orderbook.d.ts +19 -21
  626. package/build/orderbook/orderbook.js +17 -7
  627. package/build/orderbook/orderbook.js.map +1 -1
  628. package/build/orderbook/types.js +17 -7
  629. package/build/orderbook/types.js.map +1 -1
  630. package/build/orderbook/utils.js +6 -7
  631. package/build/orderbook/utils.js.map +1 -1
  632. package/build/syPosition.js +3 -4
  633. package/build/syPosition.js.map +1 -1
  634. package/build/tokenUtil.js +2 -3
  635. package/build/tokenUtil.js.map +1 -1
  636. package/build/utils/altUtil.js +2 -3
  637. package/build/utils/altUtil.js.map +1 -1
  638. package/build/utils/binSolver.js +1 -2
  639. package/build/utils/binSolver.js.map +1 -1
  640. package/build/utils/index.d.ts +2 -2
  641. package/build/utils/index.js +3 -4
  642. package/build/utils/index.js.map +1 -1
  643. package/build/vault.d.ts +11 -12
  644. package/build/vault.js +20 -10
  645. package/build/vault.js.map +1 -1
  646. package/build/ytPosition.d.ts +7 -7
  647. package/build/ytPosition.js +17 -7
  648. package/build/ytPosition.js.map +1 -1
  649. package/package.json +36 -32
  650. package/build/client/vaults/instructions/proposeAction.d.ts +0 -16
  651. package/build/client/vaults/instructions/proposeAction.js +0 -29
  652. package/build/client/vaults/instructions/proposeAction.js.map +0 -1
  653. package/build/exponentVaults/loopscale/client.test.d.ts +0 -1
  654. package/build/exponentVaults/loopscale/client.test.js +0 -183
  655. package/build/exponentVaults/loopscale/client.test.js.map +0 -1
  656. package/build/exponentVaults/loopscale/prepared-transactions.test.d.ts +0 -1
  657. package/build/exponentVaults/loopscale/prepared-transactions.test.js +0 -400
  658. package/build/exponentVaults/loopscale/prepared-transactions.test.js.map +0 -1
  659. package/build/exponentVaults/loopscale/response-plan.d.ts +0 -69
  660. package/build/exponentVaults/loopscale/response-plan.js +0 -141
  661. package/build/exponentVaults/loopscale/response-plan.js.map +0 -1
  662. package/build/exponentVaults/loopscale/response-plan.test.d.ts +0 -1
  663. package/build/exponentVaults/loopscale/response-plan.test.js +0 -139
  664. package/build/exponentVaults/loopscale/response-plan.test.js.map +0 -1
  665. package/build/exponentVaults/loopscale/send-plan.d.ts +0 -75
  666. package/build/exponentVaults/loopscale/send-plan.js +0 -235
  667. package/build/exponentVaults/loopscale/send-plan.js.map +0 -1
  668. package/build/exponentVaults/loopscale-client.d.ts +0 -130
  669. package/build/exponentVaults/loopscale-client.js +0 -489
  670. package/build/exponentVaults/loopscale-client.js.map +0 -1
  671. package/build/exponentVaults/loopscale-client.test.d.ts +0 -1
  672. package/build/exponentVaults/loopscale-client.test.js +0 -162
  673. package/build/exponentVaults/loopscale-client.test.js.map +0 -1
  674. package/build/exponentVaults/loopscale-client.types.d.ts +0 -425
  675. package/build/exponentVaults/loopscale-client.types.js +0 -3
  676. package/build/exponentVaults/loopscale-client.types.js.map +0 -1
  677. package/build/exponentVaults/loopscale-execution.d.ts +0 -125
  678. package/build/exponentVaults/loopscale-execution.js +0 -341
  679. package/build/exponentVaults/loopscale-execution.js.map +0 -1
  680. package/build/exponentVaults/loopscale-execution.test.d.ts +0 -1
  681. package/build/exponentVaults/loopscale-execution.test.js +0 -139
  682. package/build/exponentVaults/loopscale-execution.test.js.map +0 -1
  683. package/build/exponentVaults/loopscale-vault.d.ts +0 -115
  684. package/build/exponentVaults/loopscale-vault.js +0 -275
  685. package/build/exponentVaults/loopscale-vault.js.map +0 -1
  686. package/build/exponentVaults/loopscale-vault.test.d.ts +0 -1
  687. package/build/exponentVaults/loopscale-vault.test.js +0 -102
  688. package/build/exponentVaults/loopscale-vault.test.js.map +0 -1
  689. package/build/exponentVaults/pricePathResolver.test.d.ts +0 -1
  690. package/build/exponentVaults/pricePathResolver.test.js +0 -369
  691. package/build/exponentVaults/pricePathResolver.test.js.map +0 -1
  692. package/build/exponentVaults/vaultTransactionBuilder.test.d.ts +0 -1
  693. package/build/exponentVaults/vaultTransactionBuilder.test.js +0 -214
  694. package/build/exponentVaults/vaultTransactionBuilder.test.js.map +0 -1
  695. package/build/marketThree.test.d.ts +0 -1
  696. package/build/marketThree.test.js +0 -166
  697. package/build/marketThree.test.js.map +0 -1
  698. package/build/utils/binSolver.test.d.ts +0 -1
  699. package/build/utils/binSolver.test.js +0 -16
  700. package/build/utils/binSolver.test.js.map +0 -1
  701. package/jest.config.js +0 -5
  702. package/src/CodamaEventDecoder.ts +0 -151
  703. package/src/addressLookupTableUtil.ts +0 -110
  704. package/src/client/clmm/accounts/lpPosition.ts +0 -143
  705. package/src/client/clmm/accounts/marketThree.ts +0 -274
  706. package/src/client/clmm/accounts/vault.ts +0 -234
  707. package/src/client/clmm/eventRegistry.ts +0 -92
  708. package/src/client/clmm/index.ts +0 -82
  709. package/src/client/clmm/instructions/addFarm.ts +0 -57
  710. package/src/client/clmm/instructions/addLiquidity.ts +0 -78
  711. package/src/client/clmm/instructions/addMarketEmission.ts +0 -50
  712. package/src/client/clmm/instructions/buyPt.ts +0 -73
  713. package/src/client/clmm/instructions/buyYt.ts +0 -80
  714. package/src/client/clmm/instructions/claimFarmEmission.ts +0 -56
  715. package/src/client/clmm/instructions/closeMarket.ts +0 -47
  716. package/src/client/clmm/instructions/depositLiquidity.ts +0 -71
  717. package/src/client/clmm/instructions/initializeMarket.ts +0 -127
  718. package/src/client/clmm/instructions/marketAccrueEmission.ts +0 -39
  719. package/src/client/clmm/instructions/marketCollectEmission.ts +0 -57
  720. package/src/client/clmm/instructions/modifyFarm.ts +0 -55
  721. package/src/client/clmm/instructions/modifyMarketSetting.ts +0 -45
  722. package/src/client/clmm/instructions/sellPt.ts +0 -73
  723. package/src/client/clmm/instructions/sellYt.ts +0 -80
  724. package/src/client/clmm/instructions/tradePt.ts +0 -73
  725. package/src/client/clmm/instructions/tradePtExactOut.ts +0 -75
  726. package/src/client/clmm/instructions/withdrawLiquidity.ts +0 -67
  727. package/src/client/clmm/instructions/wrapperBuyYt.ts +0 -85
  728. package/src/client/clmm/instructions/wrapperProvideLiquidity.ts +0 -100
  729. package/src/client/clmm/instructions/wrapperProvideLiquidityBase.ts +0 -98
  730. package/src/client/clmm/instructions/wrapperProvideLiquidityClassic.ts +0 -86
  731. package/src/client/clmm/instructions/wrapperSellYt.ts +0 -83
  732. package/src/client/clmm/instructions/wrapperWithdrawLiquidity.ts +0 -75
  733. package/src/client/clmm/instructions/wrapperWithdrawLiquidityClassic.ts +0 -69
  734. package/src/client/clmm/types/addFarmEvent.ts +0 -51
  735. package/src/client/clmm/types/amount.ts +0 -51
  736. package/src/client/clmm/types/buyPtEvent.ts +0 -36
  737. package/src/client/clmm/types/buyYtEvent.ts +0 -74
  738. package/src/client/clmm/types/claimFarmEmissionsEvent.ts +0 -94
  739. package/src/client/clmm/types/claimLimits.ts +0 -15
  740. package/src/client/clmm/types/closeMarketEvent.ts +0 -36
  741. package/src/client/clmm/types/configurationOptions.ts +0 -29
  742. package/src/client/clmm/types/cpiAccounts.ts +0 -21
  743. package/src/client/clmm/types/cpiCoreAccounts.ts +0 -15
  744. package/src/client/clmm/types/cpiInterfaceContext.ts +0 -13
  745. package/src/client/clmm/types/crossingSplit.ts +0 -40
  746. package/src/client/clmm/types/depositLiquidityEvent.ts +0 -93
  747. package/src/client/clmm/types/depositLiquidityReturnData.ts +0 -81
  748. package/src/client/clmm/types/emissionInfo.ts +0 -44
  749. package/src/client/clmm/types/farmEmission.ts +0 -31
  750. package/src/client/clmm/types/index.ts +0 -48
  751. package/src/client/clmm/types/liquidityNetBalanceLimits.ts +0 -22
  752. package/src/client/clmm/types/lpFarm.ts +0 -12
  753. package/src/client/clmm/types/marketAccrueEmissionEvent.ts +0 -69
  754. package/src/client/clmm/types/marketAdminAction.ts +0 -239
  755. package/src/client/clmm/types/marketCollectEmissionEvent.ts +0 -83
  756. package/src/client/clmm/types/marketEmission.ts +0 -28
  757. package/src/client/clmm/types/marketEmissions.ts +0 -10
  758. package/src/client/clmm/types/marketFinancials.ts +0 -17
  759. package/src/client/clmm/types/marketThreeInitEvent.ts +0 -92
  760. package/src/client/clmm/types/mergeEvent.ts +0 -118
  761. package/src/client/clmm/types/modifiedTick.ts +0 -13
  762. package/src/client/clmm/types/modifiedTicks.ts +0 -18
  763. package/src/client/clmm/types/modifyFarmEvent.ts +0 -56
  764. package/src/client/clmm/types/number.ts +0 -7
  765. package/src/client/clmm/types/personalYieldTracker.ts +0 -12
  766. package/src/client/clmm/types/personalYieldTrackers.ts +0 -13
  767. package/src/client/clmm/types/principalShare.ts +0 -22
  768. package/src/client/clmm/types/principalShareTrackers.ts +0 -10
  769. package/src/client/clmm/types/sellPtEvent.ts +0 -36
  770. package/src/client/clmm/types/sellYtEvent.ts +0 -69
  771. package/src/client/clmm/types/stripEvent.ts +0 -124
  772. package/src/client/clmm/types/swapDirection.ts +0 -8
  773. package/src/client/clmm/types/tradePtEvent.ts +0 -76
  774. package/src/client/clmm/types/withdrawLiquidityEvent.ts +0 -99
  775. package/src/client/clmm/types/withdrawLiquidityReturnData.ts +0 -27
  776. package/src/client/clmm/types/wrapperBuyYtEvent.ts +0 -36
  777. package/src/client/clmm/types/wrapperProvideLiquidityBaseEvent.ts +0 -60
  778. package/src/client/clmm/types/wrapperProvideLiquidityClassicEvent.ts +0 -58
  779. package/src/client/clmm/types/wrapperProvideLiquidityEvent.ts +0 -60
  780. package/src/client/clmm/types/wrapperSellYtEvent.ts +0 -36
  781. package/src/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.ts +0 -62
  782. package/src/client/clmm/types/wrapperWithdrawLiquidityEvent.ts +0 -62
  783. package/src/client/core/accounts/admin.ts +0 -112
  784. package/src/client/core/accounts/lpPosition.ts +0 -122
  785. package/src/client/core/accounts/marketTwo.ts +0 -234
  786. package/src/client/core/accounts/vault.ts +0 -234
  787. package/src/client/core/accounts/yieldTokenPosition.ts +0 -126
  788. package/src/client/core/eventRegistry.ts +0 -134
  789. package/src/client/core/index.ts +0 -113
  790. package/src/client/core/instructions/addEmission.ts +0 -62
  791. package/src/client/core/instructions/addFarm.ts +0 -53
  792. package/src/client/core/instructions/addLpTokensMetadata.ts +0 -62
  793. package/src/client/core/instructions/addMarketEmission.ts +0 -52
  794. package/src/client/core/instructions/buyYt.ts +0 -79
  795. package/src/client/core/instructions/claimFarmEmissions.ts +0 -54
  796. package/src/client/core/instructions/collectEmission.ts +0 -66
  797. package/src/client/core/instructions/collectInterest.ts +0 -64
  798. package/src/client/core/instructions/collectTreasuryEmission.ts +0 -64
  799. package/src/client/core/instructions/collectTreasuryInterest.ts +0 -62
  800. package/src/client/core/instructions/depositYt.ts +0 -59
  801. package/src/client/core/instructions/initLpPosition.ts +0 -35
  802. package/src/client/core/instructions/initMarketTwo.ts +0 -103
  803. package/src/client/core/instructions/initializeVault.ts +0 -107
  804. package/src/client/core/instructions/initializeYieldPosition.ts +0 -33
  805. package/src/client/core/instructions/marketCollectEmission.ts +0 -55
  806. package/src/client/core/instructions/marketDepositLp.ts +0 -59
  807. package/src/client/core/instructions/marketTwoDepositLiquidity.ts +0 -65
  808. package/src/client/core/instructions/marketTwoWithdrawLiquidity.ts +0 -65
  809. package/src/client/core/instructions/marketWithdrawLp.ts +0 -59
  810. package/src/client/core/instructions/merge.ts +0 -61
  811. package/src/client/core/instructions/modifyFarm.ts +0 -51
  812. package/src/client/core/instructions/modifyMarketSetting.ts +0 -47
  813. package/src/client/core/instructions/modifyVaultSetting.ts +0 -44
  814. package/src/client/core/instructions/reallocMarket.ts +0 -45
  815. package/src/client/core/instructions/sellYt.ts +0 -79
  816. package/src/client/core/instructions/stageYtYield.ts +0 -39
  817. package/src/client/core/instructions/strip.ts +0 -61
  818. package/src/client/core/instructions/tradePt.ts +0 -59
  819. package/src/client/core/instructions/withdrawYt.ts +0 -61
  820. package/src/client/core/instructions/wrapperBuyPt.ts +0 -63
  821. package/src/client/core/instructions/wrapperBuyYt.ts +0 -93
  822. package/src/client/core/instructions/wrapperCollectInterest.ts +0 -63
  823. package/src/client/core/instructions/wrapperMerge.ts +0 -77
  824. package/src/client/core/instructions/wrapperProvideLiquidity.ts +0 -103
  825. package/src/client/core/instructions/wrapperProvideLiquidityBase.ts +0 -81
  826. package/src/client/core/instructions/wrapperProvideLiquidityClassic.ts +0 -77
  827. package/src/client/core/instructions/wrapperSellPt.ts +0 -63
  828. package/src/client/core/instructions/wrapperSellYt.ts +0 -87
  829. package/src/client/core/instructions/wrapperStrip.ts +0 -81
  830. package/src/client/core/instructions/wrapperWithdrawLiquidity.ts +0 -77
  831. package/src/client/core/instructions/wrapperWithdrawLiquidityClassic.ts +0 -73
  832. package/src/client/core/types/adminAction.ts +0 -255
  833. package/src/client/core/types/amount.ts +0 -51
  834. package/src/client/core/types/buyPtEvent.ts +0 -39
  835. package/src/client/core/types/buyYtEvent.ts +0 -95
  836. package/src/client/core/types/claimFarmEmissionsEvent.ts +0 -75
  837. package/src/client/core/types/claimFarmEmissionsEventV2.ts +0 -83
  838. package/src/client/core/types/claimLimits.ts +0 -15
  839. package/src/client/core/types/collectEmissionEvent.ts +0 -51
  840. package/src/client/core/types/collectEmissionEventV2.ts +0 -60
  841. package/src/client/core/types/collectInterestEvent.ts +0 -48
  842. package/src/client/core/types/collectInterestEventV2.ts +0 -57
  843. package/src/client/core/types/collectTreasuryEmissionKind.ts +0 -8
  844. package/src/client/core/types/collectTreasuryInterestKind.ts +0 -8
  845. package/src/client/core/types/cpiAccounts.ts +0 -21
  846. package/src/client/core/types/cpiInterfaceContext.ts +0 -13
  847. package/src/client/core/types/depositLiquidityEvent.ts +0 -101
  848. package/src/client/core/types/depositLpEvent.ts +0 -75
  849. package/src/client/core/types/depositLpEventV2.ts +0 -83
  850. package/src/client/core/types/depositYtEvent.ts +0 -82
  851. package/src/client/core/types/depositYtEventV2.ts +0 -91
  852. package/src/client/core/types/emissionInfo.ts +0 -44
  853. package/src/client/core/types/farmEmission.ts +0 -31
  854. package/src/client/core/types/index.ts +0 -60
  855. package/src/client/core/types/initLpPositionEvent.ts +0 -57
  856. package/src/client/core/types/initializeYieldPositionEvent.ts +0 -43
  857. package/src/client/core/types/liquidityNetBalanceLimits.ts +0 -22
  858. package/src/client/core/types/lpFarm.ts +0 -12
  859. package/src/client/core/types/marketAdminAction.ts +0 -212
  860. package/src/client/core/types/marketCollectEmissionEvent.ts +0 -67
  861. package/src/client/core/types/marketCollectEmissionEventV2.ts +0 -75
  862. package/src/client/core/types/marketEmission.ts +0 -28
  863. package/src/client/core/types/marketEmissions.ts +0 -10
  864. package/src/client/core/types/marketFinancials.ts +0 -19
  865. package/src/client/core/types/mergeEvent.ts +0 -118
  866. package/src/client/core/types/number.ts +0 -7
  867. package/src/client/core/types/personalYieldTracker.ts +0 -12
  868. package/src/client/core/types/personalYieldTrackers.ts +0 -13
  869. package/src/client/core/types/principleDetails.ts +0 -25
  870. package/src/client/core/types/principles.ts +0 -23
  871. package/src/client/core/types/sellPtEvent.ts +0 -39
  872. package/src/client/core/types/sellYtEvent.ts +0 -90
  873. package/src/client/core/types/stageYieldEvent.ts +0 -63
  874. package/src/client/core/types/stageYieldEventV2.ts +0 -69
  875. package/src/client/core/types/stripEvent.ts +0 -124
  876. package/src/client/core/types/tradePtEvent.ts +0 -80
  877. package/src/client/core/types/withdrawLiquidityEvent.ts +0 -97
  878. package/src/client/core/types/withdrawLpEvent.ts +0 -75
  879. package/src/client/core/types/withdrawLpEventV2.ts +0 -83
  880. package/src/client/core/types/withdrawYtEvent.ts +0 -82
  881. package/src/client/core/types/withdrawYtEventV2.ts +0 -91
  882. package/src/client/core/types/wrapperBuyYtEvent.ts +0 -39
  883. package/src/client/core/types/wrapperCollectInterestEvent.ts +0 -37
  884. package/src/client/core/types/wrapperMergeEvent.ts +0 -38
  885. package/src/client/core/types/wrapperProvideLiquidityBaseEvent.ts +0 -43
  886. package/src/client/core/types/wrapperProvideLiquidityClassicEvent.ts +0 -41
  887. package/src/client/core/types/wrapperProvideLiquidityEvent.ts +0 -41
  888. package/src/client/core/types/wrapperSellYtEvent.ts +0 -39
  889. package/src/client/core/types/wrapperStripEvent.ts +0 -38
  890. package/src/client/core/types/wrapperWithdrawLiquidityClassicEvent.ts +0 -41
  891. package/src/client/core/types/wrapperWithdrawLiquidityEvent.ts +0 -39
  892. package/src/client/core/types/yieldTokenTracker.ts +0 -12
  893. package/src/client/orderbook/accounts/cpiAccountsOrderbook.ts +0 -101
  894. package/src/client/orderbook/accounts/vault.ts +0 -234
  895. package/src/client/orderbook/eventRegistry.ts +0 -71
  896. package/src/client/orderbook/index.ts +0 -55
  897. package/src/client/orderbook/instructions/collectAdminEmission.ts +0 -48
  898. package/src/client/orderbook/instructions/collectAdminFee.ts +0 -59
  899. package/src/client/orderbook/instructions/collectInterest.ts +0 -66
  900. package/src/client/orderbook/instructions/initializeOrderbook.ts +0 -104
  901. package/src/client/orderbook/instructions/marketOffer.ts +0 -89
  902. package/src/client/orderbook/instructions/postOffer.ts +0 -96
  903. package/src/client/orderbook/instructions/reallocOrderbookAccount.ts +0 -45
  904. package/src/client/orderbook/instructions/removeExpiredOffers.ts +0 -37
  905. package/src/client/orderbook/instructions/removeOffer.ts +0 -73
  906. package/src/client/orderbook/instructions/setConfigurationOptions.ts +0 -43
  907. package/src/client/orderbook/instructions/withdrawFunds.ts +0 -78
  908. package/src/client/orderbook/instructions/wrapperCollectAdminFee.ts +0 -73
  909. package/src/client/orderbook/instructions/wrapperCollectInterest.ts +0 -65
  910. package/src/client/orderbook/instructions/wrapperMarketOffer.ts +0 -94
  911. package/src/client/orderbook/instructions/wrapperPostOffer.ts +0 -99
  912. package/src/client/orderbook/instructions/wrapperRemoveOffer.ts +0 -75
  913. package/src/client/orderbook/instructions/wrapperWithdrawFunds.ts +0 -80
  914. package/src/client/orderbook/types/amount.ts +0 -51
  915. package/src/client/orderbook/types/claimLimits.ts +0 -15
  916. package/src/client/orderbook/types/collectAdminEmissionEvent.ts +0 -39
  917. package/src/client/orderbook/types/collectAdminFeeEvent.ts +0 -17
  918. package/src/client/orderbook/types/collectEmissionEventV2.ts +0 -60
  919. package/src/client/orderbook/types/collectInterestEventV2.ts +0 -57
  920. package/src/client/orderbook/types/collectUserInterestEvent.ts +0 -36
  921. package/src/client/orderbook/types/cpiAccounts.ts +0 -21
  922. package/src/client/orderbook/types/cpiInterfaceContext.ts +0 -13
  923. package/src/client/orderbook/types/emissionInfo.ts +0 -44
  924. package/src/client/orderbook/types/exponentCoreCpiAccounts.ts +0 -21
  925. package/src/client/orderbook/types/filledOffersEvent.ts +0 -19
  926. package/src/client/orderbook/types/index.ts +0 -30
  927. package/src/client/orderbook/types/marketOfferEvent.ts +0 -72
  928. package/src/client/orderbook/types/mergeEvent.ts +0 -118
  929. package/src/client/orderbook/types/number.ts +0 -7
  930. package/src/client/orderbook/types/offerOptions.ts +0 -56
  931. package/src/client/orderbook/types/offerType.ts +0 -8
  932. package/src/client/orderbook/types/orderbookInitEvent.ts +0 -54
  933. package/src/client/orderbook/types/postOfferEvent.ts +0 -78
  934. package/src/client/orderbook/types/removeOfferEvent.ts +0 -67
  935. package/src/client/orderbook/types/setConfigurationOptionsEnum.ts +0 -116
  936. package/src/client/orderbook/types/stripEvent.ts +0 -124
  937. package/src/client/orderbook/types/withdrawFundsEvent.ts +0 -65
  938. package/src/client/orderbook/types/wrapperCollectAdminFeeEvent.ts +0 -13
  939. package/src/client/orderbook/types/wrapperCollectInterestEvent.ts +0 -25
  940. package/src/client/orderbook/types/wrapperMarketOfferEvent.ts +0 -27
  941. package/src/client/orderbook/types/wrapperPostOfferEvent.ts +0 -72
  942. package/src/client/orderbook/types/wrapperRemoveOfferEvent.ts +0 -25
  943. package/src/client/orderbook/types/wrapperWithdrawFundsEvent.ts +0 -38
  944. package/src/client/orderbook/types/yieldTokenTracker.ts +0 -12
  945. package/src/client/vaults/accounts/actionProposal.ts +0 -144
  946. package/src/client/vaults/accounts/exponentStrategyVault.ts +0 -211
  947. package/src/client/vaults/accounts/programConfig.ts +0 -123
  948. package/src/client/vaults/accounts/voteAccount.ts +0 -132
  949. package/src/client/vaults/accounts/withdrawalAccount.ts +0 -132
  950. package/src/client/vaults/eventRegistry.ts +0 -45
  951. package/src/client/vaults/index.ts +0 -113
  952. package/src/client/vaults/instructions/activateProposal.ts +0 -46
  953. package/src/client/vaults/instructions/addPolicy.ts +0 -57
  954. package/src/client/vaults/instructions/appendProposalActions.ts +0 -47
  955. package/src/client/vaults/instructions/cancelProposal.ts +0 -28
  956. package/src/client/vaults/instructions/cancelWithdrawal.ts +0 -34
  957. package/src/client/vaults/instructions/collectManagementFee.ts +0 -32
  958. package/src/client/vaults/instructions/depositLiquidity.ts +0 -62
  959. package/src/client/vaults/instructions/executeProposal.ts +0 -36
  960. package/src/client/vaults/instructions/executeWithdrawal.ts +0 -58
  961. package/src/client/vaults/instructions/executeWithdrawalFromReserves.ts +0 -66
  962. package/src/client/vaults/instructions/fillWithdrawal.ts +0 -59
  963. package/src/client/vaults/instructions/finalizeProposal.ts +0 -28
  964. package/src/client/vaults/instructions/initProposal.ts +0 -46
  965. package/src/client/vaults/instructions/initializePrices.ts +0 -28
  966. package/src/client/vaults/instructions/initializeVault.ts +0 -148
  967. package/src/client/vaults/instructions/makeSentienelManager.ts +0 -28
  968. package/src/client/vaults/instructions/managePrices.ts +0 -46
  969. package/src/client/vaults/instructions/manageVaultSettings.ts +0 -48
  970. package/src/client/vaults/instructions/managerUpdatePosition.ts +0 -45
  971. package/src/client/vaults/instructions/queueWithdrawal.ts +0 -50
  972. package/src/client/vaults/instructions/removePolicy.ts +0 -44
  973. package/src/client/vaults/instructions/sentinelSetVaultFlags.ts +0 -44
  974. package/src/client/vaults/instructions/stakeVote.ts +0 -57
  975. package/src/client/vaults/instructions/unstakeVote.ts +0 -42
  976. package/src/client/vaults/instructions/updatePolicy.ts +0 -59
  977. package/src/client/vaults/instructions/updatePolicyManager.ts +0 -44
  978. package/src/client/vaults/instructions/updatePrice.ts +0 -42
  979. package/src/client/vaults/instructions/validateInteractionHook.ts +0 -60
  980. package/src/client/vaults/instructions/wrapperAddPolicy.ts +0 -57
  981. package/src/client/vaults/instructions/wrapperExecuteWithdrawal.ts +0 -76
  982. package/src/client/vaults/instructions/wrapperManageVaultSettings.ts +0 -48
  983. package/src/client/vaults/instructions/wrapperManagerUpdatePosition.ts +0 -45
  984. package/src/client/vaults/instructions/wrapperRemovePolicy.ts +0 -44
  985. package/src/client/vaults/instructions/wrapperUpdatePolicy.ts +0 -59
  986. package/src/client/vaults/types/accountConstraint.ts +0 -35
  987. package/src/client/vaults/types/accountConstraintType.ts +0 -93
  988. package/src/client/vaults/types/allowedSettingsChange.ts +0 -136
  989. package/src/client/vaults/types/cancelProposalEvent.ts +0 -47
  990. package/src/client/vaults/types/clmmPositionEntry.ts +0 -37
  991. package/src/client/vaults/types/dataConstraint.ts +0 -16
  992. package/src/client/vaults/types/dataOperator.ts +0 -13
  993. package/src/client/vaults/types/dataValue.ts +0 -119
  994. package/src/client/vaults/types/depositLiquidityEvent.ts +0 -89
  995. package/src/client/vaults/types/executeProposalEvent.ts +0 -47
  996. package/src/client/vaults/types/executeWithdrawalEvent.ts +0 -12
  997. package/src/client/vaults/types/fillParam.ts +0 -12
  998. package/src/client/vaults/types/finalizeProposalEvent.ts +0 -51
  999. package/src/client/vaults/types/hook.ts +0 -40
  1000. package/src/client/vaults/types/hookCompiledInstruction.ts +0 -20
  1001. package/src/client/vaults/types/index.ts +0 -68
  1002. package/src/client/vaults/types/instructionConstraint.ts +0 -33
  1003. package/src/client/vaults/types/internalFundTransferPolicyCreationPayload.ts +0 -35
  1004. package/src/client/vaults/types/kaminoFarmEntry.ts +0 -32
  1005. package/src/client/vaults/types/kaminoObligationEntry.ts +0 -51
  1006. package/src/client/vaults/types/limitedQuantityConstraints.ts +0 -10
  1007. package/src/client/vaults/types/limitedSpendingLimit.ts +0 -35
  1008. package/src/client/vaults/types/limitedTimeConstraints.ts +0 -15
  1009. package/src/client/vaults/types/loopscaleLoanEntry.ts +0 -23
  1010. package/src/client/vaults/types/loopscaleStrategyEntry.ts +0 -23
  1011. package/src/client/vaults/types/number.ts +0 -8
  1012. package/src/client/vaults/types/obligationType.ts +0 -63
  1013. package/src/client/vaults/types/orderbookEntry.ts +0 -50
  1014. package/src/client/vaults/types/periodV2.ts +0 -76
  1015. package/src/client/vaults/types/permissions.ts +0 -8
  1016. package/src/client/vaults/types/policyAction.ts +0 -74
  1017. package/src/client/vaults/types/policyConfig.ts +0 -32
  1018. package/src/client/vaults/types/policyCreationPayload.ts +0 -147
  1019. package/src/client/vaults/types/policyExpirationArgs.ts +0 -67
  1020. package/src/client/vaults/types/positionUpdate.ts +0 -313
  1021. package/src/client/vaults/types/priceId.ts +0 -57
  1022. package/src/client/vaults/types/priceType.ts +0 -23
  1023. package/src/client/vaults/types/programInteractionPolicyCreationPayload.ts +0 -32
  1024. package/src/client/vaults/types/proposalAction.ts +0 -97
  1025. package/src/client/vaults/types/proposalActionKind.ts +0 -11
  1026. package/src/client/vaults/types/proposalStatus.ts +0 -13
  1027. package/src/client/vaults/types/proposalVoteConfig.ts +0 -36
  1028. package/src/client/vaults/types/proposeActionEvent.ts +0 -62
  1029. package/src/client/vaults/types/quantityConstraints.ts +0 -14
  1030. package/src/client/vaults/types/reserveFarmMapping.ts +0 -35
  1031. package/src/client/vaults/types/reservePriceMapping.ts +0 -26
  1032. package/src/client/vaults/types/settingsChangePolicyCreationPayload.ts +0 -14
  1033. package/src/client/vaults/types/spendingLimitPolicyCreationPayload.ts +0 -54
  1034. package/src/client/vaults/types/stakeVoteEvent.ts +0 -54
  1035. package/src/client/vaults/types/strategyPosition.ts +0 -178
  1036. package/src/client/vaults/types/timeConstraints.ts +0 -22
  1037. package/src/client/vaults/types/tokenAccountBalance.ts +0 -35
  1038. package/src/client/vaults/types/tokenAccountEntry.ts +0 -30
  1039. package/src/client/vaults/types/tokenEntry.ts +0 -48
  1040. package/src/client/vaults/types/unstakeVoteEvent.ts +0 -53
  1041. package/src/client/vaults/types/updatePriceAction.ts +0 -268
  1042. package/src/client/vaults/types/updatePriceInput.ts +0 -12
  1043. package/src/client/vaults/types/usageState.ts +0 -12
  1044. package/src/client/vaults/types/vaultConfig.ts +0 -38
  1045. package/src/client/vaults/types/vaultFinancials.ts +0 -40
  1046. package/src/client/vaults/types/vaultFlagAction.ts +0 -75
  1047. package/src/client/vaults/types/vaultFlagsUpdatedEvent.ts +0 -37
  1048. package/src/client/vaults/types/vaultRoleKind.ts +0 -11
  1049. package/src/client/vaults/types/vaultRoles.ts +0 -59
  1050. package/src/client/vaults/types/vaultSettingsAction.ts +0 -533
  1051. package/src/client/vaults/types/voteChoice.ts +0 -9
  1052. package/src/client/vaults/types/withdrawalPeriodSettings.ts +0 -83
  1053. package/src/client/vaults/types/withdrawalTokenFill.ts +0 -35
  1054. package/src/client/vaults/types/yieldPositionEntry.ts +0 -35
  1055. package/src/clmm/codamaEvents.ts +0 -34
  1056. package/src/clmm/index.ts +0 -1
  1057. package/src/codamaEvents.ts +0 -27
  1058. package/src/environment.ts +0 -21
  1059. package/src/exponentVaults/aumCalculator.ts +0 -1350
  1060. package/src/exponentVaults/events.ts +0 -15
  1061. package/src/exponentVaults/fetcher.ts +0 -257
  1062. package/src/exponentVaults/index.ts +0 -322
  1063. package/src/exponentVaults/kamino-farms.ts +0 -538
  1064. package/src/exponentVaults/kamino-markets.ts +0 -363
  1065. package/src/exponentVaults/loopscale/client.ts +0 -808
  1066. package/src/exponentVaults/loopscale/helpers.ts +0 -172
  1067. package/src/exponentVaults/loopscale/index.ts +0 -57
  1068. package/src/exponentVaults/loopscale/prepared-transactions.ts +0 -435
  1069. package/src/exponentVaults/loopscale/prepared-types.ts +0 -73
  1070. package/src/exponentVaults/loopscale/types.ts +0 -466
  1071. package/src/exponentVaults/policyBuilders.ts +0 -1729
  1072. package/src/exponentVaults/policyMatcher.ts +0 -895
  1073. package/src/exponentVaults/pricePathResolver.test.ts +0 -466
  1074. package/src/exponentVaults/pricePathResolver.ts +0 -273
  1075. package/src/exponentVaults/scope-refresh.ts +0 -169
  1076. package/src/exponentVaults/squadsVaultTxnResolver/constants.ts +0 -59
  1077. package/src/exponentVaults/squadsVaultTxnResolver/helpers.ts +0 -355
  1078. package/src/exponentVaults/squadsVaultTxnResolver/index.ts +0 -16
  1079. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.ts +0 -472
  1080. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.ts +0 -33
  1081. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/index.ts +0 -38
  1082. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.ts +0 -83
  1083. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.ts +0 -94
  1084. package/src/exponentVaults/squadsVaultTxnResolver/resolvers/titan.ts +0 -41
  1085. package/src/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.ts +0 -91
  1086. package/src/exponentVaults/squadsVaultTxnResolver/types.ts +0 -171
  1087. package/src/exponentVaults/squadsVaultTxnResolver/utils.ts +0 -3
  1088. package/src/exponentVaults/syncTransaction.ts +0 -500
  1089. package/src/exponentVaults/titan-quote.ts +0 -446
  1090. package/src/exponentVaults/vault-instruction-types.ts +0 -493
  1091. package/src/exponentVaults/vault-interaction.ts +0 -5070
  1092. package/src/exponentVaults/vault.ts +0 -2667
  1093. package/src/exponentVaults/vaultTransactionBuilder.test.ts +0 -256
  1094. package/src/exponentVaults/vaultTransactionBuilder.ts +0 -927
  1095. package/src/flavors.ts +0 -841
  1096. package/src/index.ts +0 -26
  1097. package/src/lpPosition.ts +0 -155
  1098. package/src/market.ts +0 -2432
  1099. package/src/marketThree.test.ts +0 -210
  1100. package/src/marketThree.ts +0 -2861
  1101. package/src/orderbook/codamaEvents.ts +0 -28
  1102. package/src/orderbook/index.ts +0 -13
  1103. package/src/orderbook/math.ts +0 -138
  1104. package/src/orderbook/orderbook.ts +0 -1354
  1105. package/src/orderbook/types.ts +0 -40
  1106. package/src/orderbook/utils.ts +0 -66
  1107. package/src/router.ts +0 -810
  1108. package/src/syPosition.ts +0 -182
  1109. package/src/tokenUtil.ts +0 -23
  1110. package/src/utils/altUtil.ts +0 -52
  1111. package/src/utils/binSolver.test.ts +0 -17
  1112. package/src/utils/binSolver.ts +0 -44
  1113. package/src/utils/index.ts +0 -33
  1114. package/src/utils/ix.ts +0 -7
  1115. package/src/vault.ts +0 -1033
  1116. package/src/ytPosition.ts +0 -319
  1117. package/tsconfig.json +0 -46
@@ -1,1350 +0,0 @@
1
- import { MintLayout } from "@solana/spl-token"
2
- import { Connection, PublicKey } from "@solana/web3.js"
3
- import BN from "bn.js"
4
- import Decimal from "decimal.js"
5
-
6
- import { ExponentFetcher } from "@exponent-labs/exponent-fetcher"
7
- import { ExponentPDA } from "@exponent-labs/exponent-pda"
8
- import type {
9
- ExponentPrice,
10
- ExponentPrices,
11
- ExponentVault as ExponentVaultAccountType,
12
- PriceId,
13
- StrategyPosition,
14
- } from "@exponent-labs/exponent-vaults-fetcher"
15
- import { Fraction, Obligation, Reserve } from "@exponent-labs/kamino-reserve-deserializer"
16
- import { Loan as LoopscaleLoan, Strategy as LoopscaleStrategy } from "@exponent-labs/loopscale-deserializer"
17
-
18
- import { Environment, LOCAL_ENV } from "../environment"
19
- import {
20
- KAMINO_FARM_ACCOUNT_DISCRIMINATOR_LEN,
21
- KAMINO_FARM_GLOBAL_CONFIG_TREASURY_FEE_BPS_OFFSET,
22
- applyKaminoFarmTreasuryFee,
23
- calculateKaminoFarmPrincipalAmount,
24
- decodeKaminoFarmState,
25
- decodeKaminoFarmUserState,
26
- decodeKaminoScopeDatedPrice,
27
- getKaminoFarmScopePricesAddress,
28
- projectKaminoFarmGlobalRewards,
29
- projectKaminoFarmUserRewards,
30
- } from "./kamino-farms"
31
- import { getKaminoFarmsObligationFarm, KAMINO_FARMS_PROGRAM_ID } from "./../../../kamino-lend-standard/src/constants"
32
-
33
- // ============================================================================
34
- // Types
35
- // ============================================================================
36
-
37
- export enum PositionType {
38
- Reserves = "reserves",
39
- TokenAccount = "tokenAccount",
40
- Orderbook = "orderbook",
41
- YieldPosition = "yieldPosition",
42
- KaminoObligation = "kaminoObligation",
43
- ClmmPosition = "clmmPosition",
44
- LoopscaleLoan = "loopscaleLoan",
45
- LoopscaleStrategy = "loopscaleStrategy",
46
- KaminoFarm = "kaminoFarm",
47
- }
48
-
49
- export type AumResult = {
50
- positionType: PositionType
51
- mint: string
52
- aum: bigint
53
- /** Exists only for PositionType.KaminoObligation */
54
- kaminoObligationExposure?: Array<{
55
- mint: string
56
- amount: bigint // negative for borrowed, positive for supplied; value is in raw base units like `aum`
57
- }>
58
- /** Exists only for PositionType.LoopscaleLoan */
59
- loopscaleLoanExposure?: Array<{
60
- mint: string
61
- amount: bigint // negative for debt, positive for collateral; value is in raw base units like `aum`
62
- }>
63
- }
64
-
65
- type TokenAccountEntryTyped = {
66
- tokenMint: PublicKey
67
- balances: Array<{ tokenAccount: PublicKey; priceId: PriceId }>
68
- }
69
-
70
- type OrderbookEntryTyped = {
71
- orderbook: PublicKey
72
- mint: PublicKey
73
- offerIdxVec: number[]
74
- priceIdPt: PriceId
75
- baseMint: PublicKey
76
- }
77
-
78
- type YieldPositionEntryTyped = {
79
- yieldPosition: PublicKey
80
- vault: PublicKey
81
- priceIdPt: PriceId
82
- }
83
-
84
- type ObligationEntryTyped = {
85
- obligation: PublicKey
86
- lendingProgramId: PublicKey
87
- quotePriceId: PriceId
88
- reservePriceMappings: Array<{ reserve: PublicKey; reservePriceId: PriceId }>
89
- reserveFarmMappings: Array<{
90
- reserve: PublicKey
91
- farmKind: number
92
- farmState: PublicKey
93
- }>
94
- minPriceStatusFlags: number
95
- }
96
-
97
- type ClmmPositionEntryTyped = {
98
- lpPosition: PublicKey
99
- market: PublicKey
100
- priceIdPt: PriceId
101
- priceIdSy: PriceId
102
- }
103
-
104
- type LoopscaleLoanEntryTyped = {
105
- loan: PublicKey
106
- }
107
-
108
- type LoopscaleStrategyEntryTyped = {
109
- strategy: PublicKey
110
- }
111
-
112
- type KaminoFarmEntryTyped = {
113
- farmState: PublicKey
114
- userState: PublicKey
115
- }
116
-
117
- type TokenEntryTyped = {
118
- mint: PublicKey
119
- priceId: PriceId
120
- tokenSquadsAccount: PublicKey
121
- tokenAccountVault: PublicKey
122
- }
123
-
124
- type ValuationClock = {
125
- currentSlot: bigint
126
- currentUnixTimestamp: bigint
127
- }
128
-
129
- // ============================================================================
130
- // Constants
131
- // ============================================================================
132
-
133
- const PRECISE_NUMBER_DECIMALS = 12
134
- const PRECISE_NUMBER_SCALE = new Decimal(10).pow(PRECISE_NUMBER_DECIMALS)
135
- const DEFAULT_PUBLIC_KEY = PublicKey.default
136
- const KAMINO_RESERVE_FARM_KIND_COLLATERAL = 0
137
- const KAMINO_RESERVE_FARM_KIND_DEBT = 1
138
-
139
- // ============================================================================
140
- // AumCalculator
141
- // ============================================================================
142
-
143
- export class AumCalculator {
144
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
- private clmmMarketCache = new Map<string, Promise<any>>()
146
- private mintDecimalsCache = new Map<string, Promise<number>>()
147
-
148
- constructor(
149
- private state: ExponentVaultAccountType,
150
- private connection: Connection,
151
- private env: Environment = LOCAL_ENV,
152
- ) {}
153
-
154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
- private async loadClmmMarket(market: PublicKey): Promise<any> {
156
- const key = market.toBase58()
157
- let cached = this.clmmMarketCache.get(key)
158
- if (!cached) {
159
- cached = (async () => {
160
- const { MarketThree } = await import("../marketThree")
161
- return MarketThree.load(this.env, this.connection, market)
162
- })()
163
- this.clmmMarketCache.set(key, cached)
164
- }
165
- return cached
166
- }
167
-
168
- /**
169
- * Total AUM: on-chain tracked base value + value held in strategy positions.
170
- */
171
- getTotalAum(): bigint {
172
- return (
173
- BigInt(this.state.financials.aumInBase.toString()) + BigInt(this.state.financials.aumInBaseInPositions.toString())
174
- )
175
- }
176
-
177
- // ==========================================================================
178
- // Price resolution
179
- // ==========================================================================
180
-
181
- static priceEntryToDecimal(entry: ExponentPrice): Decimal {
182
- const [n0, n1, n2, n3] = entry.price[0]
183
- const raw =
184
- BigInt(n0.toString()) +
185
- (BigInt(n1.toString()) << BigInt(64)) +
186
- (BigInt(n2.toString()) << BigInt(128)) +
187
- (BigInt(n3.toString()) << BigInt(192))
188
- return new Decimal(raw.toString()).div(PRECISE_NUMBER_SCALE)
189
- }
190
-
191
- static resolvePrice(priceId: PriceId, prices: ExponentPrices): Decimal {
192
- const getPrice = (id: bigint): Decimal => {
193
- const entry = prices.prices[Number(id)]
194
- if (!entry) {
195
- throw new Error(`Price not found for id ${id}`)
196
- }
197
- return AumCalculator.priceEntryToDecimal(entry)
198
- }
199
-
200
- if ("simple" in priceId) {
201
- return getPrice(priceId.simple.priceId)
202
- }
203
- if ("multiply" in priceId) {
204
- const ids = priceId.multiply.priceIds
205
- if (ids.length === 0) {
206
- throw new Error("Multiply priceIds cannot be empty")
207
- }
208
- let acc = getPrice(ids[0])
209
- for (const id of ids.slice(1)) {
210
- acc = acc.mul(getPrice(id))
211
- }
212
- return acc
213
- }
214
- throw new Error("Unknown PriceId variant")
215
- }
216
-
217
- static decimalFloorToBigInt(value: Decimal | bigint | number | string): bigint {
218
- const decimalValue = value instanceof Decimal ? value : new Decimal(value.toString())
219
- return BigInt(decimalValue.floor().toFixed(0))
220
- }
221
-
222
- static getPriceIds(priceId: PriceId): bigint[] {
223
- if ("simple" in priceId) {
224
- return [priceId.simple.priceId]
225
- }
226
- if ("multiply" in priceId) {
227
- const ids = priceId.multiply.priceIds
228
- if (ids.length === 0) {
229
- throw new Error("Multiply priceIds cannot be empty")
230
- }
231
- return ids
232
- }
233
- throw new Error("Unknown PriceId variant")
234
- }
235
-
236
- static projectYieldPositionClaimableInterestAfterFee(
237
- yieldPosition: { ytBalance: bigint; interest: { staged: bigint; lastSeenIndex: number } },
238
- coreVault: { finalSyExchangeRate: number; lastSeenSyExchangeRate: number; interestBpsFee: number },
239
- ): bigint {
240
- const projectedUnstagedInterest = AumCalculator.scaleSyToCurrentRate(
241
- AumCalculator.calcEarnedSy(
242
- yieldPosition.ytBalance,
243
- yieldPosition.interest.lastSeenIndex,
244
- coreVault.finalSyExchangeRate,
245
- ),
246
- coreVault.finalSyExchangeRate,
247
- coreVault.lastSeenSyExchangeRate,
248
- )
249
- const grossClaimableInterest = yieldPosition.interest.staged + projectedUnstagedInterest
250
- const treasuryAmount = (grossClaimableInterest * BigInt(coreVault.interestBpsFee) + BigInt(9_999)) / BigInt(10_000)
251
- return grossClaimableInterest - treasuryAmount
252
- }
253
-
254
- static calcEarnedSy(ytBalance: bigint, lastSeenRate: number, currentRate: number): bigint {
255
- if (ytBalance === BigInt(0) || lastSeenRate >= currentRate || lastSeenRate === 0) {
256
- return BigInt(0)
257
- }
258
-
259
- const delta = new Decimal(1).div(lastSeenRate).sub(new Decimal(1).div(currentRate))
260
- return AumCalculator.decimalFloorToBigInt(delta.mul(ytBalance.toString()))
261
- }
262
-
263
- static scaleSyToCurrentRate(syAmount: bigint, finalRate: number, currentRate: number): bigint {
264
- if (syAmount === BigInt(0) || currentRate <= finalRate) {
265
- return syAmount
266
- }
267
-
268
- return AumCalculator.decimalFloorToBigInt(new Decimal(syAmount.toString()).mul(finalRate).div(currentRate))
269
- }
270
-
271
- private async loadMintDecimals(mint: PublicKey): Promise<number> {
272
- const key = mint.toBase58()
273
- let cached = this.mintDecimalsCache.get(key)
274
- if (!cached) {
275
- cached = (async () => {
276
- const mintInfo = await this.connection.getAccountInfo(mint)
277
- if (!mintInfo?.data) {
278
- throw new Error(`Mint not found: ${mint.toBase58()}`)
279
- }
280
- return MintLayout.decode(Buffer.from(mintInfo.data)).decimals
281
- })()
282
- this.mintDecimalsCache.set(key, cached)
283
- }
284
- return cached
285
- }
286
-
287
- private async getCurrentValuationClock(): Promise<ValuationClock> {
288
- const currentSlot = BigInt(await this.connection.getSlot("confirmed"))
289
- const blockTime = await this.connection.getBlockTime(Number(currentSlot))
290
- return {
291
- currentSlot,
292
- currentUnixTimestamp: BigInt(blockTime ?? Math.floor(Date.now() / 1000)),
293
- }
294
- }
295
-
296
- private getPriceInputMint(priceId: PriceId, prices: ExponentPrices): PublicKey {
297
- const ids = AumCalculator.getPriceIds(priceId)
298
- const lastEntry = prices.prices[Number(ids[ids.length - 1])]
299
- if (!lastEntry) {
300
- throw new Error(`Price not found for id ${ids[ids.length - 1]}`)
301
- }
302
- return lastEntry.priceMint
303
- }
304
-
305
- private async resolveInputAmountScale(priceId: PriceId, prices: ExponentPrices): Promise<Decimal> {
306
- const inputMint = this.getPriceInputMint(priceId, prices)
307
- const inputDecimals = await this.loadMintDecimals(inputMint)
308
- return new Decimal(10).pow(inputDecimals)
309
- }
310
-
311
- // ==========================================================================
312
- // Token account balance parsing
313
- // ==========================================================================
314
-
315
- /** Read SPL token amount from account data (offset 64 = after mint(32) + owner(32)) */
316
- static parseTokenAccountAmount(data: Buffer | Uint8Array): bigint {
317
- const u8 = data instanceof Uint8Array ? data : new Uint8Array(data)
318
- if (u8.byteLength < 72) {
319
- throw new Error("SPL token account data too short")
320
- }
321
- return new DataView(u8.buffer, u8.byteOffset, u8.byteLength).getBigUint64(64, true)
322
- }
323
-
324
- static parseU128LE(data: Buffer, offset: number): bigint {
325
- const lo = data.readBigUInt64LE(offset)
326
- const hi = data.readBigUInt64LE(offset + 8)
327
- return lo + (hi << 64n)
328
- }
329
-
330
- // ==========================================================================
331
- // AUM calculation per position type
332
- // ==========================================================================
333
-
334
- /**
335
- * TokenAccount position AUM.
336
- * Fetches each token account balance and multiplies by resolved price.
337
- */
338
- async calculateTokenAccountAum(entry: TokenAccountEntryTyped, prices: ExponentPrices): Promise<AumResult[]> {
339
- const results: AumResult[] = []
340
-
341
- if (entry.balances.length === 0) {
342
- return results
343
- }
344
-
345
- const accountKeys = entry.balances.map((b) => b.tokenAccount)
346
- const accountInfos = await this.connection.getMultipleAccountsInfo(accountKeys)
347
-
348
- let totalAum = BigInt(0)
349
- for (let i = 0; i < entry.balances.length; i++) {
350
- const balance = entry.balances[i]
351
- const info = accountInfos[i]
352
- if (!info?.data) {
353
- continue
354
- }
355
-
356
- try {
357
- const tokenAmount = AumCalculator.parseTokenAccountAmount(Buffer.from(info.data))
358
- const price = AumCalculator.resolvePrice(balance.priceId, prices)
359
- const valueInBase = new Decimal(tokenAmount.toString()).mul(price)
360
- totalAum += AumCalculator.decimalFloorToBigInt(valueInBase)
361
- } catch {
362
- // Skip if price resolution fails
363
- }
364
- }
365
-
366
- results.push({ positionType: PositionType.TokenAccount, mint: entry.tokenMint.toBase58(), aum: totalAum })
367
- return results
368
- }
369
-
370
- /**
371
- * Orderbook position AUM.
372
- * Reads SY exchange rate from raw bytes, iterates tracked offers,
373
- * and calculates SY value per offer following the Rust logic.
374
- */
375
- async calculateOrderbookAum(entry: OrderbookEntryTyped, prices: ExponentPrices): Promise<AumResult[]> {
376
- try {
377
- const fetcher = new ExponentFetcher({ connection: this.connection })
378
- const orderbook = await fetcher.fetchOrderbook(entry.orderbook)
379
-
380
- const syPrice = new Decimal(orderbook.lastSyExchangeRate.toString()).div(PRECISE_NUMBER_SCALE)
381
- const ptPrice = AumCalculator.resolvePrice(entry.priceIdPt, prices)
382
- const ytPrice = Decimal.max(new Decimal(1).sub(ptPrice), new Decimal(0))
383
- const mintPt = new ExponentPDA().mintPt({ vault: orderbook.vault }).toBase58()
384
- const mintYt = new ExponentPDA().mintYt({ vault: orderbook.vault }).toBase58()
385
-
386
- // Find vault's user escrow indices by matching squadsVault address
387
- const vaultEscrowIndices = new Set<number>()
388
- for (let i = 0; i < orderbook.userEscrows.length; i++) {
389
- if (orderbook.userEscrows[i].user.equals(this.state.squadsVault)) {
390
- vaultEscrowIndices.add(i + 1)
391
- }
392
- }
393
-
394
- const aumByMint = new Map<string, Decimal>()
395
-
396
- for (const offerIdx of entry.offerIdxVec) {
397
- const offer = orderbook.offers.find((o) => o.offerIndex === offerIdx)
398
- if (!offer) {
399
- continue
400
- }
401
- if (!vaultEscrowIndices.has(offer.userVaultPointer)) {
402
- continue
403
- }
404
-
405
- const offerMint = entry.mint.toBase58()
406
-
407
- const syInOffer = AumCalculator.getSyInOffer(offer, ptPrice, syPrice)
408
- const valueInBase = syInOffer.mul(syPrice)
409
- aumByMint.set(offerMint, (aumByMint.get(offerMint) ?? new Decimal(0)).add(valueInBase))
410
- }
411
-
412
- const userEscrow = orderbook.userEscrows.find((escrow) => escrow.user.equals(this.state.squadsVault))
413
- if (userEscrow) {
414
- const stagedSy = AumCalculator.projectOrderbookStagedSy(userEscrow, syPrice)
415
- AumCalculator.addOrderbookEscrowValue(aumByMint, entry.mint.toBase58(), userEscrow.syAmount + stagedSy, syPrice)
416
- AumCalculator.addOrderbookEscrowValue(aumByMint, mintPt, userEscrow.ptAmount, ptPrice)
417
- AumCalculator.addOrderbookEscrowValue(aumByMint, mintYt, userEscrow.ytAmount, ytPrice)
418
- }
419
-
420
- return Array.from(aumByMint.entries()).map(([mint, aum]) => ({
421
- positionType: PositionType.Orderbook,
422
- mint,
423
- aum: AumCalculator.decimalFloorToBigInt(aum),
424
- }))
425
- } catch (e) {
426
- console.warn("Failed to calculate orderbook AUM:", e)
427
- return []
428
- }
429
- }
430
-
431
- private static addOrderbookEscrowValue(
432
- aumByMint: Map<string, Decimal>,
433
- mint: string,
434
- amount: bigint,
435
- price: Decimal,
436
- ): void {
437
- if (amount <= BigInt(0) || price.lte(0)) {
438
- return
439
- }
440
-
441
- const valueInBase = new Decimal(amount.toString()).mul(price)
442
- aumByMint.set(mint, (aumByMint.get(mint) ?? new Decimal(0)).add(valueInBase))
443
- }
444
-
445
- private static projectOrderbookStagedSy(
446
- userEscrow: {
447
- staged: bigint
448
- stakedYtAmount: bigint
449
- yieldIndex: number
450
- },
451
- currentSyRate: Decimal,
452
- ): bigint {
453
- if (userEscrow.staged < BigInt(0)) {
454
- return BigInt(0)
455
- }
456
-
457
- const lastSeenSyRate = userEscrow.yieldIndex
458
- if (lastSeenSyRate <= 0) {
459
- return userEscrow.staged
460
- }
461
-
462
- const currentSyRateNumber = currentSyRate.toNumber()
463
- if (currentSyRateNumber <= lastSeenSyRate) {
464
- return userEscrow.staged
465
- }
466
-
467
- const rateDelta = 1 / lastSeenSyRate - 1 / currentSyRateNumber
468
- const interestEarned = Math.floor(rateDelta * Number(userEscrow.stakedYtAmount))
469
- return userEscrow.staged + BigInt(Math.max(interestEarned, 0))
470
- }
471
-
472
- /**
473
- * Calculate the SY-equivalent amount in an offer.
474
- * Mirrors Rust get_sy_in_offer() logic.
475
- */
476
- static getSyInOffer(
477
- offer: { amount: bigint; virtualOffer: boolean; orderTypeFlag: number },
478
- ptPrice: Decimal,
479
- syExchangeRate: Decimal,
480
- ): Decimal {
481
- const amount = new Decimal(offer.amount.toString())
482
- const isBuyYt = offer.orderTypeFlag === 2
483
-
484
- if (offer.virtualOffer) {
485
- if (isBuyYt) {
486
- // PT in offer -> convert to SY
487
- return amount.mul(ptPrice).div(syExchangeRate)
488
- } else {
489
- // SY in offer directly
490
- return amount
491
- }
492
- } else {
493
- if (isBuyYt) {
494
- // SY in offer directly
495
- return amount
496
- } else {
497
- // YT in offer -> convert to SY
498
- const ytToSyRate = new Decimal(1).sub(ptPrice).div(syExchangeRate)
499
- return amount.mul(ytToSyRate)
500
- }
501
- }
502
- }
503
-
504
- /**
505
- * YieldPosition AUM (Exponent core YT).
506
- * YT value = yt_balance * (1 - pt_price)
507
- */
508
- async calculateYieldPositionAum(entry: YieldPositionEntryTyped, prices: ExponentPrices): Promise<AumResult> {
509
- const ytMint = new ExponentPDA().mintYt({ vault: entry.vault }).toBase58()
510
-
511
- try {
512
- const fetcher = new ExponentFetcher({ connection: this.connection })
513
- const [yieldPosition, coreVault] = await Promise.all([
514
- fetcher.fetchYtPosition(entry.yieldPosition),
515
- fetcher.fetchVault(entry.vault),
516
- ])
517
-
518
- if (!yieldPosition) {
519
- return { positionType: PositionType.YieldPosition, mint: ytMint, aum: BigInt(0) }
520
- }
521
-
522
- const ptPrice = AumCalculator.resolvePrice(entry.priceIdPt, prices)
523
- const ytValueFactor = new Decimal(1).sub(ptPrice)
524
- let valueInBase = new Decimal(0)
525
-
526
- if (ytValueFactor.gt(0)) {
527
- valueInBase = valueInBase.add(new Decimal(yieldPosition.ytBalance.toString()).mul(ytValueFactor))
528
- }
529
-
530
- if (yieldPosition.ytBalance > BigInt(0) || yieldPosition.interest.staged > BigInt(0)) {
531
- const netClaimableInterest = AumCalculator.projectYieldPositionClaimableInterestAfterFee(
532
- yieldPosition,
533
- coreVault,
534
- )
535
- valueInBase = valueInBase.add(
536
- new Decimal(netClaimableInterest.toString()).mul(new Decimal(coreVault.lastSeenSyExchangeRate.toString())),
537
- )
538
- }
539
-
540
- return { positionType: PositionType.YieldPosition, mint: ytMint, aum: AumCalculator.decimalFloorToBigInt(valueInBase) }
541
- } catch (e) {
542
- console.warn("Failed to calculate yield position AUM:", e)
543
- return { positionType: PositionType.YieldPosition, mint: ytMint, aum: BigInt(0) }
544
- }
545
- }
546
-
547
- /**
548
- * Kamino obligation position AUM.
549
- * AUM = sum(collateral market values in base) - sum(debt market values in base).
550
- *
551
- * In practice, obligation marketValueSf values are stale for our use case, so
552
- * we derive each side directly from the current Kamino Reserve accounts.
553
- */
554
- async calculateObligationAum(
555
- entry: ObligationEntryTyped,
556
- prices: ExponentPrices,
557
- valuationClock: ValuationClock,
558
- ): Promise<AumResult> {
559
- try {
560
- const obligation = await Obligation.fetch(this.connection, entry.obligation, entry.lendingProgramId)
561
- if (!obligation) {
562
- return {
563
- positionType: PositionType.KaminoObligation,
564
- mint: this.state.underlyingMint.toBase58(),
565
- aum: BigInt(0),
566
- }
567
- }
568
-
569
- const defaultKey = PublicKey.default
570
-
571
- // Filter active deposits (collateral)
572
- const collateralValues = obligation.deposits
573
- .filter((d) => !d.depositReserve.equals(defaultKey) && !d.depositedAmount.isZero())
574
- .map((d) => ({
575
- reserve: d.depositReserve,
576
- rawAmount: d.depositedAmount,
577
- isDeposit: true as const,
578
- }))
579
-
580
- // Filter active borrows (debt)
581
- const debtValues = obligation.borrows
582
- .filter((b) => !b.borrowReserve.equals(defaultKey) && !b.borrowedAmountSf.isZero())
583
- .map((b) => ({
584
- reserve: b.borrowReserve,
585
- rawAmount: b.borrowedAmountSf,
586
- isDeposit: false as const,
587
- }))
588
-
589
- const allValues = [...collateralValues, ...debtValues]
590
- let reserveMap: Map<string, Reserve> | undefined
591
- const reserveKeysToFetch = new Set<string>()
592
- for (const value of allValues) {
593
- reserveKeysToFetch.add(value.reserve.toBase58())
594
- }
595
- for (const mapping of entry.reservePriceMappings) {
596
- reserveKeysToFetch.add(mapping.reserve.toBase58())
597
- }
598
- for (const reserveFarmMapping of entry.reserveFarmMappings ?? []) {
599
- reserveKeysToFetch.add(reserveFarmMapping.reserve.toBase58())
600
- }
601
-
602
- if (reserveKeysToFetch.size > 0) {
603
- const uniqueReserves = Array.from(reserveKeysToFetch)
604
- const reserveKeys = uniqueReserves.map((k) => new PublicKey(k))
605
- const reserves = await Reserve.fetchMultiple(this.connection, reserveKeys, entry.lendingProgramId)
606
- reserveMap = new Map()
607
- for (let i = 0; i < reserveKeys.length; i++) {
608
- if (reserves[i]) {
609
- reserveMap.set(reserveKeys[i].toBase58(), reserves[i]!)
610
- }
611
- }
612
- }
613
-
614
- const kaminoObligationExposure = await this.buildKaminoObligationExposure(
615
- obligation.deposits,
616
- obligation.borrows,
617
- entry,
618
- prices,
619
- reserveMap,
620
- )
621
- const collateralBase = await this.calculateSideInBase(collateralValues, entry, prices, reserveMap)
622
- const debtBase = await this.calculateSideInBase(debtValues, entry, prices, reserveMap)
623
- const delegatedRewardBase = await this.calculateDelegatedFarmRewardAumInBase(
624
- entry,
625
- obligation,
626
- prices,
627
- reserveMap,
628
- valuationClock,
629
- )
630
-
631
- const aumDecimal = Decimal.max(collateralBase.sub(debtBase).add(delegatedRewardBase), new Decimal(0))
632
-
633
- return {
634
- positionType: PositionType.KaminoObligation,
635
- mint: this.state.underlyingMint.toBase58(),
636
- aum: AumCalculator.decimalFloorToBigInt(aumDecimal),
637
- kaminoObligationExposure,
638
- }
639
- } catch (e) {
640
- console.warn("Failed to calculate obligation AUM:", e)
641
- return {
642
- positionType: PositionType.KaminoObligation,
643
- mint: this.state.underlyingMint.toBase58(),
644
- aum: BigInt(0),
645
- }
646
- }
647
- }
648
-
649
- private async buildKaminoObligationExposure(
650
- deposits: Obligation["deposits"],
651
- borrows: Obligation["borrows"],
652
- entry: ObligationEntryTyped,
653
- prices: ExponentPrices,
654
- reserveMap?: Map<string, Reserve>,
655
- ): Promise<Array<{ mint: string; amount: bigint }>> {
656
- const exposureByMint = new Map<string, bigint>()
657
- const defaultKey = PublicKey.default
658
- const quotePrice = AumCalculator.resolvePrice(entry.quotePriceId, prices)
659
- const quoteInputMint = this.getPriceInputMint(entry.quotePriceId, prices)
660
-
661
- for (const deposit of deposits) {
662
- if (deposit.depositReserve.equals(defaultKey) || deposit.depositedAmount.isZero()) {
663
- continue
664
- }
665
-
666
- const reserve = reserveMap?.get(deposit.depositReserve.toBase58())
667
- if (!reserve) {
668
- continue
669
- }
670
- const mapping = entry.reservePriceMappings.find((candidate) => candidate.reserve.equals(deposit.depositReserve))
671
- if (!mapping) {
672
- continue
673
- }
674
-
675
- const mint = reserve.liquidity.mintPubkey.toBase58()
676
- const amount = BigInt(
677
- this.calculateReserveAmountInBase(
678
- reserve,
679
- deposit.depositedAmount,
680
- true,
681
- mapping,
682
- prices,
683
- quotePrice,
684
- quoteInputMint,
685
- )
686
- .floor()
687
- .toString(),
688
- )
689
- exposureByMint.set(mint, (exposureByMint.get(mint) ?? BigInt(0)) + amount)
690
- }
691
-
692
- for (const borrow of borrows) {
693
- if (borrow.borrowReserve.equals(defaultKey) || borrow.borrowedAmountSf.isZero()) {
694
- continue
695
- }
696
-
697
- const reserve = reserveMap?.get(borrow.borrowReserve.toBase58())
698
- if (!reserve) {
699
- continue
700
- }
701
- const mapping = entry.reservePriceMappings.find((candidate) => candidate.reserve.equals(borrow.borrowReserve))
702
- if (!mapping) {
703
- continue
704
- }
705
-
706
- const mint = reserve.liquidity.mintPubkey.toBase58()
707
- const amount = BigInt(
708
- this.calculateReserveAmountInBase(
709
- reserve,
710
- borrow.borrowedAmountSf,
711
- false,
712
- mapping,
713
- prices,
714
- quotePrice,
715
- quoteInputMint,
716
- )
717
- .floor()
718
- .toString(),
719
- )
720
- exposureByMint.set(mint, (exposureByMint.get(mint) ?? BigInt(0)) - amount)
721
- }
722
-
723
- return Array.from(exposureByMint.entries()).map(([mint, amount]) => ({ mint, amount }))
724
- }
725
-
726
- private calculateKaminoFarmRewardValueInBase(params: {
727
- farm: ReturnType<typeof decodeKaminoFarmState>
728
- user: ReturnType<typeof decodeKaminoFarmUserState>
729
- globalConfigData: Buffer
730
- scopePriceData?: Buffer | null
731
- prices: ExponentPrices
732
- valuationClock: ValuationClock
733
- }): Decimal {
734
- const treasuryFeeBps = params.globalConfigData.readBigUInt64LE(
735
- KAMINO_FARM_ACCOUNT_DISCRIMINATOR_LEN + KAMINO_FARM_GLOBAL_CONFIG_TREASURY_FEE_BPS_OFFSET,
736
- )
737
- const scopePrice = params.scopePriceData
738
- ? decodeKaminoScopeDatedPrice(params.scopePriceData, params.farm.scopeOraclePriceId)
739
- : null
740
- const projectedRewards = projectKaminoFarmUserRewards(
741
- params.farm,
742
- params.user,
743
- projectKaminoFarmGlobalRewards(params.farm, scopePrice, params.valuationClock),
744
- )
745
-
746
- let rewardValueInBase = new Decimal(0)
747
- for (let rewardIndex = 0; rewardIndex < params.farm.numRewardTokens; rewardIndex += 1) {
748
- const rewardMint = projectedRewards.projectedRewardInfos[rewardIndex].rewardMint
749
- const rewardPriceId = this.resolveTrackedMintPriceId(rewardMint)
750
- if (!rewardPriceId) {
751
- throw new Error(`Missing Exponent price for Kamino farm reward mint ${rewardMint.toBase58()}`)
752
- }
753
-
754
- const netRewardAmount = applyKaminoFarmTreasuryFee(
755
- projectedRewards.projectedRewardsIssuedUnclaimed[rewardIndex],
756
- treasuryFeeBps,
757
- )
758
- rewardValueInBase = rewardValueInBase.add(
759
- new Decimal(netRewardAmount.toString()).mul(AumCalculator.resolvePrice(rewardPriceId, params.prices)),
760
- )
761
- }
762
-
763
- return rewardValueInBase
764
- }
765
-
766
- private async calculateDelegatedFarmRewardAumInBase(
767
- entry: ObligationEntryTyped,
768
- obligation: Obligation,
769
- prices: ExponentPrices,
770
- reserveMap: Map<string, Reserve> | undefined,
771
- valuationClock: ValuationClock,
772
- ): Promise<Decimal> {
773
- if ((entry.reserveFarmMappings?.length ?? 0) === 0) {
774
- return new Decimal(0)
775
- }
776
-
777
- const accountKeys = new Map<string, PublicKey>()
778
- for (const reserveFarmMapping of entry.reserveFarmMappings) {
779
- accountKeys.set(reserveFarmMapping.farmState.toBase58(), reserveFarmMapping.farmState)
780
- const userState = getKaminoFarmsObligationFarm(
781
- entry.obligation,
782
- reserveFarmMapping.farmState,
783
- KAMINO_FARMS_PROGRAM_ID,
784
- )
785
- accountKeys.set(userState.toBase58(), userState)
786
- }
787
-
788
- const uniqueAccountKeys = [...accountKeys.values()]
789
- const accountInfos = uniqueAccountKeys.length > 0
790
- ? await this.connection.getMultipleAccountsInfo(uniqueAccountKeys)
791
- : []
792
- const accountInfoMap = new Map<string, Buffer | null>()
793
- for (let index = 0; index < uniqueAccountKeys.length; index += 1) {
794
- accountInfoMap.set(uniqueAccountKeys[index].toBase58(), accountInfos[index]?.data ? Buffer.from(accountInfos[index]!.data) : null)
795
- }
796
-
797
- let totalRewardValueInBase = new Decimal(0)
798
- for (const reserveFarmMapping of entry.reserveFarmMappings) {
799
- let reserve = reserveMap?.get(reserveFarmMapping.reserve.toBase58())
800
- if (!reserve) {
801
- reserve = await Reserve.fetch(this.connection, reserveFarmMapping.reserve, entry.lendingProgramId) ?? undefined
802
- if (reserve) {
803
- reserveMap?.set(reserveFarmMapping.reserve.toBase58(), reserve)
804
- }
805
- }
806
- if (!reserve) {
807
- throw new Error(`Missing tracked Kamino reserve ${reserveFarmMapping.reserve.toBase58()}`)
808
- }
809
-
810
- const expectedFarmState = reserveFarmMapping.farmKind === KAMINO_RESERVE_FARM_KIND_COLLATERAL
811
- ? reserve.farmCollateral
812
- : reserveFarmMapping.farmKind === KAMINO_RESERVE_FARM_KIND_DEBT
813
- ? reserve.farmDebt
814
- : null
815
- if (!expectedFarmState?.equals(reserveFarmMapping.farmState)) {
816
- throw new Error(`Stored reserve farm mapping is stale for reserve ${reserveFarmMapping.reserve.toBase58()}`)
817
- }
818
-
819
- const farmData = accountInfoMap.get(reserveFarmMapping.farmState.toBase58())
820
- if (!farmData) {
821
- throw new Error(`Missing delegated farm account ${reserveFarmMapping.farmState.toBase58()}`)
822
- }
823
- const farm = decodeKaminoFarmState(farmData)
824
- if (!farm.isDelegated) {
825
- throw new Error(`Stored farm ${reserveFarmMapping.farmState.toBase58()} is not delegated`)
826
- }
827
- const userState = getKaminoFarmsObligationFarm(
828
- entry.obligation,
829
- reserveFarmMapping.farmState,
830
- KAMINO_FARMS_PROGRAM_ID,
831
- )
832
-
833
- const additionalAccounts = [farm.globalConfig]
834
- const scopePrices = getKaminoFarmScopePricesAddress(farm)
835
- if (scopePrices) {
836
- additionalAccounts.push(scopePrices)
837
- }
838
- const [globalConfigInfo, scopeInfo] = await this.connection.getMultipleAccountsInfo(additionalAccounts)
839
- if (!globalConfigInfo?.data) {
840
- throw new Error(`Missing delegated farm global config ${farm.globalConfig.toBase58()}`)
841
- }
842
- const globalConfigData = Buffer.from(globalConfigInfo.data)
843
-
844
- const userData = accountInfoMap.get(userState.toBase58())
845
- if (!userData) {
846
- continue
847
- }
848
- const user = decodeKaminoFarmUserState(userData)
849
- if (!user.delegatee.equals(entry.obligation)) {
850
- throw new Error(`Delegated farm user ${userState.toBase58()} does not delegate to obligation`)
851
- }
852
- if (!user.owner.equals(obligation.owner)) {
853
- throw new Error(`Delegated farm user ${userState.toBase58()} owner mismatch`)
854
- }
855
-
856
- const scopePriceData = scopePrices ? Buffer.from(scopeInfo?.data ?? []) : null
857
- if (scopePrices && !scopeInfo?.data) {
858
- throw new Error(`Missing delegated farm scope prices ${scopePrices.toBase58()}`)
859
- }
860
-
861
- totalRewardValueInBase = totalRewardValueInBase.add(this.calculateKaminoFarmRewardValueInBase({
862
- farm,
863
- user,
864
- globalConfigData,
865
- scopePriceData,
866
- prices,
867
- valuationClock,
868
- }))
869
- }
870
-
871
- return totalRewardValueInBase
872
- }
873
-
874
- /**
875
- * CLMM position AUM.
876
- * Uses MarketThree.getPtAndSyOnWithdrawLiquidity to keep parity with
877
- * existing frontend CLMM valuation logic, plus uncollected fees.
878
- */
879
- async calculateClmmPositionAum(entry: ClmmPositionEntryTyped, prices: ExponentPrices): Promise<AumResult> {
880
- const zeroResult: AumResult = {
881
- positionType: PositionType.ClmmPosition,
882
- mint: this.state.underlyingMint.toBase58(),
883
- aum: BigInt(0),
884
- }
885
-
886
- try {
887
- const fetcher = new ExponentFetcher({ connection: this.connection })
888
-
889
- const [lpPosition, marketThree] = await Promise.all([
890
- fetcher.fetchLpPositionCLMM(entry.lpPosition),
891
- this.loadClmmMarket(entry.market),
892
- ])
893
-
894
- if (!lpPosition.market.equals(entry.market)) {
895
- return zeroResult
896
- }
897
-
898
- if (lpPosition.lpBalance === BigInt(0)) {
899
- return zeroResult
900
- }
901
-
902
- const { totalPtOut, totalSyOut } = marketThree.getPtAndSyOnWithdrawLiquidity(lpPosition)
903
-
904
- // Add uncollected fees
905
- const finalPt = totalPtOut + lpPosition.tokensOwedPt
906
- const finalSy = totalSyOut + lpPosition.tokensOwedSy
907
-
908
- const ptPrice = AumCalculator.resolvePrice(entry.priceIdPt, prices)
909
- const syPrice = AumCalculator.resolvePrice(entry.priceIdSy, prices)
910
-
911
- const ptValue = new Decimal(finalPt.toString()).mul(ptPrice)
912
- const syValue = new Decimal(finalSy.toString()).mul(syPrice)
913
- const totalValue = ptValue.add(syValue)
914
-
915
- return {
916
- positionType: PositionType.ClmmPosition,
917
- mint: this.state.underlyingMint.toBase58(),
918
- aum: AumCalculator.decimalFloorToBigInt(totalValue),
919
- }
920
- } catch (e) {
921
- console.warn("Failed to calculate CLMM position AUM:", e)
922
- return zeroResult
923
- }
924
- }
925
-
926
- async calculateKaminoFarmAum(
927
- entry: KaminoFarmEntryTyped,
928
- prices: ExponentPrices,
929
- valuationClock: ValuationClock,
930
- ): Promise<AumResult> {
931
- const zeroResult: AumResult = {
932
- positionType: PositionType.KaminoFarm,
933
- mint: this.state.underlyingMint.toBase58(),
934
- aum: 0n,
935
- }
936
-
937
- const [farmInfo, userInfo] = await this.connection.getMultipleAccountsInfo([entry.farmState, entry.userState])
938
- if (!farmInfo?.data || !userInfo?.data) {
939
- return zeroResult
940
- }
941
-
942
- const farm = decodeKaminoFarmState(Buffer.from(farmInfo.data))
943
- if (farm.isDelegated) {
944
- return zeroResult
945
- }
946
-
947
- const user = decodeKaminoFarmUserState(Buffer.from(userInfo.data))
948
-
949
- const principalAmount = calculateKaminoFarmPrincipalAmount(farm, user)
950
- const principalPriceId = this.resolveTrackedMintPriceId(farm.underlyingMint)
951
- if (!principalPriceId) {
952
- throw new Error(`Missing Exponent price for Kamino farm underlying mint ${farm.underlyingMint.toBase58()}`)
953
- }
954
- const principalValueInBase = new Decimal(principalAmount.toString()).mul(
955
- AumCalculator.resolvePrice(principalPriceId, prices),
956
- )
957
-
958
- if (farm.numRewardTokens === 0) {
959
- return {
960
- positionType: PositionType.KaminoFarm,
961
- mint: farm.underlyingMint.toBase58(),
962
- aum: AumCalculator.decimalFloorToBigInt(principalValueInBase),
963
- }
964
- }
965
-
966
- const additionalAccounts = [farm.globalConfig]
967
- const scopePricesAddress = getKaminoFarmScopePricesAddress(farm)
968
- if (scopePricesAddress) {
969
- additionalAccounts.push(scopePricesAddress)
970
- }
971
- const additionalInfos = await this.connection.getMultipleAccountsInfo(additionalAccounts)
972
- const globalConfigInfo = additionalInfos[0]
973
- if (!globalConfigInfo?.data) {
974
- throw new Error(`Missing Kamino farm global config ${farm.globalConfig.toBase58()}`)
975
- }
976
- const scopeInfo = scopePricesAddress ? additionalInfos[1] : null
977
- if (scopePricesAddress && !scopeInfo?.data) {
978
- throw new Error(`Missing scope prices account ${scopePricesAddress.toBase58()}`)
979
- }
980
- const rewardValueInBase = this.calculateKaminoFarmRewardValueInBase({
981
- farm,
982
- user,
983
- globalConfigData: Buffer.from(globalConfigInfo.data),
984
- scopePriceData: scopeInfo?.data ? Buffer.from(scopeInfo.data) : null,
985
- prices,
986
- valuationClock,
987
- })
988
-
989
- return {
990
- positionType: PositionType.KaminoFarm,
991
- mint: farm.underlyingMint.toBase58(),
992
- aum: AumCalculator.decimalFloorToBigInt(principalValueInBase.add(rewardValueInBase)),
993
- }
994
- }
995
-
996
- /**
997
- * Calculate one side (collateral or debt) of a Kamino obligation in base units.
998
- * For SDK-side valuation we derive the current reserve value directly from
999
- * Kamino Reserve accounts and convert the resulting human base amount into raw
1000
- * base units at the end.
1001
- */
1002
- private async calculateSideInBase(
1003
- reserveValues: Array<{ reserve: PublicKey; rawAmount: BN; isDeposit: boolean }>,
1004
- entry: ObligationEntryTyped,
1005
- prices: ExponentPrices,
1006
- reserveMap?: Map<string, Reserve>,
1007
- ): Promise<Decimal> {
1008
- if (reserveValues.length === 0) {
1009
- return new Decimal(0)
1010
- }
1011
-
1012
- const quotePrice = AumCalculator.resolvePrice(entry.quotePriceId, prices)
1013
- const quoteInputMint = this.getPriceInputMint(entry.quotePriceId, prices)
1014
-
1015
- let aggregateBaseValue = new Decimal(0)
1016
- for (const rv of reserveValues) {
1017
- const mapping = entry.reservePriceMappings.find((candidate) => candidate.reserve.equals(rv.reserve))
1018
- if (!mapping) {
1019
- throw new Error(`Missing Kamino reserve mapping for ${rv.reserve.toBase58()}`)
1020
- }
1021
-
1022
- const reserve = reserveMap?.get(rv.reserve.toBase58())
1023
- if (!reserve) {
1024
- throw new Error(`Reserve not found for ${rv.reserve.toBase58()}, cannot compute market value`)
1025
- }
1026
-
1027
- aggregateBaseValue = aggregateBaseValue.add(
1028
- this.calculateReserveAmountInBase(
1029
- reserve,
1030
- rv.rawAmount,
1031
- rv.isDeposit,
1032
- mapping,
1033
- prices,
1034
- quotePrice,
1035
- quoteInputMint,
1036
- ),
1037
- )
1038
- }
1039
-
1040
- return aggregateBaseValue
1041
- }
1042
-
1043
- private calculateReserveAmountInBase(
1044
- reserve: Reserve,
1045
- rawAmount: BN,
1046
- isDeposit: boolean,
1047
- mapping: { reservePriceId: PriceId },
1048
- prices: ExponentPrices,
1049
- quotePrice: Decimal,
1050
- quoteInputMint: PublicKey,
1051
- ): Decimal {
1052
- let liquidityAmountRaw: Decimal
1053
- if (isDeposit) {
1054
- // cTokens -> liquidity token raw amount via collateral exchange rate
1055
- liquidityAmountRaw = new Decimal(rawAmount.toString()).mul(reserve.getCollateralExchangeRate())
1056
- } else {
1057
- // borrowedAmountSf decodes into liquidity token raw amount
1058
- liquidityAmountRaw = new Fraction(rawAmount).toDecimal()
1059
- }
1060
-
1061
- if (reserve.liquidity.mintPubkey.equals(quoteInputMint)) {
1062
- return liquidityAmountRaw.mul(quotePrice)
1063
- }
1064
-
1065
- const reservePriceId = mapping.reservePriceId
1066
- if (!reservePriceId || ("simple" in reservePriceId && reservePriceId.simple.priceId === 0n)) {
1067
- // Passthrough — no price conversion, treat as 1:1
1068
- return liquidityAmountRaw.mul(quotePrice)
1069
- }
1070
-
1071
- return liquidityAmountRaw.mul(AumCalculator.resolvePrice(reservePriceId, prices)).mul(quotePrice)
1072
- }
1073
-
1074
- /**
1075
- * Loopscale Loan AUM (BORROWER side).
1076
- * AUM = sum(collateral_value) - sum(outstanding_debt).
1077
- */
1078
- async calculateLoopscaleLoanAum(entry: LoopscaleLoanEntryTyped, prices: ExponentPrices): Promise<AumResult> {
1079
- const mint = this.state.underlyingMint.toBase58()
1080
-
1081
- try {
1082
- const loan = await LoopscaleLoan.fetch(this.connection, entry.loan)
1083
- if (!loan) {
1084
- return { positionType: PositionType.LoopscaleLoan, mint, aum: BigInt(0) }
1085
- }
1086
-
1087
- const tokenEntries = this.state.tokenEntries as unknown as TokenEntryTyped[]
1088
- const mintPriceMap = new Map<string, PriceId>()
1089
- for (const te of tokenEntries) {
1090
- mintPriceMap.set(te.mint.toBase58(), te.priceId)
1091
- }
1092
-
1093
- const exposureByMint = new Map<string, bigint>()
1094
-
1095
- let collateralValue = new Decimal(0)
1096
- for (const collateral of loan.collateral) {
1097
- const assetMint = collateral.assetMint.toBase58()
1098
- const amount = BigInt(collateral.amount.toString())
1099
- if (collateral.assetMint.equals(PublicKey.default) || amount === BigInt(0)) {
1100
- continue
1101
- }
1102
- const priceId = mintPriceMap.get(assetMint)
1103
- if (!priceId) {
1104
- continue
1105
- }
1106
- const price = AumCalculator.resolvePrice(priceId, prices)
1107
- const valueInBase = BigInt(new Decimal(amount.toString()).mul(price).floor().toString())
1108
- collateralValue = collateralValue.add(new Decimal(amount.toString()).mul(price))
1109
- exposureByMint.set(assetMint, (exposureByMint.get(assetMint) ?? BigInt(0)) + valueInBase)
1110
- }
1111
-
1112
- let debtValue = new Decimal(0)
1113
- for (const ledger of loan.ledgers) {
1114
- const principalDue = BigInt(ledger.principalDue.toString())
1115
- const principalRepaid = BigInt(ledger.principalRepaid.toString())
1116
- const interestOutstanding = BigInt(ledger.interestOutstanding.toString())
1117
- const outstanding = principalDue - principalRepaid + interestOutstanding
1118
- if (outstanding <= BigInt(0)) {
1119
- continue
1120
- }
1121
- const ledgerMint = ledger.principalMint.toBase58()
1122
- const priceId = mintPriceMap.get(ledgerMint)
1123
- if (!priceId) {
1124
- continue
1125
- }
1126
- const price = AumCalculator.resolvePrice(priceId, prices)
1127
- const valueInBase = BigInt(new Decimal(outstanding.toString()).mul(price).floor().toString())
1128
- debtValue = debtValue.add(new Decimal(outstanding.toString()).mul(price))
1129
- exposureByMint.set(ledgerMint, (exposureByMint.get(ledgerMint) ?? BigInt(0)) - valueInBase)
1130
- }
1131
-
1132
- const loopscaleLoanExposure = Array.from(exposureByMint.entries()).map(([m, amount]) => ({ mint: m, amount }))
1133
- const aum = Decimal.max(collateralValue.sub(debtValue), new Decimal(0))
1134
- return {
1135
- positionType: PositionType.LoopscaleLoan,
1136
- mint,
1137
- aum: BigInt(aum.floor().toString()),
1138
- loopscaleLoanExposure,
1139
- }
1140
- } catch (e) {
1141
- console.warn("Failed to calculate Loopscale loan AUM:", e)
1142
- return { positionType: PositionType.LoopscaleLoan, mint, aum: BigInt(0) }
1143
- }
1144
- }
1145
-
1146
- /**
1147
- * Loopscale Strategy AUM (LENDER side).
1148
- * AUM = (tokenBalance + currentDeployedAmount + outstandingInterestAmount) × price.
1149
- */
1150
- async calculateLoopscaleStrategyAum(entry: LoopscaleStrategyEntryTyped, prices: ExponentPrices): Promise<AumResult> {
1151
- const underlyingMint = this.state.underlyingMint.toBase58()
1152
-
1153
- try {
1154
- const strategy = await LoopscaleStrategy.fetch(this.connection, entry.strategy)
1155
- if (!strategy) {
1156
- return { positionType: PositionType.LoopscaleStrategy, mint: underlyingMint, aum: BigInt(0) }
1157
- }
1158
-
1159
- const principalMint = strategy.principalMint.toBase58()
1160
-
1161
- const tokenBalance = BigInt(strategy.tokenBalance.toString())
1162
- const currentDeployedAmount = BigInt(strategy.currentDeployedAmount.toString())
1163
- const outstandingInterestAmount = BigInt(strategy.outstandingInterestAmount.toString())
1164
- const totalValue = tokenBalance + currentDeployedAmount + outstandingInterestAmount
1165
-
1166
- if (totalValue === BigInt(0)) {
1167
- return { positionType: PositionType.LoopscaleStrategy, mint: principalMint, aum: BigInt(0) }
1168
- }
1169
-
1170
- const tokenEntries = this.state.tokenEntries as unknown as TokenEntryTyped[]
1171
- const priceId = tokenEntries.find((te) => te.mint.toBase58() === principalMint)?.priceId
1172
- if (!priceId) {
1173
- return { positionType: PositionType.LoopscaleStrategy, mint: principalMint, aum: BigInt(0) }
1174
- }
1175
-
1176
- const price = AumCalculator.resolvePrice(priceId, prices)
1177
- const aum = new Decimal(totalValue.toString()).mul(price)
1178
- const amount = BigInt(aum.floor().toString())
1179
- return {
1180
- positionType: PositionType.LoopscaleStrategy,
1181
- mint: principalMint,
1182
- aum: amount,
1183
- loopscaleLoanExposure: [{ mint: principalMint, amount }],
1184
- }
1185
- } catch (e) {
1186
- console.warn("Failed to calculate Loopscale strategy AUM:", e)
1187
- return { positionType: PositionType.LoopscaleStrategy, mint: underlyingMint, aum: BigInt(0) }
1188
- }
1189
- }
1190
-
1191
- /**
1192
- * Reserve tokens AUM (funds in vault token accounts - "Instant Liquidity").
1193
- */
1194
- async calculateReserveTokensAum(prices: ExponentPrices): Promise<AumResult[]> {
1195
- const tokenEntries = this.state.tokenEntries as unknown as TokenEntryTyped[]
1196
- const results: AumResult[] = []
1197
-
1198
- const allAccounts = tokenEntries.map((e) => e.tokenSquadsAccount)
1199
- const accountInfos = await this.connection.getMultipleAccountsInfo(allAccounts)
1200
-
1201
- for (let i = 0; i < tokenEntries.length; i++) {
1202
- const entry = tokenEntries[i]
1203
- const squadsInfo = accountInfos[i * 2]
1204
- const vaultInfo = accountInfos[i * 2 + 1]
1205
-
1206
- let balance = BigInt(0)
1207
- if (squadsInfo?.data) {
1208
- balance += AumCalculator.parseTokenAccountAmount(Buffer.from(squadsInfo.data))
1209
- }
1210
- if (vaultInfo?.data) {
1211
- balance += AumCalculator.parseTokenAccountAmount(Buffer.from(vaultInfo.data))
1212
- }
1213
-
1214
- if (balance === BigInt(0)) {
1215
- continue
1216
- }
1217
-
1218
- try {
1219
- const price = AumCalculator.resolvePrice(entry.priceId, prices)
1220
- const valueInBase = new Decimal(balance.toString()).mul(price)
1221
- results.push({
1222
- positionType: PositionType.Reserves,
1223
- mint: entry.mint.toBase58(),
1224
- aum: AumCalculator.decimalFloorToBigInt(valueInBase),
1225
- })
1226
- } catch {
1227
- // Skip if price resolution fails
1228
- }
1229
- }
1230
-
1231
- return results
1232
- }
1233
-
1234
- // ==========================================================================
1235
- // Convenience: calculate all position AUMs
1236
- // ==========================================================================
1237
-
1238
- /**
1239
- * Calculate AUM for a single strategy position.
1240
- * Returns array of AumResults (may be multiple for tokenAccount positions).
1241
- */
1242
- async calculatePositionAum(
1243
- position: StrategyPosition,
1244
- prices: ExponentPrices,
1245
- valuationClock?: ValuationClock,
1246
- ): Promise<AumResult[]> {
1247
- if ("tokenAccount" in position) {
1248
- const entry = (position as { tokenAccount: { 0: TokenAccountEntryTyped } }).tokenAccount[0]
1249
- return this.calculateTokenAccountAum(entry, prices)
1250
- }
1251
- if ("orderbook" in position) {
1252
- const entry = (position as { orderbook: { 0: OrderbookEntryTyped } }).orderbook[0]
1253
- const result = await this.calculateOrderbookAum(entry, prices)
1254
- return result
1255
- }
1256
- if ("yieldPosition" in position) {
1257
- const entry = (position as { yieldPosition: { 0: YieldPositionEntryTyped } }).yieldPosition[0]
1258
- const result = await this.calculateYieldPositionAum(entry, prices)
1259
- return [result]
1260
- }
1261
- if ("obligation" in position) {
1262
- const inner = (position as { obligation: { 0: Record<string, unknown> } }).obligation[0]
1263
- if (inner && "kaminoObligation" in inner) {
1264
- const kaminoVariant = inner.kaminoObligation as unknown
1265
- const entry = Array.isArray(kaminoVariant)
1266
- ? (kaminoVariant[0] as ObligationEntryTyped | undefined)
1267
- : kaminoVariant && typeof kaminoVariant === "object" && "0" in (kaminoVariant as Record<string, unknown>)
1268
- ? ((kaminoVariant as { 0?: ObligationEntryTyped })[0] ?? undefined)
1269
- : (kaminoVariant as ObligationEntryTyped | undefined)
1270
- if (entry) {
1271
- const result = await this.calculateObligationAum(
1272
- entry,
1273
- prices,
1274
- valuationClock ?? await this.getCurrentValuationClock(),
1275
- )
1276
- return [result]
1277
- }
1278
- }
1279
- }
1280
- if ("clmmPosition" in position) {
1281
- const entry = (position as { clmmPosition: { 0: ClmmPositionEntryTyped } }).clmmPosition[0]
1282
- const result = await this.calculateClmmPositionAum(entry, prices)
1283
- return [result]
1284
- }
1285
- if ("loopscaleLoan" in position) {
1286
- const entry = (position as { loopscaleLoan: { 0: LoopscaleLoanEntryTyped } }).loopscaleLoan[0]
1287
- const result = await this.calculateLoopscaleLoanAum(entry, prices)
1288
- return [result]
1289
- }
1290
- if ("loopscaleStrategy" in position) {
1291
- const entry = (position as { loopscaleStrategy: { 0: LoopscaleStrategyEntryTyped } }).loopscaleStrategy[0]
1292
- const result = await this.calculateLoopscaleStrategyAum(entry, prices)
1293
- return [result]
1294
- }
1295
- if ("kaminoFarm" in position) {
1296
- const entry = (position as { kaminoFarm: { 0: KaminoFarmEntryTyped } }).kaminoFarm[0]
1297
- const result = await this.calculateKaminoFarmAum(
1298
- entry,
1299
- prices,
1300
- valuationClock ?? await this.getCurrentValuationClock(),
1301
- )
1302
- return [result]
1303
- }
1304
- return []
1305
- }
1306
-
1307
- /**
1308
- * Calculate AUM for all positions: reserve tokens + strategy positions.
1309
- */
1310
- async calculatePositionsAum(prices: ExponentPrices): Promise<AumResult[]> {
1311
- const valuationClock = await this.getCurrentValuationClock()
1312
- const [reserveResults, ...positionResults] = await Promise.all([
1313
- this.calculateReserveTokensAum(prices),
1314
- ...this.state.strategyPositions.map((position) => this.calculatePositionAum(position, prices, valuationClock)),
1315
- ])
1316
- return [reserveResults, ...positionResults].flat()
1317
- }
1318
-
1319
- get strategyPositions(): StrategyPosition[] {
1320
- return this.state.strategyPositions
1321
- }
1322
-
1323
- private resolveTrackedMintPriceId(mint: PublicKey): PriceId | null {
1324
- const tokenEntry = (this.state.tokenEntries as unknown as TokenEntryTyped[]).find((entry) => entry.mint.equals(mint))
1325
- if (tokenEntry) {
1326
- return tokenEntry.priceId
1327
- }
1328
-
1329
- for (const position of this.state.strategyPositions) {
1330
- if ("tokenAccount" in position) {
1331
- const entry = (position as { tokenAccount: { 0: TokenAccountEntryTyped } }).tokenAccount[0]
1332
- if (entry.tokenMint.equals(mint) && entry.balances.length > 0) {
1333
- return entry.balances[0].priceId
1334
- }
1335
- }
1336
- }
1337
-
1338
- return null
1339
- }
1340
-
1341
- private static convertKaminoStakeToAmount(stake: bigint, totalStake: bigint, totalAmount: bigint): bigint {
1342
- if (stake === 0n) {
1343
- return 0n
1344
- }
1345
- if (totalStake === 0n) {
1346
- return totalAmount
1347
- }
1348
- return (stake * totalAmount) / totalStake
1349
- }
1350
- }