@exponent-labs/klend-idl 0.9.24 → 0.9.26

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 (394) hide show
  1. package/build/accounts/GlobalConfig.d.ts +27 -0
  2. package/build/accounts/GlobalConfig.js +112 -0
  3. package/build/accounts/GlobalConfig.js.map +1 -0
  4. package/build/accounts/LendingMarket.d.ts +93 -9
  5. package/build/accounts/LendingMarket.js +202 -20
  6. package/build/accounts/LendingMarket.js.map +1 -1
  7. package/build/accounts/Obligation.d.ts +33 -9
  8. package/build/accounts/Obligation.js +69 -20
  9. package/build/accounts/Obligation.js.map +1 -1
  10. package/build/accounts/ReferrerState.js +7 -2
  11. package/build/accounts/ReferrerState.js.map +1 -1
  12. package/build/accounts/ReferrerTokenState.js +3 -1
  13. package/build/accounts/ReferrerTokenState.js.map +1 -1
  14. package/build/accounts/Reserve.d.ts +3 -0
  15. package/build/accounts/Reserve.js +8 -2
  16. package/build/accounts/Reserve.js.map +1 -1
  17. package/build/accounts/ShortUrl.js +7 -2
  18. package/build/accounts/ShortUrl.js.map +1 -1
  19. package/build/accounts/UserMetadata.js +3 -1
  20. package/build/accounts/UserMetadata.js.map +1 -1
  21. package/build/accounts/UserState.js +3 -1
  22. package/build/accounts/UserState.js.map +1 -1
  23. package/build/accounts/WithdrawTicket.d.ts +49 -0
  24. package/build/accounts/WithdrawTicket.js +158 -0
  25. package/build/accounts/WithdrawTicket.js.map +1 -0
  26. package/build/accounts/index.d.ts +4 -0
  27. package/build/accounts/index.js +5 -1
  28. package/build/accounts/index.js.map +1 -1
  29. package/build/errors/custom.d.ts +605 -13
  30. package/build/errors/custom.js +1063 -26
  31. package/build/errors/custom.js.map +1 -1
  32. package/build/index.d.ts +2 -3
  33. package/build/index.js +3 -7
  34. package/build/index.js.map +1 -1
  35. package/build/instructions/abortObligationOwnershipTransfer.d.ts +7 -0
  36. package/build/instructions/abortObligationOwnershipTransfer.js +21 -0
  37. package/build/instructions/abortObligationOwnershipTransfer.js.map +1 -0
  38. package/build/instructions/acceptObligationOwnership.d.ts +7 -0
  39. package/build/instructions/acceptObligationOwnership.js +21 -0
  40. package/build/instructions/acceptObligationOwnership.js.map +1 -0
  41. package/build/instructions/approveObligationOwnershipTransfer.d.ts +9 -0
  42. package/build/instructions/approveObligationOwnershipTransfer.js +23 -0
  43. package/build/instructions/approveObligationOwnershipTransfer.js.map +1 -0
  44. package/build/instructions/borrowObligationLiquidity.d.ts +1 -1
  45. package/build/instructions/borrowObligationLiquidity.js +9 -2
  46. package/build/instructions/borrowObligationLiquidity.js.map +1 -1
  47. package/build/instructions/borrowObligationLiquidityV2.js +26 -6
  48. package/build/instructions/borrowObligationLiquidityV2.js.map +1 -1
  49. package/build/instructions/calculateCtokenExchangeRate.d.ts +5 -0
  50. package/build/instructions/calculateCtokenExchangeRate.js +15 -0
  51. package/build/instructions/calculateCtokenExchangeRate.js.map +1 -0
  52. package/build/instructions/cancelWithdrawTicket.d.ts +19 -0
  53. package/build/instructions/cancelWithdrawTicket.js +87 -0
  54. package/build/instructions/cancelWithdrawTicket.js.map +1 -0
  55. package/build/instructions/cloneReserveConfig.d.ts +14 -0
  56. package/build/instructions/cloneReserveConfig.js +70 -0
  57. package/build/instructions/cloneReserveConfig.js.map +1 -0
  58. package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -1
  59. package/build/instructions/depositAndWithdraw.d.ts +51 -0
  60. package/build/instructions/depositAndWithdraw.js +202 -0
  61. package/build/instructions/depositAndWithdraw.js.map +1 -0
  62. package/build/instructions/depositObligationCollateral.js.map +1 -1
  63. package/build/instructions/depositObligationCollateralV2.d.ts +25 -0
  64. package/build/instructions/depositObligationCollateralV2.js +109 -0
  65. package/build/instructions/depositObligationCollateralV2.js.map +1 -0
  66. package/build/instructions/depositReserveLiquidity.js +1 -1
  67. package/build/instructions/depositReserveLiquidity.js.map +1 -1
  68. package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +1 -1
  69. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +9 -6
  70. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
  71. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +26 -6
  72. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -1
  73. package/build/instructions/enqueueToWithdraw.d.ts +26 -0
  74. package/build/instructions/enqueueToWithdraw.js +113 -0
  75. package/build/instructions/enqueueToWithdraw.js.map +1 -0
  76. package/build/instructions/fillBorrowOrder.d.ts +25 -0
  77. package/build/instructions/fillBorrowOrder.js +82 -0
  78. package/build/instructions/fillBorrowOrder.js.map +1 -0
  79. package/build/instructions/fillBorrowOrderV2.d.ts +29 -0
  80. package/build/instructions/fillBorrowOrderV2.js +122 -0
  81. package/build/instructions/fillBorrowOrderV2.js.map +1 -0
  82. package/build/instructions/flashBorrowReserveLiquidity.d.ts +2 -2
  83. package/build/instructions/flashBorrowReserveLiquidity.js +9 -2
  84. package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -1
  85. package/build/instructions/flashRepayReserveLiquidity.d.ts +2 -2
  86. package/build/instructions/flashRepayReserveLiquidity.js +13 -3
  87. package/build/instructions/flashRepayReserveLiquidity.js.map +1 -1
  88. package/build/instructions/idlMissingTypes.d.ts +3 -2
  89. package/build/instructions/idlMissingTypes.js +7 -3
  90. package/build/instructions/idlMissingTypes.js.map +1 -1
  91. package/build/instructions/index.d.ts +61 -3
  92. package/build/instructions/index.js +62 -3
  93. package/build/instructions/index.js.map +1 -1
  94. package/build/instructions/initFarmsForReserve.d.ts +1 -0
  95. package/build/instructions/initFarmsForReserve.js +6 -1
  96. package/build/instructions/initFarmsForReserve.js.map +1 -1
  97. package/build/instructions/initGlobalConfig.d.ts +10 -0
  98. package/build/instructions/initGlobalConfig.js +24 -0
  99. package/build/instructions/initGlobalConfig.js.map +1 -0
  100. package/build/instructions/initLendingMarket.d.ts +1 -0
  101. package/build/instructions/initLendingMarket.js +8 -1
  102. package/build/instructions/initLendingMarket.js.map +1 -1
  103. package/build/instructions/initObligation.js.map +1 -1
  104. package/build/instructions/initObligationFarmsForReserve.js +1 -1
  105. package/build/instructions/initObligationFarmsForReserve.js.map +1 -1
  106. package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -1
  107. package/build/instructions/initReferrerTokenState.d.ts +2 -5
  108. package/build/instructions/initReferrerTokenState.js +3 -42
  109. package/build/instructions/initReferrerTokenState.js.map +1 -1
  110. package/build/instructions/initReserve.d.ts +3 -1
  111. package/build/instructions/initReserve.js +11 -1
  112. package/build/instructions/initReserve.js.map +1 -1
  113. package/build/instructions/initUserMetadata.d.ts +1 -1
  114. package/build/instructions/initUserMetadata.js +8 -5
  115. package/build/instructions/initUserMetadata.js.map +1 -1
  116. package/build/instructions/initiateObligationOwnershipTransfer.d.ts +11 -0
  117. package/build/instructions/initiateObligationOwnershipTransfer.js +61 -0
  118. package/build/instructions/initiateObligationOwnershipTransfer.js.map +1 -0
  119. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +2 -2
  120. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
  121. package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +42 -0
  122. package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +172 -0
  123. package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -0
  124. package/build/instructions/markObligationForDeleveraging.d.ts +12 -0
  125. package/build/instructions/markObligationForDeleveraging.js +62 -0
  126. package/build/instructions/markObligationForDeleveraging.js.map +1 -0
  127. package/build/instructions/recoverInvalidTicketCollateral.d.ts +20 -0
  128. package/build/instructions/recoverInvalidTicketCollateral.js +89 -0
  129. package/build/instructions/recoverInvalidTicketCollateral.js.map +1 -0
  130. package/build/instructions/redeemFees.js +1 -1
  131. package/build/instructions/redeemFees.js.map +1 -1
  132. package/build/instructions/redeemReserveCollateral.js +1 -1
  133. package/build/instructions/redeemReserveCollateral.js.map +1 -1
  134. package/build/instructions/refreshObligation.js.map +1 -1
  135. package/build/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
  136. package/build/instructions/refreshObligationFarmsForReserve.js +23 -7
  137. package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -1
  138. package/build/instructions/refreshReserve.d.ts +4 -4
  139. package/build/instructions/refreshReserve.js +11 -12
  140. package/build/instructions/refreshReserve.js.map +1 -1
  141. package/build/instructions/refreshReservesBatch.js.map +1 -1
  142. package/build/instructions/repayAndWithdrawAndRedeem.d.ts +46 -0
  143. package/build/instructions/repayAndWithdrawAndRedeem.js +177 -0
  144. package/build/instructions/repayAndWithdrawAndRedeem.js.map +1 -0
  145. package/build/instructions/repayObligationLiquidity.js +1 -1
  146. package/build/instructions/repayObligationLiquidity.js.map +1 -1
  147. package/build/instructions/repayObligationLiquidityV2.js +31 -7
  148. package/build/instructions/repayObligationLiquidityV2.js.map +1 -1
  149. package/build/instructions/requestElevationGroup.js.map +1 -1
  150. package/build/instructions/rolloverFixedTermBorrow.d.ts +25 -0
  151. package/build/instructions/rolloverFixedTermBorrow.js +76 -0
  152. package/build/instructions/rolloverFixedTermBorrow.js.map +1 -0
  153. package/build/instructions/seedDepositOnInitReserve.d.ts +11 -0
  154. package/build/instructions/seedDepositOnInitReserve.js +37 -0
  155. package/build/instructions/seedDepositOnInitReserve.js.map +1 -0
  156. package/build/instructions/setBorrowOrder.d.ts +20 -0
  157. package/build/instructions/setBorrowOrder.js +76 -0
  158. package/build/instructions/setBorrowOrder.js.map +1 -0
  159. package/build/instructions/setBorrowOrderV2.d.ts +21 -0
  160. package/build/instructions/setBorrowOrderV2.js +78 -0
  161. package/build/instructions/setBorrowOrderV2.js.map +1 -0
  162. package/build/instructions/setObligationOrder.d.ts +13 -0
  163. package/build/instructions/setObligationOrder.js +62 -0
  164. package/build/instructions/setObligationOrder.js.map +1 -0
  165. package/build/instructions/socializeLoss.d.ts +1 -1
  166. package/build/instructions/socializeLoss.js +1 -1
  167. package/build/instructions/socializeLoss.js.map +1 -1
  168. package/build/instructions/socializeLossV2.d.ts +22 -0
  169. package/build/instructions/socializeLossV2.js +94 -0
  170. package/build/instructions/socializeLossV2.js.map +1 -0
  171. package/build/instructions/topupReserveRewards.d.ts +16 -0
  172. package/build/instructions/topupReserveRewards.js +73 -0
  173. package/build/instructions/topupReserveRewards.js.map +1 -0
  174. package/build/instructions/updateGlobalConfig.d.ts +13 -0
  175. package/build/instructions/updateGlobalConfig.js +66 -0
  176. package/build/instructions/updateGlobalConfig.js.map +1 -0
  177. package/build/instructions/updateGlobalConfigAdmin.d.ts +7 -0
  178. package/build/instructions/updateGlobalConfigAdmin.js +21 -0
  179. package/build/instructions/updateGlobalConfigAdmin.js.map +1 -0
  180. package/build/instructions/updateLendingMarket.d.ts +2 -1
  181. package/build/instructions/updateLendingMarket.js +10 -2
  182. package/build/instructions/updateLendingMarket.js.map +1 -1
  183. package/build/instructions/updateLendingMarketOwner.d.ts +1 -0
  184. package/build/instructions/updateLendingMarketOwner.js +5 -0
  185. package/build/instructions/updateLendingMarketOwner.js.map +1 -1
  186. package/build/instructions/updateObligationConfig.d.ts +15 -0
  187. package/build/instructions/updateObligationConfig.js +71 -0
  188. package/build/instructions/updateObligationConfig.js.map +1 -0
  189. package/build/instructions/updateReserveConfig.d.ts +6 -4
  190. package/build/instructions/updateReserveConfig.js +15 -4
  191. package/build/instructions/updateReserveConfig.js.map +1 -1
  192. package/build/instructions/withdrawObligationCollateral.js +1 -1
  193. package/build/instructions/withdrawObligationCollateral.js.map +1 -1
  194. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +1 -1
  195. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +9 -6
  196. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
  197. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +21 -5
  198. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -1
  199. package/build/instructions/withdrawObligationCollateralV2.d.ts +25 -0
  200. package/build/instructions/withdrawObligationCollateralV2.js +109 -0
  201. package/build/instructions/withdrawObligationCollateralV2.js.map +1 -0
  202. package/build/instructions/withdrawProtocolFee.d.ts +3 -2
  203. package/build/instructions/withdrawProtocolFee.js +6 -5
  204. package/build/instructions/withdrawProtocolFee.js.map +1 -1
  205. package/build/instructions/withdrawQueuedLiquidity.d.ts +23 -0
  206. package/build/instructions/withdrawQueuedLiquidity.js +80 -0
  207. package/build/instructions/withdrawQueuedLiquidity.js.map +1 -0
  208. package/build/instructions/withdrawReferrerFees.js +1 -1
  209. package/build/instructions/withdrawReferrerFees.js.map +1 -1
  210. package/build/kamino_lending.d.ts +5753 -2295
  211. package/build/kamino_lending.js +5 -3936
  212. package/build/kamino_lending.js.map +1 -1
  213. package/build/kamino_lending.json +1856 -645
  214. package/build/types/BigFractionBytes.d.ts +2 -1
  215. package/build/types/BigFractionBytes.js +4 -1
  216. package/build/types/BigFractionBytes.js.map +1 -1
  217. package/build/types/BorrowOrder.d.ts +83 -0
  218. package/build/types/BorrowOrder.js +164 -0
  219. package/build/types/BorrowOrder.js.map +1 -0
  220. package/build/types/BorrowOrderConfigArgs.d.ts +42 -0
  221. package/build/types/BorrowOrderConfigArgs.js +107 -0
  222. package/build/types/BorrowOrderConfigArgs.js.map +1 -0
  223. package/build/types/BorrowRateCurve.js.map +1 -1
  224. package/build/types/CurvePoint.d.ts +2 -1
  225. package/build/types/CurvePoint.js.map +1 -1
  226. package/build/types/ElevationGroup.d.ts +2 -1
  227. package/build/types/ElevationGroup.js.map +1 -1
  228. package/build/types/ExchangeRateWithDecimals.d.ts +27 -0
  229. package/build/types/ExchangeRateWithDecimals.js +82 -0
  230. package/build/types/ExchangeRateWithDecimals.js.map +1 -0
  231. package/build/types/FeeCalculation.js +4 -1
  232. package/build/types/FeeCalculation.js.map +1 -1
  233. package/build/types/FixedTermBorrowRolloverConfig.d.ts +47 -0
  234. package/build/types/FixedTermBorrowRolloverConfig.js +114 -0
  235. package/build/types/FixedTermBorrowRolloverConfig.js.map +1 -0
  236. package/build/types/InitObligationArgs.d.ts +2 -1
  237. package/build/types/InitObligationArgs.js.map +1 -1
  238. package/build/types/LastUpdate.d.ts +12 -6
  239. package/build/types/LastUpdate.js +19 -7
  240. package/build/types/LastUpdate.js.map +1 -1
  241. package/build/types/ObligationLiquidity.d.ts +29 -5
  242. package/build/types/ObligationLiquidity.js +25 -8
  243. package/build/types/ObligationLiquidity.js.map +1 -1
  244. package/build/types/ObligationOrder.d.ts +57 -0
  245. package/build/types/ObligationOrder.js +127 -0
  246. package/build/types/ObligationOrder.js.map +1 -0
  247. package/build/types/ProgressCallbackType.d.ts +31 -0
  248. package/build/types/ProgressCallbackType.js +108 -0
  249. package/build/types/ProgressCallbackType.js.map +1 -0
  250. package/build/types/ReserveConfig.d.ts +87 -32
  251. package/build/types/ReserveConfig.js +122 -44
  252. package/build/types/ReserveConfig.js.map +1 -1
  253. package/build/types/ReserveConfigCustomizationArgs.d.ts +42 -0
  254. package/build/types/ReserveConfigCustomizationArgs.js +106 -0
  255. package/build/types/ReserveConfigCustomizationArgs.js.map +1 -0
  256. package/build/types/ReserveFees.d.ts +5 -5
  257. package/build/types/ReserveFees.js +7 -7
  258. package/build/types/ReserveFees.js.map +1 -1
  259. package/build/types/ReserveLiquidity.d.ts +20 -15
  260. package/build/types/ReserveLiquidity.js +29 -22
  261. package/build/types/ReserveLiquidity.js.map +1 -1
  262. package/build/types/UpdateConfigMode.d.ts +232 -63
  263. package/build/types/UpdateConfigMode.js +413 -100
  264. package/build/types/UpdateConfigMode.js.map +1 -1
  265. package/build/types/UpdateGlobalConfigMode.d.ts +31 -0
  266. package/build/types/UpdateGlobalConfigMode.js +108 -0
  267. package/build/types/UpdateGlobalConfigMode.js.map +1 -0
  268. package/build/types/UpdateLendingMarketConfigValue.d.ts +20 -0
  269. package/build/types/UpdateLendingMarketConfigValue.js +33 -1
  270. package/build/types/UpdateLendingMarketConfigValue.js.map +1 -1
  271. package/build/types/UpdateLendingMarketMode.d.ts +400 -23
  272. package/build/types/UpdateLendingMarketMode.js +732 -36
  273. package/build/types/UpdateLendingMarketMode.js.map +1 -1
  274. package/build/types/UpdateObligationConfigMode.d.ts +83 -0
  275. package/build/types/UpdateObligationConfigMode.js +204 -0
  276. package/build/types/UpdateObligationConfigMode.js.map +1 -0
  277. package/build/types/WithdrawQueue.d.ts +32 -0
  278. package/build/types/WithdrawQueue.js +93 -0
  279. package/build/types/WithdrawQueue.js.map +1 -0
  280. package/build/types/index.d.ts +32 -10
  281. package/build/types/index.js +21 -3
  282. package/build/types/index.js.map +1 -1
  283. package/package.json +3 -2
  284. package/scripts/generate-idl-module.mjs +18 -0
  285. package/scripts/patch-optional-accounts.mjs +98 -0
  286. package/scripts/verify-idl-provenance.mjs +16 -0
  287. package/src/accounts/GlobalConfig.ts +113 -0
  288. package/src/accounts/LendingMarket.ts +300 -29
  289. package/src/accounts/Obligation.ts +111 -26
  290. package/src/accounts/ReferrerState.ts +11 -4
  291. package/src/accounts/ReferrerTokenState.ts +6 -3
  292. package/src/accounts/Reserve.ts +10 -2
  293. package/src/accounts/ShortUrl.ts +15 -4
  294. package/src/accounts/UserMetadata.ts +6 -3
  295. package/src/accounts/UserState.ts +24 -8
  296. package/src/accounts/WithdrawTicket.ts +173 -0
  297. package/src/accounts/index.ts +4 -0
  298. package/src/errors/custom.ts +1177 -24
  299. package/src/index.ts +2 -4
  300. package/src/instructions/abortObligationOwnershipTransfer.ts +30 -0
  301. package/src/instructions/acceptObligationOwnership.ts +30 -0
  302. package/src/instructions/approveObligationOwnershipTransfer.ts +34 -0
  303. package/src/instructions/borrowObligationLiquidity.ts +18 -5
  304. package/src/instructions/borrowObligationLiquidityV2.ts +30 -9
  305. package/src/instructions/calculateCtokenExchangeRate.ts +22 -0
  306. package/src/instructions/cancelWithdrawTicket.ts +77 -0
  307. package/src/instructions/cloneReserveConfig.ts +56 -0
  308. package/src/instructions/deleteReferrerStateAndShortUrl.ts +4 -1
  309. package/src/instructions/depositAndWithdraw.ts +229 -0
  310. package/src/instructions/depositObligationCollateral.ts +3 -2
  311. package/src/instructions/depositObligationCollateralV2.ts +110 -0
  312. package/src/instructions/depositReserveLiquidity.ts +4 -3
  313. package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +18 -9
  314. package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +31 -14
  315. package/src/instructions/enqueueToWithdraw.ts +113 -0
  316. package/src/instructions/fillBorrowOrder.ts +114 -0
  317. package/src/instructions/fillBorrowOrderV2.ts +128 -0
  318. package/src/instructions/flashBorrowReserveLiquidity.ts +19 -6
  319. package/src/instructions/flashRepayReserveLiquidity.ts +23 -7
  320. package/src/instructions/idlMissingTypes.ts +17 -9
  321. package/src/instructions/index.ts +118 -6
  322. package/src/instructions/initFarmsForReserve.ts +11 -3
  323. package/src/instructions/initGlobalConfig.ts +36 -0
  324. package/src/instructions/initLendingMarket.ts +13 -3
  325. package/src/instructions/initObligation.ts +3 -2
  326. package/src/instructions/initObligationFarmsForReserve.ts +5 -3
  327. package/src/instructions/initReferrerStateAndShortUrl.ts +4 -2
  328. package/src/instructions/initReferrerTokenState.ts +6 -16
  329. package/src/instructions/initReserve.ts +21 -3
  330. package/src/instructions/initUserMetadata.ts +18 -8
  331. package/src/instructions/initiateObligationOwnershipTransfer.ts +44 -0
  332. package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +7 -5
  333. package/src/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +191 -0
  334. package/src/instructions/markObligationForDeleveraging.ts +46 -0
  335. package/src/instructions/recoverInvalidTicketCollateral.ts +80 -0
  336. package/src/instructions/redeemFees.ts +8 -2
  337. package/src/instructions/redeemReserveCollateral.ts +4 -3
  338. package/src/instructions/refreshObligation.ts +7 -1
  339. package/src/instructions/refreshObligationFarmsForReserve.ts +35 -15
  340. package/src/instructions/refreshReserve.ts +27 -17
  341. package/src/instructions/refreshReservesBatch.ts +7 -2
  342. package/src/instructions/repayAndWithdrawAndRedeem.ts +199 -0
  343. package/src/instructions/repayObligationLiquidity.ts +4 -3
  344. package/src/instructions/repayObligationLiquidityV2.ts +35 -10
  345. package/src/instructions/requestElevationGroup.ts +4 -2
  346. package/src/instructions/rolloverFixedTermBorrow.ts +108 -0
  347. package/src/instructions/seedDepositOnInitReserve.ts +50 -0
  348. package/src/instructions/setBorrowOrder.ts +66 -0
  349. package/src/instructions/setBorrowOrderV2.ts +69 -0
  350. package/src/instructions/setObligationOrder.ts +45 -0
  351. package/src/instructions/socializeLoss.ts +5 -4
  352. package/src/instructions/socializeLossV2.ts +92 -0
  353. package/src/instructions/topupReserveRewards.ts +60 -0
  354. package/src/instructions/updateGlobalConfig.ts +53 -0
  355. package/src/instructions/updateGlobalConfigAdmin.ts +30 -0
  356. package/src/instructions/updateLendingMarket.ts +15 -5
  357. package/src/instructions/updateLendingMarketOwner.ts +10 -1
  358. package/src/instructions/updateObligationConfig.ts +65 -0
  359. package/src/instructions/updateReserveConfig.ts +27 -10
  360. package/src/instructions/withdrawObligationCollateral.ts +4 -3
  361. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +18 -9
  362. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +26 -13
  363. package/src/instructions/withdrawObligationCollateralV2.ts +110 -0
  364. package/src/instructions/withdrawProtocolFee.ts +12 -9
  365. package/src/instructions/withdrawQueuedLiquidity.ts +110 -0
  366. package/src/instructions/withdrawReferrerFees.ts +8 -2
  367. package/src/kamino_lending.json +1856 -645
  368. package/src/kamino_lending.ts +5558 -6034
  369. package/src/types/BigFractionBytes.ts +9 -1
  370. package/src/types/BorrowOrder.ts +168 -0
  371. package/src/types/BorrowOrderConfigArgs.ts +96 -0
  372. package/src/types/BorrowRateCurve.ts +10 -3
  373. package/src/types/CurvePoint.ts +7 -1
  374. package/src/types/ElevationGroup.ts +2 -1
  375. package/src/types/ExchangeRateWithDecimals.ts +64 -0
  376. package/src/types/FeeCalculation.ts +9 -2
  377. package/src/types/FixedTermBorrowRolloverConfig.ts +110 -0
  378. package/src/types/InitObligationArgs.ts +3 -0
  379. package/src/types/LastUpdate.ts +26 -10
  380. package/src/types/ObligationLiquidity.ts +43 -10
  381. package/src/types/ObligationOrder.ts +121 -0
  382. package/src/types/ProgressCallbackType.ts +90 -0
  383. package/src/types/ReserveConfig.ts +169 -62
  384. package/src/types/ReserveConfigCustomizationArgs.ts +96 -0
  385. package/src/types/ReserveFees.ts +9 -9
  386. package/src/types/ReserveLiquidity.ts +38 -28
  387. package/src/types/UpdateConfigMode.ts +507 -117
  388. package/src/types/UpdateGlobalConfigMode.ts +90 -0
  389. package/src/types/UpdateLendingMarketConfigValue.ts +43 -0
  390. package/src/types/UpdateLendingMarketMode.ts +912 -41
  391. package/src/types/UpdateObligationConfigMode.ts +210 -0
  392. package/src/types/WithdrawQueue.ts +85 -0
  393. package/src/types/index.ts +175 -34
  394. package/src/types/AssetTier.ts +0 -116
