@kamino-finance/klend-sdk 7.0.3 → 7.0.5

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 (340) hide show
  1. package/dist/@codegen/jupiter_perps/instructions/addCustody.d.ts +2 -2
  2. package/dist/@codegen/jupiter_perps/instructions/addCustody.d.ts.map +1 -1
  3. package/dist/@codegen/jupiter_perps/instructions/addLiquidity.d.ts +2 -2
  4. package/dist/@codegen/jupiter_perps/instructions/addLiquidity.d.ts.map +1 -1
  5. package/dist/@codegen/jupiter_perps/instructions/addPool.d.ts +2 -2
  6. package/dist/@codegen/jupiter_perps/instructions/addPool.d.ts.map +1 -1
  7. package/dist/@codegen/jupiter_perps/instructions/closePositionRequest.d.ts +2 -2
  8. package/dist/@codegen/jupiter_perps/instructions/closePositionRequest.d.ts.map +1 -1
  9. package/dist/@codegen/jupiter_perps/instructions/createDecreasePositionRequest.d.ts +2 -2
  10. package/dist/@codegen/jupiter_perps/instructions/createDecreasePositionRequest.d.ts.map +1 -1
  11. package/dist/@codegen/jupiter_perps/instructions/createIncreasePositionRequest.d.ts +2 -2
  12. package/dist/@codegen/jupiter_perps/instructions/createIncreasePositionRequest.d.ts.map +1 -1
  13. package/dist/@codegen/jupiter_perps/instructions/decreasePosition.d.ts +2 -2
  14. package/dist/@codegen/jupiter_perps/instructions/decreasePosition.d.ts.map +1 -1
  15. package/dist/@codegen/jupiter_perps/instructions/decreasePositionPostSwap.d.ts +2 -2
  16. package/dist/@codegen/jupiter_perps/instructions/decreasePositionPostSwap.d.ts.map +1 -1
  17. package/dist/@codegen/jupiter_perps/instructions/getAddLiquidityAmountAndFee.d.ts +2 -2
  18. package/dist/@codegen/jupiter_perps/instructions/getAddLiquidityAmountAndFee.d.ts.map +1 -1
  19. package/dist/@codegen/jupiter_perps/instructions/getDecreasePosition.d.ts +2 -2
  20. package/dist/@codegen/jupiter_perps/instructions/getDecreasePosition.d.ts.map +1 -1
  21. package/dist/@codegen/jupiter_perps/instructions/getExactOutSwapAmountAndFees.d.ts +2 -2
  22. package/dist/@codegen/jupiter_perps/instructions/getExactOutSwapAmountAndFees.d.ts.map +1 -1
  23. package/dist/@codegen/jupiter_perps/instructions/getIncreasePosition.d.ts +2 -2
  24. package/dist/@codegen/jupiter_perps/instructions/getIncreasePosition.d.ts.map +1 -1
  25. package/dist/@codegen/jupiter_perps/instructions/getLiquidationState.d.ts +2 -2
  26. package/dist/@codegen/jupiter_perps/instructions/getLiquidationState.d.ts.map +1 -1
  27. package/dist/@codegen/jupiter_perps/instructions/getOraclePrice.d.ts +2 -2
  28. package/dist/@codegen/jupiter_perps/instructions/getOraclePrice.d.ts.map +1 -1
  29. package/dist/@codegen/jupiter_perps/instructions/getPnl.d.ts +2 -2
  30. package/dist/@codegen/jupiter_perps/instructions/getPnl.d.ts.map +1 -1
  31. package/dist/@codegen/jupiter_perps/instructions/getRemoveLiquidityAmountAndFee.d.ts +2 -2
  32. package/dist/@codegen/jupiter_perps/instructions/getRemoveLiquidityAmountAndFee.d.ts.map +1 -1
  33. package/dist/@codegen/jupiter_perps/instructions/getSwapAmountAndFees.d.ts +2 -2
  34. package/dist/@codegen/jupiter_perps/instructions/getSwapAmountAndFees.d.ts.map +1 -1
  35. package/dist/@codegen/jupiter_perps/instructions/increasePosition.d.ts +2 -2
  36. package/dist/@codegen/jupiter_perps/instructions/increasePosition.d.ts.map +1 -1
  37. package/dist/@codegen/jupiter_perps/instructions/increasePositionPreSwap.d.ts +2 -2
  38. package/dist/@codegen/jupiter_perps/instructions/increasePositionPreSwap.d.ts.map +1 -1
  39. package/dist/@codegen/jupiter_perps/instructions/init.d.ts +2 -2
  40. package/dist/@codegen/jupiter_perps/instructions/init.d.ts.map +1 -1
  41. package/dist/@codegen/jupiter_perps/instructions/liquidatePosition.d.ts +2 -2
  42. package/dist/@codegen/jupiter_perps/instructions/liquidatePosition.d.ts.map +1 -1
  43. package/dist/@codegen/jupiter_perps/instructions/removeLiquidity.d.ts +2 -2
  44. package/dist/@codegen/jupiter_perps/instructions/removeLiquidity.d.ts.map +1 -1
  45. package/dist/@codegen/jupiter_perps/instructions/setCustodyConfig.d.ts +2 -2
  46. package/dist/@codegen/jupiter_perps/instructions/setCustodyConfig.d.ts.map +1 -1
  47. package/dist/@codegen/jupiter_perps/instructions/setCustodyGlobalLimit.d.ts +2 -2
  48. package/dist/@codegen/jupiter_perps/instructions/setCustodyGlobalLimit.d.ts.map +1 -1
  49. package/dist/@codegen/jupiter_perps/instructions/setPerpetualsConfig.d.ts +2 -2
  50. package/dist/@codegen/jupiter_perps/instructions/setPerpetualsConfig.d.ts.map +1 -1
  51. package/dist/@codegen/jupiter_perps/instructions/setPoolConfig.d.ts +2 -2
  52. package/dist/@codegen/jupiter_perps/instructions/setPoolConfig.d.ts.map +1 -1
  53. package/dist/@codegen/jupiter_perps/instructions/setTestOraclePrice.d.ts +2 -2
  54. package/dist/@codegen/jupiter_perps/instructions/setTestOraclePrice.d.ts.map +1 -1
  55. package/dist/@codegen/jupiter_perps/instructions/setTestTime.d.ts +2 -2
  56. package/dist/@codegen/jupiter_perps/instructions/setTestTime.d.ts.map +1 -1
  57. package/dist/@codegen/jupiter_perps/instructions/swap.d.ts +2 -2
  58. package/dist/@codegen/jupiter_perps/instructions/swap.d.ts.map +1 -1
  59. package/dist/@codegen/jupiter_perps/instructions/swapExactOut.d.ts +2 -2
  60. package/dist/@codegen/jupiter_perps/instructions/swapExactOut.d.ts.map +1 -1
  61. package/dist/@codegen/jupiter_perps/instructions/testInit.d.ts +2 -2
  62. package/dist/@codegen/jupiter_perps/instructions/testInit.d.ts.map +1 -1
  63. package/dist/@codegen/jupiter_perps/instructions/transferAdmin.d.ts +2 -2
  64. package/dist/@codegen/jupiter_perps/instructions/transferAdmin.d.ts.map +1 -1
  65. package/dist/@codegen/jupiter_perps/instructions/updateDecreasePositionRequest.d.ts +2 -2
  66. package/dist/@codegen/jupiter_perps/instructions/updateDecreasePositionRequest.d.ts.map +1 -1
  67. package/dist/@codegen/jupiter_perps/instructions/updateIncreasePositionRequest.d.ts +2 -2
  68. package/dist/@codegen/jupiter_perps/instructions/updateIncreasePositionRequest.d.ts.map +1 -1
  69. package/dist/@codegen/jupiter_perps/instructions/withdrawFees.d.ts +2 -2
  70. package/dist/@codegen/jupiter_perps/instructions/withdrawFees.d.ts.map +1 -1
  71. package/dist/@codegen/klend/instructions/borrowObligationLiquidity.d.ts +2 -2
  72. package/dist/@codegen/klend/instructions/borrowObligationLiquidity.d.ts.map +1 -1
  73. package/dist/@codegen/klend/instructions/borrowObligationLiquidityV2.d.ts +2 -2
  74. package/dist/@codegen/klend/instructions/borrowObligationLiquidityV2.d.ts.map +1 -1
  75. package/dist/@codegen/klend/instructions/deleteReferrerStateAndShortUrl.d.ts +2 -2
  76. package/dist/@codegen/klend/instructions/deleteReferrerStateAndShortUrl.d.ts.map +1 -1
  77. package/dist/@codegen/klend/instructions/depositAndWithdraw.d.ts +2 -2
  78. package/dist/@codegen/klend/instructions/depositAndWithdraw.d.ts.map +1 -1
  79. package/dist/@codegen/klend/instructions/depositObligationCollateral.d.ts +2 -2
  80. package/dist/@codegen/klend/instructions/depositObligationCollateral.d.ts.map +1 -1
  81. package/dist/@codegen/klend/instructions/depositObligationCollateralV2.d.ts +2 -2
  82. package/dist/@codegen/klend/instructions/depositObligationCollateralV2.d.ts.map +1 -1
  83. package/dist/@codegen/klend/instructions/depositReserveLiquidity.d.ts +2 -2
  84. package/dist/@codegen/klend/instructions/depositReserveLiquidity.d.ts.map +1 -1
  85. package/dist/@codegen/klend/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +2 -2
  86. package/dist/@codegen/klend/instructions/depositReserveLiquidityAndObligationCollateral.d.ts.map +1 -1
  87. package/dist/@codegen/klend/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +2 -2
  88. package/dist/@codegen/klend/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts.map +1 -1
  89. package/dist/@codegen/klend/instructions/flashBorrowReserveLiquidity.d.ts +2 -2
  90. package/dist/@codegen/klend/instructions/flashBorrowReserveLiquidity.d.ts.map +1 -1
  91. package/dist/@codegen/klend/instructions/flashRepayReserveLiquidity.d.ts +2 -2
  92. package/dist/@codegen/klend/instructions/flashRepayReserveLiquidity.d.ts.map +1 -1
  93. package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts +2 -2
  94. package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts.map +1 -1
  95. package/dist/@codegen/klend/instructions/initFarmsForReserve.d.ts +2 -2
  96. package/dist/@codegen/klend/instructions/initFarmsForReserve.d.ts.map +1 -1
  97. package/dist/@codegen/klend/instructions/initGlobalConfig.d.ts +2 -2
  98. package/dist/@codegen/klend/instructions/initGlobalConfig.d.ts.map +1 -1
  99. package/dist/@codegen/klend/instructions/initLendingMarket.d.ts +2 -2
  100. package/dist/@codegen/klend/instructions/initLendingMarket.d.ts.map +1 -1
  101. package/dist/@codegen/klend/instructions/initObligation.d.ts +2 -2
  102. package/dist/@codegen/klend/instructions/initObligation.d.ts.map +1 -1
  103. package/dist/@codegen/klend/instructions/initObligationFarmsForReserve.d.ts +2 -2
  104. package/dist/@codegen/klend/instructions/initObligationFarmsForReserve.d.ts.map +1 -1
  105. package/dist/@codegen/klend/instructions/initReferrerStateAndShortUrl.d.ts +2 -2
  106. package/dist/@codegen/klend/instructions/initReferrerStateAndShortUrl.d.ts.map +1 -1
  107. package/dist/@codegen/klend/instructions/initReferrerTokenState.d.ts +2 -2
  108. package/dist/@codegen/klend/instructions/initReferrerTokenState.d.ts.map +1 -1
  109. package/dist/@codegen/klend/instructions/initReserve.d.ts +2 -2
  110. package/dist/@codegen/klend/instructions/initReserve.d.ts.map +1 -1
  111. package/dist/@codegen/klend/instructions/initUserMetadata.d.ts +2 -2
  112. package/dist/@codegen/klend/instructions/initUserMetadata.d.ts.map +1 -1
  113. package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +2 -2
  114. package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts.map +1 -1
  115. package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +2 -2
  116. package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts.map +1 -1
  117. package/dist/@codegen/klend/instructions/markObligationForDeleveraging.d.ts +2 -2
  118. package/dist/@codegen/klend/instructions/markObligationForDeleveraging.d.ts.map +1 -1
  119. package/dist/@codegen/klend/instructions/redeemFees.d.ts +2 -2
  120. package/dist/@codegen/klend/instructions/redeemFees.d.ts.map +1 -1
  121. package/dist/@codegen/klend/instructions/redeemReserveCollateral.d.ts +2 -2
  122. package/dist/@codegen/klend/instructions/redeemReserveCollateral.d.ts.map +1 -1
  123. package/dist/@codegen/klend/instructions/refreshObligation.d.ts +2 -2
  124. package/dist/@codegen/klend/instructions/refreshObligation.d.ts.map +1 -1
  125. package/dist/@codegen/klend/instructions/refreshObligationFarmsForReserve.d.ts +2 -2
  126. package/dist/@codegen/klend/instructions/refreshObligationFarmsForReserve.d.ts.map +1 -1
  127. package/dist/@codegen/klend/instructions/refreshReserve.d.ts +2 -2
  128. package/dist/@codegen/klend/instructions/refreshReserve.d.ts.map +1 -1
  129. package/dist/@codegen/klend/instructions/refreshReservesBatch.d.ts +2 -2
  130. package/dist/@codegen/klend/instructions/refreshReservesBatch.d.ts.map +1 -1
  131. package/dist/@codegen/klend/instructions/repayAndWithdrawAndRedeem.d.ts +2 -2
  132. package/dist/@codegen/klend/instructions/repayAndWithdrawAndRedeem.d.ts.map +1 -1
  133. package/dist/@codegen/klend/instructions/repayObligationLiquidity.d.ts +2 -2
  134. package/dist/@codegen/klend/instructions/repayObligationLiquidity.d.ts.map +1 -1
  135. package/dist/@codegen/klend/instructions/repayObligationLiquidityV2.d.ts +2 -2
  136. package/dist/@codegen/klend/instructions/repayObligationLiquidityV2.d.ts.map +1 -1
  137. package/dist/@codegen/klend/instructions/requestElevationGroup.d.ts +2 -2
  138. package/dist/@codegen/klend/instructions/requestElevationGroup.d.ts.map +1 -1
  139. package/dist/@codegen/klend/instructions/setObligationOrder.d.ts +2 -2
  140. package/dist/@codegen/klend/instructions/setObligationOrder.d.ts.map +1 -1
  141. package/dist/@codegen/klend/instructions/socializeLoss.d.ts +2 -2
  142. package/dist/@codegen/klend/instructions/socializeLoss.d.ts.map +1 -1
  143. package/dist/@codegen/klend/instructions/socializeLossV2.d.ts +2 -2
  144. package/dist/@codegen/klend/instructions/socializeLossV2.d.ts.map +1 -1
  145. package/dist/@codegen/klend/instructions/updateGlobalConfig.d.ts +2 -2
  146. package/dist/@codegen/klend/instructions/updateGlobalConfig.d.ts.map +1 -1
  147. package/dist/@codegen/klend/instructions/updateGlobalConfigAdmin.d.ts +2 -2
  148. package/dist/@codegen/klend/instructions/updateGlobalConfigAdmin.d.ts.map +1 -1
  149. package/dist/@codegen/klend/instructions/updateLendingMarket.d.ts +2 -2
  150. package/dist/@codegen/klend/instructions/updateLendingMarket.d.ts.map +1 -1
  151. package/dist/@codegen/klend/instructions/updateLendingMarketOwner.d.ts +2 -2
  152. package/dist/@codegen/klend/instructions/updateLendingMarketOwner.d.ts.map +1 -1
  153. package/dist/@codegen/klend/instructions/updateReserveConfig.d.ts +2 -2
  154. package/dist/@codegen/klend/instructions/updateReserveConfig.d.ts.map +1 -1
  155. package/dist/@codegen/klend/instructions/withdrawObligationCollateral.d.ts +2 -2
  156. package/dist/@codegen/klend/instructions/withdrawObligationCollateral.d.ts.map +1 -1
  157. package/dist/@codegen/klend/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +2 -2
  158. package/dist/@codegen/klend/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts.map +1 -1
  159. package/dist/@codegen/klend/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +2 -2
  160. package/dist/@codegen/klend/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts.map +1 -1
  161. package/dist/@codegen/klend/instructions/withdrawObligationCollateralV2.d.ts +2 -2
  162. package/dist/@codegen/klend/instructions/withdrawObligationCollateralV2.d.ts.map +1 -1
  163. package/dist/@codegen/klend/instructions/withdrawProtocolFee.d.ts +2 -2
  164. package/dist/@codegen/klend/instructions/withdrawProtocolFee.d.ts.map +1 -1
  165. package/dist/@codegen/klend/instructions/withdrawReferrerFees.d.ts +2 -2
  166. package/dist/@codegen/klend/instructions/withdrawReferrerFees.d.ts.map +1 -1
  167. package/dist/@codegen/kvault/instructions/deposit.d.ts +2 -2
  168. package/dist/@codegen/kvault/instructions/deposit.d.ts.map +1 -1
  169. package/dist/@codegen/kvault/instructions/giveUpPendingFees.d.ts +2 -2
  170. package/dist/@codegen/kvault/instructions/giveUpPendingFees.d.ts.map +1 -1
  171. package/dist/@codegen/kvault/instructions/initVault.d.ts +2 -2
  172. package/dist/@codegen/kvault/instructions/initVault.d.ts.map +1 -1
  173. package/dist/@codegen/kvault/instructions/initializeSharesMetadata.d.ts +2 -2
  174. package/dist/@codegen/kvault/instructions/initializeSharesMetadata.d.ts.map +1 -1
  175. package/dist/@codegen/kvault/instructions/invest.d.ts +2 -2
  176. package/dist/@codegen/kvault/instructions/invest.d.ts.map +1 -1
  177. package/dist/@codegen/kvault/instructions/removeAllocation.d.ts +2 -2
  178. package/dist/@codegen/kvault/instructions/removeAllocation.d.ts.map +1 -1
  179. package/dist/@codegen/kvault/instructions/updateAdmin.d.ts +2 -2
  180. package/dist/@codegen/kvault/instructions/updateAdmin.d.ts.map +1 -1
  181. package/dist/@codegen/kvault/instructions/updateReserveAllocation.d.ts +2 -2
  182. package/dist/@codegen/kvault/instructions/updateReserveAllocation.d.ts.map +1 -1
  183. package/dist/@codegen/kvault/instructions/updateSharesMetadata.d.ts +2 -2
  184. package/dist/@codegen/kvault/instructions/updateSharesMetadata.d.ts.map +1 -1
  185. package/dist/@codegen/kvault/instructions/updateVaultConfig.d.ts +2 -2
  186. package/dist/@codegen/kvault/instructions/updateVaultConfig.d.ts.map +1 -1
  187. package/dist/@codegen/kvault/instructions/withdraw.d.ts +2 -2
  188. package/dist/@codegen/kvault/instructions/withdraw.d.ts.map +1 -1
  189. package/dist/@codegen/kvault/instructions/withdrawFromAvailable.d.ts +2 -2
  190. package/dist/@codegen/kvault/instructions/withdrawFromAvailable.d.ts.map +1 -1
  191. package/dist/@codegen/kvault/instructions/withdrawPendingFees.d.ts +2 -2
  192. package/dist/@codegen/kvault/instructions/withdrawPendingFees.d.ts.map +1 -1
  193. package/dist/@codegen/pyth_rec/instructions/acceptGovernanceAuthorityTransfer.d.ts +2 -2
  194. package/dist/@codegen/pyth_rec/instructions/acceptGovernanceAuthorityTransfer.d.ts.map +1 -1
  195. package/dist/@codegen/pyth_rec/instructions/reclaimRent.d.ts +2 -2
  196. package/dist/@codegen/pyth_rec/instructions/reclaimRent.d.ts.map +1 -1
  197. package/dist/@codegen/pyth_rec/instructions/reclaimTwapRent.d.ts +2 -2
  198. package/dist/@codegen/pyth_rec/instructions/reclaimTwapRent.d.ts.map +1 -1
  199. package/dist/@codegen/pyth_rec/instructions/requestGovernanceAuthorityTransfer.d.ts +2 -2
  200. package/dist/@codegen/pyth_rec/instructions/requestGovernanceAuthorityTransfer.d.ts.map +1 -1
  201. package/dist/@codegen/pyth_rec/instructions/setDataSources.d.ts +2 -2
  202. package/dist/@codegen/pyth_rec/instructions/setDataSources.d.ts.map +1 -1
  203. package/dist/@codegen/pyth_rec/instructions/setFee.d.ts +2 -2
  204. package/dist/@codegen/pyth_rec/instructions/setFee.d.ts.map +1 -1
  205. package/dist/@codegen/pyth_rec/instructions/setMinimumSignatures.d.ts +2 -2
  206. package/dist/@codegen/pyth_rec/instructions/setMinimumSignatures.d.ts.map +1 -1
  207. package/dist/@codegen/pyth_rec/instructions/setWormholeAddress.d.ts +2 -2
  208. package/dist/@codegen/pyth_rec/instructions/setWormholeAddress.d.ts.map +1 -1
  209. package/dist/@codegen/switchboard_v2/instructions/aggregatorAddJob.d.ts +2 -2
  210. package/dist/@codegen/switchboard_v2/instructions/aggregatorAddJob.d.ts.map +1 -1
  211. package/dist/@codegen/switchboard_v2/instructions/aggregatorInit.d.ts +2 -2
  212. package/dist/@codegen/switchboard_v2/instructions/aggregatorInit.d.ts.map +1 -1
  213. package/dist/@codegen/switchboard_v2/instructions/aggregatorLock.d.ts +2 -2
  214. package/dist/@codegen/switchboard_v2/instructions/aggregatorLock.d.ts.map +1 -1
  215. package/dist/@codegen/switchboard_v2/instructions/aggregatorOpenRound.d.ts +2 -2
  216. package/dist/@codegen/switchboard_v2/instructions/aggregatorOpenRound.d.ts.map +1 -1
  217. package/dist/@codegen/switchboard_v2/instructions/aggregatorRemoveJob.d.ts +2 -2
  218. package/dist/@codegen/switchboard_v2/instructions/aggregatorRemoveJob.d.ts.map +1 -1
  219. package/dist/@codegen/switchboard_v2/instructions/aggregatorSaveResult.d.ts +2 -2
  220. package/dist/@codegen/switchboard_v2/instructions/aggregatorSaveResult.d.ts.map +1 -1
  221. package/dist/@codegen/switchboard_v2/instructions/aggregatorSaveResultV2.d.ts +2 -2
  222. package/dist/@codegen/switchboard_v2/instructions/aggregatorSaveResultV2.d.ts.map +1 -1
  223. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetAuthority.d.ts +2 -2
  224. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetAuthority.d.ts.map +1 -1
  225. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetConfig.d.ts +2 -2
  226. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetConfig.d.ts.map +1 -1
  227. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetHistoryBuffer.d.ts +2 -2
  228. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetHistoryBuffer.d.ts.map +1 -1
  229. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetQueue.d.ts +2 -2
  230. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetQueue.d.ts.map +1 -1
  231. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetResolutionMode.d.ts +2 -2
  232. package/dist/@codegen/switchboard_v2/instructions/aggregatorSetResolutionMode.d.ts.map +1 -1
  233. package/dist/@codegen/switchboard_v2/instructions/bufferRelayerInit.d.ts +2 -2
  234. package/dist/@codegen/switchboard_v2/instructions/bufferRelayerInit.d.ts.map +1 -1
  235. package/dist/@codegen/switchboard_v2/instructions/bufferRelayerOpenRound.d.ts +2 -2
  236. package/dist/@codegen/switchboard_v2/instructions/bufferRelayerOpenRound.d.ts.map +1 -1
  237. package/dist/@codegen/switchboard_v2/instructions/bufferRelayerSaveResult.d.ts +2 -2
  238. package/dist/@codegen/switchboard_v2/instructions/bufferRelayerSaveResult.d.ts.map +1 -1
  239. package/dist/@codegen/switchboard_v2/instructions/crankInit.d.ts +2 -2
  240. package/dist/@codegen/switchboard_v2/instructions/crankInit.d.ts.map +1 -1
  241. package/dist/@codegen/switchboard_v2/instructions/crankPop.d.ts +2 -2
  242. package/dist/@codegen/switchboard_v2/instructions/crankPop.d.ts.map +1 -1
  243. package/dist/@codegen/switchboard_v2/instructions/crankPopV2.d.ts +2 -2
  244. package/dist/@codegen/switchboard_v2/instructions/crankPopV2.d.ts.map +1 -1
  245. package/dist/@codegen/switchboard_v2/instructions/crankPush.d.ts +2 -2
  246. package/dist/@codegen/switchboard_v2/instructions/crankPush.d.ts.map +1 -1
  247. package/dist/@codegen/switchboard_v2/instructions/jobInit.d.ts +2 -2
  248. package/dist/@codegen/switchboard_v2/instructions/jobInit.d.ts.map +1 -1
  249. package/dist/@codegen/switchboard_v2/instructions/jobSetData.d.ts +2 -2
  250. package/dist/@codegen/switchboard_v2/instructions/jobSetData.d.ts.map +1 -1
  251. package/dist/@codegen/switchboard_v2/instructions/leaseExtend.d.ts +2 -2
  252. package/dist/@codegen/switchboard_v2/instructions/leaseExtend.d.ts.map +1 -1
  253. package/dist/@codegen/switchboard_v2/instructions/leaseInit.d.ts +2 -2
  254. package/dist/@codegen/switchboard_v2/instructions/leaseInit.d.ts.map +1 -1
  255. package/dist/@codegen/switchboard_v2/instructions/leaseSetAuthority.d.ts +2 -2
  256. package/dist/@codegen/switchboard_v2/instructions/leaseSetAuthority.d.ts.map +1 -1
  257. package/dist/@codegen/switchboard_v2/instructions/leaseWithdraw.d.ts +2 -2
  258. package/dist/@codegen/switchboard_v2/instructions/leaseWithdraw.d.ts.map +1 -1
  259. package/dist/@codegen/switchboard_v2/instructions/oracleHeartbeat.d.ts +2 -2
  260. package/dist/@codegen/switchboard_v2/instructions/oracleHeartbeat.d.ts.map +1 -1
  261. package/dist/@codegen/switchboard_v2/instructions/oracleInit.d.ts +2 -2
  262. package/dist/@codegen/switchboard_v2/instructions/oracleInit.d.ts.map +1 -1
  263. package/dist/@codegen/switchboard_v2/instructions/oracleQueueInit.d.ts +2 -2
  264. package/dist/@codegen/switchboard_v2/instructions/oracleQueueInit.d.ts.map +1 -1
  265. package/dist/@codegen/switchboard_v2/instructions/oracleQueueSetConfig.d.ts +2 -2
  266. package/dist/@codegen/switchboard_v2/instructions/oracleQueueSetConfig.d.ts.map +1 -1
  267. package/dist/@codegen/switchboard_v2/instructions/oracleWithdraw.d.ts +2 -2
  268. package/dist/@codegen/switchboard_v2/instructions/oracleWithdraw.d.ts.map +1 -1
  269. package/dist/@codegen/switchboard_v2/instructions/permissionInit.d.ts +2 -2
  270. package/dist/@codegen/switchboard_v2/instructions/permissionInit.d.ts.map +1 -1
  271. package/dist/@codegen/switchboard_v2/instructions/permissionSet.d.ts +2 -2
  272. package/dist/@codegen/switchboard_v2/instructions/permissionSet.d.ts.map +1 -1
  273. package/dist/@codegen/switchboard_v2/instructions/programConfig.d.ts +2 -2
  274. package/dist/@codegen/switchboard_v2/instructions/programConfig.d.ts.map +1 -1
  275. package/dist/@codegen/switchboard_v2/instructions/programInit.d.ts +2 -2
  276. package/dist/@codegen/switchboard_v2/instructions/programInit.d.ts.map +1 -1
  277. package/dist/@codegen/switchboard_v2/instructions/vaultTransfer.d.ts +2 -2
  278. package/dist/@codegen/switchboard_v2/instructions/vaultTransfer.d.ts.map +1 -1
  279. package/dist/@codegen/switchboard_v2/instructions/vrfCloseAction.d.ts +2 -2
  280. package/dist/@codegen/switchboard_v2/instructions/vrfCloseAction.d.ts.map +1 -1
  281. package/dist/@codegen/switchboard_v2/instructions/vrfInit.d.ts +2 -2
  282. package/dist/@codegen/switchboard_v2/instructions/vrfInit.d.ts.map +1 -1
  283. package/dist/@codegen/switchboard_v2/instructions/vrfLiteCloseAction.d.ts +2 -2
  284. package/dist/@codegen/switchboard_v2/instructions/vrfLiteCloseAction.d.ts.map +1 -1
  285. package/dist/@codegen/switchboard_v2/instructions/vrfLiteInit.d.ts +2 -2
  286. package/dist/@codegen/switchboard_v2/instructions/vrfLiteInit.d.ts.map +1 -1
  287. package/dist/@codegen/switchboard_v2/instructions/vrfLiteProveAndVerify.d.ts +2 -2
  288. package/dist/@codegen/switchboard_v2/instructions/vrfLiteProveAndVerify.d.ts.map +1 -1
  289. package/dist/@codegen/switchboard_v2/instructions/vrfLiteRequestRandomness.d.ts +2 -2
  290. package/dist/@codegen/switchboard_v2/instructions/vrfLiteRequestRandomness.d.ts.map +1 -1
  291. package/dist/@codegen/switchboard_v2/instructions/vrfPoolAdd.d.ts +2 -2
  292. package/dist/@codegen/switchboard_v2/instructions/vrfPoolAdd.d.ts.map +1 -1
  293. package/dist/@codegen/switchboard_v2/instructions/vrfPoolInit.d.ts +2 -2
  294. package/dist/@codegen/switchboard_v2/instructions/vrfPoolInit.d.ts.map +1 -1
  295. package/dist/@codegen/switchboard_v2/instructions/vrfPoolRemove.d.ts +2 -2
  296. package/dist/@codegen/switchboard_v2/instructions/vrfPoolRemove.d.ts.map +1 -1
  297. package/dist/@codegen/switchboard_v2/instructions/vrfPoolRequest.d.ts +2 -2
  298. package/dist/@codegen/switchboard_v2/instructions/vrfPoolRequest.d.ts.map +1 -1
  299. package/dist/@codegen/switchboard_v2/instructions/vrfProveAndVerify.d.ts +2 -2
  300. package/dist/@codegen/switchboard_v2/instructions/vrfProveAndVerify.d.ts.map +1 -1
  301. package/dist/@codegen/switchboard_v2/instructions/vrfRequestRandomness.d.ts +2 -2
  302. package/dist/@codegen/switchboard_v2/instructions/vrfRequestRandomness.d.ts.map +1 -1
  303. package/dist/@codegen/switchboard_v2/instructions/vrfSetCallback.d.ts +2 -2
  304. package/dist/@codegen/switchboard_v2/instructions/vrfSetCallback.d.ts.map +1 -1
  305. package/dist/classes/action.d.ts +2 -2
  306. package/dist/classes/action.d.ts.map +1 -1
  307. package/dist/classes/fraction.d.ts.map +1 -1
  308. package/dist/classes/fraction.js +24 -5
  309. package/dist/classes/fraction.js.map +1 -1
  310. package/dist/classes/manager.d.ts +15 -11
  311. package/dist/classes/manager.d.ts.map +1 -1
  312. package/dist/classes/manager.js +16 -49
  313. package/dist/classes/manager.js.map +1 -1
  314. package/dist/classes/vault.d.ts +19 -9
  315. package/dist/classes/vault.d.ts.map +1 -1
  316. package/dist/classes/vault.js +67 -20
  317. package/dist/classes/vault.js.map +1 -1
  318. package/dist/client/commands/initFarmsForReserve.d.ts.map +1 -1
  319. package/dist/client/commands/initFarmsForReserve.js +1 -2
  320. package/dist/client/commands/initFarmsForReserve.js.map +1 -1
  321. package/dist/leverage/instructions.d.ts +4 -4
  322. package/dist/leverage/instructions.d.ts.map +1 -1
  323. package/dist/leverage/operations.d.ts +3 -3
  324. package/dist/manager/client_kamino_manager.js +4 -0
  325. package/dist/manager/client_kamino_manager.js.map +1 -1
  326. package/dist/referrals/instructions.d.ts +2 -2
  327. package/dist/referrals/instructions.d.ts.map +1 -1
  328. package/dist/utils/ata.d.ts +1 -1
  329. package/dist/utils/ata.d.ts.map +1 -1
  330. package/dist/utils/farmUtils.d.ts +10 -0
  331. package/dist/utils/farmUtils.d.ts.map +1 -0
  332. package/dist/utils/farmUtils.js +41 -0
  333. package/dist/utils/farmUtils.js.map +1 -0
  334. package/package.json +5 -4
  335. package/src/classes/fraction.ts +25 -5
  336. package/src/classes/manager.ts +34 -66
  337. package/src/classes/vault.ts +124 -22
  338. package/src/client/commands/initFarmsForReserve.ts +1 -1
  339. package/src/manager/client_kamino_manager.ts +4 -0
  340. package/src/utils/farmUtils.ts +76 -0
