@exponent-labs/klend-idl 0.9.25 → 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 (436) 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 +94 -12
  5. package/build/accounts/LendingMarket.js +219 -27
  6. package/build/accounts/LendingMarket.js.map +1 -1
  7. package/build/accounts/Obligation.d.ts +34 -12
  8. package/build/accounts/Obligation.js +86 -27
  9. package/build/accounts/Obligation.js.map +1 -1
  10. package/build/accounts/ReferrerState.d.ts +1 -3
  11. package/build/accounts/ReferrerState.js +24 -9
  12. package/build/accounts/ReferrerState.js.map +1 -1
  13. package/build/accounts/ReferrerTokenState.d.ts +1 -3
  14. package/build/accounts/ReferrerTokenState.js +20 -8
  15. package/build/accounts/ReferrerTokenState.js.map +1 -1
  16. package/build/accounts/Reserve.d.ts +4 -3
  17. package/build/accounts/Reserve.js +25 -9
  18. package/build/accounts/Reserve.js.map +1 -1
  19. package/build/accounts/ShortUrl.d.ts +1 -3
  20. package/build/accounts/ShortUrl.js +24 -9
  21. package/build/accounts/ShortUrl.js.map +1 -1
  22. package/build/accounts/UserMetadata.d.ts +1 -3
  23. package/build/accounts/UserMetadata.js +20 -8
  24. package/build/accounts/UserMetadata.js.map +1 -1
  25. package/build/accounts/UserState.d.ts +1 -3
  26. package/build/accounts/UserState.js +20 -8
  27. package/build/accounts/UserState.js.map +1 -1
  28. package/build/accounts/WithdrawTicket.d.ts +49 -0
  29. package/build/accounts/WithdrawTicket.js +158 -0
  30. package/build/accounts/WithdrawTicket.js.map +1 -0
  31. package/build/accounts/index.d.ts +4 -0
  32. package/build/accounts/index.js +5 -1
  33. package/build/accounts/index.js.map +1 -1
  34. package/build/errors/anchor.js +2 -2
  35. package/build/errors/anchor.js.map +1 -1
  36. package/build/errors/custom.d.ts +605 -13
  37. package/build/errors/custom.js +1064 -27
  38. package/build/errors/custom.js.map +1 -1
  39. package/build/errors/index.js +19 -10
  40. package/build/errors/index.js.map +1 -1
  41. package/build/index.d.ts +2 -3
  42. package/build/index.js +20 -14
  43. package/build/index.js.map +1 -1
  44. package/build/instructions/abortObligationOwnershipTransfer.d.ts +7 -0
  45. package/build/instructions/abortObligationOwnershipTransfer.js +21 -0
  46. package/build/instructions/abortObligationOwnershipTransfer.js.map +1 -0
  47. package/build/instructions/acceptObligationOwnership.d.ts +7 -0
  48. package/build/instructions/acceptObligationOwnership.js +21 -0
  49. package/build/instructions/acceptObligationOwnership.js.map +1 -0
  50. package/build/instructions/approveObligationOwnershipTransfer.d.ts +9 -0
  51. package/build/instructions/approveObligationOwnershipTransfer.js +23 -0
  52. package/build/instructions/approveObligationOwnershipTransfer.js.map +1 -0
  53. package/build/instructions/borrowObligationLiquidity.d.ts +1 -1
  54. package/build/instructions/borrowObligationLiquidity.js +28 -11
  55. package/build/instructions/borrowObligationLiquidity.js.map +1 -1
  56. package/build/instructions/borrowObligationLiquidityV2.js +45 -15
  57. package/build/instructions/borrowObligationLiquidityV2.js.map +1 -1
  58. package/build/instructions/calculateCtokenExchangeRate.d.ts +5 -0
  59. package/build/instructions/calculateCtokenExchangeRate.js +15 -0
  60. package/build/instructions/calculateCtokenExchangeRate.js.map +1 -0
  61. package/build/instructions/cancelWithdrawTicket.d.ts +19 -0
  62. package/build/instructions/cancelWithdrawTicket.js +87 -0
  63. package/build/instructions/cancelWithdrawTicket.js.map +1 -0
  64. package/build/instructions/cloneReserveConfig.d.ts +14 -0
  65. package/build/instructions/cloneReserveConfig.js +70 -0
  66. package/build/instructions/cloneReserveConfig.js.map +1 -0
  67. package/build/instructions/deleteReferrerStateAndShortUrl.js +1 -2
  68. package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -1
  69. package/build/instructions/depositAndWithdraw.d.ts +51 -0
  70. package/build/instructions/depositAndWithdraw.js +202 -0
  71. package/build/instructions/depositAndWithdraw.js.map +1 -0
  72. package/build/instructions/depositObligationCollateral.js +19 -9
  73. package/build/instructions/depositObligationCollateral.js.map +1 -1
  74. package/build/instructions/depositObligationCollateralV2.d.ts +25 -0
  75. package/build/instructions/depositObligationCollateralV2.js +109 -0
  76. package/build/instructions/depositObligationCollateralV2.js.map +1 -0
  77. package/build/instructions/depositReserveLiquidity.js +20 -10
  78. package/build/instructions/depositReserveLiquidity.js.map +1 -1
  79. package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +1 -1
  80. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +28 -15
  81. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
  82. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +45 -15
  83. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -1
  84. package/build/instructions/enqueueToWithdraw.d.ts +26 -0
  85. package/build/instructions/enqueueToWithdraw.js +113 -0
  86. package/build/instructions/enqueueToWithdraw.js.map +1 -0
  87. package/build/instructions/fillBorrowOrder.d.ts +25 -0
  88. package/build/instructions/fillBorrowOrder.js +82 -0
  89. package/build/instructions/fillBorrowOrder.js.map +1 -0
  90. package/build/instructions/fillBorrowOrderV2.d.ts +29 -0
  91. package/build/instructions/fillBorrowOrderV2.js +122 -0
  92. package/build/instructions/fillBorrowOrderV2.js.map +1 -0
  93. package/build/instructions/flashBorrowReserveLiquidity.d.ts +2 -2
  94. package/build/instructions/flashBorrowReserveLiquidity.js +28 -11
  95. package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -1
  96. package/build/instructions/flashRepayReserveLiquidity.d.ts +2 -2
  97. package/build/instructions/flashRepayReserveLiquidity.js +32 -12
  98. package/build/instructions/flashRepayReserveLiquidity.js.map +1 -1
  99. package/build/instructions/idlMissingTypes.d.ts +3 -2
  100. package/build/instructions/idlMissingTypes.js +26 -12
  101. package/build/instructions/idlMissingTypes.js.map +1 -1
  102. package/build/instructions/index.d.ts +61 -3
  103. package/build/instructions/index.js +62 -3
  104. package/build/instructions/index.js.map +1 -1
  105. package/build/instructions/initFarmsForReserve.d.ts +1 -0
  106. package/build/instructions/initFarmsForReserve.js +25 -10
  107. package/build/instructions/initFarmsForReserve.js.map +1 -1
  108. package/build/instructions/initGlobalConfig.d.ts +10 -0
  109. package/build/instructions/initGlobalConfig.js +24 -0
  110. package/build/instructions/initGlobalConfig.js.map +1 -0
  111. package/build/instructions/initLendingMarket.d.ts +1 -0
  112. package/build/instructions/initLendingMarket.js +27 -10
  113. package/build/instructions/initLendingMarket.js.map +1 -1
  114. package/build/instructions/initObligation.js +19 -9
  115. package/build/instructions/initObligation.js.map +1 -1
  116. package/build/instructions/initObligationFarmsForReserve.js +20 -10
  117. package/build/instructions/initObligationFarmsForReserve.js.map +1 -1
  118. package/build/instructions/initReferrerStateAndShortUrl.js +19 -9
  119. package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -1
  120. package/build/instructions/initReferrerTokenState.d.ts +2 -5
  121. package/build/instructions/initReferrerTokenState.js +4 -33
  122. package/build/instructions/initReferrerTokenState.js.map +1 -1
  123. package/build/instructions/initReserve.d.ts +3 -1
  124. package/build/instructions/initReserve.js +12 -3
  125. package/build/instructions/initReserve.js.map +1 -1
  126. package/build/instructions/initUserMetadata.d.ts +1 -1
  127. package/build/instructions/initUserMetadata.js +27 -14
  128. package/build/instructions/initUserMetadata.js.map +1 -1
  129. package/build/instructions/initiateObligationOwnershipTransfer.d.ts +11 -0
  130. package/build/instructions/initiateObligationOwnershipTransfer.js +61 -0
  131. package/build/instructions/initiateObligationOwnershipTransfer.js.map +1 -0
  132. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +21 -11
  133. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
  134. package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +42 -0
  135. package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +172 -0
  136. package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -0
  137. package/build/instructions/markObligationForDeleveraging.d.ts +12 -0
  138. package/build/instructions/markObligationForDeleveraging.js +62 -0
  139. package/build/instructions/markObligationForDeleveraging.js.map +1 -0
  140. package/build/instructions/recoverInvalidTicketCollateral.d.ts +20 -0
  141. package/build/instructions/recoverInvalidTicketCollateral.js +89 -0
  142. package/build/instructions/recoverInvalidTicketCollateral.js.map +1 -0
  143. package/build/instructions/redeemFees.js +2 -3
  144. package/build/instructions/redeemFees.js.map +1 -1
  145. package/build/instructions/redeemReserveCollateral.js +20 -10
  146. package/build/instructions/redeemReserveCollateral.js.map +1 -1
  147. package/build/instructions/refreshObligation.js +1 -2
  148. package/build/instructions/refreshObligation.js.map +1 -1
  149. package/build/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
  150. package/build/instructions/refreshObligationFarmsForReserve.js +42 -16
  151. package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -1
  152. package/build/instructions/refreshReserve.d.ts +4 -4
  153. package/build/instructions/refreshReserve.js +12 -14
  154. package/build/instructions/refreshReserve.js.map +1 -1
  155. package/build/instructions/refreshReservesBatch.js +19 -9
  156. package/build/instructions/refreshReservesBatch.js.map +1 -1
  157. package/build/instructions/repayAndWithdrawAndRedeem.d.ts +46 -0
  158. package/build/instructions/repayAndWithdrawAndRedeem.js +177 -0
  159. package/build/instructions/repayAndWithdrawAndRedeem.js.map +1 -0
  160. package/build/instructions/repayObligationLiquidity.js +20 -10
  161. package/build/instructions/repayObligationLiquidity.js.map +1 -1
  162. package/build/instructions/repayObligationLiquidityV2.js +50 -16
  163. package/build/instructions/repayObligationLiquidityV2.js.map +1 -1
  164. package/build/instructions/requestElevationGroup.js +19 -9
  165. package/build/instructions/requestElevationGroup.js.map +1 -1
  166. package/build/instructions/rolloverFixedTermBorrow.d.ts +25 -0
  167. package/build/instructions/rolloverFixedTermBorrow.js +76 -0
  168. package/build/instructions/rolloverFixedTermBorrow.js.map +1 -0
  169. package/build/instructions/seedDepositOnInitReserve.d.ts +11 -0
  170. package/build/instructions/seedDepositOnInitReserve.js +37 -0
  171. package/build/instructions/seedDepositOnInitReserve.js.map +1 -0
  172. package/build/instructions/setBorrowOrder.d.ts +20 -0
  173. package/build/instructions/setBorrowOrder.js +76 -0
  174. package/build/instructions/setBorrowOrder.js.map +1 -0
  175. package/build/instructions/setBorrowOrderV2.d.ts +21 -0
  176. package/build/instructions/setBorrowOrderV2.js +78 -0
  177. package/build/instructions/setBorrowOrderV2.js.map +1 -0
  178. package/build/instructions/setObligationOrder.d.ts +13 -0
  179. package/build/instructions/setObligationOrder.js +62 -0
  180. package/build/instructions/setObligationOrder.js.map +1 -0
  181. package/build/instructions/socializeLoss.d.ts +1 -1
  182. package/build/instructions/socializeLoss.js +20 -10
  183. package/build/instructions/socializeLoss.js.map +1 -1
  184. package/build/instructions/socializeLossV2.d.ts +22 -0
  185. package/build/instructions/socializeLossV2.js +94 -0
  186. package/build/instructions/socializeLossV2.js.map +1 -0
  187. package/build/instructions/topupReserveRewards.d.ts +16 -0
  188. package/build/instructions/topupReserveRewards.js +73 -0
  189. package/build/instructions/topupReserveRewards.js.map +1 -0
  190. package/build/instructions/updateGlobalConfig.d.ts +13 -0
  191. package/build/instructions/updateGlobalConfig.js +66 -0
  192. package/build/instructions/updateGlobalConfig.js.map +1 -0
  193. package/build/instructions/updateGlobalConfigAdmin.d.ts +7 -0
  194. package/build/instructions/updateGlobalConfigAdmin.js +21 -0
  195. package/build/instructions/updateGlobalConfigAdmin.js.map +1 -0
  196. package/build/instructions/updateLendingMarket.d.ts +2 -1
  197. package/build/instructions/updateLendingMarket.js +29 -11
  198. package/build/instructions/updateLendingMarket.js.map +1 -1
  199. package/build/instructions/updateLendingMarketOwner.d.ts +1 -0
  200. package/build/instructions/updateLendingMarketOwner.js +6 -2
  201. package/build/instructions/updateLendingMarketOwner.js.map +1 -1
  202. package/build/instructions/updateObligationConfig.d.ts +15 -0
  203. package/build/instructions/updateObligationConfig.js +71 -0
  204. package/build/instructions/updateObligationConfig.js.map +1 -0
  205. package/build/instructions/updateReserveConfig.d.ts +6 -4
  206. package/build/instructions/updateReserveConfig.js +34 -13
  207. package/build/instructions/updateReserveConfig.js.map +1 -1
  208. package/build/instructions/withdrawObligationCollateral.js +20 -10
  209. package/build/instructions/withdrawObligationCollateral.js.map +1 -1
  210. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +1 -1
  211. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +28 -15
  212. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
  213. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +40 -14
  214. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -1
  215. package/build/instructions/withdrawObligationCollateralV2.d.ts +25 -0
  216. package/build/instructions/withdrawObligationCollateralV2.js +109 -0
  217. package/build/instructions/withdrawObligationCollateralV2.js.map +1 -0
  218. package/build/instructions/withdrawProtocolFee.d.ts +3 -2
  219. package/build/instructions/withdrawProtocolFee.js +25 -14
  220. package/build/instructions/withdrawProtocolFee.js.map +1 -1
  221. package/build/instructions/withdrawQueuedLiquidity.d.ts +23 -0
  222. package/build/instructions/withdrawQueuedLiquidity.js +80 -0
  223. package/build/instructions/withdrawQueuedLiquidity.js.map +1 -0
  224. package/build/instructions/withdrawReferrerFees.js +2 -3
  225. package/build/instructions/withdrawReferrerFees.js.map +1 -1
  226. package/build/kamino_lending.d.ts +5753 -2295
  227. package/build/kamino_lending.js +5 -3936
  228. package/build/kamino_lending.js.map +1 -1
  229. package/build/kamino_lending.json +1856 -645
  230. package/build/types/AssetTier.js +21 -11
  231. package/build/types/AssetTier.js.map +1 -1
  232. package/build/types/BigFractionBytes.d.ts +2 -1
  233. package/build/types/BigFractionBytes.js +21 -8
  234. package/build/types/BigFractionBytes.js.map +1 -1
  235. package/build/types/BorrowOrder.d.ts +83 -0
  236. package/build/types/BorrowOrder.js +164 -0
  237. package/build/types/BorrowOrder.js.map +1 -0
  238. package/build/types/BorrowOrderConfigArgs.d.ts +42 -0
  239. package/build/types/BorrowOrderConfigArgs.js +107 -0
  240. package/build/types/BorrowOrderConfigArgs.js.map +1 -0
  241. package/build/types/BorrowRateCurve.js +17 -7
  242. package/build/types/BorrowRateCurve.js.map +1 -1
  243. package/build/types/CurvePoint.d.ts +2 -1
  244. package/build/types/CurvePoint.js +17 -7
  245. package/build/types/CurvePoint.js.map +1 -1
  246. package/build/types/ElevationGroup.d.ts +2 -1
  247. package/build/types/ElevationGroup.js +17 -7
  248. package/build/types/ElevationGroup.js.map +1 -1
  249. package/build/types/ExchangeRateWithDecimals.d.ts +27 -0
  250. package/build/types/ExchangeRateWithDecimals.js +82 -0
  251. package/build/types/ExchangeRateWithDecimals.js.map +1 -0
  252. package/build/types/FeeCalculation.js +25 -12
  253. package/build/types/FeeCalculation.js.map +1 -1
  254. package/build/types/FixedTermBorrowRolloverConfig.d.ts +47 -0
  255. package/build/types/FixedTermBorrowRolloverConfig.js +114 -0
  256. package/build/types/FixedTermBorrowRolloverConfig.js.map +1 -0
  257. package/build/types/InitObligationArgs.d.ts +2 -1
  258. package/build/types/InitObligationArgs.js +17 -7
  259. package/build/types/InitObligationArgs.js.map +1 -1
  260. package/build/types/LastUpdate.d.ts +12 -6
  261. package/build/types/LastUpdate.js +36 -14
  262. package/build/types/LastUpdate.js.map +1 -1
  263. package/build/types/ObligationCollateral.js +17 -7
  264. package/build/types/ObligationCollateral.js.map +1 -1
  265. package/build/types/ObligationLiquidity.d.ts +29 -5
  266. package/build/types/ObligationLiquidity.js +42 -15
  267. package/build/types/ObligationLiquidity.js.map +1 -1
  268. package/build/types/ObligationOrder.d.ts +57 -0
  269. package/build/types/ObligationOrder.js +127 -0
  270. package/build/types/ObligationOrder.js.map +1 -0
  271. package/build/types/PriceHeuristic.js +17 -7
  272. package/build/types/PriceHeuristic.js.map +1 -1
  273. package/build/types/ProgressCallbackType.d.ts +31 -0
  274. package/build/types/ProgressCallbackType.js +108 -0
  275. package/build/types/ProgressCallbackType.js.map +1 -0
  276. package/build/types/PythConfiguration.js +17 -7
  277. package/build/types/PythConfiguration.js.map +1 -1
  278. package/build/types/ReserveCollateral.js +17 -7
  279. package/build/types/ReserveCollateral.js.map +1 -1
  280. package/build/types/ReserveConfig.d.ts +87 -32
  281. package/build/types/ReserveConfig.js +139 -51
  282. package/build/types/ReserveConfig.js.map +1 -1
  283. package/build/types/ReserveConfigCustomizationArgs.d.ts +42 -0
  284. package/build/types/ReserveConfigCustomizationArgs.js +106 -0
  285. package/build/types/ReserveConfigCustomizationArgs.js.map +1 -0
  286. package/build/types/ReserveFarmKind.js +21 -11
  287. package/build/types/ReserveFarmKind.js.map +1 -1
  288. package/build/types/ReserveFees.d.ts +5 -5
  289. package/build/types/ReserveFees.js +24 -14
  290. package/build/types/ReserveFees.js.map +1 -1
  291. package/build/types/ReserveLiquidity.d.ts +20 -15
  292. package/build/types/ReserveLiquidity.js +46 -29
  293. package/build/types/ReserveLiquidity.js.map +1 -1
  294. package/build/types/ReserveStatus.js +21 -11
  295. package/build/types/ReserveStatus.js.map +1 -1
  296. package/build/types/ScopeConfiguration.js +17 -7
  297. package/build/types/ScopeConfiguration.js.map +1 -1
  298. package/build/types/SwitchboardConfiguration.js +17 -7
  299. package/build/types/SwitchboardConfiguration.js.map +1 -1
  300. package/build/types/TokenInfo.js +17 -7
  301. package/build/types/TokenInfo.js.map +1 -1
  302. package/build/types/UpdateConfigMode.d.ts +232 -63
  303. package/build/types/UpdateConfigMode.js +433 -110
  304. package/build/types/UpdateConfigMode.js.map +1 -1
  305. package/build/types/UpdateGlobalConfigMode.d.ts +31 -0
  306. package/build/types/UpdateGlobalConfigMode.js +108 -0
  307. package/build/types/UpdateGlobalConfigMode.js.map +1 -0
  308. package/build/types/UpdateLendingMarketConfigValue.d.ts +20 -0
  309. package/build/types/UpdateLendingMarketConfigValue.js +53 -11
  310. package/build/types/UpdateLendingMarketConfigValue.js.map +1 -1
  311. package/build/types/UpdateLendingMarketMode.d.ts +400 -23
  312. package/build/types/UpdateLendingMarketMode.js +752 -46
  313. package/build/types/UpdateLendingMarketMode.js.map +1 -1
  314. package/build/types/UpdateObligationConfigMode.d.ts +83 -0
  315. package/build/types/UpdateObligationConfigMode.js +204 -0
  316. package/build/types/UpdateObligationConfigMode.js.map +1 -0
  317. package/build/types/WithdrawQueue.d.ts +32 -0
  318. package/build/types/WithdrawQueue.js +93 -0
  319. package/build/types/WithdrawQueue.js.map +1 -0
  320. package/build/types/WithdrawalCaps.js +17 -7
  321. package/build/types/WithdrawalCaps.js.map +1 -1
  322. package/build/types/index.d.ts +32 -10
  323. package/build/types/index.js +38 -10
  324. package/build/types/index.js.map +1 -1
  325. package/package.json +3 -2
  326. package/scripts/generate-idl-module.mjs +18 -0
  327. package/scripts/patch-optional-accounts.mjs +98 -0
  328. package/scripts/verify-idl-provenance.mjs +16 -0
  329. package/src/accounts/GlobalConfig.ts +113 -0
  330. package/src/accounts/LendingMarket.ts +300 -29
  331. package/src/accounts/Obligation.ts +111 -26
  332. package/src/accounts/ReferrerState.ts +11 -4
  333. package/src/accounts/ReferrerTokenState.ts +6 -3
  334. package/src/accounts/Reserve.ts +10 -2
  335. package/src/accounts/ShortUrl.ts +15 -4
  336. package/src/accounts/UserMetadata.ts +6 -3
  337. package/src/accounts/UserState.ts +24 -8
  338. package/src/accounts/WithdrawTicket.ts +173 -0
  339. package/src/accounts/index.ts +4 -0
  340. package/src/errors/custom.ts +1177 -24
  341. package/src/index.ts +2 -4
  342. package/src/instructions/abortObligationOwnershipTransfer.ts +30 -0
  343. package/src/instructions/acceptObligationOwnership.ts +30 -0
  344. package/src/instructions/approveObligationOwnershipTransfer.ts +34 -0
  345. package/src/instructions/borrowObligationLiquidity.ts +18 -5
  346. package/src/instructions/borrowObligationLiquidityV2.ts +30 -9
  347. package/src/instructions/calculateCtokenExchangeRate.ts +22 -0
  348. package/src/instructions/cancelWithdrawTicket.ts +77 -0
  349. package/src/instructions/cloneReserveConfig.ts +56 -0
  350. package/src/instructions/deleteReferrerStateAndShortUrl.ts +4 -1
  351. package/src/instructions/depositAndWithdraw.ts +229 -0
  352. package/src/instructions/depositObligationCollateral.ts +3 -2
  353. package/src/instructions/depositObligationCollateralV2.ts +110 -0
  354. package/src/instructions/depositReserveLiquidity.ts +4 -3
  355. package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +18 -9
  356. package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +31 -14
  357. package/src/instructions/enqueueToWithdraw.ts +113 -0
  358. package/src/instructions/fillBorrowOrder.ts +114 -0
  359. package/src/instructions/fillBorrowOrderV2.ts +128 -0
  360. package/src/instructions/flashBorrowReserveLiquidity.ts +19 -6
  361. package/src/instructions/flashRepayReserveLiquidity.ts +23 -7
  362. package/src/instructions/idlMissingTypes.ts +17 -9
  363. package/src/instructions/index.ts +118 -6
  364. package/src/instructions/initFarmsForReserve.ts +11 -3
  365. package/src/instructions/initGlobalConfig.ts +36 -0
  366. package/src/instructions/initLendingMarket.ts +13 -3
  367. package/src/instructions/initObligation.ts +3 -2
  368. package/src/instructions/initObligationFarmsForReserve.ts +5 -3
  369. package/src/instructions/initReferrerStateAndShortUrl.ts +4 -2
  370. package/src/instructions/initReferrerTokenState.ts +6 -16
  371. package/src/instructions/initReserve.ts +21 -3
  372. package/src/instructions/initUserMetadata.ts +18 -8
  373. package/src/instructions/initiateObligationOwnershipTransfer.ts +44 -0
  374. package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +7 -5
  375. package/src/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +191 -0
  376. package/src/instructions/markObligationForDeleveraging.ts +46 -0
  377. package/src/instructions/recoverInvalidTicketCollateral.ts +80 -0
  378. package/src/instructions/redeemFees.ts +8 -2
  379. package/src/instructions/redeemReserveCollateral.ts +4 -3
  380. package/src/instructions/refreshObligation.ts +7 -1
  381. package/src/instructions/refreshObligationFarmsForReserve.ts +35 -15
  382. package/src/instructions/refreshReserve.ts +27 -17
  383. package/src/instructions/refreshReservesBatch.ts +7 -2
  384. package/src/instructions/repayAndWithdrawAndRedeem.ts +199 -0
  385. package/src/instructions/repayObligationLiquidity.ts +4 -3
  386. package/src/instructions/repayObligationLiquidityV2.ts +35 -10
  387. package/src/instructions/requestElevationGroup.ts +4 -2
  388. package/src/instructions/rolloverFixedTermBorrow.ts +108 -0
  389. package/src/instructions/seedDepositOnInitReserve.ts +50 -0
  390. package/src/instructions/setBorrowOrder.ts +66 -0
  391. package/src/instructions/setBorrowOrderV2.ts +69 -0
  392. package/src/instructions/setObligationOrder.ts +45 -0
  393. package/src/instructions/socializeLoss.ts +5 -4
  394. package/src/instructions/socializeLossV2.ts +92 -0
  395. package/src/instructions/topupReserveRewards.ts +60 -0
  396. package/src/instructions/updateGlobalConfig.ts +53 -0
  397. package/src/instructions/updateGlobalConfigAdmin.ts +30 -0
  398. package/src/instructions/updateLendingMarket.ts +15 -5
  399. package/src/instructions/updateLendingMarketOwner.ts +10 -1
  400. package/src/instructions/updateObligationConfig.ts +65 -0
  401. package/src/instructions/updateReserveConfig.ts +27 -10
  402. package/src/instructions/withdrawObligationCollateral.ts +4 -3
  403. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +18 -9
  404. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +26 -13
  405. package/src/instructions/withdrawObligationCollateralV2.ts +110 -0
  406. package/src/instructions/withdrawProtocolFee.ts +12 -9
  407. package/src/instructions/withdrawQueuedLiquidity.ts +110 -0
  408. package/src/instructions/withdrawReferrerFees.ts +8 -2
  409. package/src/kamino_lending.json +1856 -645
  410. package/src/kamino_lending.ts +5558 -6034
  411. package/src/types/BigFractionBytes.ts +9 -1
  412. package/src/types/BorrowOrder.ts +168 -0
  413. package/src/types/BorrowOrderConfigArgs.ts +96 -0
  414. package/src/types/BorrowRateCurve.ts +10 -3
  415. package/src/types/CurvePoint.ts +7 -1
  416. package/src/types/ElevationGroup.ts +2 -1
  417. package/src/types/ExchangeRateWithDecimals.ts +64 -0
  418. package/src/types/FeeCalculation.ts +9 -2
  419. package/src/types/FixedTermBorrowRolloverConfig.ts +110 -0
  420. package/src/types/InitObligationArgs.ts +3 -0
  421. package/src/types/LastUpdate.ts +26 -10
  422. package/src/types/ObligationLiquidity.ts +43 -10
  423. package/src/types/ObligationOrder.ts +121 -0
  424. package/src/types/ProgressCallbackType.ts +90 -0
  425. package/src/types/ReserveConfig.ts +169 -62
  426. package/src/types/ReserveConfigCustomizationArgs.ts +96 -0
  427. package/src/types/ReserveFees.ts +9 -9
  428. package/src/types/ReserveLiquidity.ts +38 -28
  429. package/src/types/UpdateConfigMode.ts +507 -117
  430. package/src/types/UpdateGlobalConfigMode.ts +90 -0
  431. package/src/types/UpdateLendingMarketConfigValue.ts +43 -0
  432. package/src/types/UpdateLendingMarketMode.ts +912 -41
  433. package/src/types/UpdateObligationConfigMode.ts +210 -0
  434. package/src/types/WithdrawQueue.ts +85 -0
  435. package/src/types/index.ts +175 -34
  436. package/src/types/AssetTier.ts +0 -116