@@ -1,5 +1,7 @@
1
1
  import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
3
  import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
3
5
  import { PROGRAM_ID } from "../programId"
4
6
 
5
7
  export interface RefreshObligationFarmsForReserveArgs {
@@ -8,12 +10,14 @@ export interface RefreshObligationFarmsForReserveArgs {
8
10
 
9
11
  export interface RefreshObligationFarmsForReserveAccounts {
10
12
  crank: PublicKey
11
- obligation: PublicKey
12
- lendingMarketAuthority: PublicKey
13
- reserve: PublicKey
14
- reserveFarmState: PublicKey
15
- obligationFarmUserState: PublicKey
16
- lendingMarket: PublicKey
13
+ baseAccounts: {
14
+ obligation: PublicKey
15
+ lendingMarketAuthority: PublicKey
16
+ reserve: PublicKey
17
+ reserveFarmState: PublicKey
18
+ obligationFarmUserState: PublicKey
19
+ lendingMarket: PublicKey
20
+ }
17
21
  farmsProgram: PublicKey
18
22
  rent: PublicKey
19
23
  systemProgram: PublicKey
@@ -24,24 +28,40 @@ export const layout = borsh.struct([borsh.u8("mode")])
24
28
  export function refreshObligationFarmsForReserve(
25
29
  args: RefreshObligationFarmsForReserveArgs,
26
30
  accounts: RefreshObligationFarmsForReserveAccounts,
27
- programId: PublicKey = PROGRAM_ID,
31
+ programId: PublicKey = PROGRAM_ID
28
32
  ) {
29
33
  const keys: Array<AccountMeta> = [
30
- { pubkey: accounts.crank, isSigner: true, isWritable: true },
31
- { pubkey: accounts.obligation, isSigner: false, isWritable: false },
34
+ { pubkey: accounts.crank, isSigner: true, isWritable: false },
32
35
  {
33
- pubkey: accounts.lendingMarketAuthority,
36
+ pubkey: accounts.baseAccounts.obligation,
37
+ isSigner: false,
38
+ isWritable: false,
39
+ },
40
+ {
41
+ pubkey: accounts.baseAccounts.lendingMarketAuthority,
42
+ isSigner: false,
43
+ isWritable: false,
44
+ },
45
+ {
46
+ pubkey: accounts.baseAccounts.reserve,
47
+ isSigner: false,
48
+ isWritable: false,
49
+ },
50
+ {
51
+ pubkey: accounts.baseAccounts.reserveFarmState,
34
52
  isSigner: false,
35
53
  isWritable: true,
36
54
  },
37
- { pubkey: accounts.reserve, isSigner: false, isWritable: false },
38
- { pubkey: accounts.reserveFarmState, isSigner: false, isWritable: true },
39
55
  {
40
- pubkey: accounts.obligationFarmUserState,
56
+ pubkey: accounts.baseAccounts.obligationFarmUserState,
41
57
  isSigner: false,
42
58
  isWritable: true,
43
59
  },
44
- { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
60
+ {
61
+ pubkey: accounts.baseAccounts.lendingMarket,
62
+ isSigner: false,
63
+ isWritable: false,
64
+ },
45
65
  { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
46
66
  { pubkey: accounts.rent, isSigner: false, isWritable: false },
47
67
  { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
@@ -52,7 +72,7 @@ export function refreshObligationFarmsForReserve(
52
72
  {
53
73
  mode: args.mode,
54
74
  },
55
- buffer,
75
+ buffer
56
76
  )
57
77
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
58
78
  const ix = new TransactionInstruction({ keys, programId, data })
@@ -1,31 +1,41 @@
1
1
  import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
2
5
  import { PROGRAM_ID } from "../programId"
3
6
 
4
7
  export interface RefreshReserveAccounts {
5
8
  reserve: PublicKey
6
9
  lendingMarket: PublicKey
7
- pythOracle: PublicKey
8
- switchboardPriceOracle: PublicKey
9
- switchboardTwapOracle: PublicKey
10
- scopePrices: PublicKey
10
+ pythOracle?: PublicKey | null
11
+ switchboardPriceOracle?: PublicKey | null
12
+ switchboardTwapOracle?: PublicKey | null
13
+ scopePrices?: PublicKey | null
11
14
  }
12
15
 
13
- export function refreshReserve(accounts: RefreshReserveAccounts, programId: PublicKey = PROGRAM_ID) {
16
+ function optionalAccountMeta(
17
+ pubkey: PublicKey | null | undefined,
18
+ isWritable: boolean,
19
+ programId: PublicKey
20
+ ): AccountMeta {
21
+ return {
22
+ pubkey: pubkey ?? programId,
23
+ isSigner: false,
24
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
25
+ }
26
+ }
27
+
28
+ export function refreshReserve(
29
+ accounts: RefreshReserveAccounts,
30
+ programId: PublicKey = PROGRAM_ID
31
+ ) {
14
32
  const keys: Array<AccountMeta> = [
15
33
  { pubkey: accounts.reserve, isSigner: false, isWritable: true },
16
34
  { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
17
- { pubkey: accounts.pythOracle, isSigner: false, isWritable: false },
18
- {
19
- pubkey: accounts.switchboardPriceOracle,
20
- isSigner: false,
21
- isWritable: false,
22
- },
23
- {
24
- pubkey: accounts.switchboardTwapOracle,
25
- isSigner: false,
26
- isWritable: false,
27
- },
28
- { pubkey: accounts.scopePrices, isSigner: false, isWritable: false },
35
+ optionalAccountMeta(accounts.pythOracle, false, programId),
36
+ optionalAccountMeta(accounts.switchboardPriceOracle, false, programId),
37
+ optionalAccountMeta(accounts.switchboardTwapOracle, false, programId),
38
+ optionalAccountMeta(accounts.scopePrices, false, programId),
29
39
  ]
30
40
  const identifier = Buffer.from([2, 218, 138, 235, 79, 201, 25, 102])
31
41
  const data = identifier
@@ -1,5 +1,7 @@
1
1
  import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
3
  import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
3
5
  import { PROGRAM_ID } from "../programId"
4
6
 
5
7
  export interface RefreshReservesBatchArgs {
@@ -8,7 +10,10 @@ export interface RefreshReservesBatchArgs {
8
10
 
9
11
  export const layout = borsh.struct([borsh.bool("skipPriceUpdates")])
10
12
 
11
- export function refreshReservesBatch(args: RefreshReservesBatchArgs, programId: PublicKey = PROGRAM_ID) {
13
+ export function refreshReservesBatch(
14
+ args: RefreshReservesBatchArgs,
15
+ programId: PublicKey = PROGRAM_ID
16
+ ) {
12
17
  const keys: Array<AccountMeta> = []
13
18
  const identifier = Buffer.from([144, 110, 26, 103, 162, 204, 252, 147])
14
19
  const buffer = Buffer.alloc(1000)
@@ -16,7 +21,7 @@ export function refreshReservesBatch(args: RefreshReservesBatchArgs, programId:
16
21
  {
17
22
  skipPriceUpdates: args.skipPriceUpdates,
18
23
  },
19
- buffer,
24
+ buffer
20
25
  )
21
26
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
22
27
  const ix = new TransactionInstruction({ keys, programId, data })
@@ -0,0 +1,199 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface RepayAndWithdrawAndRedeemArgs {
8
+ repayAmount: BN
9
+ withdrawCollateralAmount: BN
10
+ }
11
+
12
+ export interface RepayAndWithdrawAndRedeemAccounts {
13
+ repayAccounts: {
14
+ owner: PublicKey
15
+ obligation: PublicKey
16
+ lendingMarket: PublicKey
17
+ repayReserve: PublicKey
18
+ reserveLiquidityMint: PublicKey
19
+ reserveDestinationLiquidity: PublicKey
20
+ userSourceLiquidity: PublicKey
21
+ tokenProgram: PublicKey
22
+ instructionSysvarAccount: PublicKey
23
+ }
24
+ withdrawAccounts: {
25
+ owner: PublicKey
26
+ obligation: PublicKey
27
+ lendingMarket: PublicKey
28
+ lendingMarketAuthority: PublicKey
29
+ withdrawReserve: PublicKey
30
+ reserveLiquidityMint: PublicKey
31
+ reserveSourceCollateral: PublicKey
32
+ reserveCollateralMint: PublicKey
33
+ reserveLiquiditySupply: PublicKey
34
+ userDestinationLiquidity: PublicKey
35
+ placeholderUserDestinationCollateral?: PublicKey | null
36
+ collateralTokenProgram: PublicKey
37
+ liquidityTokenProgram: PublicKey
38
+ instructionSysvarAccount: PublicKey
39
+ }
40
+ collateralFarmsAccounts: {
41
+ obligationFarmUserState?: PublicKey | null
42
+ reserveFarmState?: PublicKey | null
43
+ }
44
+ debtFarmsAccounts: {
45
+ obligationFarmUserState?: PublicKey | null
46
+ reserveFarmState?: PublicKey | null
47
+ }
48
+ farmsProgram: PublicKey
49
+ }
50
+
51
+ export const layout = borsh.struct([
52
+ borsh.u64("repayAmount"),
53
+ borsh.u64("withdrawCollateralAmount"),
54
+ ])
55
+
56
+ function optionalAccountMeta(
57
+ pubkey: PublicKey | null | undefined,
58
+ isWritable: boolean,
59
+ programId: PublicKey
60
+ ): AccountMeta {
61
+ return {
62
+ pubkey: pubkey ?? programId,
63
+ isSigner: false,
64
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
65
+ }
66
+ }
67
+
68
+ export function repayAndWithdrawAndRedeem(
69
+ args: RepayAndWithdrawAndRedeemArgs,
70
+ accounts: RepayAndWithdrawAndRedeemAccounts,
71
+ programId: PublicKey = PROGRAM_ID
72
+ ) {
73
+ const keys: Array<AccountMeta> = [
74
+ { pubkey: accounts.repayAccounts.owner, isSigner: true, isWritable: false },
75
+ {
76
+ pubkey: accounts.repayAccounts.obligation,
77
+ isSigner: false,
78
+ isWritable: true,
79
+ },
80
+ {
81
+ pubkey: accounts.repayAccounts.lendingMarket,
82
+ isSigner: false,
83
+ isWritable: false,
84
+ },
85
+ {
86
+ pubkey: accounts.repayAccounts.repayReserve,
87
+ isSigner: false,
88
+ isWritable: true,
89
+ },
90
+ {
91
+ pubkey: accounts.repayAccounts.reserveLiquidityMint,
92
+ isSigner: false,
93
+ isWritable: false,
94
+ },
95
+ {
96
+ pubkey: accounts.repayAccounts.reserveDestinationLiquidity,
97
+ isSigner: false,
98
+ isWritable: true,
99
+ },
100
+ {
101
+ pubkey: accounts.repayAccounts.userSourceLiquidity,
102
+ isSigner: false,
103
+ isWritable: true,
104
+ },
105
+ {
106
+ pubkey: accounts.repayAccounts.tokenProgram,
107
+ isSigner: false,
108
+ isWritable: false,
109
+ },
110
+ {
111
+ pubkey: accounts.repayAccounts.instructionSysvarAccount,
112
+ isSigner: false,
113
+ isWritable: false,
114
+ },
115
+ {
116
+ pubkey: accounts.withdrawAccounts.owner,
117
+ isSigner: true,
118
+ isWritable: true,
119
+ },
120
+ {
121
+ pubkey: accounts.withdrawAccounts.obligation,
122
+ isSigner: false,
123
+ isWritable: true,
124
+ },
125
+ {
126
+ pubkey: accounts.withdrawAccounts.lendingMarket,
127
+ isSigner: false,
128
+ isWritable: false,
129
+ },
130
+ {
131
+ pubkey: accounts.withdrawAccounts.lendingMarketAuthority,
132
+ isSigner: false,
133
+ isWritable: false,
134
+ },
135
+ {
136
+ pubkey: accounts.withdrawAccounts.withdrawReserve,
137
+ isSigner: false,
138
+ isWritable: true,
139
+ },
140
+ {
141
+ pubkey: accounts.withdrawAccounts.reserveLiquidityMint,
142
+ isSigner: false,
143
+ isWritable: false,
144
+ },
145
+ {
146
+ pubkey: accounts.withdrawAccounts.reserveSourceCollateral,
147
+ isSigner: false,
148
+ isWritable: true,
149
+ },
150
+ {
151
+ pubkey: accounts.withdrawAccounts.reserveCollateralMint,
152
+ isSigner: false,
153
+ isWritable: true,
154
+ },
155
+ {
156
+ pubkey: accounts.withdrawAccounts.reserveLiquiditySupply,
157
+ isSigner: false,
158
+ isWritable: true,
159
+ },
160
+ {
161
+ pubkey: accounts.withdrawAccounts.userDestinationLiquidity,
162
+ isSigner: false,
163
+ isWritable: true,
164
+ },
165
+ optionalAccountMeta(accounts.withdrawAccounts.placeholderUserDestinationCollateral, false, programId),
166
+ {
167
+ pubkey: accounts.withdrawAccounts.collateralTokenProgram,
168
+ isSigner: false,
169
+ isWritable: false,
170
+ },
171
+ {
172
+ pubkey: accounts.withdrawAccounts.liquidityTokenProgram,
173
+ isSigner: false,
174
+ isWritable: false,
175
+ },
176
+ {
177
+ pubkey: accounts.withdrawAccounts.instructionSysvarAccount,
178
+ isSigner: false,
179
+ isWritable: false,
180
+ },
181
+ optionalAccountMeta(accounts.collateralFarmsAccounts.obligationFarmUserState, true, programId),
182
+ optionalAccountMeta(accounts.collateralFarmsAccounts.reserveFarmState, true, programId),
183
+ optionalAccountMeta(accounts.debtFarmsAccounts.obligationFarmUserState, true, programId),
184
+ optionalAccountMeta(accounts.debtFarmsAccounts.reserveFarmState, true, programId),
185
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
186
+ ]
187
+ const identifier = Buffer.from([2, 54, 152, 3, 148, 96, 109, 218])
188
+ const buffer = Buffer.alloc(1000)
189
+ const len = layout.encode(
190
+ {
191
+ repayAmount: args.repayAmount,
192
+ withdrawCollateralAmount: args.withdrawCollateralAmount,
193
+ },
194
+ buffer
195
+ )
196
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
197
+ const ix = new TransactionInstruction({ keys, programId, data })
198
+ return ix
199
+ }
@@ -1,6 +1,7 @@
1
1
  import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
2
  import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
3
  import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
5
  import { PROGRAM_ID } from "../programId"
5
6
 
6
7
  export interface RepayObligationLiquidityArgs {
@@ -24,7 +25,7 @@ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
24
25
  export function repayObligationLiquidity(
25
26
  args: RepayObligationLiquidityArgs,
26
27
  accounts: RepayObligationLiquidityAccounts,
27
- programId: PublicKey = PROGRAM_ID,
28
+ programId: PublicKey = PROGRAM_ID
28
29
  ) {
29
30
  const keys: Array<AccountMeta> = [
30
31
  { pubkey: accounts.owner, isSigner: true, isWritable: false },
@@ -34,7 +35,7 @@ export function repayObligationLiquidity(
34
35
  {
35
36
  pubkey: accounts.reserveLiquidityMint,
36
37
  isSigner: false,
37
- isWritable: true,
38
+ isWritable: false,
38
39
  },
39
40
  {
40
41
  pubkey: accounts.reserveDestinationLiquidity,
@@ -55,7 +56,7 @@ export function repayObligationLiquidity(
55
56
  {
56
57
  liquidityAmount: args.liquidityAmount,
57
58
  },
58
- buffer,
59
+ buffer
59
60
  )
60
61
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
61
62
  const ix = new TransactionInstruction({ keys, programId, data })
@@ -1,6 +1,7 @@
1
1
  import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
2
  import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
3
  import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
5
  import { PROGRAM_ID } from "../programId"
5
6
 
6
7
  export interface RepayObligationLiquidityV2Args {
@@ -32,25 +33,37 @@ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
32
33
  function optionalAccountMeta(
33
34
  pubkey: PublicKey | null | undefined,
34
35
  isWritable: boolean,
35
- programId: PublicKey,
36
+ programId: PublicKey
36
37
  ): AccountMeta {
37
38
  return {
38
39
  pubkey: pubkey ?? programId,
39
40
  isSigner: false,
40
- isWritable,
41
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
41
42
  }
42
43
  }
43
44
 
44
45
  export function repayObligationLiquidityV2(
45
46
  args: RepayObligationLiquidityV2Args,
46
47
  accounts: RepayObligationLiquidityV2Accounts,
47
- programId: PublicKey = PROGRAM_ID,
48
+ programId: PublicKey = PROGRAM_ID
48
49
  ) {
49
50
  const keys: Array<AccountMeta> = [
50
51
  { pubkey: accounts.repayAccounts.owner, isSigner: true, isWritable: false },
51
- { pubkey: accounts.repayAccounts.obligation, isSigner: false, isWritable: true },
52
- { pubkey: accounts.repayAccounts.lendingMarket, isSigner: false, isWritable: false },
53
- { pubkey: accounts.repayAccounts.repayReserve, isSigner: false, isWritable: true },
52
+ {
53
+ pubkey: accounts.repayAccounts.obligation,
54
+ isSigner: false,
55
+ isWritable: true,
56
+ },
57
+ {
58
+ pubkey: accounts.repayAccounts.lendingMarket,
59
+ isSigner: false,
60
+ isWritable: false,
61
+ },
62
+ {
63
+ pubkey: accounts.repayAccounts.repayReserve,
64
+ isSigner: false,
65
+ isWritable: true,
66
+ },
54
67
  {
55
68
  pubkey: accounts.repayAccounts.reserveLiquidityMint,
56
69
  isSigner: false,
@@ -61,8 +74,16 @@ export function repayObligationLiquidityV2(
61
74
  isSigner: false,
62
75
  isWritable: true,
63
76
  },
64
- { pubkey: accounts.repayAccounts.userSourceLiquidity, isSigner: false, isWritable: true },
65
- { pubkey: accounts.repayAccounts.tokenProgram, isSigner: false, isWritable: false },
77
+ {
78
+ pubkey: accounts.repayAccounts.userSourceLiquidity,
79
+ isSigner: false,
80
+ isWritable: true,
81
+ },
82
+ {
83
+ pubkey: accounts.repayAccounts.tokenProgram,
84
+ isSigner: false,
85
+ isWritable: false,
86
+ },
66
87
  {
67
88
  pubkey: accounts.repayAccounts.instructionSysvarAccount,
68
89
  isSigner: false,
@@ -70,7 +91,11 @@ export function repayObligationLiquidityV2(
70
91
  },
71
92
  optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
72
93
  optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
73
- { pubkey: accounts.lendingMarketAuthority, isSigner: false, isWritable: false },
94
+ {
95
+ pubkey: accounts.lendingMarketAuthority,
96
+ isSigner: false,
97
+ isWritable: false,
98
+ },
74
99
  { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
75
100
  ]
76
101
  const identifier = Buffer.from([116, 174, 213, 76, 180, 53, 210, 144])
@@ -79,7 +104,7 @@ export function repayObligationLiquidityV2(
79
104
  {
80
105
  liquidityAmount: args.liquidityAmount,
81
106
  },
82
- buffer,
107
+ buffer
83
108
  )
84
109
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
85
110
  const ix = new TransactionInstruction({ keys, programId, data })
@@ -1,5 +1,7 @@
1
1
  import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
3
  import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
3
5
  import { PROGRAM_ID } from "../programId"
4
6
 
5
7
  export interface RequestElevationGroupArgs {
@@ -17,7 +19,7 @@ export const layout = borsh.struct([borsh.u8("elevationGroup")])
17
19
  export function requestElevationGroup(
18
20
  args: RequestElevationGroupArgs,
19
21
  accounts: RequestElevationGroupAccounts,
20
- programId: PublicKey = PROGRAM_ID,
22
+ programId: PublicKey = PROGRAM_ID
21
23
  ) {
22
24
  const keys: Array<AccountMeta> = [
23
25
  { pubkey: accounts.owner, isSigner: true, isWritable: false },
@@ -30,7 +32,7 @@ export function requestElevationGroup(
30
32
  {
31
33
  elevationGroup: args.elevationGroup,
32
34
  },
33
- buffer,
35
+ buffer
34
36
  )
35
37
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
36
38
  const ix = new TransactionInstruction({ keys, programId, data })
@@ -0,0 +1,108 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface RolloverFixedTermBorrowAccounts {
8
+ rolloverAccounts: {
9
+ payer: PublicKey
10
+ obligation: PublicKey
11
+ lendingMarket: PublicKey
12
+ lendingMarketAuthority: PublicKey
13
+ sourceBorrowReserve: PublicKey
14
+ targetBorrowReserve: PublicKey
15
+ liquidityMint: PublicKey
16
+ sourceBorrowReserveLiquidity: PublicKey
17
+ targetBorrowReserveLiquidity: PublicKey
18
+ tokenProgram: PublicKey
19
+ }
20
+ sourceFarmsAccounts: {
21
+ obligationFarmUserState?: PublicKey | null
22
+ reserveFarmState?: PublicKey | null
23
+ }
24
+ targetFarmsAccounts: {
25
+ obligationFarmUserState?: PublicKey | null
26
+ reserveFarmState?: PublicKey | null
27
+ }
28
+ farmsProgram: PublicKey
29
+ }
30
+
31
+ function optionalAccountMeta(
32
+ pubkey: PublicKey | null | undefined,
33
+ isWritable: boolean,
34
+ programId: PublicKey
35
+ ): AccountMeta {
36
+ return {
37
+ pubkey: pubkey ?? programId,
38
+ isSigner: false,
39
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
40
+ }
41
+ }
42
+
43
+ export function rolloverFixedTermBorrow(
44
+ accounts: RolloverFixedTermBorrowAccounts,
45
+ programId: PublicKey = PROGRAM_ID
46
+ ) {
47
+ const keys: Array<AccountMeta> = [
48
+ {
49
+ pubkey: accounts.rolloverAccounts.payer,
50
+ isSigner: true,
51
+ isWritable: false,
52
+ },
53
+ {
54
+ pubkey: accounts.rolloverAccounts.obligation,
55
+ isSigner: false,
56
+ isWritable: true,
57
+ },
58
+ {
59
+ pubkey: accounts.rolloverAccounts.lendingMarket,
60
+ isSigner: false,
61
+ isWritable: false,
62
+ },
63
+ {
64
+ pubkey: accounts.rolloverAccounts.lendingMarketAuthority,
65
+ isSigner: false,
66
+ isWritable: false,
67
+ },
68
+ {
69
+ pubkey: accounts.rolloverAccounts.sourceBorrowReserve,
70
+ isSigner: false,
71
+ isWritable: true,
72
+ },
73
+ {
74
+ pubkey: accounts.rolloverAccounts.targetBorrowReserve,
75
+ isSigner: false,
76
+ isWritable: true,
77
+ },
78
+ {
79
+ pubkey: accounts.rolloverAccounts.liquidityMint,
80
+ isSigner: false,
81
+ isWritable: false,
82
+ },
83
+ {
84
+ pubkey: accounts.rolloverAccounts.sourceBorrowReserveLiquidity,
85
+ isSigner: false,
86
+ isWritable: true,
87
+ },
88
+ {
89
+ pubkey: accounts.rolloverAccounts.targetBorrowReserveLiquidity,
90
+ isSigner: false,
91
+ isWritable: true,
92
+ },
93
+ {
94
+ pubkey: accounts.rolloverAccounts.tokenProgram,
95
+ isSigner: false,
96
+ isWritable: false,
97
+ },
98
+ optionalAccountMeta(accounts.sourceFarmsAccounts.obligationFarmUserState, true, programId),
99
+ optionalAccountMeta(accounts.sourceFarmsAccounts.reserveFarmState, true, programId),
100
+ optionalAccountMeta(accounts.targetFarmsAccounts.obligationFarmUserState, true, programId),
101
+ optionalAccountMeta(accounts.targetFarmsAccounts.reserveFarmState, true, programId),
102
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
103
+ ]
104
+ const identifier = Buffer.from([85, 30, 155, 225, 224, 186, 141, 148])
105
+ const data = identifier
106
+ const ix = new TransactionInstruction({ keys, programId, data })
107
+ return ix
108
+ }
@@ -0,0 +1,50 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface SeedDepositOnInitReserveAccounts {
8
+ signer: PublicKey
9
+ lendingMarket: PublicKey
10
+ reserve: PublicKey
11
+ reserveLiquidityMint: PublicKey
12
+ reserveLiquiditySupply: PublicKey
13
+ initialLiquiditySource: PublicKey
14
+ liquidityTokenProgram: PublicKey
15
+ }
16
+
17
+ export function seedDepositOnInitReserve(
18
+ accounts: SeedDepositOnInitReserveAccounts,
19
+ programId: PublicKey = PROGRAM_ID
20
+ ) {
21
+ const keys: Array<AccountMeta> = [
22
+ { pubkey: accounts.signer, isSigner: true, isWritable: false },
23
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
24
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
25
+ {
26
+ pubkey: accounts.reserveLiquidityMint,
27
+ isSigner: false,
28
+ isWritable: false,
29
+ },
30
+ {
31
+ pubkey: accounts.reserveLiquiditySupply,
32
+ isSigner: false,
33
+ isWritable: true,
34
+ },
35
+ {
36
+ pubkey: accounts.initialLiquiditySource,
37
+ isSigner: false,
38
+ isWritable: true,
39
+ },
40
+ {
41
+ pubkey: accounts.liquidityTokenProgram,
42
+ isSigner: false,
43
+ isWritable: false,
44
+ },
45
+ ]
46
+ const identifier = Buffer.from([254, 197, 228, 118, 183, 206, 62, 226])
47
+ const data = identifier
48
+ const ix = new TransactionInstruction({ keys, programId, data })
49
+ return ix
50
+ }