@exponent-labs/klend-idl 0.9.0

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 (320) hide show
  1. package/build/accounts/LendingMarket.d.ts +88 -0
  2. package/build/accounts/LendingMarket.js +225 -0
  3. package/build/accounts/LendingMarket.js.map +1 -0
  4. package/build/accounts/Obligation.d.ts +85 -0
  5. package/build/accounts/Obligation.js +217 -0
  6. package/build/accounts/Obligation.js.map +1 -0
  7. package/build/accounts/ReferrerState.d.ts +23 -0
  8. package/build/accounts/ReferrerState.js +85 -0
  9. package/build/accounts/ReferrerState.js.map +1 -0
  10. package/build/accounts/ReferrerTokenState.d.ts +36 -0
  11. package/build/accounts/ReferrerTokenState.js +116 -0
  12. package/build/accounts/ReferrerTokenState.js.map +1 -0
  13. package/build/accounts/Reserve.d.ts +61 -0
  14. package/build/accounts/Reserve.js +169 -0
  15. package/build/accounts/Reserve.js.map +1 -0
  16. package/build/accounts/ShortUrl.d.ts +23 -0
  17. package/build/accounts/ShortUrl.js +85 -0
  18. package/build/accounts/ShortUrl.js.map +1 -0
  19. package/build/accounts/UserMetadata.d.ts +36 -0
  20. package/build/accounts/UserMetadata.js +116 -0
  21. package/build/accounts/UserMetadata.js.map +1 -0
  22. package/build/accounts/UserState.d.ts +69 -0
  23. package/build/accounts/UserState.js +182 -0
  24. package/build/accounts/UserState.js.map +1 -0
  25. package/build/accounts/index.d.ts +16 -0
  26. package/build/accounts/index.js +20 -0
  27. package/build/accounts/index.js.map +1 -0
  28. package/build/errors/anchor.d.ts +434 -0
  29. package/build/errors/anchor.js +767 -0
  30. package/build/errors/anchor.js.map +1 -0
  31. package/build/errors/custom.d.ts +898 -0
  32. package/build/errors/custom.js +1580 -0
  33. package/build/errors/custom.js.map +1 -0
  34. package/build/errors/index.d.ts +5 -0
  35. package/build/errors/index.js +71 -0
  36. package/build/errors/index.js.map +1 -0
  37. package/build/index.d.ts +4 -0
  38. package/build/index.js +34 -0
  39. package/build/index.js.map +1 -0
  40. package/build/instructions/borrowObligationLiquidity.d.ts +21 -0
  41. package/build/instructions/borrowObligationLiquidity.js +80 -0
  42. package/build/instructions/borrowObligationLiquidity.js.map +1 -0
  43. package/build/instructions/borrowObligationLiquidityV2.d.ts +28 -0
  44. package/build/instructions/borrowObligationLiquidityV2.js +90 -0
  45. package/build/instructions/borrowObligationLiquidityV2.js.map +1 -0
  46. package/build/instructions/deleteReferrerStateAndShortUrl.d.ts +9 -0
  47. package/build/instructions/deleteReferrerStateAndShortUrl.js +20 -0
  48. package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -0
  49. package/build/instructions/depositObligationCollateral.d.ts +17 -0
  50. package/build/instructions/depositObligationCollateral.js +64 -0
  51. package/build/instructions/depositObligationCollateral.js.map +1 -0
  52. package/build/instructions/depositReserveLiquidity.d.ts +21 -0
  53. package/build/instructions/depositReserveLiquidity.js +88 -0
  54. package/build/instructions/depositReserveLiquidity.js.map +1 -0
  55. package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +23 -0
  56. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +94 -0
  57. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -0
  58. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +30 -0
  59. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +100 -0
  60. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -0
  61. package/build/instructions/flashBorrowReserveLiquidity.d.ts +21 -0
  62. package/build/instructions/flashBorrowReserveLiquidity.js +80 -0
  63. package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -0
  64. package/build/instructions/flashRepayReserveLiquidity.d.ts +22 -0
  65. package/build/instructions/flashRepayReserveLiquidity.js +77 -0
  66. package/build/instructions/flashRepayReserveLiquidity.js.map +1 -0
  67. package/build/instructions/idlMissingTypes.d.ts +18 -0
  68. package/build/instructions/idlMissingTypes.js +62 -0
  69. package/build/instructions/idlMissingTypes.js.map +1 -0
  70. package/build/instructions/index.d.ts +74 -0
  71. package/build/instructions/index.js +78 -0
  72. package/build/instructions/index.js.map +1 -0
  73. package/build/instructions/initFarmsForReserve.d.ts +18 -0
  74. package/build/instructions/initFarmsForReserve.js +62 -0
  75. package/build/instructions/initFarmsForReserve.js.map +1 -0
  76. package/build/instructions/initLendingMarket.d.ts +13 -0
  77. package/build/instructions/initLendingMarket.js +53 -0
  78. package/build/instructions/initLendingMarket.js.map +1 -0
  79. package/build/instructions/initObligation.d.ts +18 -0
  80. package/build/instructions/initObligation.js +54 -0
  81. package/build/instructions/initObligation.js.map +1 -0
  82. package/build/instructions/initObligationFarmsForReserve.d.ts +19 -0
  83. package/build/instructions/initObligationFarmsForReserve.js +59 -0
  84. package/build/instructions/initObligationFarmsForReserve.js.map +1 -0
  85. package/build/instructions/initReferrerStateAndShortUrl.d.ts +14 -0
  86. package/build/instructions/initReferrerStateAndShortUrl.js +54 -0
  87. package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -0
  88. package/build/instructions/initReferrerTokenState.d.ts +14 -0
  89. package/build/instructions/initReferrerTokenState.js +50 -0
  90. package/build/instructions/initReferrerTokenState.js.map +1 -0
  91. package/build/instructions/initReserve.d.ts +17 -0
  92. package/build/instructions/initReserve.js +56 -0
  93. package/build/instructions/initReserve.js.map +1 -0
  94. package/build/instructions/initUserMetadata.d.ts +14 -0
  95. package/build/instructions/initUserMetadata.js +54 -0
  96. package/build/instructions/initUserMetadata.js.map +1 -0
  97. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +31 -0
  98. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +126 -0
  99. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -0
  100. package/build/instructions/redeemFees.d.ts +11 -0
  101. package/build/instructions/redeemFees.js +38 -0
  102. package/build/instructions/redeemFees.js.map +1 -0
  103. package/build/instructions/redeemReserveCollateral.d.ts +21 -0
  104. package/build/instructions/redeemReserveCollateral.js +92 -0
  105. package/build/instructions/redeemReserveCollateral.js.map +1 -0
  106. package/build/instructions/refreshObligation.d.ts +6 -0
  107. package/build/instructions/refreshObligation.js +17 -0
  108. package/build/instructions/refreshObligation.js.map +1 -0
  109. package/build/instructions/refreshObligationFarmsForReserve.d.ts +18 -0
  110. package/build/instructions/refreshObligationFarmsForReserve.js +62 -0
  111. package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -0
  112. package/build/instructions/refreshReserve.d.ts +10 -0
  113. package/build/instructions/refreshReserve.js +29 -0
  114. package/build/instructions/refreshReserve.js.map +1 -0
  115. package/build/instructions/refreshReservesBatch.d.ts +6 -0
  116. package/build/instructions/refreshReservesBatch.js +43 -0
  117. package/build/instructions/refreshReservesBatch.js.map +1 -0
  118. package/build/instructions/repayObligationLiquidity.d.ts +18 -0
  119. package/build/instructions/repayObligationLiquidity.js +65 -0
  120. package/build/instructions/repayObligationLiquidity.js.map +1 -0
  121. package/build/instructions/repayObligationLiquidityV2.d.ts +26 -0
  122. package/build/instructions/repayObligationLiquidityV2.js +76 -0
  123. package/build/instructions/repayObligationLiquidityV2.js.map +1 -0
  124. package/build/instructions/requestElevationGroup.d.ts +11 -0
  125. package/build/instructions/requestElevationGroup.js +47 -0
  126. package/build/instructions/requestElevationGroup.js.map +1 -0
  127. package/build/instructions/socializeLoss.d.ts +14 -0
  128. package/build/instructions/socializeLoss.js +53 -0
  129. package/build/instructions/socializeLoss.js.map +1 -0
  130. package/build/instructions/updateLendingMarket.d.ts +12 -0
  131. package/build/instructions/updateLendingMarket.js +47 -0
  132. package/build/instructions/updateLendingMarket.js.map +1 -0
  133. package/build/instructions/updateLendingMarketOwner.d.ts +6 -0
  134. package/build/instructions/updateLendingMarketOwner.js +21 -0
  135. package/build/instructions/updateLendingMarketOwner.js.map +1 -0
  136. package/build/instructions/updateReserveConfig.d.ts +14 -0
  137. package/build/instructions/updateReserveConfig.js +49 -0
  138. package/build/instructions/updateReserveConfig.js.map +1 -0
  139. package/build/instructions/withdrawObligationCollateral.d.ts +18 -0
  140. package/build/instructions/withdrawObligationCollateral.js +69 -0
  141. package/build/instructions/withdrawObligationCollateral.js.map +1 -0
  142. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +23 -0
  143. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +98 -0
  144. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -0
  145. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +30 -0
  146. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +104 -0
  147. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -0
  148. package/build/instructions/withdrawProtocolFee.d.ts +17 -0
  149. package/build/instructions/withdrawProtocolFee.js +64 -0
  150. package/build/instructions/withdrawProtocolFee.js.map +1 -0
  151. package/build/instructions/withdrawReferrerFees.d.ts +13 -0
  152. package/build/instructions/withdrawReferrerFees.js +40 -0
  153. package/build/instructions/withdrawReferrerFees.js.map +1 -0
  154. package/build/kamino_lending.d.ts +3937 -0
  155. package/build/kamino_lending.js +3940 -0
  156. package/build/kamino_lending.js.map +1 -0
  157. package/build/kamino_lending.json +6352 -0
  158. package/build/programId.d.ts +3 -0
  159. package/build/programId.js +9 -0
  160. package/build/programId.js.map +1 -0
  161. package/build/types/AssetTier.d.ts +44 -0
  162. package/build/types/AssetTier.js +122 -0
  163. package/build/types/AssetTier.js.map +1 -0
  164. package/build/types/BigFractionBytes.d.ts +26 -0
  165. package/build/types/BigFractionBytes.js +72 -0
  166. package/build/types/BigFractionBytes.js.map +1 -0
  167. package/build/types/BorrowRateCurve.d.ts +27 -0
  168. package/build/types/BorrowRateCurve.js +63 -0
  169. package/build/types/BorrowRateCurve.js.map +1 -0
  170. package/build/types/CurvePoint.d.ts +25 -0
  171. package/build/types/CurvePoint.js +68 -0
  172. package/build/types/CurvePoint.js.map +1 -0
  173. package/build/types/ElevationGroup.d.ts +62 -0
  174. package/build/types/ElevationGroup.js +125 -0
  175. package/build/types/ElevationGroup.js.map +1 -0
  176. package/build/types/FeeCalculation.d.ts +31 -0
  177. package/build/types/FeeCalculation.js +95 -0
  178. package/build/types/FeeCalculation.js.map +1 -0
  179. package/build/types/InitObligationArgs.d.ts +25 -0
  180. package/build/types/InitObligationArgs.js +68 -0
  181. package/build/types/InitObligationArgs.js.map +1 -0
  182. package/build/types/LastUpdate.d.ts +36 -0
  183. package/build/types/LastUpdate.js +84 -0
  184. package/build/types/LastUpdate.js.map +1 -0
  185. package/build/types/ObligationCollateral.d.ts +43 -0
  186. package/build/types/ObligationCollateral.js +98 -0
  187. package/build/types/ObligationCollateral.js.map +1 -0
  188. package/build/types/ObligationLiquidity.d.ts +64 -0
  189. package/build/types/ObligationLiquidity.js +123 -0
  190. package/build/types/ObligationLiquidity.js.map +1 -0
  191. package/build/types/PriceHeuristic.d.ts +32 -0
  192. package/build/types/PriceHeuristic.js +78 -0
  193. package/build/types/PriceHeuristic.js.map +1 -0
  194. package/build/types/PythConfiguration.d.ts +22 -0
  195. package/build/types/PythConfiguration.js +63 -0
  196. package/build/types/PythConfiguration.js.map +1 -0
  197. package/build/types/ReserveCollateral.d.ts +43 -0
  198. package/build/types/ReserveCollateral.js +97 -0
  199. package/build/types/ReserveCollateral.js.map +1 -0
  200. package/build/types/ReserveConfig.d.ts +246 -0
  201. package/build/types/ReserveConfig.js +269 -0
  202. package/build/types/ReserveConfig.js.map +1 -0
  203. package/build/types/ReserveFarmKind.d.ts +31 -0
  204. package/build/types/ReserveFarmKind.js +98 -0
  205. package/build/types/ReserveFarmKind.js.map +1 -0
  206. package/build/types/ReserveFees.d.ts +32 -0
  207. package/build/types/ReserveFees.js +82 -0
  208. package/build/types/ReserveFees.js.map +1 -0
  209. package/build/types/ReserveLiquidity.d.ts +114 -0
  210. package/build/types/ReserveLiquidity.js +191 -0
  211. package/build/types/ReserveLiquidity.js.map +1 -0
  212. package/build/types/ReserveStatus.d.ts +44 -0
  213. package/build/types/ReserveStatus.js +122 -0
  214. package/build/types/ReserveStatus.js.map +1 -0
  215. package/build/types/ScopeConfiguration.d.ts +32 -0
  216. package/build/types/ScopeConfiguration.js +79 -0
  217. package/build/types/ScopeConfiguration.js.map +1 -0
  218. package/build/types/SwitchboardConfiguration.d.ts +27 -0
  219. package/build/types/SwitchboardConfiguration.js +69 -0
  220. package/build/types/SwitchboardConfiguration.js.map +1 -0
  221. package/build/types/TokenInfo.d.ts +99 -0
  222. package/build/types/TokenInfo.js +145 -0
  223. package/build/types/TokenInfo.js.map +1 -0
  224. package/build/types/UpdateConfigMode.d.ts +616 -0
  225. package/build/types/UpdateConfigMode.js +1178 -0
  226. package/build/types/UpdateConfigMode.js.map +1 -0
  227. package/build/types/UpdateLendingMarketConfigValue.d.ts +177 -0
  228. package/build/types/UpdateLendingMarketConfigValue.js +312 -0
  229. package/build/types/UpdateLendingMarketConfigValue.js.map +1 -0
  230. package/build/types/UpdateLendingMarketMode.d.ts +239 -0
  231. package/build/types/UpdateLendingMarketMode.js +482 -0
  232. package/build/types/UpdateLendingMarketMode.js.map +1 -0
  233. package/build/types/WithdrawalCaps.d.ts +37 -0
  234. package/build/types/WithdrawalCaps.js +89 -0
  235. package/build/types/WithdrawalCaps.js.map +1 -0
  236. package/build/types/index.d.ts +64 -0
  237. package/build/types/index.js +77 -0
  238. package/build/types/index.js.map +1 -0
  239. package/package.json +44 -0
  240. package/src/accounts/LendingMarket.ts +292 -0
  241. package/src/accounts/Obligation.ts +282 -0
  242. package/src/accounts/ReferrerState.ts +90 -0
  243. package/src/accounts/ReferrerTokenState.ts +126 -0
  244. package/src/accounts/Reserve.ts +218 -0
  245. package/src/accounts/ShortUrl.ts +86 -0
  246. package/src/accounts/UserMetadata.ts +126 -0
  247. package/src/accounts/UserState.ts +210 -0
  248. package/src/accounts/index.ts +19 -0
  249. package/src/errors/anchor.ts +773 -0
  250. package/src/errors/custom.ts +1633 -0
  251. package/src/errors/index.ts +62 -0
  252. package/src/index.ts +5 -0
  253. package/src/instructions/borrowObligationLiquidity.ts +81 -0
  254. package/src/instructions/borrowObligationLiquidityV2.ts +103 -0
  255. package/src/instructions/deleteReferrerStateAndShortUrl.ts +27 -0
  256. package/src/instructions/depositObligationCollateral.ts +61 -0
  257. package/src/instructions/depositReserveLiquidity.ts +89 -0
  258. package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +97 -0
  259. package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +119 -0
  260. package/src/instructions/flashBorrowReserveLiquidity.ts +81 -0
  261. package/src/instructions/flashRepayReserveLiquidity.ts +79 -0
  262. package/src/instructions/idlMissingTypes.ts +59 -0
  263. package/src/instructions/index.ts +158 -0
  264. package/src/instructions/initFarmsForReserve.ts +60 -0
  265. package/src/instructions/initLendingMarket.ts +46 -0
  266. package/src/instructions/initObligation.ts +51 -0
  267. package/src/instructions/initObligationFarmsForReserve.ts +58 -0
  268. package/src/instructions/initReferrerStateAndShortUrl.ts +48 -0
  269. package/src/instructions/initReferrerTokenState.ts +44 -0
  270. package/src/instructions/initReserve.ts +68 -0
  271. package/src/instructions/initUserMetadata.ts +48 -0
  272. package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +137 -0
  273. package/src/instructions/redeemFees.ts +44 -0
  274. package/src/instructions/redeemReserveCollateral.ts +93 -0
  275. package/src/instructions/refreshObligation.ts +18 -0
  276. package/src/instructions/refreshObligationFarmsForReserve.ts +60 -0
  277. package/src/instructions/refreshReserve.ts +34 -0
  278. package/src/instructions/refreshReservesBatch.ts +24 -0
  279. package/src/instructions/repayObligationLiquidity.ts +63 -0
  280. package/src/instructions/repayObligationLiquidityV2.ts +87 -0
  281. package/src/instructions/requestElevationGroup.ts +38 -0
  282. package/src/instructions/socializeLoss.ts +47 -0
  283. package/src/instructions/updateLendingMarket.ts +39 -0
  284. package/src/instructions/updateLendingMarketOwner.ts +25 -0
  285. package/src/instructions/updateReserveConfig.ts +43 -0
  286. package/src/instructions/withdrawObligationCollateral.ts +67 -0
  287. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +101 -0
  288. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +123 -0
  289. package/src/instructions/withdrawProtocolFee.ts +61 -0
  290. package/src/instructions/withdrawReferrerFees.ts +48 -0
  291. package/src/kamino_lending.json +6352 -0
  292. package/src/kamino_lending.ts +7873 -0
  293. package/src/programId.ts +9 -0
  294. package/src/types/AssetTier.ts +116 -0
  295. package/src/types/BigFractionBytes.ts +59 -0
  296. package/src/types/BorrowRateCurve.ts +53 -0
  297. package/src/types/CurvePoint.ts +58 -0
  298. package/src/types/ElevationGroup.ts +129 -0
  299. package/src/types/FeeCalculation.ts +83 -0
  300. package/src/types/InitObligationArgs.ts +58 -0
  301. package/src/types/LastUpdate.ts +78 -0
  302. package/src/types/ObligationCollateral.ts +100 -0
  303. package/src/types/ObligationLiquidity.ts +140 -0
  304. package/src/types/PriceHeuristic.ts +72 -0
  305. package/src/types/PythConfiguration.ts +53 -0
  306. package/src/types/ReserveCollateral.ts +94 -0
  307. package/src/types/ReserveConfig.ts +349 -0
  308. package/src/types/ReserveFarmKind.ts +90 -0
  309. package/src/types/ReserveFees.ts +76 -0
  310. package/src/types/ReserveLiquidity.ts +219 -0
  311. package/src/types/ReserveStatus.ts +120 -0
  312. package/src/types/ScopeConfiguration.ts +76 -0
  313. package/src/types/SwitchboardConfiguration.ts +64 -0
  314. package/src/types/TokenInfo.ts +172 -0
  315. package/src/types/UpdateConfigMode.ts +1440 -0
  316. package/src/types/UpdateLendingMarketConfigValue.ts +376 -0
  317. package/src/types/UpdateLendingMarketMode.ts +570 -0
  318. package/src/types/WithdrawalCaps.ts +85 -0
  319. package/src/types/index.ts +275 -0
  320. package/tsconfig.json +17 -0