@@ -0,0 +1,110 @@
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 DepositObligationCollateralV2Args {
8
+ collateralAmount: BN
9
+ }
10
+
11
+ export interface DepositObligationCollateralV2Accounts {
12
+ depositAccounts: {
13
+ owner: PublicKey
14
+ obligation: PublicKey
15
+ lendingMarket: PublicKey
16
+ depositReserve: PublicKey
17
+ reserveDestinationCollateral: PublicKey
18
+ userSourceCollateral: PublicKey
19
+ tokenProgram: PublicKey
20
+ instructionSysvarAccount: PublicKey
21
+ }
22
+ lendingMarketAuthority: PublicKey
23
+ farmsAccounts: {
24
+ obligationFarmUserState?: PublicKey | null
25
+ reserveFarmState?: PublicKey | null
26
+ }
27
+ farmsProgram: PublicKey
28
+ }
29
+
30
+ export const layout = borsh.struct([borsh.u64("collateralAmount")])
31
+
32
+ function optionalAccountMeta(
33
+ pubkey: PublicKey | null | undefined,
34
+ isWritable: boolean,
35
+ programId: PublicKey
36
+ ): AccountMeta {
37
+ return {
38
+ pubkey: pubkey ?? programId,
39
+ isSigner: false,
40
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
41
+ }
42
+ }
43
+
44
+ export function depositObligationCollateralV2(
45
+ args: DepositObligationCollateralV2Args,
46
+ accounts: DepositObligationCollateralV2Accounts,
47
+ programId: PublicKey = PROGRAM_ID
48
+ ) {
49
+ const keys: Array<AccountMeta> = [
50
+ {
51
+ pubkey: accounts.depositAccounts.owner,
52
+ isSigner: true,
53
+ isWritable: false,
54
+ },
55
+ {
56
+ pubkey: accounts.depositAccounts.obligation,
57
+ isSigner: false,
58
+ isWritable: true,
59
+ },
60
+ {
61
+ pubkey: accounts.depositAccounts.lendingMarket,
62
+ isSigner: false,
63
+ isWritable: false,
64
+ },
65
+ {
66
+ pubkey: accounts.depositAccounts.depositReserve,
67
+ isSigner: false,
68
+ isWritable: true,
69
+ },
70
+ {
71
+ pubkey: accounts.depositAccounts.reserveDestinationCollateral,
72
+ isSigner: false,
73
+ isWritable: true,
74
+ },
75
+ {
76
+ pubkey: accounts.depositAccounts.userSourceCollateral,
77
+ isSigner: false,
78
+ isWritable: true,
79
+ },
80
+ {
81
+ pubkey: accounts.depositAccounts.tokenProgram,
82
+ isSigner: false,
83
+ isWritable: false,
84
+ },
85
+ {
86
+ pubkey: accounts.depositAccounts.instructionSysvarAccount,
87
+ isSigner: false,
88
+ isWritable: false,
89
+ },
90
+ {
91
+ pubkey: accounts.lendingMarketAuthority,
92
+ isSigner: false,
93
+ isWritable: false,
94
+ },
95
+ optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
96
+ optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
97
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
98
+ ]
99
+ const identifier = Buffer.from([137, 145, 151, 94, 167, 113, 4, 145])
100
+ const buffer = Buffer.alloc(1000)
101
+ const len = layout.encode(
102
+ {
103
+ collateralAmount: args.collateralAmount,
104
+ },
105
+ buffer
106
+ )
107
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
108
+ const ix = new TransactionInstruction({ keys, programId, data })
109
+ return ix
110
+ }
@@ -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 DepositReserveLiquidityArgs {
@@ -27,7 +28,7 @@ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
27
28
  export function depositReserveLiquidity(
28
29
  args: DepositReserveLiquidityArgs,
29
30
  accounts: DepositReserveLiquidityAccounts,
30
- programId: PublicKey = PROGRAM_ID,
31
+ programId: PublicKey = PROGRAM_ID
31
32
  ) {
32
33
  const keys: Array<AccountMeta> = [
33
34
  { pubkey: accounts.owner, isSigner: true, isWritable: false },
@@ -41,7 +42,7 @@ export function depositReserveLiquidity(
41
42
  {
42
43
  pubkey: accounts.reserveLiquidityMint,
43
44
  isSigner: false,
44
- isWritable: true,
45
+ isWritable: false,
45
46
  },
46
47
  {
47
48
  pubkey: accounts.reserveLiquiditySupply,
@@ -81,7 +82,7 @@ export function depositReserveLiquidity(
81
82
  {
82
83
  liquidityAmount: args.liquidityAmount,
83
84
  },
84
- buffer,
85
+ buffer
85
86
  )
86
87
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
87
88
  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 DepositReserveLiquidityAndObligationCollateralArgs {
@@ -18,7 +19,7 @@ export interface DepositReserveLiquidityAndObligationCollateralAccounts {
18
19
  reserveCollateralMint: PublicKey
19
20
  reserveDestinationDepositCollateral: PublicKey
20
21
  userSourceLiquidity: PublicKey
21
- placeholderUserDestinationCollateral: PublicKey
22
+ placeholderUserDestinationCollateral?: PublicKey | null
22
23
  collateralTokenProgram: PublicKey
23
24
  liquidityTokenProgram: PublicKey
24
25
  instructionSysvarAccount: PublicKey
@@ -26,10 +27,22 @@ export interface DepositReserveLiquidityAndObligationCollateralAccounts {
26
27
 
27
28
  export const layout = borsh.struct([borsh.u64("liquidityAmount")])
28
29
 
30
+ function optionalAccountMeta(
31
+ pubkey: PublicKey | null | undefined,
32
+ isWritable: boolean,
33
+ programId: PublicKey
34
+ ): AccountMeta {
35
+ return {
36
+ pubkey: pubkey ?? programId,
37
+ isSigner: false,
38
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
39
+ }
40
+ }
41
+
29
42
  export function depositReserveLiquidityAndObligationCollateral(
30
43
  args: DepositReserveLiquidityAndObligationCollateralArgs,
31
44
  accounts: DepositReserveLiquidityAndObligationCollateralAccounts,
32
- programId: PublicKey = PROGRAM_ID,
45
+ programId: PublicKey = PROGRAM_ID
33
46
  ) {
34
47
  const keys: Array<AccountMeta> = [
35
48
  { pubkey: accounts.owner, isSigner: true, isWritable: true },
@@ -44,7 +57,7 @@ export function depositReserveLiquidityAndObligationCollateral(
44
57
  {
45
58
  pubkey: accounts.reserveLiquidityMint,
46
59
  isSigner: false,
47
- isWritable: true,
60
+ isWritable: false,
48
61
  },
49
62
  {
50
63
  pubkey: accounts.reserveLiquiditySupply,
@@ -62,11 +75,7 @@ export function depositReserveLiquidityAndObligationCollateral(
62
75
  isWritable: true,
63
76
  },
64
77
  { pubkey: accounts.userSourceLiquidity, isSigner: false, isWritable: true },
65
- {
66
- pubkey: accounts.placeholderUserDestinationCollateral,
67
- isSigner: false,
68
- isWritable: false,
69
- },
78
+ optionalAccountMeta(accounts.placeholderUserDestinationCollateral, false, programId),
70
79
  {
71
80
  pubkey: accounts.collateralTokenProgram,
72
81
  isSigner: false,
@@ -89,7 +98,7 @@ export function depositReserveLiquidityAndObligationCollateral(
89
98
  {
90
99
  liquidityAmount: args.liquidityAmount,
91
100
  },
92
- buffer,
101
+ buffer
93
102
  )
94
103
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
95
104
  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 DepositReserveLiquidityAndObligationCollateralV2Args {
@@ -36,30 +37,46 @@ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
36
37
  function optionalAccountMeta(
37
38
  pubkey: PublicKey | null | undefined,
38
39
  isWritable: boolean,
39
- programId: PublicKey,
40
+ programId: PublicKey
40
41
  ): AccountMeta {
41
42
  return {
42
43
  pubkey: pubkey ?? programId,
43
44
  isSigner: false,
44
- isWritable,
45
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
45
46
  }
46
47
  }
47
48
 
48
49
  export function depositReserveLiquidityAndObligationCollateralV2(
49
50
  args: DepositReserveLiquidityAndObligationCollateralV2Args,
50
51
  accounts: DepositReserveLiquidityAndObligationCollateralV2Accounts,
51
- programId: PublicKey = PROGRAM_ID,
52
+ programId: PublicKey = PROGRAM_ID
52
53
  ) {
53
54
  const keys: Array<AccountMeta> = [
54
- { pubkey: accounts.depositAccounts.owner, isSigner: true, isWritable: true },
55
- { pubkey: accounts.depositAccounts.obligation, isSigner: false, isWritable: true },
56
- { pubkey: accounts.depositAccounts.lendingMarket, isSigner: false, isWritable: false },
55
+ {
56
+ pubkey: accounts.depositAccounts.owner,
57
+ isSigner: true,
58
+ isWritable: true,
59
+ },
60
+ {
61
+ pubkey: accounts.depositAccounts.obligation,
62
+ isSigner: false,
63
+ isWritable: true,
64
+ },
65
+ {
66
+ pubkey: accounts.depositAccounts.lendingMarket,
67
+ isSigner: false,
68
+ isWritable: false,
69
+ },
57
70
  {
58
71
  pubkey: accounts.depositAccounts.lendingMarketAuthority,
59
72
  isSigner: false,
60
73
  isWritable: false,
61
74
  },
62
- { pubkey: accounts.depositAccounts.reserve, isSigner: false, isWritable: true },
75
+ {
76
+ pubkey: accounts.depositAccounts.reserve,
77
+ isSigner: false,
78
+ isWritable: true,
79
+ },
63
80
  {
64
81
  pubkey: accounts.depositAccounts.reserveLiquidityMint,
65
82
  isSigner: false,
@@ -80,12 +97,12 @@ export function depositReserveLiquidityAndObligationCollateralV2(
80
97
  isSigner: false,
81
98
  isWritable: true,
82
99
  },
83
- { pubkey: accounts.depositAccounts.userSourceLiquidity, isSigner: false, isWritable: true },
84
- optionalAccountMeta(
85
- accounts.depositAccounts.placeholderUserDestinationCollateral,
86
- false,
87
- programId,
88
- ),
100
+ {
101
+ pubkey: accounts.depositAccounts.userSourceLiquidity,
102
+ isSigner: false,
103
+ isWritable: true,
104
+ },
105
+ optionalAccountMeta(accounts.depositAccounts.placeholderUserDestinationCollateral, false, programId),
89
106
  {
90
107
  pubkey: accounts.depositAccounts.collateralTokenProgram,
91
108
  isSigner: false,
@@ -111,7 +128,7 @@ export function depositReserveLiquidityAndObligationCollateralV2(
111
128
  {
112
129
  liquidityAmount: args.liquidityAmount,
113
130
  },
114
- buffer,
131
+ buffer
115
132
  )
116
133
  const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
117
134
  const ix = new TransactionInstruction({ keys, programId, data })
@@ -0,0 +1,113 @@
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 EnqueueToWithdrawArgs {
8
+ collateralAmount: BN
9
+ progressCallbackType: types.ProgressCallbackTypeKind
10
+ }
11
+
12
+ export interface EnqueueToWithdrawAccounts {
13
+ owner: PublicKey
14
+ lendingMarket: PublicKey
15
+ lendingMarketAuthority: PublicKey
16
+ reserve: PublicKey
17
+ userSourceCollateralTa: PublicKey
18
+ userDestinationLiquidityTa: PublicKey
19
+ reserveLiquidityMint: PublicKey
20
+ reserveCollateralMint: PublicKey
21
+ collateralTokenProgram: PublicKey
22
+ withdrawTicket: PublicKey
23
+ ownerQueuedCollateralVault: PublicKey
24
+ systemProgram: PublicKey
25
+ progressCallbackCustomAccount0?: PublicKey | null
26
+ progressCallbackCustomAccount1?: PublicKey | null
27
+ instructionSysvarAccount: PublicKey
28
+ }
29
+
30
+ export const layout = borsh.struct([
31
+ borsh.u64("collateralAmount"),
32
+ types.ProgressCallbackType.layout("progressCallbackType"),
33
+ ])
34
+
35
+ function optionalAccountMeta(
36
+ pubkey: PublicKey | null | undefined,
37
+ isWritable: boolean,
38
+ programId: PublicKey
39
+ ): AccountMeta {
40
+ return {
41
+ pubkey: pubkey ?? programId,
42
+ isSigner: false,
43
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
44
+ }
45
+ }
46
+
47
+ export function enqueueToWithdraw(
48
+ args: EnqueueToWithdrawArgs,
49
+ accounts: EnqueueToWithdrawAccounts,
50
+ programId: PublicKey = PROGRAM_ID
51
+ ) {
52
+ const keys: Array<AccountMeta> = [
53
+ { pubkey: accounts.owner, isSigner: true, isWritable: true },
54
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
55
+ {
56
+ pubkey: accounts.lendingMarketAuthority,
57
+ isSigner: false,
58
+ isWritable: false,
59
+ },
60
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
61
+ {
62
+ pubkey: accounts.userSourceCollateralTa,
63
+ isSigner: false,
64
+ isWritable: true,
65
+ },
66
+ {
67
+ pubkey: accounts.userDestinationLiquidityTa,
68
+ isSigner: false,
69
+ isWritable: false,
70
+ },
71
+ {
72
+ pubkey: accounts.reserveLiquidityMint,
73
+ isSigner: false,
74
+ isWritable: false,
75
+ },
76
+ {
77
+ pubkey: accounts.reserveCollateralMint,
78
+ isSigner: false,
79
+ isWritable: false,
80
+ },
81
+ {
82
+ pubkey: accounts.collateralTokenProgram,
83
+ isSigner: false,
84
+ isWritable: false,
85
+ },
86
+ { pubkey: accounts.withdrawTicket, isSigner: false, isWritable: true },
87
+ {
88
+ pubkey: accounts.ownerQueuedCollateralVault,
89
+ isSigner: false,
90
+ isWritable: true,
91
+ },
92
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
93
+ optionalAccountMeta(accounts.progressCallbackCustomAccount0, false, programId),
94
+ optionalAccountMeta(accounts.progressCallbackCustomAccount1, false, programId),
95
+ {
96
+ pubkey: accounts.instructionSysvarAccount,
97
+ isSigner: false,
98
+ isWritable: false,
99
+ },
100
+ ]
101
+ const identifier = Buffer.from([134, 113, 160, 207, 90, 75, 213, 219])
102
+ const buffer = Buffer.alloc(1000)
103
+ const len = layout.encode(
104
+ {
105
+ collateralAmount: args.collateralAmount,
106
+ progressCallbackType: args.progressCallbackType.toEncodable(),
107
+ },
108
+ buffer
109
+ )
110
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
111
+ const ix = new TransactionInstruction({ keys, programId, data })
112
+ return ix
113
+ }
@@ -0,0 +1,114 @@
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 FillBorrowOrderAccounts {
8
+ borrowAccounts: {
9
+ payer: PublicKey
10
+ obligation: PublicKey
11
+ lendingMarket: PublicKey
12
+ lendingMarketAuthority: PublicKey
13
+ borrowReserve: PublicKey
14
+ borrowReserveLiquidityMint: PublicKey
15
+ reserveSourceLiquidity: PublicKey
16
+ borrowReserveLiquidityFeeReceiver: PublicKey
17
+ userDestinationLiquidity: PublicKey
18
+ referrerTokenState?: PublicKey | null
19
+ tokenProgram: PublicKey
20
+ instructionSysvarAccount: PublicKey
21
+ }
22
+ farmsAccounts: {
23
+ obligationFarmUserState?: PublicKey | null
24
+ reserveFarmState?: PublicKey | null
25
+ }
26
+ farmsProgram: PublicKey
27
+ eventAuthority: PublicKey
28
+ program: 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 fillBorrowOrder(
44
+ accounts: FillBorrowOrderAccounts,
45
+ programId: PublicKey = PROGRAM_ID
46
+ ) {
47
+ const keys: Array<AccountMeta> = [
48
+ {
49
+ pubkey: accounts.borrowAccounts.payer,
50
+ isSigner: true,
51
+ isWritable: false,
52
+ },
53
+ {
54
+ pubkey: accounts.borrowAccounts.obligation,
55
+ isSigner: false,
56
+ isWritable: true,
57
+ },
58
+ {
59
+ pubkey: accounts.borrowAccounts.lendingMarket,
60
+ isSigner: false,
61
+ isWritable: false,
62
+ },
63
+ {
64
+ pubkey: accounts.borrowAccounts.lendingMarketAuthority,
65
+ isSigner: false,
66
+ isWritable: false,
67
+ },
68
+ {
69
+ pubkey: accounts.borrowAccounts.borrowReserve,
70
+ isSigner: false,
71
+ isWritable: true,
72
+ },
73
+ {
74
+ pubkey: accounts.borrowAccounts.borrowReserveLiquidityMint,
75
+ isSigner: false,
76
+ isWritable: false,
77
+ },
78
+ {
79
+ pubkey: accounts.borrowAccounts.reserveSourceLiquidity,
80
+ isSigner: false,
81
+ isWritable: true,
82
+ },
83
+ {
84
+ pubkey: accounts.borrowAccounts.borrowReserveLiquidityFeeReceiver,
85
+ isSigner: false,
86
+ isWritable: true,
87
+ },
88
+ {
89
+ pubkey: accounts.borrowAccounts.userDestinationLiquidity,
90
+ isSigner: false,
91
+ isWritable: true,
92
+ },
93
+ optionalAccountMeta(accounts.borrowAccounts.referrerTokenState, true, programId),
94
+ {
95
+ pubkey: accounts.borrowAccounts.tokenProgram,
96
+ isSigner: false,
97
+ isWritable: false,
98
+ },
99
+ {
100
+ pubkey: accounts.borrowAccounts.instructionSysvarAccount,
101
+ isSigner: false,
102
+ isWritable: false,
103
+ },
104
+ optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
105
+ optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
106
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
107
+ { pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
108
+ { pubkey: accounts.program, isSigner: false, isWritable: false },
109
+ ]
110
+ const identifier = Buffer.from([102, 4, 167, 76, 131, 170, 93, 19])
111
+ const data = identifier
112
+ const ix = new TransactionInstruction({ keys, programId, data })
113
+ return ix
114
+ }
@@ -0,0 +1,128 @@
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 FillBorrowOrderV2Args {
8
+ orderIdx: number
9
+ }
10
+
11
+ export interface FillBorrowOrderV2Accounts {
12
+ borrowAccounts: {
13
+ payer: PublicKey
14
+ obligation: PublicKey
15
+ lendingMarket: PublicKey
16
+ lendingMarketAuthority: PublicKey
17
+ borrowReserve: PublicKey
18
+ borrowReserveLiquidityMint: PublicKey
19
+ reserveSourceLiquidity: PublicKey
20
+ borrowReserveLiquidityFeeReceiver: PublicKey
21
+ userDestinationLiquidity: PublicKey
22
+ referrerTokenState?: PublicKey | null
23
+ tokenProgram: PublicKey
24
+ instructionSysvarAccount: PublicKey
25
+ }
26
+ farmsAccounts: {
27
+ obligationFarmUserState?: PublicKey | null
28
+ reserveFarmState?: PublicKey | null
29
+ }
30
+ farmsProgram: PublicKey
31
+ eventAuthority: PublicKey
32
+ program: PublicKey
33
+ }
34
+
35
+ export const layout = borsh.struct([borsh.u8("orderIdx")])
36
+
37
+ function optionalAccountMeta(
38
+ pubkey: PublicKey | null | undefined,
39
+ isWritable: boolean,
40
+ programId: PublicKey
41
+ ): AccountMeta {
42
+ return {
43
+ pubkey: pubkey ?? programId,
44
+ isSigner: false,
45
+ isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
46
+ }
47
+ }
48
+
49
+ export function fillBorrowOrderV2(
50
+ args: FillBorrowOrderV2Args,
51
+ accounts: FillBorrowOrderV2Accounts,
52
+ programId: PublicKey = PROGRAM_ID
53
+ ) {
54
+ const keys: Array<AccountMeta> = [
55
+ {
56
+ pubkey: accounts.borrowAccounts.payer,
57
+ isSigner: true,
58
+ isWritable: false,
59
+ },
60
+ {
61
+ pubkey: accounts.borrowAccounts.obligation,
62
+ isSigner: false,
63
+ isWritable: true,
64
+ },
65
+ {
66
+ pubkey: accounts.borrowAccounts.lendingMarket,
67
+ isSigner: false,
68
+ isWritable: false,
69
+ },
70
+ {
71
+ pubkey: accounts.borrowAccounts.lendingMarketAuthority,
72
+ isSigner: false,
73
+ isWritable: false,
74
+ },
75
+ {
76
+ pubkey: accounts.borrowAccounts.borrowReserve,
77
+ isSigner: false,
78
+ isWritable: true,
79
+ },
80
+ {
81
+ pubkey: accounts.borrowAccounts.borrowReserveLiquidityMint,
82
+ isSigner: false,
83
+ isWritable: false,
84
+ },
85
+ {
86
+ pubkey: accounts.borrowAccounts.reserveSourceLiquidity,
87
+ isSigner: false,
88
+ isWritable: true,
89
+ },
90
+ {
91
+ pubkey: accounts.borrowAccounts.borrowReserveLiquidityFeeReceiver,
92
+ isSigner: false,
93
+ isWritable: true,
94
+ },
95
+ {
96
+ pubkey: accounts.borrowAccounts.userDestinationLiquidity,
97
+ isSigner: false,
98
+ isWritable: true,
99
+ },
100
+ optionalAccountMeta(accounts.borrowAccounts.referrerTokenState, true, programId),
101
+ {
102
+ pubkey: accounts.borrowAccounts.tokenProgram,
103
+ isSigner: false,
104
+ isWritable: false,
105
+ },
106
+ {
107
+ pubkey: accounts.borrowAccounts.instructionSysvarAccount,
108
+ isSigner: false,
109
+ isWritable: false,
110
+ },
111
+ optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
112
+ optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
113
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
114
+ { pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
115
+ { pubkey: accounts.program, isSigner: false, isWritable: false },
116
+ ]
117
+ const identifier = Buffer.from([197, 85, 193, 139, 40, 94, 194, 143])
118
+ const buffer = Buffer.alloc(1000)
119
+ const len = layout.encode(
120
+ {
121
+ orderIdx: args.orderIdx,
122
+ },
123
+ buffer
124
+ )
125
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
126
+ const ix = new TransactionInstruction({ keys, programId, data })
127
+ return ix
128
+ }