@@ -98,8 +98,8 @@ import { SYSVAR_RENT_ADDRESS } from '@solana/sysvars';
98
98
  import { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';
99
99
  import type { AccountInfoBase, AccountInfoWithJsonData, AccountInfoWithPubkey } from '@solana/rpc-types';
100
100
  import { arrayElementConfigItems, ConfigUpdater } from './configItems';
101
- import { getFarmIncentives, ReserveIncentives } from '@kamino-finance/farms-sdk/dist/utils/apy';
102
101
  import { OracleMappings } from '@kamino-finance/scope-sdk/dist/@codegen/scope/accounts';
102
+ import { getReserveFarmRewardsAPY as getReserveFarmRewardsAPYUtils, ReserveIncentives } from '../utils/farmUtils';
103
103
 
104
104
  const base58Decoder = getBase58Decoder();
105
105
 
@@ -1023,14 +1023,15 @@ export class KaminoManager {
1023
1023
  }
1024
1024
 
1025
1025
  /**
1026
- * This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, actual APY, utilization ratio and total borrowed amount
1026
+ * This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, utilization ratio and total borrowed amount
1027
1027
  * @param vault - the kamino vault to get available liquidity to withdraw for
1028
- * @param price - the price of the token in the vault (e.g. USDC)
1028
+ * @param vaultTokenPrice - the price of the token in the vault (e.g. USDC)
1029
1029
  * @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
1030
- * @param [vaultReserves] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
1030
+ * @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
1031
1031
  * @param [kaminoMarkets] - a list of all kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
1032
1032
  * @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
1033
- * @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
1033
+ * @param [tokensPrices] - a hashmap from a token pubkey to the price of the token in USD. Optional. If some tokens are not in the map, the function will fetch the price
1034
+ * @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD, along sie APYs
1034
1035
  */
1035
1036
  async getVaultOverview(
1036
1037
  vault: VaultState,
@@ -1038,9 +1039,10 @@ export class KaminoManager {
1038
1039
  slot?: Slot,
1039
1040
  vaultReserves?: Map<Address, KaminoReserve>,
1040
1041
  kaminoMarkets?: KaminoMarket[],
1041
- currentSlot?: Slot
1042
+ currentSlot?: Slot,
1043
+ tokensPrices?: Map<Address, Decimal>
1042
1044
  ): Promise<VaultOverview> {
1043
- return this._vaultClient.getVaultOverview(vault, price, slot, vaultReserves, kaminoMarkets, currentSlot);
1045
+ return this._vaultClient.getVaultOverview(vault, price, slot, vaultReserves, kaminoMarkets, currentSlot, tokensPrices);
1044
1046
  }
1045
1047
 
1046
1048
  /**
@@ -1190,82 +1192,48 @@ export class KaminoManager {
1190
1192
  * Read the APY of the farm built on top of the vault (farm in vaultState.vaultFarm)
1191
1193
  * @param vault - the vault to read the farm APY for
1192
1194
  * @param vaultTokenPrice - the price of the vault token in USD (e.g. 1.0 for USDC)
1195
+ * @param [farmsClient] - the farms client to use. Optional. If not provided, the function will create a new one
1193
1196
  * @param [slot] - the slot to read the farm APY for. Optional. If not provided, the function will read the current slot
1194
1197
  * @returns the APY of the farm built on top of the vault
1195
1198
  */
1196
- async getVaultFarmRewardsAPY(vault: KaminoVault, vaultTokenPrice: Decimal, slot?: Slot): Promise<FarmIncentives> {
1197
- return this._vaultClient.getVaultRewardsAPY(vault, vaultTokenPrice, slot);
1199
+ async getVaultFarmRewardsAPY(
1200
+ vault: KaminoVault,
1201
+ vaultTokenPrice: Decimal,
1202
+ farmsClient?: Farms,
1203
+ slot?: Slot
1204
+ ): Promise<FarmIncentives> {
1205
+ return this._vaultClient.getVaultRewardsAPY(vault, vaultTokenPrice, farmsClient, slot);
1198
1206
  }
1199
1207
 
1200
1208
  /**
1201
1209
  * This will return the APY of the reserve farms (debt and supply)
1202
1210
  * @param reserve - the reserve to get the farms APY for
1203
1211
  * @param reserveTokenPrice - the price of the reserve token in USD (e.g. 1.0 for USDC)
1212
+ * @param [farmsClient] - the farms client to use. Optional. If not provided, the function will create a new one
1213
+ * @param [slot] - the slot to read the farm APY for. Optional. If not provided, the function will read the current slot
1204
1214
  * @param [reserveState] - the reserve state. Optional. If not provided, the function will fetch the reserve state
1205
- * @param [kaminoMarket] - the kamino market. Optional. If not provided, the function will fetch the kamino market
1215
+ * @param [cTokenMintDecimals] - the decimals of the cToken mint. Optional. If not provided, the function will fetch the decimals from the mint
1206
1216
  * @returns the APY of the farm built on top of the reserve
1207
1217
  */
1208
1218
  async getReserveFarmRewardsAPY(
1209
1219
  reserve: Address,
1210
1220
  reserveTokenPrice: Decimal,
1221
+ farmsClient?: Farms,
1222
+ slot?: Slot,
1211
1223
  reserveState?: Reserve,
1212
- kaminoMarket?: KaminoMarket
1224
+ cTokenMintDecimals?: number
1213
1225
  ): Promise<ReserveIncentives> {
1214
- const reserveIncentives: ReserveIncentives = {
1215
- collateralFarmIncentives: null,
1216
- debtFarmIncentives: null,
1217
- };
1218
-
1219
- console.log('this._kaminoLendProgramId', this._kaminoLendProgramId.toString());
1220
- const reserveAccount = reserveState
1221
- ? reserveState
1222
- : await Reserve.fetch(this._rpc, reserve, this._kaminoLendProgramId);
1223
- if (!reserveAccount) {
1224
- throw new Error(`Reserve ${reserve} not found`);
1225
- }
1226
-
1227
- let market = kaminoMarket;
1228
- if (!market) {
1229
- const fetckedMarket = await KaminoMarket.load(this._rpc, reserveAccount.lendingMarket, 450);
1230
- if (!fetckedMarket) {
1231
- throw new Error(`Market ${reserveAccount.lendingMarket} not found`);
1232
- }
1233
- market = fetckedMarket;
1234
- }
1235
-
1236
- const kaminoReserve = market.getReserveByAddress(reserve);
1237
- if (!kaminoReserve) {
1238
- throw new Error(`Strategy state not found for strategy: ${reserve}`);
1239
- }
1240
-
1241
- const farmCollateral = kaminoReserve.state.farmCollateral;
1242
- const farmDebt = kaminoReserve.state.farmDebt;
1243
-
1244
- const stakedTokenMintDecimals = kaminoReserve.getMintDecimals();
1245
- const reserveCtokenPrice = reserveTokenPrice.div(kaminoReserve.getCollateralExchangeRate());
1246
-
1247
- const farmsClient = new Farms(this._rpc);
1248
- if (farmCollateral !== DEFAULT_PUBLIC_KEY) {
1249
- const farmIncentivesCollateral = await getFarmIncentives(
1250
- farmsClient,
1251
- farmCollateral,
1252
- reserveCtokenPrice,
1253
- 6 // all cTokens have 6 decimals
1254
- );
1255
- reserveIncentives.collateralFarmIncentives = farmIncentivesCollateral;
1256
- }
1257
-
1258
- if (farmDebt !== DEFAULT_PUBLIC_KEY) {
1259
- const farmIncentivesDebt = await getFarmIncentives(
1260
- farmsClient,
1261
- farmDebt,
1262
- reserveTokenPrice,
1263
- stakedTokenMintDecimals
1264
- );
1265
- reserveIncentives.debtFarmIncentives = farmIncentivesDebt;
1266
- }
1267
-
1268
- return reserveIncentives;
1226
+ return getReserveFarmRewardsAPYUtils(
1227
+ this._rpc,
1228
+ this.recentSlotDurationMs,
1229
+ reserve,
1230
+ reserveTokenPrice,
1231
+ this._kaminoLendProgramId,
1232
+ farmsClient ? farmsClient : new Farms(this._rpc),
1233
+ slot ? slot : await this.getRpc().getSlot().send(),
1234
+ reserveState,
1235
+ cTokenMintDecimals
1236
+ );
1269
1237
  }
1270
1238
 
1271
1239
  /**
@@ -125,6 +125,7 @@ import { getExtendLookupTableInstruction } from '@solana-program/address-lookup-
125
125
  import { Farms } from '@kamino-finance/farms-sdk';
126
126
  import { getFarmIncentives } from '@kamino-finance/farms-sdk/dist/utils/apy';
127
127
  import { computeReservesAllocation } from '../utils/vaultAllocation';
128
+ import { getReserveFarmRewardsAPY } from '../utils/farmUtils';
128
129
 
129
130
  export const kaminoVaultId = address('KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd');
130
131
  export const kaminoVaultStagingId = address('stKvQfwRsQiKnLtMNVLHKS3exFJmZFsgfzBPWHECUYK');
@@ -2065,19 +2066,21 @@ export class KaminoVaultClient {
2065
2066
 
2066
2067
  /**
2067
2068
  * This method calculates the token per share value. This will always change based on interest earned from the vault, but calculating it requires a bunch of rpc requests. Caching this for a short duration would be optimal
2068
- * @param vault - vault to calculate tokensPerShare for
2069
+ * @param vaultState - vault state to calculate tokensPerShare for
2069
2070
  * @param [slot] - the slot at which we retrieve the tokens per share. Optional. If not provided, the function will fetch the current slot
2070
2071
  * @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
2071
2072
  * @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
2072
2073
  * @returns - token per share value
2073
2074
  */
2074
2075
  async getTokensPerShareSingleVault(
2075
- vault: KaminoVault,
2076
+ vaultOrState: KaminoVault | VaultState,
2076
2077
  slot?: Slot,
2077
2078
  vaultReservesMap?: Map<Address, KaminoReserve>,
2078
2079
  currentSlot?: Slot
2079
2080
  ): Promise<Decimal> {
2080
- const vaultState = await vault.getState(this.getConnection());
2081
+ // Determine if we have a KaminoVault or VaultState
2082
+ const vaultState = 'getState' in vaultOrState ? await vaultOrState.getState(this.getConnection()) : vaultOrState;
2083
+
2081
2084
  if (vaultState.sharesIssued.isZero()) {
2082
2085
  return new Decimal(0);
2083
2086
  }
@@ -2649,47 +2652,60 @@ export class KaminoVaultClient {
2649
2652
  /**
2650
2653
  * This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, utilization ratio and total borrowed amount
2651
2654
  * @param vault - the kamino vault to get available liquidity to withdraw for
2652
- * @param price - the price of the token in the vault (e.g. USDC)
2655
+ * @param vaultTokenPrice - the price of the token in the vault (e.g. USDC)
2653
2656
  * @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
2654
2657
  * @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
2655
2658
  * @param [kaminoMarkets] - a list of all kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
2656
2659
  * @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
2657
- * @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
2660
+ * @param [tokensPrices] - a hashmap from a token pubkey to the price of the token in USD. Optional. If some tokens are not in the map, the function will fetch the price
2661
+ * @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD, along sie APYs
2658
2662
  */
2659
2663
  async getVaultOverview(
2660
2664
  vault: VaultState,
2661
- price: Decimal,
2665
+ vaultTokenPrice: Decimal,
2662
2666
  slot?: Slot,
2663
2667
  vaultReservesMap?: Map<Address, KaminoReserve>,
2664
2668
  kaminoMarkets?: KaminoMarket[],
2665
- currentSlot?: Slot
2669
+ currentSlot?: Slot,
2670
+ tokensPrices?: Map<Address, Decimal>
2666
2671
  ): Promise<VaultOverview> {
2667
2672
  const vaultReservesState = vaultReservesMap ? vaultReservesMap : await this.loadVaultReserves(vault);
2668
2673
 
2669
- const vaultHoldingsWithUSDValuePromise = await this.getVaultHoldingsWithPrice(
2674
+ const vaultHoldingsWithUSDValuePromise = this.getVaultHoldingsWithPrice(
2670
2675
  vault,
2671
- price,
2676
+ vaultTokenPrice,
2672
2677
  slot,
2673
2678
  vaultReservesState,
2674
2679
  currentSlot
2675
2680
  );
2676
2681
 
2677
2682
  const slotForOverview = slot ? slot : await this.getConnection().getSlot().send();
2683
+ const farmsClient = new Farms(this.getConnection());
2678
2684
 
2679
- const vaultTheoreticalAPYPromise = await this.getVaultTheoreticalAPY(vault, slotForOverview, vaultReservesState);
2680
- const vaultActualAPYPromise = await this.getVaultActualAPY(vault, slotForOverview, vaultReservesState);
2681
- const totalInvestedAndBorrowedPromise = await this.getTotalBorrowedAndInvested(
2685
+ const vaultTheoreticalAPYPromise = this.getVaultTheoreticalAPY(vault, slotForOverview, vaultReservesState);
2686
+ const vaultActualAPYPromise = this.getVaultActualAPY(vault, slotForOverview, vaultReservesState);
2687
+ const totalInvestedAndBorrowedPromise = this.getTotalBorrowedAndInvested(
2682
2688
  vault,
2683
2689
  slotForOverview,
2684
2690
  vaultReservesState
2685
2691
  );
2686
- const vaultCollateralsPromise = await this.getVaultCollaterals(
2692
+ const vaultCollateralsPromise = this.getVaultCollaterals(vault, slotForOverview, vaultReservesState, kaminoMarkets);
2693
+ const reservesOverviewPromise = this.getVaultReservesDetails(vault, slotForOverview, vaultReservesState);
2694
+ const vaultFarmIncentivesPromise = this.getVaultRewardsAPY(
2695
+ vault,
2696
+ vaultTokenPrice,
2697
+ farmsClient,
2698
+ slotForOverview,
2699
+ tokensPrices
2700
+ );
2701
+ const vaultReservesFarmIncentivesPromise = this.getVaultReservesFarmsIncentives(
2687
2702
  vault,
2703
+ vaultTokenPrice,
2704
+ farmsClient,
2688
2705
  slotForOverview,
2689
2706
  vaultReservesState,
2690
- kaminoMarkets
2707
+ tokensPrices
2691
2708
  );
2692
- const reservesOverviewPromise = await this.getVaultReservesDetails(vault, slotForOverview, vaultReservesState);
2693
2709
 
2694
2710
  // all the async part of the functions above just read the vaultReservesState which is read beforehand, so excepting vaultCollateralsPromise they should do no additional network calls
2695
2711
  const [
@@ -2699,6 +2715,8 @@ export class KaminoVaultClient {
2699
2715
  totalInvestedAndBorrowed,
2700
2716
  vaultCollaterals,
2701
2717
  reservesOverview,
2718
+ vaultFarmIncentives,
2719
+ vaultReservesFarmIncentives,
2702
2720
  ] = await Promise.all([
2703
2721
  vaultHoldingsWithUSDValuePromise,
2704
2722
  vaultTheoreticalAPYPromise,
@@ -2706,6 +2724,8 @@ export class KaminoVaultClient {
2706
2724
  totalInvestedAndBorrowedPromise,
2707
2725
  vaultCollateralsPromise,
2708
2726
  reservesOverviewPromise,
2727
+ vaultFarmIncentivesPromise,
2728
+ vaultReservesFarmIncentivesPromise,
2709
2729
  ]);
2710
2730
 
2711
2731
  return {
@@ -2714,11 +2734,13 @@ export class KaminoVaultClient {
2714
2734
  vaultCollaterals: vaultCollaterals,
2715
2735
  actualSupplyAPY: vaultActualAPYs,
2716
2736
  theoreticalSupplyAPY: vaultTheoreticalAPYs,
2737
+ vaultFarmIncentives: vaultFarmIncentives,
2738
+ reservesFarmsIncentives: vaultReservesFarmIncentives,
2717
2739
  totalBorrowed: totalInvestedAndBorrowed.totalBorrowed,
2718
- totalBorrowedUSD: totalInvestedAndBorrowed.totalBorrowed.mul(price),
2740
+ totalBorrowedUSD: totalInvestedAndBorrowed.totalBorrowed.mul(vaultTokenPrice),
2719
2741
  utilizationRatio: totalInvestedAndBorrowed.utilizationRatio,
2720
2742
  totalSupplied: totalInvestedAndBorrowed.totalInvested,
2721
- totalSuppliedUSD: totalInvestedAndBorrowed.totalInvested.mul(price),
2743
+ totalSuppliedUSD: totalInvestedAndBorrowed.totalInvested.mul(vaultTokenPrice),
2722
2744
  };
2723
2745
  }
2724
2746
 
@@ -3032,11 +3054,19 @@ export class KaminoVaultClient {
3032
3054
  * Read the APY of the farm built on top of the vault (farm in vaultState.vaultFarm)
3033
3055
  * @param vault - the vault to read the farm APY for
3034
3056
  * @param vaultTokenPrice - the price of the vault token in USD (e.g. 1.0 for USDC)
3057
+ * @param [farmsClient] - the farms client to use. Optional. If not provided, the function will create a new one
3035
3058
  * @param [slot] - the slot to read the farm APY for. Optional. If not provided, the function will read the current slot
3036
3059
  * @returns the APY of the farm built on top of the vault
3037
3060
  */
3038
- async getVaultRewardsAPY(vault: KaminoVault, vaultTokenPrice: Decimal, slot?: Slot): Promise<FarmIncentives> {
3039
- const vaultState = await vault.getState(this.getConnection());
3061
+ async getVaultRewardsAPY(
3062
+ vaultOrState: KaminoVault | VaultState,
3063
+ vaultTokenPrice: Decimal,
3064
+ farmsClient?: Farms,
3065
+ slot?: Slot,
3066
+ tokensPrices?: Map<Address, Decimal>
3067
+ ): Promise<FarmIncentives> {
3068
+ // Determine if we have a KaminoVault or VaultState
3069
+ const vaultState = 'getState' in vaultOrState ? await vaultOrState.getState(this.getConnection()) : vaultOrState;
3040
3070
  if (vaultState.vaultFarm === DEFAULT_PUBLIC_KEY) {
3041
3071
  return {
3042
3072
  incentivesStats: [],
@@ -3044,12 +3074,77 @@ export class KaminoVaultClient {
3044
3074
  };
3045
3075
  }
3046
3076
 
3047
- const tokensPerShare = await this.getTokensPerShareSingleVault(vault, slot);
3077
+ const tokensPerShare = await this.getTokensPerShareSingleVault(vaultState, slot);
3048
3078
  const sharePrice = tokensPerShare.mul(vaultTokenPrice);
3049
3079
  const stakedTokenMintDecimals = vaultState.sharesMintDecimals.toNumber();
3050
3080
 
3051
- const farmsClient = new Farms(this.getConnection());
3052
- return getFarmIncentives(farmsClient, vaultState.vaultFarm, sharePrice, stakedTokenMintDecimals);
3081
+ const kFarmsClient = farmsClient ? farmsClient : new Farms(this.getConnection());
3082
+ return getFarmIncentives(kFarmsClient, vaultState.vaultFarm, sharePrice, stakedTokenMintDecimals, tokensPrices);
3083
+ }
3084
+
3085
+ async getVaultReservesFarmsIncentives(
3086
+ vaultOrState: KaminoVault | VaultState,
3087
+ vaultTokenPrice: Decimal,
3088
+ farmsClient?: Farms,
3089
+ slot?: Slot,
3090
+ vaultReservesMap?: Map<Address, KaminoReserve>,
3091
+ tokensPrices?: Map<Address, Decimal>
3092
+ ): Promise<VaultReservesFarmsIncentives> {
3093
+ const vaultState = 'getState' in vaultOrState ? await vaultOrState.getState(this.getConnection()) : vaultOrState;
3094
+
3095
+ const vaultReservesState = vaultReservesMap ? vaultReservesMap : await this.loadVaultReserves(vaultState);
3096
+ const currentSlot = slot ? slot : await this.getConnection().getSlot({ commitment: 'confirmed' }).send();
3097
+
3098
+ const holdings = await this.getVaultHoldings(vaultState, currentSlot, vaultReservesState);
3099
+
3100
+ const vaultReservesAddresses = vaultState.vaultAllocationStrategy.map(
3101
+ (allocationStrategy) => allocationStrategy.reserve
3102
+ );
3103
+
3104
+ const vaultReservesFarmsIncentives = new Map<Address, FarmIncentives>();
3105
+ let totalIncentivesApy = new Decimal(0);
3106
+
3107
+ const kFarmsClient = farmsClient ? farmsClient : new Farms(this.getConnection());
3108
+ for (const reserveAddress of vaultReservesAddresses) {
3109
+ if (reserveAddress === DEFAULT_PUBLIC_KEY) {
3110
+ continue;
3111
+ }
3112
+
3113
+ const reserveState = vaultReservesState.get(reserveAddress);
3114
+ if (reserveState === undefined) {
3115
+ console.log(`Reserve to read farm incentives for not found: ${reserveAddress}`);
3116
+ vaultReservesFarmsIncentives.set(reserveAddress, {
3117
+ incentivesStats: [],
3118
+ totalIncentivesApy: 0,
3119
+ });
3120
+ continue;
3121
+ }
3122
+
3123
+ const reserveFarmIncentives = await getReserveFarmRewardsAPY(
3124
+ this._rpc,
3125
+ this.recentSlotDurationMs,
3126
+ reserveAddress,
3127
+ vaultTokenPrice,
3128
+ this._kaminoLendProgramId,
3129
+ kFarmsClient,
3130
+ currentSlot,
3131
+ reserveState.state,
3132
+ undefined,
3133
+ tokensPrices
3134
+ );
3135
+ vaultReservesFarmsIncentives.set(reserveAddress, reserveFarmIncentives.collateralFarmIncentives);
3136
+
3137
+ const investedInReserve = holdings.investedInReserves.get(reserveAddress);
3138
+ const weightedReserveAPY = new Decimal(reserveFarmIncentives.collateralFarmIncentives.totalIncentivesApy)
3139
+ .mul(investedInReserve ?? 0)
3140
+ .div(holdings.totalAUMIncludingFees);
3141
+ totalIncentivesApy = totalIncentivesApy.add(weightedReserveAPY);
3142
+ }
3143
+
3144
+ return {
3145
+ reserveFarmsIncentives: vaultReservesFarmsIncentives,
3146
+ totalIncentivesAPY: totalIncentivesApy,
3147
+ };
3053
3148
  }
3054
3149
 
3055
3150
  private appendRemainingAccountsForVaultReserves(
@@ -3286,6 +3381,8 @@ export type VaultOverview = {
3286
3381
  vaultCollaterals: Map<Address, MarketOverview>;
3287
3382
  theoreticalSupplyAPY: APYs;
3288
3383
  actualSupplyAPY: APYs;
3384
+ vaultFarmIncentives: FarmIncentives;
3385
+ reservesFarmsIncentives: VaultReservesFarmsIncentives;
3289
3386
  totalBorrowed: Decimal;
3290
3387
  totalBorrowedUSD: Decimal;
3291
3388
  totalSupplied: Decimal;
@@ -3293,6 +3390,11 @@ export type VaultOverview = {
3293
3390
  utilizationRatio: Decimal;
3294
3391
  };
3295
3392
 
3393
+ export type VaultReservesFarmsIncentives = {
3394
+ reserveFarmsIncentives: Map<Address, FarmIncentives>;
3395
+ totalIncentivesAPY: Decimal;
3396
+ };
3397
+
3296
3398
  export type VaultFeesPct = {
3297
3399
  managementFeePct: Decimal;
3298
3400
  performanceFeePct: Decimal;
@@ -1,5 +1,6 @@
1
1
  import { Address, generateKeyPairSigner, TransactionSigner } from '@solana/kit';
2
2
  import {
3
+ DEFAULT_RECENT_SLOT_DURATION_MS,
3
4
  initFarmsForReserve as initFarmsForReserveIx,
4
5
  KaminoMarket,
5
6
  lendingMarketAuthPda,
@@ -11,7 +12,6 @@ import { getCreateAccountInstruction, SYSTEM_PROGRAM_ADDRESS } from '@solana-pro
11
12
  import { SYSVAR_RENT_ADDRESS } from '@solana/sysvars';
12
13
  import { CliEnv, SendTxMode } from '../tx/CliEnv';
13
14
  import { processTx } from '../tx/processor';
14
- import { DEFAULT_RECENT_SLOT_DURATION_MS } from '@kamino-finance/klend-sdk';
15
15
 
16
16
  export async function initFarmsForReserve(
17
17
  env: CliEnv,
@@ -1318,6 +1318,10 @@ async function main() {
1318
1318
  );
1319
1319
 
1320
1320
  console.log('vaultOverview', vaultOverview);
1321
+ vaultOverview.reservesFarmsIncentives.reserveFarmsIncentives.forEach((incentive, reserveAddress) => {
1322
+ console.log('reserve ', reserveAddress);
1323
+ console.log('reserve incentive', incentive);
1324
+ });
1321
1325
  });
1322
1326
 
1323
1327
  commands
@@ -0,0 +1,76 @@
1
+ import { Address, Rpc, Slot, SolanaRpcApi } from '@solana/kit';
2
+ import { Decimal } from 'decimal.js';
3
+ import { FarmIncentives, Farms } from '@kamino-finance/farms-sdk';
4
+ import { getFarmIncentives } from '@kamino-finance/farms-sdk/dist/utils/apy';
5
+ import { DEFAULT_PUBLIC_KEY } from '@kamino-finance/farms-sdk';
6
+ import { Reserve } from '../@codegen/klend/accounts';
7
+ import { KaminoReserve } from '../lib';
8
+ import { getMintDecimals } from '@kamino-finance/kliquidity-sdk';
9
+
10
+ export interface ReserveIncentives {
11
+ collateralFarmIncentives: FarmIncentives;
12
+ debtFarmIncentives: FarmIncentives;
13
+ }
14
+
15
+ export async function getReserveFarmRewardsAPY(
16
+ rpc: Rpc<SolanaRpcApi>,
17
+ recentSlotDurationMs: number,
18
+ reserve: Address,
19
+ reserveLiquidityTokenPrice: Decimal,
20
+ kaminoLendProgramId: Address,
21
+ farmsClient: Farms,
22
+ slot: Slot,
23
+ reserveState?: Reserve,
24
+ cTokenMintDecimals?: number,
25
+ tokensPrices?: Map<Address, Decimal>
26
+ ): Promise<ReserveIncentives> {
27
+ const reserveIncentives: ReserveIncentives = {
28
+ collateralFarmIncentives: {
29
+ incentivesStats: [],
30
+ totalIncentivesApy: 0,
31
+ },
32
+ debtFarmIncentives: {
33
+ incentivesStats: [],
34
+ totalIncentivesApy: 0,
35
+ },
36
+ };
37
+
38
+ const reserveAccount = reserveState ? reserveState : await Reserve.fetch(rpc, reserve, kaminoLendProgramId);
39
+ if (!reserveAccount) {
40
+ throw new Error(`Reserve ${reserve} not found`);
41
+ }
42
+
43
+ const kaminoReserve = await KaminoReserve.initializeFromAddress(reserve, rpc, recentSlotDurationMs, reserveAccount);
44
+
45
+ const farmCollateral = kaminoReserve.state.farmCollateral;
46
+ const farmDebt = kaminoReserve.state.farmDebt;
47
+
48
+ const stakedTokenMintDecimals = kaminoReserve.getMintDecimals();
49
+ const reserveCtokenPrice = reserveLiquidityTokenPrice.div(kaminoReserve.getEstimatedCollateralExchangeRate(slot, 0));
50
+ const cTokenMint = kaminoReserve.getCTokenMint();
51
+ const cTokenDecimals = cTokenMintDecimals ? cTokenMintDecimals : await getMintDecimals(rpc, cTokenMint);
52
+
53
+ if (farmCollateral !== DEFAULT_PUBLIC_KEY) {
54
+ const farmIncentivesCollateral = await getFarmIncentives(
55
+ farmsClient,
56
+ farmCollateral,
57
+ reserveCtokenPrice,
58
+ cTokenDecimals,
59
+ tokensPrices
60
+ );
61
+ reserveIncentives.collateralFarmIncentives = farmIncentivesCollateral;
62
+ }
63
+
64
+ if (farmDebt !== DEFAULT_PUBLIC_KEY) {
65
+ const farmIncentivesDebt = await getFarmIncentives(
66
+ farmsClient,
67
+ farmDebt,
68
+ reserveLiquidityTokenPrice,
69
+ stakedTokenMintDecimals,
70
+ tokensPrices
71
+ );
72
+ reserveIncentives.debtFarmIncentives = farmIncentivesDebt;
73
+ }
74
+
75
+ return reserveIncentives;
76
+ }