@@ -0,0 +1,64 @@
1
+ import * as UpdateConfigMode from "./UpdateConfigMode";
2
+ import * as UpdateLendingMarketConfigValue from "./UpdateLendingMarketConfigValue";
3
+ import * as UpdateLendingMarketMode from "./UpdateLendingMarketMode";
4
+ import * as AssetTier from "./AssetTier";
5
+ import * as FeeCalculation from "./FeeCalculation";
6
+ import * as ReserveFarmKind from "./ReserveFarmKind";
7
+ import * as ReserveStatus from "./ReserveStatus";
8
+ export { UpdateConfigMode };
9
+ export type UpdateConfigModeKind = UpdateConfigMode.UpdateLoanToValuePct | UpdateConfigMode.UpdateMaxLiquidationBonusBps | UpdateConfigMode.UpdateLiquidationThresholdPct | UpdateConfigMode.UpdateProtocolLiquidationFee | UpdateConfigMode.UpdateProtocolTakeRate | UpdateConfigMode.UpdateFeesBorrowFee | UpdateConfigMode.UpdateFeesFlashLoanFee | UpdateConfigMode.UpdateFeesReferralFeeBps | UpdateConfigMode.UpdateDepositLimit | UpdateConfigMode.UpdateBorrowLimit | UpdateConfigMode.UpdateTokenInfoLowerHeuristic | UpdateConfigMode.UpdateTokenInfoUpperHeuristic | UpdateConfigMode.UpdateTokenInfoExpHeuristic | UpdateConfigMode.UpdateTokenInfoTwapDivergence | UpdateConfigMode.UpdateTokenInfoScopeTwap | UpdateConfigMode.UpdateTokenInfoScopeChain | UpdateConfigMode.UpdateTokenInfoName | UpdateConfigMode.UpdateTokenInfoPriceMaxAge | UpdateConfigMode.UpdateTokenInfoTwapMaxAge | UpdateConfigMode.UpdateScopePriceFeed | UpdateConfigMode.UpdatePythPrice | UpdateConfigMode.UpdateSwitchboardFeed | UpdateConfigMode.UpdateSwitchboardTwapFeed | UpdateConfigMode.UpdateBorrowRateCurve | UpdateConfigMode.UpdateEntireReserveConfig | UpdateConfigMode.UpdateDebtWithdrawalCap | UpdateConfigMode.UpdateDepositWithdrawalCap | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateBadDebtLiquidationBonusBps | UpdateConfigMode.UpdateMinLiquidationBonusBps | UpdateConfigMode.DeleveragingMarginCallPeriod | UpdateConfigMode.UpdateBorrowFactor | UpdateConfigMode.UpdateAssetTier | UpdateConfigMode.UpdateElevationGroup | UpdateConfigMode.DeleveragingThresholdSlotsPerBps | UpdateConfigMode.DeprecatedUpdateMultiplierSideBoost | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoost | UpdateConfigMode.UpdateReserveStatus | UpdateConfigMode.UpdateFarmCollateral | UpdateConfigMode.UpdateFarmDebt | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode | UpdateConfigMode.UpdateBlockBorrowingAboveUtilization | UpdateConfigMode.UpdateBlockPriceUsage | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroup | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserve | UpdateConfigMode.UpdateHostFixedInterestRateBps;
10
+ export type UpdateConfigModeJSON = UpdateConfigMode.UpdateLoanToValuePctJSON | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON | UpdateConfigMode.UpdateLiquidationThresholdPctJSON | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON | UpdateConfigMode.UpdateProtocolTakeRateJSON | UpdateConfigMode.UpdateFeesBorrowFeeJSON | UpdateConfigMode.UpdateFeesFlashLoanFeeJSON | UpdateConfigMode.UpdateFeesReferralFeeBpsJSON | UpdateConfigMode.UpdateDepositLimitJSON | UpdateConfigMode.UpdateBorrowLimitJSON | UpdateConfigMode.UpdateTokenInfoLowerHeuristicJSON | UpdateConfigMode.UpdateTokenInfoUpperHeuristicJSON | UpdateConfigMode.UpdateTokenInfoExpHeuristicJSON | UpdateConfigMode.UpdateTokenInfoTwapDivergenceJSON | UpdateConfigMode.UpdateTokenInfoScopeTwapJSON | UpdateConfigMode.UpdateTokenInfoScopeChainJSON | UpdateConfigMode.UpdateTokenInfoNameJSON | UpdateConfigMode.UpdateTokenInfoPriceMaxAgeJSON | UpdateConfigMode.UpdateTokenInfoTwapMaxAgeJSON | UpdateConfigMode.UpdateScopePriceFeedJSON | UpdateConfigMode.UpdatePythPriceJSON | UpdateConfigMode.UpdateSwitchboardFeedJSON | UpdateConfigMode.UpdateSwitchboardTwapFeedJSON | UpdateConfigMode.UpdateBorrowRateCurveJSON | UpdateConfigMode.UpdateEntireReserveConfigJSON | UpdateConfigMode.UpdateDebtWithdrawalCapJSON | UpdateConfigMode.UpdateDepositWithdrawalCapJSON | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateBadDebtLiquidationBonusBpsJSON | UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON | UpdateConfigMode.DeleveragingMarginCallPeriodJSON | UpdateConfigMode.UpdateBorrowFactorJSON | UpdateConfigMode.UpdateAssetTierJSON | UpdateConfigMode.UpdateElevationGroupJSON | UpdateConfigMode.DeleveragingThresholdSlotsPerBpsJSON | UpdateConfigMode.DeprecatedUpdateMultiplierSideBoostJSON | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoostJSON | UpdateConfigMode.UpdateReserveStatusJSON | UpdateConfigMode.UpdateFarmCollateralJSON | UpdateConfigMode.UpdateFarmDebtJSON | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmodeJSON | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationJSON | UpdateConfigMode.UpdateBlockPriceUsageJSON | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroupJSON | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserveJSON | UpdateConfigMode.UpdateHostFixedInterestRateBpsJSON;
11
+ export { UpdateLendingMarketConfigValue };
12
+ export type UpdateLendingMarketConfigValueKind = UpdateLendingMarketConfigValue.Bool | UpdateLendingMarketConfigValue.U8 | UpdateLendingMarketConfigValue.U8Array | UpdateLendingMarketConfigValue.U16 | UpdateLendingMarketConfigValue.U64 | UpdateLendingMarketConfigValue.U128 | UpdateLendingMarketConfigValue.Pubkey | UpdateLendingMarketConfigValue.ElevationGroup;
13
+ export type UpdateLendingMarketConfigValueJSON = UpdateLendingMarketConfigValue.BoolJSON | UpdateLendingMarketConfigValue.U8JSON | UpdateLendingMarketConfigValue.U8ArrayJSON | UpdateLendingMarketConfigValue.U16JSON | UpdateLendingMarketConfigValue.U64JSON | UpdateLendingMarketConfigValue.U128JSON | UpdateLendingMarketConfigValue.PubkeyJSON | UpdateLendingMarketConfigValue.ElevationGroupJSON;
14
+ export { UpdateLendingMarketMode };
15
+ export type UpdateLendingMarketModeKind = UpdateLendingMarketMode.UpdateOwner | UpdateLendingMarketMode.UpdateEmergencyMode | UpdateLendingMarketMode.UpdateLiquidationCloseFactor | UpdateLendingMarketMode.UpdateLiquidationMaxValue | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrow | UpdateLendingMarketMode.UpdateGlobalAllowedBorrow | UpdateLendingMarketMode.UpdateRiskCouncil | UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold | UpdateLendingMarketMode.UpdateInsolvencyRiskLtv | UpdateLendingMarketMode.UpdateElevationGroup | UpdateLendingMarketMode.UpdateReferralFeeBps | UpdateLendingMarketMode.DeprecatedUpdateMultiplierPoints | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct | UpdateLendingMarketMode.UpdateAutodeleverageEnabled | UpdateLendingMarketMode.UpdateBorrowingDisabled | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheck | UpdateLendingMarketMode.UpdatePaddingFields;
16
+ export type UpdateLendingMarketModeJSON = UpdateLendingMarketMode.UpdateOwnerJSON | UpdateLendingMarketMode.UpdateEmergencyModeJSON | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrowJSON | UpdateLendingMarketMode.UpdateGlobalAllowedBorrowJSON | UpdateLendingMarketMode.UpdateRiskCouncilJSON | UpdateLendingMarketMode.UpdateMinFullLiquidationThresholdJSON | UpdateLendingMarketMode.UpdateInsolvencyRiskLtvJSON | UpdateLendingMarketMode.UpdateElevationGroupJSON | UpdateLendingMarketMode.UpdateReferralFeeBpsJSON | UpdateLendingMarketMode.DeprecatedUpdateMultiplierPointsJSON | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheckJSON | UpdateLendingMarketMode.UpdatePaddingFieldsJSON;
17
+ export { LastUpdate } from "./LastUpdate";
18
+ export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate";
19
+ export { ElevationGroup } from "./ElevationGroup";
20
+ export type { ElevationGroupFields, ElevationGroupJSON } from "./ElevationGroup";
21
+ export { InitObligationArgs } from "./InitObligationArgs";
22
+ export type { InitObligationArgsFields, InitObligationArgsJSON, } from "./InitObligationArgs";
23
+ export { ObligationCollateral } from "./ObligationCollateral";
24
+ export type { ObligationCollateralFields, ObligationCollateralJSON, } from "./ObligationCollateral";
25
+ export { ObligationLiquidity } from "./ObligationLiquidity";
26
+ export type { ObligationLiquidityFields, ObligationLiquidityJSON, } from "./ObligationLiquidity";
27
+ export { AssetTier };
28
+ export type AssetTierKind = AssetTier.Regular | AssetTier.IsolatedCollateral | AssetTier.IsolatedDebt;
29
+ export type AssetTierJSON = AssetTier.RegularJSON | AssetTier.IsolatedCollateralJSON | AssetTier.IsolatedDebtJSON;
30
+ export { BigFractionBytes } from "./BigFractionBytes";
31
+ export type { BigFractionBytesFields, BigFractionBytesJSON, } from "./BigFractionBytes";
32
+ export { FeeCalculation };
33
+ export type FeeCalculationKind = FeeCalculation.Exclusive | FeeCalculation.Inclusive;
34
+ export type FeeCalculationJSON = FeeCalculation.ExclusiveJSON | FeeCalculation.InclusiveJSON;
35
+ export { ReserveCollateral } from "./ReserveCollateral";
36
+ export type { ReserveCollateralFields, ReserveCollateralJSON, } from "./ReserveCollateral";
37
+ export { ReserveConfig } from "./ReserveConfig";
38
+ export type { ReserveConfigFields, ReserveConfigJSON } from "./ReserveConfig";
39
+ export { ReserveFarmKind };
40
+ export type ReserveFarmKindKind = ReserveFarmKind.Collateral | ReserveFarmKind.Debt;
41
+ export type ReserveFarmKindJSON = ReserveFarmKind.CollateralJSON | ReserveFarmKind.DebtJSON;
42
+ export { ReserveFees } from "./ReserveFees";
43
+ export type { ReserveFeesFields, ReserveFeesJSON } from "./ReserveFees";
44
+ export { ReserveLiquidity } from "./ReserveLiquidity";
45
+ export type { ReserveLiquidityFields, ReserveLiquidityJSON, } from "./ReserveLiquidity";
46
+ export { ReserveStatus };
47
+ export type ReserveStatusKind = ReserveStatus.Active | ReserveStatus.Obsolete | ReserveStatus.Hidden;
48
+ export type ReserveStatusJSON = ReserveStatus.ActiveJSON | ReserveStatus.ObsoleteJSON | ReserveStatus.HiddenJSON;
49
+ export { WithdrawalCaps } from "./WithdrawalCaps";
50
+ export type { WithdrawalCapsFields, WithdrawalCapsJSON } from "./WithdrawalCaps";
51
+ export { PriceHeuristic } from "./PriceHeuristic";
52
+ export type { PriceHeuristicFields, PriceHeuristicJSON } from "./PriceHeuristic";
53
+ export { PythConfiguration } from "./PythConfiguration";
54
+ export type { PythConfigurationFields, PythConfigurationJSON, } from "./PythConfiguration";
55
+ export { ScopeConfiguration } from "./ScopeConfiguration";
56
+ export type { ScopeConfigurationFields, ScopeConfigurationJSON, } from "./ScopeConfiguration";
57
+ export { SwitchboardConfiguration } from "./SwitchboardConfiguration";
58
+ export type { SwitchboardConfigurationFields, SwitchboardConfigurationJSON, } from "./SwitchboardConfiguration";
59
+ export { TokenInfo } from "./TokenInfo";
60
+ export type { TokenInfoFields, TokenInfoJSON } from "./TokenInfo";
61
+ export { BorrowRateCurve } from "./BorrowRateCurve";
62
+ export type { BorrowRateCurveFields, BorrowRateCurveJSON, } from "./BorrowRateCurve";
63
+ export { CurvePoint } from "./CurvePoint";
64
+ export type { CurvePointFields, CurvePointJSON } from "./CurvePoint";
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.CurvePoint = exports.BorrowRateCurve = exports.TokenInfo = exports.SwitchboardConfiguration = exports.ScopeConfiguration = exports.PythConfiguration = exports.PriceHeuristic = exports.WithdrawalCaps = exports.ReserveStatus = exports.ReserveLiquidity = exports.ReserveFees = exports.ReserveFarmKind = exports.ReserveConfig = exports.ReserveCollateral = exports.FeeCalculation = exports.BigFractionBytes = exports.AssetTier = exports.ObligationLiquidity = exports.ObligationCollateral = exports.InitObligationArgs = exports.ElevationGroup = exports.LastUpdate = exports.UpdateLendingMarketMode = exports.UpdateLendingMarketConfigValue = exports.UpdateConfigMode = void 0;
27
+ const UpdateConfigMode = __importStar(require("./UpdateConfigMode"));
28
+ exports.UpdateConfigMode = UpdateConfigMode;
29
+ const UpdateLendingMarketConfigValue = __importStar(require("./UpdateLendingMarketConfigValue"));
30
+ exports.UpdateLendingMarketConfigValue = UpdateLendingMarketConfigValue;
31
+ const UpdateLendingMarketMode = __importStar(require("./UpdateLendingMarketMode"));
32
+ exports.UpdateLendingMarketMode = UpdateLendingMarketMode;
33
+ const AssetTier = __importStar(require("./AssetTier"));
34
+ exports.AssetTier = AssetTier;
35
+ const FeeCalculation = __importStar(require("./FeeCalculation"));
36
+ exports.FeeCalculation = FeeCalculation;
37
+ const ReserveFarmKind = __importStar(require("./ReserveFarmKind"));
38
+ exports.ReserveFarmKind = ReserveFarmKind;
39
+ const ReserveStatus = __importStar(require("./ReserveStatus"));
40
+ exports.ReserveStatus = ReserveStatus;
41
+ var LastUpdate_1 = require("./LastUpdate");
42
+ Object.defineProperty(exports, "LastUpdate", { enumerable: true, get: function () { return LastUpdate_1.LastUpdate; } });
43
+ var ElevationGroup_1 = require("./ElevationGroup");
44
+ Object.defineProperty(exports, "ElevationGroup", { enumerable: true, get: function () { return ElevationGroup_1.ElevationGroup; } });
45
+ var InitObligationArgs_1 = require("./InitObligationArgs");
46
+ Object.defineProperty(exports, "InitObligationArgs", { enumerable: true, get: function () { return InitObligationArgs_1.InitObligationArgs; } });
47
+ var ObligationCollateral_1 = require("./ObligationCollateral");
48
+ Object.defineProperty(exports, "ObligationCollateral", { enumerable: true, get: function () { return ObligationCollateral_1.ObligationCollateral; } });
49
+ var ObligationLiquidity_1 = require("./ObligationLiquidity");
50
+ Object.defineProperty(exports, "ObligationLiquidity", { enumerable: true, get: function () { return ObligationLiquidity_1.ObligationLiquidity; } });
51
+ var BigFractionBytes_1 = require("./BigFractionBytes");
52
+ Object.defineProperty(exports, "BigFractionBytes", { enumerable: true, get: function () { return BigFractionBytes_1.BigFractionBytes; } });
53
+ var ReserveCollateral_1 = require("./ReserveCollateral");
54
+ Object.defineProperty(exports, "ReserveCollateral", { enumerable: true, get: function () { return ReserveCollateral_1.ReserveCollateral; } });
55
+ var ReserveConfig_1 = require("./ReserveConfig");
56
+ Object.defineProperty(exports, "ReserveConfig", { enumerable: true, get: function () { return ReserveConfig_1.ReserveConfig; } });
57
+ var ReserveFees_1 = require("./ReserveFees");
58
+ Object.defineProperty(exports, "ReserveFees", { enumerable: true, get: function () { return ReserveFees_1.ReserveFees; } });
59
+ var ReserveLiquidity_1 = require("./ReserveLiquidity");
60
+ Object.defineProperty(exports, "ReserveLiquidity", { enumerable: true, get: function () { return ReserveLiquidity_1.ReserveLiquidity; } });
61
+ var WithdrawalCaps_1 = require("./WithdrawalCaps");
62
+ Object.defineProperty(exports, "WithdrawalCaps", { enumerable: true, get: function () { return WithdrawalCaps_1.WithdrawalCaps; } });
63
+ var PriceHeuristic_1 = require("./PriceHeuristic");
64
+ Object.defineProperty(exports, "PriceHeuristic", { enumerable: true, get: function () { return PriceHeuristic_1.PriceHeuristic; } });
65
+ var PythConfiguration_1 = require("./PythConfiguration");
66
+ Object.defineProperty(exports, "PythConfiguration", { enumerable: true, get: function () { return PythConfiguration_1.PythConfiguration; } });
67
+ var ScopeConfiguration_1 = require("./ScopeConfiguration");
68
+ Object.defineProperty(exports, "ScopeConfiguration", { enumerable: true, get: function () { return ScopeConfiguration_1.ScopeConfiguration; } });
69
+ var SwitchboardConfiguration_1 = require("./SwitchboardConfiguration");
70
+ Object.defineProperty(exports, "SwitchboardConfiguration", { enumerable: true, get: function () { return SwitchboardConfiguration_1.SwitchboardConfiguration; } });
71
+ var TokenInfo_1 = require("./TokenInfo");
72
+ Object.defineProperty(exports, "TokenInfo", { enumerable: true, get: function () { return TokenInfo_1.TokenInfo; } });
73
+ var BorrowRateCurve_1 = require("./BorrowRateCurve");
74
+ Object.defineProperty(exports, "BorrowRateCurve", { enumerable: true, get: function () { return BorrowRateCurve_1.BorrowRateCurve; } });
75
+ var CurvePoint_1 = require("./CurvePoint");
76
+ Object.defineProperty(exports, "CurvePoint", { enumerable: true, get: function () { return CurvePoint_1.CurvePoint; } });
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAsD;AAQ7C,4CAAgB;AAPzB,iGAAkF;AA0GzE,wEAA8B;AAzGvC,mFAAoE;AA8H3D,0DAAuB;AA7HhC,uDAAwC;AAyL/B,8BAAS;AAxLlB,iEAAkD;AAwMzC,wCAAc;AAvMvB,mEAAoD;AAuN3C,0CAAe;AAtNxB,+DAAgD;AAsOvC,sCAAa;AAnEtB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAK7B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAgB5B,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAczB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAK1B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAWtB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AAEpB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAgBzB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAK1B,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AAKjC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AAKxB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@exponent-labs/klend-idl",
3
+ "version": "0.9.0",
4
+ "main": "build/index.js",
5
+ "types": "build/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./build/index.d.ts",
9
+ "default": "./build/index.js"
10
+ },
11
+ "./instructions": {
12
+ "types": "./build/instructions/index.d.ts",
13
+ "default": "./build/instructions/index.js"
14
+ },
15
+ "./accounts": {
16
+ "types": "./build/accounts/index.d.ts",
17
+ "default": "./build/accounts/index.js"
18
+ },
19
+ "./types": {
20
+ "types": "./build/types/index.d.ts",
21
+ "default": "./build/types/index.js"
22
+ }
23
+ },
24
+ "typesVersions": {
25
+ "*": {
26
+ "instructions": ["./build/instructions/index.d.ts"],
27
+ "accounts": ["./build/accounts/index.d.ts"],
28
+ "types": ["./build/types/index.d.ts"]
29
+ }
30
+ },
31
+ "license": "AGPL-3.0",
32
+ "scripts": {
33
+ "build": "tsc --build",
34
+ "gen": "anchor-client-gen ./src/kamino_lending.json ./src --program-id=KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
35
+ },
36
+ "dependencies": {
37
+ "@coral-xyz/borsh": "^0.28.0",
38
+ "@solana/web3.js": "1.95.8",
39
+ "bn.js": "^5.2.1"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "5.4.5"
43
+ }
44
+ }
@@ -0,0 +1,292 @@
1
+ import { PublicKey, Connection } from "@solana/web3.js"
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 LendingMarketFields {
8
+ version: BN
9
+ bumpSeed: BN
10
+ lendingMarketOwner: PublicKey
11
+ lendingMarketOwnerCached: PublicKey
12
+ quoteCurrency: Array<number>
13
+ referralFeeBps: number
14
+ emergencyMode: number
15
+ autodeleverageEnabled: number
16
+ borrowDisabled: number
17
+ priceRefreshTriggerToMaxAgePct: number
18
+ liquidationMaxDebtCloseFactorPct: number
19
+ insolvencyRiskUnhealthyLtvPct: number
20
+ minFullLiquidationValueThreshold: BN
21
+ maxLiquidatableDebtMarketValueAtOnce: BN
22
+ globalUnhealthyBorrowValue: BN
23
+ globalAllowedBorrowValue: BN
24
+ riskCouncil: PublicKey
25
+ reserved1: Array<number>
26
+ elevationGroups: Array<types.ElevationGroupFields>
27
+ elevationGroupPadding: Array<BN>
28
+ minNetValueInObligationSf: BN
29
+ minValueSkipLiquidationLtvBfChecks: BN
30
+ padding1: Array<BN>
31
+ }
32
+
33
+ export interface LendingMarketJSON {
34
+ version: string
35
+ bumpSeed: string
36
+ lendingMarketOwner: string
37
+ lendingMarketOwnerCached: string
38
+ quoteCurrency: Array<number>
39
+ referralFeeBps: number
40
+ emergencyMode: number
41
+ autodeleverageEnabled: number
42
+ borrowDisabled: number
43
+ priceRefreshTriggerToMaxAgePct: number
44
+ liquidationMaxDebtCloseFactorPct: number
45
+ insolvencyRiskUnhealthyLtvPct: number
46
+ minFullLiquidationValueThreshold: string
47
+ maxLiquidatableDebtMarketValueAtOnce: string
48
+ globalUnhealthyBorrowValue: string
49
+ globalAllowedBorrowValue: string
50
+ riskCouncil: string
51
+ reserved1: Array<number>
52
+ elevationGroups: Array<types.ElevationGroupJSON>
53
+ elevationGroupPadding: Array<string>
54
+ minNetValueInObligationSf: string
55
+ minValueSkipLiquidationLtvBfChecks: string
56
+ padding1: Array<string>
57
+ }
58
+
59
+ export class LendingMarket {
60
+ readonly version: BN
61
+ readonly bumpSeed: BN
62
+ readonly lendingMarketOwner: PublicKey
63
+ readonly lendingMarketOwnerCached: PublicKey
64
+ readonly quoteCurrency: Array<number>
65
+ readonly referralFeeBps: number
66
+ readonly emergencyMode: number
67
+ readonly autodeleverageEnabled: number
68
+ readonly borrowDisabled: number
69
+ readonly priceRefreshTriggerToMaxAgePct: number
70
+ readonly liquidationMaxDebtCloseFactorPct: number
71
+ readonly insolvencyRiskUnhealthyLtvPct: number
72
+ readonly minFullLiquidationValueThreshold: BN
73
+ readonly maxLiquidatableDebtMarketValueAtOnce: BN
74
+ readonly globalUnhealthyBorrowValue: BN
75
+ readonly globalAllowedBorrowValue: BN
76
+ readonly riskCouncil: PublicKey
77
+ readonly reserved1: Array<number>
78
+ readonly elevationGroups: Array<types.ElevationGroup>
79
+ readonly elevationGroupPadding: Array<BN>
80
+ readonly minNetValueInObligationSf: BN
81
+ readonly minValueSkipLiquidationLtvBfChecks: BN
82
+ readonly padding1: Array<BN>
83
+
84
+ static readonly discriminator = Buffer.from([
85
+ 246, 114, 50, 98, 72, 157, 28, 120,
86
+ ])
87
+
88
+ static readonly layout = borsh.struct([
89
+ borsh.u64("version"),
90
+ borsh.u64("bumpSeed"),
91
+ borsh.publicKey("lendingMarketOwner"),
92
+ borsh.publicKey("lendingMarketOwnerCached"),
93
+ borsh.array(borsh.u8(), 32, "quoteCurrency"),
94
+ borsh.u16("referralFeeBps"),
95
+ borsh.u8("emergencyMode"),
96
+ borsh.u8("autodeleverageEnabled"),
97
+ borsh.u8("borrowDisabled"),
98
+ borsh.u8("priceRefreshTriggerToMaxAgePct"),
99
+ borsh.u8("liquidationMaxDebtCloseFactorPct"),
100
+ borsh.u8("insolvencyRiskUnhealthyLtvPct"),
101
+ borsh.u64("minFullLiquidationValueThreshold"),
102
+ borsh.u64("maxLiquidatableDebtMarketValueAtOnce"),
103
+ borsh.u64("globalUnhealthyBorrowValue"),
104
+ borsh.u64("globalAllowedBorrowValue"),
105
+ borsh.publicKey("riskCouncil"),
106
+ borsh.array(borsh.u8(), 8, "reserved1"),
107
+ borsh.array(types.ElevationGroup.layout(), 32, "elevationGroups"),
108
+ borsh.array(borsh.u64(), 90, "elevationGroupPadding"),
109
+ borsh.u128("minNetValueInObligationSf"),
110
+ borsh.u64("minValueSkipLiquidationLtvBfChecks"),
111
+ borsh.array(borsh.u64(), 177, "padding1"),
112
+ ])
113
+
114
+ constructor(fields: LendingMarketFields) {
115
+ this.version = fields.version
116
+ this.bumpSeed = fields.bumpSeed
117
+ this.lendingMarketOwner = fields.lendingMarketOwner
118
+ this.lendingMarketOwnerCached = fields.lendingMarketOwnerCached
119
+ this.quoteCurrency = fields.quoteCurrency
120
+ this.referralFeeBps = fields.referralFeeBps
121
+ this.emergencyMode = fields.emergencyMode
122
+ this.autodeleverageEnabled = fields.autodeleverageEnabled
123
+ this.borrowDisabled = fields.borrowDisabled
124
+ this.priceRefreshTriggerToMaxAgePct = fields.priceRefreshTriggerToMaxAgePct
125
+ this.liquidationMaxDebtCloseFactorPct =
126
+ fields.liquidationMaxDebtCloseFactorPct
127
+ this.insolvencyRiskUnhealthyLtvPct = fields.insolvencyRiskUnhealthyLtvPct
128
+ this.minFullLiquidationValueThreshold =
129
+ fields.minFullLiquidationValueThreshold
130
+ this.maxLiquidatableDebtMarketValueAtOnce =
131
+ fields.maxLiquidatableDebtMarketValueAtOnce
132
+ this.globalUnhealthyBorrowValue = fields.globalUnhealthyBorrowValue
133
+ this.globalAllowedBorrowValue = fields.globalAllowedBorrowValue
134
+ this.riskCouncil = fields.riskCouncil
135
+ this.reserved1 = fields.reserved1
136
+ this.elevationGroups = fields.elevationGroups.map(
137
+ (item) => new types.ElevationGroup({ ...item })
138
+ )
139
+ this.elevationGroupPadding = fields.elevationGroupPadding
140
+ this.minNetValueInObligationSf = fields.minNetValueInObligationSf
141
+ this.minValueSkipLiquidationLtvBfChecks =
142
+ fields.minValueSkipLiquidationLtvBfChecks
143
+ this.padding1 = fields.padding1
144
+ }
145
+
146
+ static async fetch(
147
+ c: Connection,
148
+ address: PublicKey,
149
+ programId: PublicKey = PROGRAM_ID
150
+ ): Promise<LendingMarket | null> {
151
+ const info = await c.getAccountInfo(address)
152
+
153
+ if (info === null) {
154
+ return null
155
+ }
156
+ if (!info.owner.equals(programId)) {
157
+ throw new Error("account doesn't belong to this program")
158
+ }
159
+
160
+ return this.decode(info.data)
161
+ }
162
+
163
+ static async fetchMultiple(
164
+ c: Connection,
165
+ addresses: PublicKey[],
166
+ programId: PublicKey = PROGRAM_ID
167
+ ): Promise<Array<LendingMarket | null>> {
168
+ const infos = await c.getMultipleAccountsInfo(addresses)
169
+
170
+ return infos.map((info) => {
171
+ if (info === null) {
172
+ return null
173
+ }
174
+ if (!info.owner.equals(programId)) {
175
+ throw new Error("account doesn't belong to this program")
176
+ }
177
+
178
+ return this.decode(info.data)
179
+ })
180
+ }
181
+
182
+ static decode(data: Buffer): LendingMarket {
183
+ if (!data.slice(0, 8).equals(LendingMarket.discriminator)) {
184
+ throw new Error("invalid account discriminator")
185
+ }
186
+
187
+ const dec = LendingMarket.layout.decode(data.slice(8))
188
+
189
+ return new LendingMarket({
190
+ version: dec.version,
191
+ bumpSeed: dec.bumpSeed,
192
+ lendingMarketOwner: dec.lendingMarketOwner,
193
+ lendingMarketOwnerCached: dec.lendingMarketOwnerCached,
194
+ quoteCurrency: dec.quoteCurrency,
195
+ referralFeeBps: dec.referralFeeBps,
196
+ emergencyMode: dec.emergencyMode,
197
+ autodeleverageEnabled: dec.autodeleverageEnabled,
198
+ borrowDisabled: dec.borrowDisabled,
199
+ priceRefreshTriggerToMaxAgePct: dec.priceRefreshTriggerToMaxAgePct,
200
+ liquidationMaxDebtCloseFactorPct: dec.liquidationMaxDebtCloseFactorPct,
201
+ insolvencyRiskUnhealthyLtvPct: dec.insolvencyRiskUnhealthyLtvPct,
202
+ minFullLiquidationValueThreshold: dec.minFullLiquidationValueThreshold,
203
+ maxLiquidatableDebtMarketValueAtOnce:
204
+ dec.maxLiquidatableDebtMarketValueAtOnce,
205
+ globalUnhealthyBorrowValue: dec.globalUnhealthyBorrowValue,
206
+ globalAllowedBorrowValue: dec.globalAllowedBorrowValue,
207
+ riskCouncil: dec.riskCouncil,
208
+ reserved1: dec.reserved1,
209
+ elevationGroups: dec.elevationGroups.map(
210
+ (
211
+ item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
212
+ ) => types.ElevationGroup.fromDecoded(item)
213
+ ),
214
+ elevationGroupPadding: dec.elevationGroupPadding,
215
+ minNetValueInObligationSf: dec.minNetValueInObligationSf,
216
+ minValueSkipLiquidationLtvBfChecks:
217
+ dec.minValueSkipLiquidationLtvBfChecks,
218
+ padding1: dec.padding1,
219
+ })
220
+ }
221
+
222
+ toJSON(): LendingMarketJSON {
223
+ return {
224
+ version: this.version.toString(),
225
+ bumpSeed: this.bumpSeed.toString(),
226
+ lendingMarketOwner: this.lendingMarketOwner.toString(),
227
+ lendingMarketOwnerCached: this.lendingMarketOwnerCached.toString(),
228
+ quoteCurrency: this.quoteCurrency,
229
+ referralFeeBps: this.referralFeeBps,
230
+ emergencyMode: this.emergencyMode,
231
+ autodeleverageEnabled: this.autodeleverageEnabled,
232
+ borrowDisabled: this.borrowDisabled,
233
+ priceRefreshTriggerToMaxAgePct: this.priceRefreshTriggerToMaxAgePct,
234
+ liquidationMaxDebtCloseFactorPct: this.liquidationMaxDebtCloseFactorPct,
235
+ insolvencyRiskUnhealthyLtvPct: this.insolvencyRiskUnhealthyLtvPct,
236
+ minFullLiquidationValueThreshold:
237
+ this.minFullLiquidationValueThreshold.toString(),
238
+ maxLiquidatableDebtMarketValueAtOnce:
239
+ this.maxLiquidatableDebtMarketValueAtOnce.toString(),
240
+ globalUnhealthyBorrowValue: this.globalUnhealthyBorrowValue.toString(),
241
+ globalAllowedBorrowValue: this.globalAllowedBorrowValue.toString(),
242
+ riskCouncil: this.riskCouncil.toString(),
243
+ reserved1: this.reserved1,
244
+ elevationGroups: this.elevationGroups.map((item) => item.toJSON()),
245
+ elevationGroupPadding: this.elevationGroupPadding.map((item) =>
246
+ item.toString()
247
+ ),
248
+ minNetValueInObligationSf: this.minNetValueInObligationSf.toString(),
249
+ minValueSkipLiquidationLtvBfChecks:
250
+ this.minValueSkipLiquidationLtvBfChecks.toString(),
251
+ padding1: this.padding1.map((item) => item.toString()),
252
+ }
253
+ }
254
+
255
+ static fromJSON(obj: LendingMarketJSON): LendingMarket {
256
+ return new LendingMarket({
257
+ version: new BN(obj.version),
258
+ bumpSeed: new BN(obj.bumpSeed),
259
+ lendingMarketOwner: new PublicKey(obj.lendingMarketOwner),
260
+ lendingMarketOwnerCached: new PublicKey(obj.lendingMarketOwnerCached),
261
+ quoteCurrency: obj.quoteCurrency,
262
+ referralFeeBps: obj.referralFeeBps,
263
+ emergencyMode: obj.emergencyMode,
264
+ autodeleverageEnabled: obj.autodeleverageEnabled,
265
+ borrowDisabled: obj.borrowDisabled,
266
+ priceRefreshTriggerToMaxAgePct: obj.priceRefreshTriggerToMaxAgePct,
267
+ liquidationMaxDebtCloseFactorPct: obj.liquidationMaxDebtCloseFactorPct,
268
+ insolvencyRiskUnhealthyLtvPct: obj.insolvencyRiskUnhealthyLtvPct,
269
+ minFullLiquidationValueThreshold: new BN(
270
+ obj.minFullLiquidationValueThreshold
271
+ ),
272
+ maxLiquidatableDebtMarketValueAtOnce: new BN(
273
+ obj.maxLiquidatableDebtMarketValueAtOnce
274
+ ),
275
+ globalUnhealthyBorrowValue: new BN(obj.globalUnhealthyBorrowValue),
276
+ globalAllowedBorrowValue: new BN(obj.globalAllowedBorrowValue),
277
+ riskCouncil: new PublicKey(obj.riskCouncil),
278
+ reserved1: obj.reserved1,
279
+ elevationGroups: obj.elevationGroups.map((item) =>
280
+ types.ElevationGroup.fromJSON(item)
281
+ ),
282
+ elevationGroupPadding: obj.elevationGroupPadding.map(
283
+ (item) => new BN(item)
284
+ ),
285
+ minNetValueInObligationSf: new BN(obj.minNetValueInObligationSf),
286
+ minValueSkipLiquidationLtvBfChecks: new BN(
287
+ obj.minValueSkipLiquidationLtvBfChecks
288
+ ),
289
+ padding1: obj.padding1.map((item) => new BN(item)),
290
+ })
291
+ }
292
+ }