@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
@@ -1,4 +1,6 @@
1
+ import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
1
2
  import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
2
4
  import * as borsh from "@coral-xyz/borsh"
3
5
 
4
6
  export interface BigFractionBytesFields {
@@ -21,7 +23,13 @@ export class BigFractionBytes {
21
23
  }
22
24
 
23
25
  static layout(property?: string) {
24
- return borsh.struct([borsh.array(borsh.u64(), 4, "value"), borsh.array(borsh.u64(), 2, "padding")], property)
26
+ return borsh.struct(
27
+ [
28
+ borsh.array(borsh.u64(), 4, "value"),
29
+ borsh.array(borsh.u64(), 2, "padding"),
30
+ ],
31
+ property
32
+ )
25
33
  }
26
34
 
27
35
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -0,0 +1,168 @@
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
+
6
+ export interface BorrowOrderFields {
7
+ debtLiquidityMint: PublicKey
8
+ remainingDebtAmount: BN
9
+ filledDebtDestination: PublicKey
10
+ minDebtTermSeconds: BN
11
+ fillableUntilTimestamp: BN
12
+ placedAtTimestamp: BN
13
+ lastUpdatedAtTimestamp: BN
14
+ requestedDebtAmount: BN
15
+ maxBorrowRateBps: number
16
+ active: number
17
+ enableAutoRolloverOnFilledBorrows: number
18
+ padding1: Array<number>
19
+ endPadding: Array<BN>
20
+ }
21
+
22
+ export interface BorrowOrderJSON {
23
+ debtLiquidityMint: string
24
+ remainingDebtAmount: string
25
+ filledDebtDestination: string
26
+ minDebtTermSeconds: string
27
+ fillableUntilTimestamp: string
28
+ placedAtTimestamp: string
29
+ lastUpdatedAtTimestamp: string
30
+ requestedDebtAmount: string
31
+ maxBorrowRateBps: number
32
+ active: number
33
+ enableAutoRolloverOnFilledBorrows: number
34
+ padding1: Array<number>
35
+ endPadding: Array<string>
36
+ }
37
+
38
+ export class BorrowOrder {
39
+ readonly debtLiquidityMint: PublicKey
40
+ readonly remainingDebtAmount: BN
41
+ readonly filledDebtDestination: PublicKey
42
+ readonly minDebtTermSeconds: BN
43
+ readonly fillableUntilTimestamp: BN
44
+ readonly placedAtTimestamp: BN
45
+ readonly lastUpdatedAtTimestamp: BN
46
+ readonly requestedDebtAmount: BN
47
+ readonly maxBorrowRateBps: number
48
+ readonly active: number
49
+ readonly enableAutoRolloverOnFilledBorrows: number
50
+ readonly padding1: Array<number>
51
+ readonly endPadding: Array<BN>
52
+
53
+ constructor(fields: BorrowOrderFields) {
54
+ this.debtLiquidityMint = fields.debtLiquidityMint
55
+ this.remainingDebtAmount = fields.remainingDebtAmount
56
+ this.filledDebtDestination = fields.filledDebtDestination
57
+ this.minDebtTermSeconds = fields.minDebtTermSeconds
58
+ this.fillableUntilTimestamp = fields.fillableUntilTimestamp
59
+ this.placedAtTimestamp = fields.placedAtTimestamp
60
+ this.lastUpdatedAtTimestamp = fields.lastUpdatedAtTimestamp
61
+ this.requestedDebtAmount = fields.requestedDebtAmount
62
+ this.maxBorrowRateBps = fields.maxBorrowRateBps
63
+ this.active = fields.active
64
+ this.enableAutoRolloverOnFilledBorrows =
65
+ fields.enableAutoRolloverOnFilledBorrows
66
+ this.padding1 = fields.padding1
67
+ this.endPadding = fields.endPadding
68
+ }
69
+
70
+ static layout(property?: string) {
71
+ return borsh.struct(
72
+ [
73
+ borsh.publicKey("debtLiquidityMint"),
74
+ borsh.u64("remainingDebtAmount"),
75
+ borsh.publicKey("filledDebtDestination"),
76
+ borsh.u64("minDebtTermSeconds"),
77
+ borsh.u64("fillableUntilTimestamp"),
78
+ borsh.u64("placedAtTimestamp"),
79
+ borsh.u64("lastUpdatedAtTimestamp"),
80
+ borsh.u64("requestedDebtAmount"),
81
+ borsh.u32("maxBorrowRateBps"),
82
+ borsh.u8("active"),
83
+ borsh.u8("enableAutoRolloverOnFilledBorrows"),
84
+ borsh.array(borsh.u8(), 2, "padding1"),
85
+ borsh.array(borsh.u64(), 5, "endPadding"),
86
+ ],
87
+ property
88
+ )
89
+ }
90
+
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ static fromDecoded(obj: any) {
93
+ return new BorrowOrder({
94
+ debtLiquidityMint: obj.debtLiquidityMint,
95
+ remainingDebtAmount: obj.remainingDebtAmount,
96
+ filledDebtDestination: obj.filledDebtDestination,
97
+ minDebtTermSeconds: obj.minDebtTermSeconds,
98
+ fillableUntilTimestamp: obj.fillableUntilTimestamp,
99
+ placedAtTimestamp: obj.placedAtTimestamp,
100
+ lastUpdatedAtTimestamp: obj.lastUpdatedAtTimestamp,
101
+ requestedDebtAmount: obj.requestedDebtAmount,
102
+ maxBorrowRateBps: obj.maxBorrowRateBps,
103
+ active: obj.active,
104
+ enableAutoRolloverOnFilledBorrows: obj.enableAutoRolloverOnFilledBorrows,
105
+ padding1: obj.padding1,
106
+ endPadding: obj.endPadding,
107
+ })
108
+ }
109
+
110
+ static toEncodable(fields: BorrowOrderFields) {
111
+ return {
112
+ debtLiquidityMint: fields.debtLiquidityMint,
113
+ remainingDebtAmount: fields.remainingDebtAmount,
114
+ filledDebtDestination: fields.filledDebtDestination,
115
+ minDebtTermSeconds: fields.minDebtTermSeconds,
116
+ fillableUntilTimestamp: fields.fillableUntilTimestamp,
117
+ placedAtTimestamp: fields.placedAtTimestamp,
118
+ lastUpdatedAtTimestamp: fields.lastUpdatedAtTimestamp,
119
+ requestedDebtAmount: fields.requestedDebtAmount,
120
+ maxBorrowRateBps: fields.maxBorrowRateBps,
121
+ active: fields.active,
122
+ enableAutoRolloverOnFilledBorrows:
123
+ fields.enableAutoRolloverOnFilledBorrows,
124
+ padding1: fields.padding1,
125
+ endPadding: fields.endPadding,
126
+ }
127
+ }
128
+
129
+ toJSON(): BorrowOrderJSON {
130
+ return {
131
+ debtLiquidityMint: this.debtLiquidityMint.toString(),
132
+ remainingDebtAmount: this.remainingDebtAmount.toString(),
133
+ filledDebtDestination: this.filledDebtDestination.toString(),
134
+ minDebtTermSeconds: this.minDebtTermSeconds.toString(),
135
+ fillableUntilTimestamp: this.fillableUntilTimestamp.toString(),
136
+ placedAtTimestamp: this.placedAtTimestamp.toString(),
137
+ lastUpdatedAtTimestamp: this.lastUpdatedAtTimestamp.toString(),
138
+ requestedDebtAmount: this.requestedDebtAmount.toString(),
139
+ maxBorrowRateBps: this.maxBorrowRateBps,
140
+ active: this.active,
141
+ enableAutoRolloverOnFilledBorrows: this.enableAutoRolloverOnFilledBorrows,
142
+ padding1: this.padding1,
143
+ endPadding: this.endPadding.map((item) => item.toString()),
144
+ }
145
+ }
146
+
147
+ static fromJSON(obj: BorrowOrderJSON): BorrowOrder {
148
+ return new BorrowOrder({
149
+ debtLiquidityMint: new PublicKey(obj.debtLiquidityMint),
150
+ remainingDebtAmount: new BN(obj.remainingDebtAmount),
151
+ filledDebtDestination: new PublicKey(obj.filledDebtDestination),
152
+ minDebtTermSeconds: new BN(obj.minDebtTermSeconds),
153
+ fillableUntilTimestamp: new BN(obj.fillableUntilTimestamp),
154
+ placedAtTimestamp: new BN(obj.placedAtTimestamp),
155
+ lastUpdatedAtTimestamp: new BN(obj.lastUpdatedAtTimestamp),
156
+ requestedDebtAmount: new BN(obj.requestedDebtAmount),
157
+ maxBorrowRateBps: obj.maxBorrowRateBps,
158
+ active: obj.active,
159
+ enableAutoRolloverOnFilledBorrows: obj.enableAutoRolloverOnFilledBorrows,
160
+ padding1: obj.padding1,
161
+ endPadding: obj.endPadding.map((item) => new BN(item)),
162
+ })
163
+ }
164
+
165
+ toEncodable() {
166
+ return BorrowOrder.toEncodable(this)
167
+ }
168
+ }
@@ -0,0 +1,96 @@
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
+
6
+ export interface BorrowOrderConfigArgsFields {
7
+ remainingDebtAmount: BN
8
+ maxBorrowRateBps: number
9
+ minDebtTermSeconds: BN
10
+ fillableUntilTimestamp: BN
11
+ enableAutoRolloverOnFilledBorrows: boolean
12
+ }
13
+
14
+ export interface BorrowOrderConfigArgsJSON {
15
+ remainingDebtAmount: string
16
+ maxBorrowRateBps: number
17
+ minDebtTermSeconds: string
18
+ fillableUntilTimestamp: string
19
+ enableAutoRolloverOnFilledBorrows: boolean
20
+ }
21
+
22
+ export class BorrowOrderConfigArgs {
23
+ readonly remainingDebtAmount: BN
24
+ readonly maxBorrowRateBps: number
25
+ readonly minDebtTermSeconds: BN
26
+ readonly fillableUntilTimestamp: BN
27
+ readonly enableAutoRolloverOnFilledBorrows: boolean
28
+
29
+ constructor(fields: BorrowOrderConfigArgsFields) {
30
+ this.remainingDebtAmount = fields.remainingDebtAmount
31
+ this.maxBorrowRateBps = fields.maxBorrowRateBps
32
+ this.minDebtTermSeconds = fields.minDebtTermSeconds
33
+ this.fillableUntilTimestamp = fields.fillableUntilTimestamp
34
+ this.enableAutoRolloverOnFilledBorrows =
35
+ fields.enableAutoRolloverOnFilledBorrows
36
+ }
37
+
38
+ static layout(property?: string) {
39
+ return borsh.struct(
40
+ [
41
+ borsh.u64("remainingDebtAmount"),
42
+ borsh.u32("maxBorrowRateBps"),
43
+ borsh.u64("minDebtTermSeconds"),
44
+ borsh.u64("fillableUntilTimestamp"),
45
+ borsh.bool("enableAutoRolloverOnFilledBorrows"),
46
+ ],
47
+ property
48
+ )
49
+ }
50
+
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ static fromDecoded(obj: any) {
53
+ return new BorrowOrderConfigArgs({
54
+ remainingDebtAmount: obj.remainingDebtAmount,
55
+ maxBorrowRateBps: obj.maxBorrowRateBps,
56
+ minDebtTermSeconds: obj.minDebtTermSeconds,
57
+ fillableUntilTimestamp: obj.fillableUntilTimestamp,
58
+ enableAutoRolloverOnFilledBorrows: obj.enableAutoRolloverOnFilledBorrows,
59
+ })
60
+ }
61
+
62
+ static toEncodable(fields: BorrowOrderConfigArgsFields) {
63
+ return {
64
+ remainingDebtAmount: fields.remainingDebtAmount,
65
+ maxBorrowRateBps: fields.maxBorrowRateBps,
66
+ minDebtTermSeconds: fields.minDebtTermSeconds,
67
+ fillableUntilTimestamp: fields.fillableUntilTimestamp,
68
+ enableAutoRolloverOnFilledBorrows:
69
+ fields.enableAutoRolloverOnFilledBorrows,
70
+ }
71
+ }
72
+
73
+ toJSON(): BorrowOrderConfigArgsJSON {
74
+ return {
75
+ remainingDebtAmount: this.remainingDebtAmount.toString(),
76
+ maxBorrowRateBps: this.maxBorrowRateBps,
77
+ minDebtTermSeconds: this.minDebtTermSeconds.toString(),
78
+ fillableUntilTimestamp: this.fillableUntilTimestamp.toString(),
79
+ enableAutoRolloverOnFilledBorrows: this.enableAutoRolloverOnFilledBorrows,
80
+ }
81
+ }
82
+
83
+ static fromJSON(obj: BorrowOrderConfigArgsJSON): BorrowOrderConfigArgs {
84
+ return new BorrowOrderConfigArgs({
85
+ remainingDebtAmount: new BN(obj.remainingDebtAmount),
86
+ maxBorrowRateBps: obj.maxBorrowRateBps,
87
+ minDebtTermSeconds: new BN(obj.minDebtTermSeconds),
88
+ fillableUntilTimestamp: new BN(obj.fillableUntilTimestamp),
89
+ enableAutoRolloverOnFilledBorrows: obj.enableAutoRolloverOnFilledBorrows,
90
+ })
91
+ }
92
+
93
+ toEncodable() {
94
+ return BorrowOrderConfigArgs.toEncodable(this)
95
+ }
96
+ }
@@ -1,3 +1,5 @@
1
+ import { PublicKey } 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
1
3
  import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
2
4
  import * as borsh from "@coral-xyz/borsh"
3
5
 
@@ -17,14 +19,19 @@ export class BorrowRateCurve {
17
19
  }
18
20
 
19
21
  static layout(property?: string) {
20
- return borsh.struct([borsh.array(types.CurvePoint.layout(), 11, "points")], property)
22
+ return borsh.struct(
23
+ [borsh.array(types.CurvePoint.layout(), 11, "points")],
24
+ property
25
+ )
21
26
  }
22
27
 
23
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
29
  static fromDecoded(obj: any) {
25
30
  return new BorrowRateCurve({
26
- points: obj.points.map((item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */) =>
27
- types.CurvePoint.fromDecoded(item),
31
+ points: obj.points.map(
32
+ (
33
+ item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
34
+ ) => types.CurvePoint.fromDecoded(item)
28
35
  ),
29
36
  })
30
37
  }
@@ -1,3 +1,6 @@
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
1
4
  import * as borsh from "@coral-xyz/borsh"
2
5
 
3
6
  export interface CurvePointFields {
@@ -20,7 +23,10 @@ export class CurvePoint {
20
23
  }
21
24
 
22
25
  static layout(property?: string) {
23
- return borsh.struct([borsh.u32("utilizationRateBps"), borsh.u32("borrowRateBps")], property)
26
+ return borsh.struct(
27
+ [borsh.u32("utilizationRateBps"), borsh.u32("borrowRateBps")],
28
+ property
29
+ )
24
30
  }
25
31
 
26
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1,5 +1,6 @@
1
1
  import { PublicKey } 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
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
3
4
  import * as borsh from "@coral-xyz/borsh"
4
5
 
5
6
  export interface ElevationGroupFields {
@@ -62,7 +63,7 @@ export class ElevationGroup {
62
63
  borsh.publicKey("debtReserve"),
63
64
  borsh.array(borsh.u64(), 4, "padding1"),
64
65
  ],
65
- property,
66
+ property
66
67
  )
67
68
  }
68
69
 
@@ -0,0 +1,64 @@
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
+
6
+ export interface ExchangeRateWithDecimalsFields {
7
+ exchangeRateSf: BN
8
+ mintDecimals: number
9
+ }
10
+
11
+ export interface ExchangeRateWithDecimalsJSON {
12
+ exchangeRateSf: string
13
+ mintDecimals: number
14
+ }
15
+
16
+ export class ExchangeRateWithDecimals {
17
+ readonly exchangeRateSf: BN
18
+ readonly mintDecimals: number
19
+
20
+ constructor(fields: ExchangeRateWithDecimalsFields) {
21
+ this.exchangeRateSf = fields.exchangeRateSf
22
+ this.mintDecimals = fields.mintDecimals
23
+ }
24
+
25
+ static layout(property?: string) {
26
+ return borsh.struct(
27
+ [borsh.u128("exchangeRateSf"), borsh.u8("mintDecimals")],
28
+ property
29
+ )
30
+ }
31
+
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ static fromDecoded(obj: any) {
34
+ return new ExchangeRateWithDecimals({
35
+ exchangeRateSf: obj.exchangeRateSf,
36
+ mintDecimals: obj.mintDecimals,
37
+ })
38
+ }
39
+
40
+ static toEncodable(fields: ExchangeRateWithDecimalsFields) {
41
+ return {
42
+ exchangeRateSf: fields.exchangeRateSf,
43
+ mintDecimals: fields.mintDecimals,
44
+ }
45
+ }
46
+
47
+ toJSON(): ExchangeRateWithDecimalsJSON {
48
+ return {
49
+ exchangeRateSf: this.exchangeRateSf.toString(),
50
+ mintDecimals: this.mintDecimals,
51
+ }
52
+ }
53
+
54
+ static fromJSON(obj: ExchangeRateWithDecimalsJSON): ExchangeRateWithDecimals {
55
+ return new ExchangeRateWithDecimals({
56
+ exchangeRateSf: new BN(obj.exchangeRateSf),
57
+ mintDecimals: obj.mintDecimals,
58
+ })
59
+ }
60
+
61
+ toEncodable() {
62
+ return ExchangeRateWithDecimals.toEncodable(this)
63
+ }
64
+ }
@@ -1,3 +1,5 @@
1
+ import { PublicKey } 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
1
3
  import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
2
4
  import * as borsh from "@coral-xyz/borsh"
3
5
 
@@ -63,7 +65,9 @@ export function fromDecoded(obj: any): types.FeeCalculationKind {
63
65
  throw new Error("Invalid enum object")
64
66
  }
65
67
 
66
- export function fromJSON(obj: types.FeeCalculationJSON): types.FeeCalculationKind {
68
+ export function fromJSON(
69
+ obj: types.FeeCalculationJSON
70
+ ): types.FeeCalculationKind {
67
71
  switch (obj.kind) {
68
72
  case "Exclusive": {
69
73
  return new Exclusive()
@@ -75,7 +79,10 @@ export function fromJSON(obj: types.FeeCalculationJSON): types.FeeCalculationKin
75
79
  }
76
80
 
77
81
  export function layout(property?: string) {
78
- const ret = borsh.rustEnum([borsh.struct([], "Exclusive"), borsh.struct([], "Inclusive")])
82
+ const ret = borsh.rustEnum([
83
+ borsh.struct([], "Exclusive"),
84
+ borsh.struct([], "Inclusive"),
85
+ ])
79
86
  if (property !== undefined) {
80
87
  return ret.replicate(property)
81
88
  }
@@ -0,0 +1,110 @@
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
+
6
+ export interface FixedTermBorrowRolloverConfigFields {
7
+ autoRolloverEnabled: number
8
+ openTermAllowed: number
9
+ migrationToFixedEnabled: number
10
+ fixedTermRolloverWindowDurationDays: number
11
+ maxBorrowRateBps: number
12
+ minDebtTermSeconds: BN
13
+ }
14
+
15
+ export interface FixedTermBorrowRolloverConfigJSON {
16
+ autoRolloverEnabled: number
17
+ openTermAllowed: number
18
+ migrationToFixedEnabled: number
19
+ fixedTermRolloverWindowDurationDays: number
20
+ maxBorrowRateBps: number
21
+ minDebtTermSeconds: string
22
+ }
23
+
24
+ export class FixedTermBorrowRolloverConfig {
25
+ readonly autoRolloverEnabled: number
26
+ readonly openTermAllowed: number
27
+ readonly migrationToFixedEnabled: number
28
+ readonly fixedTermRolloverWindowDurationDays: number
29
+ readonly maxBorrowRateBps: number
30
+ readonly minDebtTermSeconds: BN
31
+
32
+ constructor(fields: FixedTermBorrowRolloverConfigFields) {
33
+ this.autoRolloverEnabled = fields.autoRolloverEnabled
34
+ this.openTermAllowed = fields.openTermAllowed
35
+ this.migrationToFixedEnabled = fields.migrationToFixedEnabled
36
+ this.fixedTermRolloverWindowDurationDays =
37
+ fields.fixedTermRolloverWindowDurationDays
38
+ this.maxBorrowRateBps = fields.maxBorrowRateBps
39
+ this.minDebtTermSeconds = fields.minDebtTermSeconds
40
+ }
41
+
42
+ static layout(property?: string) {
43
+ return borsh.struct(
44
+ [
45
+ borsh.u8("autoRolloverEnabled"),
46
+ borsh.u8("openTermAllowed"),
47
+ borsh.u8("migrationToFixedEnabled"),
48
+ borsh.u8("fixedTermRolloverWindowDurationDays"),
49
+ borsh.u32("maxBorrowRateBps"),
50
+ borsh.u64("minDebtTermSeconds"),
51
+ ],
52
+ property
53
+ )
54
+ }
55
+
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ static fromDecoded(obj: any) {
58
+ return new FixedTermBorrowRolloverConfig({
59
+ autoRolloverEnabled: obj.autoRolloverEnabled,
60
+ openTermAllowed: obj.openTermAllowed,
61
+ migrationToFixedEnabled: obj.migrationToFixedEnabled,
62
+ fixedTermRolloverWindowDurationDays:
63
+ obj.fixedTermRolloverWindowDurationDays,
64
+ maxBorrowRateBps: obj.maxBorrowRateBps,
65
+ minDebtTermSeconds: obj.minDebtTermSeconds,
66
+ })
67
+ }
68
+
69
+ static toEncodable(fields: FixedTermBorrowRolloverConfigFields) {
70
+ return {
71
+ autoRolloverEnabled: fields.autoRolloverEnabled,
72
+ openTermAllowed: fields.openTermAllowed,
73
+ migrationToFixedEnabled: fields.migrationToFixedEnabled,
74
+ fixedTermRolloverWindowDurationDays:
75
+ fields.fixedTermRolloverWindowDurationDays,
76
+ maxBorrowRateBps: fields.maxBorrowRateBps,
77
+ minDebtTermSeconds: fields.minDebtTermSeconds,
78
+ }
79
+ }
80
+
81
+ toJSON(): FixedTermBorrowRolloverConfigJSON {
82
+ return {
83
+ autoRolloverEnabled: this.autoRolloverEnabled,
84
+ openTermAllowed: this.openTermAllowed,
85
+ migrationToFixedEnabled: this.migrationToFixedEnabled,
86
+ fixedTermRolloverWindowDurationDays:
87
+ this.fixedTermRolloverWindowDurationDays,
88
+ maxBorrowRateBps: this.maxBorrowRateBps,
89
+ minDebtTermSeconds: this.minDebtTermSeconds.toString(),
90
+ }
91
+ }
92
+
93
+ static fromJSON(
94
+ obj: FixedTermBorrowRolloverConfigJSON
95
+ ): FixedTermBorrowRolloverConfig {
96
+ return new FixedTermBorrowRolloverConfig({
97
+ autoRolloverEnabled: obj.autoRolloverEnabled,
98
+ openTermAllowed: obj.openTermAllowed,
99
+ migrationToFixedEnabled: obj.migrationToFixedEnabled,
100
+ fixedTermRolloverWindowDurationDays:
101
+ obj.fixedTermRolloverWindowDurationDays,
102
+ maxBorrowRateBps: obj.maxBorrowRateBps,
103
+ minDebtTermSeconds: new BN(obj.minDebtTermSeconds),
104
+ })
105
+ }
106
+
107
+ toEncodable() {
108
+ return FixedTermBorrowRolloverConfig.toEncodable(this)
109
+ }
110
+ }
@@ -1,3 +1,6 @@
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
1
4
  import * as borsh from "@coral-xyz/borsh"
2
5
 
3
6
  export interface InitObligationArgsFields {
@@ -1,37 +1,49 @@
1
+ import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
1
2
  import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
2
4
  import * as borsh from "@coral-xyz/borsh"
3
5
 
4
6
  export interface LastUpdateFields {
5
7
  slot: BN
6
8
  stale: number
7
9
  priceStatus: number
8
- placeholder: Array<number>
10
+ alignmentPadding: Array<number>
11
+ timestamp: number
9
12
  }
10
13
 
11
14
  export interface LastUpdateJSON {
12
15
  slot: string
13
16
  stale: number
14
17
  priceStatus: number
15
- placeholder: Array<number>
18
+ alignmentPadding: Array<number>
19
+ timestamp: number
16
20
  }
17
21
 
18
22
  export class LastUpdate {
19
23
  readonly slot: BN
20
24
  readonly stale: number
21
25
  readonly priceStatus: number
22
- readonly placeholder: Array<number>
26
+ readonly alignmentPadding: Array<number>
27
+ readonly timestamp: number
23
28
 
24
29
  constructor(fields: LastUpdateFields) {
25
30
  this.slot = fields.slot
26
31
  this.stale = fields.stale
27
32
  this.priceStatus = fields.priceStatus
28
- this.placeholder = fields.placeholder
33
+ this.alignmentPadding = fields.alignmentPadding
34
+ this.timestamp = fields.timestamp
29
35
  }
30
36
 
31
37
  static layout(property?: string) {
32
38
  return borsh.struct(
33
- [borsh.u64("slot"), borsh.u8("stale"), borsh.u8("priceStatus"), borsh.array(borsh.u8(), 6, "placeholder")],
34
- property,
39
+ [
40
+ borsh.u64("slot"),
41
+ borsh.u8("stale"),
42
+ borsh.u8("priceStatus"),
43
+ borsh.array(borsh.u8(), 2, "alignmentPadding"),
44
+ borsh.u32("timestamp"),
45
+ ],
46
+ property
35
47
  )
36
48
  }
37
49
 
@@ -41,7 +53,8 @@ export class LastUpdate {
41
53
  slot: obj.slot,
42
54
  stale: obj.stale,
43
55
  priceStatus: obj.priceStatus,
44
- placeholder: obj.placeholder,
56
+ alignmentPadding: obj.alignmentPadding,
57
+ timestamp: obj.timestamp,
45
58
  })
46
59
  }
47
60
 
@@ -50,7 +63,8 @@ export class LastUpdate {
50
63
  slot: fields.slot,
51
64
  stale: fields.stale,
52
65
  priceStatus: fields.priceStatus,
53
- placeholder: fields.placeholder,
66
+ alignmentPadding: fields.alignmentPadding,
67
+ timestamp: fields.timestamp,
54
68
  }
55
69
  }
56
70
 
@@ -59,7 +73,8 @@ export class LastUpdate {
59
73
  slot: this.slot.toString(),
60
74
  stale: this.stale,
61
75
  priceStatus: this.priceStatus,
62
- placeholder: this.placeholder,
76
+ alignmentPadding: this.alignmentPadding,
77
+ timestamp: this.timestamp,
63
78
  }
64
79
  }
65
80
 
@@ -68,7 +83,8 @@ export class LastUpdate {
68
83
  slot: new BN(obj.slot),
69
84
  stale: obj.stale,
70
85
  priceStatus: obj.priceStatus,
71
- placeholder: obj.placeholder,
86
+ alignmentPadding: obj.alignmentPadding,
87
+ timestamp: obj.timestamp,
72
88
  })
73
89
  }
74
90