@kamino-finance/klend-sdk 2.10.6
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.
- package/README.md +85 -0
- package/dist/classes/action.d.ts +154 -0
- package/dist/classes/action.js +1505 -0
- package/dist/classes/action.js.map +1 -0
- package/dist/classes/curve.d.ts +15 -0
- package/dist/classes/curve.js +32 -0
- package/dist/classes/curve.js.map +1 -0
- package/dist/classes/fraction.d.ts +23 -0
- package/dist/classes/fraction.js +60 -0
- package/dist/classes/fraction.js.map +1 -0
- package/dist/classes/index.d.ts +8 -0
- package/dist/classes/index.js +25 -0
- package/dist/classes/index.js.map +1 -0
- package/dist/classes/jupiterPerps.d.ts +2 -0
- package/dist/classes/jupiterPerps.js +25 -0
- package/dist/classes/jupiterPerps.js.map +1 -0
- package/dist/classes/market.d.ts +140 -0
- package/dist/classes/market.js +901 -0
- package/dist/classes/market.js.map +1 -0
- package/dist/classes/obligation.d.ts +170 -0
- package/dist/classes/obligation.js +610 -0
- package/dist/classes/obligation.js.map +1 -0
- package/dist/classes/reserve.d.ts +161 -0
- package/dist/classes/reserve.js +474 -0
- package/dist/classes/reserve.js.map +1 -0
- package/dist/classes/shared.d.ts +41 -0
- package/dist/classes/shared.js +10 -0
- package/dist/classes/shared.js.map +1 -0
- package/dist/classes/utils.d.ts +40 -0
- package/dist/classes/utils.js +129 -0
- package/dist/classes/utils.js.map +1 -0
- package/dist/idl.json +4102 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +153 -0
- package/dist/idl_codegen/accounts/LendingMarket.js +204 -0
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -0
- package/dist/idl_codegen/accounts/Obligation.d.ts +139 -0
- package/dist/idl_codegen/accounts/Obligation.js +193 -0
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -0
- package/dist/idl_codegen/accounts/ReferrerState.d.ts +22 -0
- package/dist/idl_codegen/accounts/ReferrerState.js +101 -0
- package/dist/idl_codegen/accounts/ReferrerState.js.map +1 -0
- package/dist/idl_codegen/accounts/ReferrerTokenState.d.ts +51 -0
- package/dist/idl_codegen/accounts/ReferrerTokenState.js +126 -0
- package/dist/idl_codegen/accounts/ReferrerTokenState.js.map +1 -0
- package/dist/idl_codegen/accounts/Reserve.d.ts +72 -0
- package/dist/idl_codegen/accounts/Reserve.js +156 -0
- package/dist/idl_codegen/accounts/Reserve.js.map +1 -0
- package/dist/idl_codegen/accounts/ShortUrl.d.ts +22 -0
- package/dist/idl_codegen/accounts/ShortUrl.js +101 -0
- package/dist/idl_codegen/accounts/ShortUrl.js.map +1 -0
- package/dist/idl_codegen/accounts/UserMetadata.d.ts +48 -0
- package/dist/idl_codegen/accounts/UserMetadata.js +126 -0
- package/dist/idl_codegen/accounts/UserMetadata.js.map +1 -0
- package/dist/idl_codegen/accounts/UserState.d.ts +143 -0
- package/dist/idl_codegen/accounts/UserState.js +180 -0
- package/dist/idl_codegen/accounts/UserState.js.map +1 -0
- package/dist/idl_codegen/accounts/index.d.ts +16 -0
- package/dist/idl_codegen/accounts/index.js +20 -0
- package/dist/idl_codegen/accounts/index.js.map +1 -0
- package/dist/idl_codegen/errors/anchor.d.ts +434 -0
- package/dist/idl_codegen/errors/anchor.js +713 -0
- package/dist/idl_codegen/errors/anchor.js.map +1 -0
- package/dist/idl_codegen/errors/custom.d.ts +730 -0
- package/dist/idl_codegen/errors/custom.js +1194 -0
- package/dist/idl_codegen/errors/custom.js.map +1 -0
- package/dist/idl_codegen/errors/index.d.ts +5 -0
- package/dist/idl_codegen/errors/index.js +71 -0
- package/dist/idl_codegen/errors/index.js.map +1 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.d.ts +20 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js +75 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js.map +1 -0
- package/dist/idl_codegen/instructions/deleteReferrerStateAndShortUrl.d.ts +9 -0
- package/dist/idl_codegen/instructions/deleteReferrerStateAndShortUrl.js +20 -0
- package/dist/idl_codegen/instructions/deleteReferrerStateAndShortUrl.js.map +1 -0
- package/dist/idl_codegen/instructions/depositObligationCollateral.d.ts +17 -0
- package/dist/idl_codegen/instructions/depositObligationCollateral.js +64 -0
- package/dist/idl_codegen/instructions/depositObligationCollateral.js.map +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidity.d.ts +19 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js +74 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js.map +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +21 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js +80 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.d.ts +20 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js +75 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js.map +1 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.d.ts +21 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js +75 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js.map +1 -0
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts +18 -0
- package/dist/idl_codegen/instructions/idlMissingTypes.js +62 -0
- package/dist/idl_codegen/instructions/idlMissingTypes.js.map +1 -0
- package/dist/idl_codegen/instructions/index.d.ts +66 -0
- package/dist/idl_codegen/instructions/index.js +70 -0
- package/dist/idl_codegen/instructions/index.js.map +1 -0
- package/dist/idl_codegen/instructions/initFarmsForReserve.d.ts +19 -0
- package/dist/idl_codegen/instructions/initFarmsForReserve.js +63 -0
- package/dist/idl_codegen/instructions/initFarmsForReserve.js.map +1 -0
- package/dist/idl_codegen/instructions/initLendingMarket.d.ts +13 -0
- package/dist/idl_codegen/instructions/initLendingMarket.js +55 -0
- package/dist/idl_codegen/instructions/initLendingMarket.js.map +1 -0
- package/dist/idl_codegen/instructions/initObligation.d.ts +19 -0
- package/dist/idl_codegen/instructions/initObligation.js +55 -0
- package/dist/idl_codegen/instructions/initObligation.js.map +1 -0
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.d.ts +20 -0
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js +60 -0
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js.map +1 -0
- package/dist/idl_codegen/instructions/initReferrerStateAndShortUrl.d.ts +14 -0
- package/dist/idl_codegen/instructions/initReferrerStateAndShortUrl.js +54 -0
- package/dist/idl_codegen/instructions/initReferrerStateAndShortUrl.js.map +1 -0
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts +14 -0
- package/dist/idl_codegen/instructions/initReferrerTokenState.js +50 -0
- package/dist/idl_codegen/instructions/initReferrerTokenState.js.map +1 -0
- package/dist/idl_codegen/instructions/initReserve.d.ts +16 -0
- package/dist/idl_codegen/instructions/initReserve.js +47 -0
- package/dist/idl_codegen/instructions/initReserve.js.map +1 -0
- package/dist/idl_codegen/instructions/initUserMetadata.d.ts +14 -0
- package/dist/idl_codegen/instructions/initUserMetadata.js +54 -0
- package/dist/idl_codegen/instructions/initUserMetadata.js.map +1 -0
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +27 -0
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js +102 -0
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -0
- package/dist/idl_codegen/instructions/redeemFees.d.ts +10 -0
- package/dist/idl_codegen/instructions/redeemFees.js +33 -0
- package/dist/idl_codegen/instructions/redeemFees.js.map +1 -0
- package/dist/idl_codegen/instructions/redeemReserveCollateral.d.ts +19 -0
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js +78 -0
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js.map +1 -0
- package/dist/idl_codegen/instructions/refreshObligation.d.ts +6 -0
- package/dist/idl_codegen/instructions/refreshObligation.js +17 -0
- package/dist/idl_codegen/instructions/refreshObligation.js.map +1 -0
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts +19 -0
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js +63 -0
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -0
- package/dist/idl_codegen/instructions/refreshReserve.d.ts +10 -0
- package/dist/idl_codegen/instructions/refreshReserve.js +29 -0
- package/dist/idl_codegen/instructions/refreshReserve.js.map +1 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.d.ts +17 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js +60 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js.map +1 -0
- package/dist/idl_codegen/instructions/requestElevationGroup.d.ts +11 -0
- package/dist/idl_codegen/instructions/requestElevationGroup.js +47 -0
- package/dist/idl_codegen/instructions/requestElevationGroup.js.map +1 -0
- package/dist/idl_codegen/instructions/socializeLoss.d.ts +14 -0
- package/dist/idl_codegen/instructions/socializeLoss.js +53 -0
- package/dist/idl_codegen/instructions/socializeLoss.js.map +1 -0
- package/dist/idl_codegen/instructions/updateEntireReserveConfig.d.ts +13 -0
- package/dist/idl_codegen/instructions/updateEntireReserveConfig.js +51 -0
- package/dist/idl_codegen/instructions/updateEntireReserveConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/updateLendingMarket.d.ts +12 -0
- package/dist/idl_codegen/instructions/updateLendingMarket.js +50 -0
- package/dist/idl_codegen/instructions/updateLendingMarket.js.map +1 -0
- package/dist/idl_codegen/instructions/updateLendingMarketOwner.d.ts +6 -0
- package/dist/idl_codegen/instructions/updateLendingMarketOwner.js +21 -0
- package/dist/idl_codegen/instructions/updateLendingMarketOwner.js.map +1 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +13 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.js +51 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/updateSingleReserveConfig.d.ts +13 -0
- package/dist/idl_codegen/instructions/updateSingleReserveConfig.js +51 -0
- package/dist/idl_codegen/instructions/updateSingleReserveConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.d.ts +18 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js +69 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js.map +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +21 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +84 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts +16 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js +59 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.d.ts +12 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js +35 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js.map +1 -0
- package/dist/idl_codegen/programId.d.ts +4 -0
- package/dist/idl_codegen/programId.js +13 -0
- package/dist/idl_codegen/programId.js.map +1 -0
- package/dist/idl_codegen/types/AssetTier.d.ts +44 -0
- package/dist/idl_codegen/types/AssetTier.js +128 -0
- package/dist/idl_codegen/types/AssetTier.js.map +1 -0
- package/dist/idl_codegen/types/BigFractionBytes.d.ts +27 -0
- package/dist/idl_codegen/types/BigFractionBytes.js +73 -0
- package/dist/idl_codegen/types/BigFractionBytes.js.map +1 -0
- package/dist/idl_codegen/types/BorrowRateCurve.d.ts +27 -0
- package/dist/idl_codegen/types/BorrowRateCurve.js +62 -0
- package/dist/idl_codegen/types/BorrowRateCurve.js.map +1 -0
- package/dist/idl_codegen/types/CurvePoint.d.ts +26 -0
- package/dist/idl_codegen/types/CurvePoint.js +66 -0
- package/dist/idl_codegen/types/CurvePoint.js.map +1 -0
- package/dist/idl_codegen/types/ElevationGroup.d.ts +52 -0
- package/dist/idl_codegen/types/ElevationGroup.js +103 -0
- package/dist/idl_codegen/types/ElevationGroup.js.map +1 -0
- package/dist/idl_codegen/types/FeeCalculation.d.ts +31 -0
- package/dist/idl_codegen/types/FeeCalculation.js +102 -0
- package/dist/idl_codegen/types/FeeCalculation.js.map +1 -0
- package/dist/idl_codegen/types/InitObligationArgs.d.ts +26 -0
- package/dist/idl_codegen/types/InitObligationArgs.js +66 -0
- package/dist/idl_codegen/types/InitObligationArgs.js.map +1 -0
- package/dist/idl_codegen/types/LastUpdate.d.ts +47 -0
- package/dist/idl_codegen/types/LastUpdate.js +86 -0
- package/dist/idl_codegen/types/LastUpdate.js.map +1 -0
- package/dist/idl_codegen/types/ObligationCollateral.d.ts +48 -0
- package/dist/idl_codegen/types/ObligationCollateral.js +87 -0
- package/dist/idl_codegen/types/ObligationCollateral.js.map +1 -0
- package/dist/idl_codegen/types/ObligationLiquidity.d.ts +75 -0
- package/dist/idl_codegen/types/ObligationLiquidity.js +107 -0
- package/dist/idl_codegen/types/ObligationLiquidity.js.map +1 -0
- package/dist/idl_codegen/types/PriceHeuristic.d.ts +41 -0
- package/dist/idl_codegen/types/PriceHeuristic.js +75 -0
- package/dist/idl_codegen/types/PriceHeuristic.js.map +1 -0
- package/dist/idl_codegen/types/PythConfiguration.d.ts +25 -0
- package/dist/idl_codegen/types/PythConfiguration.js +62 -0
- package/dist/idl_codegen/types/PythConfiguration.js.map +1 -0
- package/dist/idl_codegen/types/ReserveCollateral.d.ts +53 -0
- package/dist/idl_codegen/types/ReserveCollateral.js +93 -0
- package/dist/idl_codegen/types/ReserveCollateral.js.map +1 -0
- package/dist/idl_codegen/types/ReserveConfig.d.ts +304 -0
- package/dist/idl_codegen/types/ReserveConfig.js +209 -0
- package/dist/idl_codegen/types/ReserveConfig.js.map +1 -0
- package/dist/idl_codegen/types/ReserveFarmKind.d.ts +31 -0
- package/dist/idl_codegen/types/ReserveFarmKind.js +102 -0
- package/dist/idl_codegen/types/ReserveFarmKind.js.map +1 -0
- package/dist/idl_codegen/types/ReserveFees.d.ts +78 -0
- package/dist/idl_codegen/types/ReserveFees.js +86 -0
- package/dist/idl_codegen/types/ReserveFees.js.map +1 -0
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts +173 -0
- package/dist/idl_codegen/types/ReserveLiquidity.js +166 -0
- package/dist/idl_codegen/types/ReserveLiquidity.js.map +1 -0
- package/dist/idl_codegen/types/ReserveStatus.d.ts +44 -0
- package/dist/idl_codegen/types/ReserveStatus.js +128 -0
- package/dist/idl_codegen/types/ReserveStatus.js.map +1 -0
- package/dist/idl_codegen/types/ScopeConfiguration.d.ts +41 -0
- package/dist/idl_codegen/types/ScopeConfiguration.js +76 -0
- package/dist/idl_codegen/types/ScopeConfiguration.js.map +1 -0
- package/dist/idl_codegen/types/SwitchboardConfiguration.d.ts +30 -0
- package/dist/idl_codegen/types/SwitchboardConfiguration.js +67 -0
- package/dist/idl_codegen/types/SwitchboardConfiguration.js.map +1 -0
- package/dist/idl_codegen/types/TokenInfo.d.ts +109 -0
- package/dist/idl_codegen/types/TokenInfo.js +116 -0
- package/dist/idl_codegen/types/TokenInfo.js.map +1 -0
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts +538 -0
- package/dist/idl_codegen/types/UpdateConfigMode.js +1116 -0
- package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +155 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js +273 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +200 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +440 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -0
- package/dist/idl_codegen/types/WithdrawalCaps.d.ts +38 -0
- package/dist/idl_codegen/types/WithdrawalCaps.js +86 -0
- package/dist/idl_codegen/types/WithdrawalCaps.js.map +1 -0
- package/dist/idl_codegen/types/index.d.ts +65 -0
- package/dist/idl_codegen/types/index.js +77 -0
- package/dist/idl_codegen/types/index.js.map +1 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +53 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.js +140 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -0
- package/dist/idl_codegen/zero_padding/index.d.ts +1 -0
- package/dist/idl_codegen/zero_padding/index.js +6 -0
- package/dist/idl_codegen/zero_padding/index.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.d.ts +48 -0
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.js +144 -0
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/accounts/index.d.ts +2 -0
- package/dist/idl_codegen_jupiter_perps/accounts/index.js +6 -0
- package/dist/idl_codegen_jupiter_perps/accounts/index.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/programId.d.ts +3 -0
- package/dist/idl_codegen_jupiter_perps/programId.js +9 -0
- package/dist/idl_codegen_jupiter_perps/programId.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/Fees.d.ts +62 -0
- package/dist/idl_codegen_jupiter_perps/types/Fees.js +115 -0
- package/dist/idl_codegen_jupiter_perps/types/Fees.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/Limit.d.ts +32 -0
- package/dist/idl_codegen_jupiter_perps/types/Limit.js +75 -0
- package/dist/idl_codegen_jupiter_perps/types/Limit.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.d.ts +32 -0
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.js +75 -0
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.js.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/index.d.ts +6 -0
- package/dist/idl_codegen_jupiter_perps/types/index.js +10 -0
- package/dist/idl_codegen_jupiter_perps/types/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/lending_operations/index.d.ts +2 -0
- package/dist/lending_operations/index.js +19 -0
- package/dist/lending_operations/index.js.map +1 -0
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts +5 -0
- package/dist/lending_operations/repay_with_collateral_calcs.js +26 -0
- package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -0
- package/dist/lending_operations/repay_with_collateral_operations.d.ts +47 -0
- package/dist/lending_operations/repay_with_collateral_operations.js +163 -0
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -0
- package/dist/leverage/calcs.d.ts +132 -0
- package/dist/leverage/calcs.js +291 -0
- package/dist/leverage/calcs.js.map +1 -0
- package/dist/leverage/index.d.ts +4 -0
- package/dist/leverage/index.js +21 -0
- package/dist/leverage/index.js.map +1 -0
- package/dist/leverage/instructions.d.ts +43 -0
- package/dist/leverage/instructions.js +103 -0
- package/dist/leverage/instructions.js.map +1 -0
- package/dist/leverage/operations.d.ts +231 -0
- package/dist/leverage/operations.js +1058 -0
- package/dist/leverage/operations.js.map +1 -0
- package/dist/leverage/utils.d.ts +22 -0
- package/dist/leverage/utils.js +144 -0
- package/dist/leverage/utils.js.map +1 -0
- package/dist/lib.d.ts +9 -0
- package/dist/lib.js +26 -0
- package/dist/lib.js.map +1 -0
- package/dist/referrals/index.d.ts +2 -0
- package/dist/referrals/index.js +19 -0
- package/dist/referrals/index.js.map +1 -0
- package/dist/referrals/instructions.d.ts +16 -0
- package/dist/referrals/instructions.js +76 -0
- package/dist/referrals/instructions.js.map +1 -0
- package/dist/referrals/operations.d.ts +97 -0
- package/dist/referrals/operations.js +258 -0
- package/dist/referrals/operations.js.map +1 -0
- package/dist/utils/ObligationType.d.ts +49 -0
- package/dist/utils/ObligationType.js +129 -0
- package/dist/utils/ObligationType.js.map +1 -0
- package/dist/utils/api.d.ts +6 -0
- package/dist/utils/api.js +61 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/ata.d.ts +25 -0
- package/dist/utils/ata.js +155 -0
- package/dist/utils/ata.js.map +1 -0
- package/dist/utils/constants.d.ts +48 -0
- package/dist/utils/constants.js +75 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/idl.d.ts +2 -0
- package/dist/utils/idl.js +9 -0
- package/dist/utils/idl.js.map +1 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/instruction.d.ts +22 -0
- package/dist/utils/instruction.js +202 -0
- package/dist/utils/instruction.js.map +1 -0
- package/dist/utils/kamino.d.ts +3 -0
- package/dist/utils/kamino.js +45 -0
- package/dist/utils/kamino.js.map +1 -0
- package/dist/utils/layout.d.ts +13 -0
- package/dist/utils/layout.js +123 -0
- package/dist/utils/layout.js.map +1 -0
- package/dist/utils/lookupTable.d.ts +5 -0
- package/dist/utils/lookupTable.js +57 -0
- package/dist/utils/lookupTable.js.map +1 -0
- package/dist/utils/oracle.d.ts +51 -0
- package/dist/utils/oracle.js +295 -0
- package/dist/utils/oracle.js.map +1 -0
- package/dist/utils/pubkey.d.ts +74 -0
- package/dist/utils/pubkey.js +229 -0
- package/dist/utils/pubkey.js.map +1 -0
- package/dist/utils/seeds.d.ts +122 -0
- package/dist/utils/seeds.js +153 -0
- package/dist/utils/seeds.js.map +1 -0
- package/dist/utils/slots.d.ts +18 -0
- package/dist/utils/slots.js +32 -0
- package/dist/utils/slots.js.map +1 -0
- package/dist/utils/syncNative.d.ts +10 -0
- package/dist/utils/syncNative.js +46 -0
- package/dist/utils/syncNative.js.map +1 -0
- package/dist/utils/userMetadata.d.ts +15 -0
- package/dist/utils/userMetadata.js +259 -0
- package/dist/utils/userMetadata.js.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { PublicKey, Connection } from "@solana/web3.js";
|
|
3
|
+
import BN from "bn.js";
|
|
4
|
+
import * as types from "../types";
|
|
5
|
+
export interface LendingMarketFields {
|
|
6
|
+
/** Version of lending market */
|
|
7
|
+
version: BN;
|
|
8
|
+
/** Bump seed for derived authority address */
|
|
9
|
+
bumpSeed: BN;
|
|
10
|
+
/** Owner authority which can add new reserves */
|
|
11
|
+
lendingMarketOwner: PublicKey;
|
|
12
|
+
/** Temporary cache of the lending market owner, used in update_lending_market_owner */
|
|
13
|
+
lendingMarketOwnerCached: PublicKey;
|
|
14
|
+
/**
|
|
15
|
+
* Currency market prices are quoted in
|
|
16
|
+
* e.g. "USD" null padded (`*b"USD\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"`) or a SPL token mint pubkey
|
|
17
|
+
*/
|
|
18
|
+
quoteCurrency: Array<number>;
|
|
19
|
+
/** Referral fee for the lending market, as bps out of the total protocol fee */
|
|
20
|
+
referralFeeBps: number;
|
|
21
|
+
emergencyMode: number;
|
|
22
|
+
autodeleverageEnabled: number;
|
|
23
|
+
/** Padding used for alignment */
|
|
24
|
+
borrowDisabled: number;
|
|
25
|
+
/**
|
|
26
|
+
* Refresh price from oracle only if it's older than this percentage of the price max age.
|
|
27
|
+
* e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.
|
|
28
|
+
* Price is always refreshed if this set to 0.
|
|
29
|
+
*/
|
|
30
|
+
priceRefreshTriggerToMaxAgePct: number;
|
|
31
|
+
/** Percentage of the total borrowed value in an obligation available for liquidation */
|
|
32
|
+
liquidationMaxDebtCloseFactorPct: number;
|
|
33
|
+
/** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */
|
|
34
|
+
insolvencyRiskUnhealthyLtvPct: number;
|
|
35
|
+
/** Minimum liquidation value threshold triggering full liquidation for an obligation */
|
|
36
|
+
minFullLiquidationValueThreshold: BN;
|
|
37
|
+
/** Max allowed liquidation value in one ix call */
|
|
38
|
+
maxLiquidatableDebtMarketValueAtOnce: BN;
|
|
39
|
+
/** Global maximum unhealthy borrow value allowed for any obligation */
|
|
40
|
+
globalUnhealthyBorrowValue: BN;
|
|
41
|
+
/** Global maximum allowed borrow value allowed for any obligation */
|
|
42
|
+
globalAllowedBorrowValue: BN;
|
|
43
|
+
/** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */
|
|
44
|
+
riskCouncil: PublicKey;
|
|
45
|
+
/** Reward points multiplier per obligation type */
|
|
46
|
+
multiplierPointsTagBoost: Array<number>;
|
|
47
|
+
/** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */
|
|
48
|
+
elevationGroups: Array<types.ElevationGroupFields>;
|
|
49
|
+
elevationGroupPadding: Array<BN>;
|
|
50
|
+
padding1: Array<BN>;
|
|
51
|
+
}
|
|
52
|
+
export interface LendingMarketJSON {
|
|
53
|
+
/** Version of lending market */
|
|
54
|
+
version: string;
|
|
55
|
+
/** Bump seed for derived authority address */
|
|
56
|
+
bumpSeed: string;
|
|
57
|
+
/** Owner authority which can add new reserves */
|
|
58
|
+
lendingMarketOwner: string;
|
|
59
|
+
/** Temporary cache of the lending market owner, used in update_lending_market_owner */
|
|
60
|
+
lendingMarketOwnerCached: string;
|
|
61
|
+
/**
|
|
62
|
+
* Currency market prices are quoted in
|
|
63
|
+
* e.g. "USD" null padded (`*b"USD\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"`) or a SPL token mint pubkey
|
|
64
|
+
*/
|
|
65
|
+
quoteCurrency: Array<number>;
|
|
66
|
+
/** Referral fee for the lending market, as bps out of the total protocol fee */
|
|
67
|
+
referralFeeBps: number;
|
|
68
|
+
emergencyMode: number;
|
|
69
|
+
autodeleverageEnabled: number;
|
|
70
|
+
/** Padding used for alignment */
|
|
71
|
+
borrowDisabled: number;
|
|
72
|
+
/**
|
|
73
|
+
* Refresh price from oracle only if it's older than this percentage of the price max age.
|
|
74
|
+
* e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.
|
|
75
|
+
* Price is always refreshed if this set to 0.
|
|
76
|
+
*/
|
|
77
|
+
priceRefreshTriggerToMaxAgePct: number;
|
|
78
|
+
/** Percentage of the total borrowed value in an obligation available for liquidation */
|
|
79
|
+
liquidationMaxDebtCloseFactorPct: number;
|
|
80
|
+
/** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */
|
|
81
|
+
insolvencyRiskUnhealthyLtvPct: number;
|
|
82
|
+
/** Minimum liquidation value threshold triggering full liquidation for an obligation */
|
|
83
|
+
minFullLiquidationValueThreshold: string;
|
|
84
|
+
/** Max allowed liquidation value in one ix call */
|
|
85
|
+
maxLiquidatableDebtMarketValueAtOnce: string;
|
|
86
|
+
/** Global maximum unhealthy borrow value allowed for any obligation */
|
|
87
|
+
globalUnhealthyBorrowValue: string;
|
|
88
|
+
/** Global maximum allowed borrow value allowed for any obligation */
|
|
89
|
+
globalAllowedBorrowValue: string;
|
|
90
|
+
/** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */
|
|
91
|
+
riskCouncil: string;
|
|
92
|
+
/** Reward points multiplier per obligation type */
|
|
93
|
+
multiplierPointsTagBoost: Array<number>;
|
|
94
|
+
/** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */
|
|
95
|
+
elevationGroups: Array<types.ElevationGroupJSON>;
|
|
96
|
+
elevationGroupPadding: Array<string>;
|
|
97
|
+
padding1: Array<string>;
|
|
98
|
+
}
|
|
99
|
+
export declare class LendingMarket {
|
|
100
|
+
/** Version of lending market */
|
|
101
|
+
readonly version: BN;
|
|
102
|
+
/** Bump seed for derived authority address */
|
|
103
|
+
readonly bumpSeed: BN;
|
|
104
|
+
/** Owner authority which can add new reserves */
|
|
105
|
+
readonly lendingMarketOwner: PublicKey;
|
|
106
|
+
/** Temporary cache of the lending market owner, used in update_lending_market_owner */
|
|
107
|
+
readonly lendingMarketOwnerCached: PublicKey;
|
|
108
|
+
/**
|
|
109
|
+
* Currency market prices are quoted in
|
|
110
|
+
* e.g. "USD" null padded (`*b"USD\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"`) or a SPL token mint pubkey
|
|
111
|
+
*/
|
|
112
|
+
readonly quoteCurrency: Array<number>;
|
|
113
|
+
/** Referral fee for the lending market, as bps out of the total protocol fee */
|
|
114
|
+
readonly referralFeeBps: number;
|
|
115
|
+
readonly emergencyMode: number;
|
|
116
|
+
readonly autodeleverageEnabled: number;
|
|
117
|
+
/** Padding used for alignment */
|
|
118
|
+
readonly borrowDisabled: number;
|
|
119
|
+
/**
|
|
120
|
+
* Refresh price from oracle only if it's older than this percentage of the price max age.
|
|
121
|
+
* e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.
|
|
122
|
+
* Price is always refreshed if this set to 0.
|
|
123
|
+
*/
|
|
124
|
+
readonly priceRefreshTriggerToMaxAgePct: number;
|
|
125
|
+
/** Percentage of the total borrowed value in an obligation available for liquidation */
|
|
126
|
+
readonly liquidationMaxDebtCloseFactorPct: number;
|
|
127
|
+
/** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */
|
|
128
|
+
readonly insolvencyRiskUnhealthyLtvPct: number;
|
|
129
|
+
/** Minimum liquidation value threshold triggering full liquidation for an obligation */
|
|
130
|
+
readonly minFullLiquidationValueThreshold: BN;
|
|
131
|
+
/** Max allowed liquidation value in one ix call */
|
|
132
|
+
readonly maxLiquidatableDebtMarketValueAtOnce: BN;
|
|
133
|
+
/** Global maximum unhealthy borrow value allowed for any obligation */
|
|
134
|
+
readonly globalUnhealthyBorrowValue: BN;
|
|
135
|
+
/** Global maximum allowed borrow value allowed for any obligation */
|
|
136
|
+
readonly globalAllowedBorrowValue: BN;
|
|
137
|
+
/** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */
|
|
138
|
+
readonly riskCouncil: PublicKey;
|
|
139
|
+
/** Reward points multiplier per obligation type */
|
|
140
|
+
readonly multiplierPointsTagBoost: Array<number>;
|
|
141
|
+
/** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */
|
|
142
|
+
readonly elevationGroups: Array<types.ElevationGroup>;
|
|
143
|
+
readonly elevationGroupPadding: Array<BN>;
|
|
144
|
+
readonly padding1: Array<BN>;
|
|
145
|
+
static readonly discriminator: Buffer;
|
|
146
|
+
static readonly layout: any;
|
|
147
|
+
constructor(fields: LendingMarketFields);
|
|
148
|
+
static fetch(c: Connection, address: PublicKey, programId?: PublicKey): Promise<LendingMarket | null>;
|
|
149
|
+
static fetchMultiple(c: Connection, addresses: PublicKey[], programId?: PublicKey): Promise<Array<LendingMarket | null>>;
|
|
150
|
+
static decode(data: Buffer): LendingMarket;
|
|
151
|
+
toJSON(): LendingMarketJSON;
|
|
152
|
+
static fromJSON(obj: LendingMarketJSON): LendingMarket;
|
|
153
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.LendingMarket = void 0;
|
|
39
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
40
|
+
const bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
41
|
+
const borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
42
|
+
const types = __importStar(require("../types")); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
43
|
+
const programId_1 = require("../programId");
|
|
44
|
+
class LendingMarket {
|
|
45
|
+
constructor(fields) {
|
|
46
|
+
this.version = fields.version;
|
|
47
|
+
this.bumpSeed = fields.bumpSeed;
|
|
48
|
+
this.lendingMarketOwner = fields.lendingMarketOwner;
|
|
49
|
+
this.lendingMarketOwnerCached = fields.lendingMarketOwnerCached;
|
|
50
|
+
this.quoteCurrency = fields.quoteCurrency;
|
|
51
|
+
this.referralFeeBps = fields.referralFeeBps;
|
|
52
|
+
this.emergencyMode = fields.emergencyMode;
|
|
53
|
+
this.autodeleverageEnabled = fields.autodeleverageEnabled;
|
|
54
|
+
this.borrowDisabled = fields.borrowDisabled;
|
|
55
|
+
this.priceRefreshTriggerToMaxAgePct = fields.priceRefreshTriggerToMaxAgePct;
|
|
56
|
+
this.liquidationMaxDebtCloseFactorPct =
|
|
57
|
+
fields.liquidationMaxDebtCloseFactorPct;
|
|
58
|
+
this.insolvencyRiskUnhealthyLtvPct = fields.insolvencyRiskUnhealthyLtvPct;
|
|
59
|
+
this.minFullLiquidationValueThreshold =
|
|
60
|
+
fields.minFullLiquidationValueThreshold;
|
|
61
|
+
this.maxLiquidatableDebtMarketValueAtOnce =
|
|
62
|
+
fields.maxLiquidatableDebtMarketValueAtOnce;
|
|
63
|
+
this.globalUnhealthyBorrowValue = fields.globalUnhealthyBorrowValue;
|
|
64
|
+
this.globalAllowedBorrowValue = fields.globalAllowedBorrowValue;
|
|
65
|
+
this.riskCouncil = fields.riskCouncil;
|
|
66
|
+
this.multiplierPointsTagBoost = fields.multiplierPointsTagBoost;
|
|
67
|
+
this.elevationGroups = fields.elevationGroups.map((item) => new types.ElevationGroup(Object.assign({}, item)));
|
|
68
|
+
this.elevationGroupPadding = fields.elevationGroupPadding;
|
|
69
|
+
this.padding1 = fields.padding1;
|
|
70
|
+
}
|
|
71
|
+
static fetch(c, address, programId = programId_1.PROGRAM_ID) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const info = yield c.getAccountInfo(address);
|
|
74
|
+
if (info === null) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
if (!info.owner.equals(programId)) {
|
|
78
|
+
throw new Error("account doesn't belong to this program");
|
|
79
|
+
}
|
|
80
|
+
return this.decode(info.data);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
static fetchMultiple(c, addresses, programId = programId_1.PROGRAM_ID) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const infos = yield c.getMultipleAccountsInfo(addresses);
|
|
86
|
+
return infos.map((info) => {
|
|
87
|
+
if (info === null) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (!info.owner.equals(programId)) {
|
|
91
|
+
throw new Error("account doesn't belong to this program");
|
|
92
|
+
}
|
|
93
|
+
return this.decode(info.data);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
static decode(data) {
|
|
98
|
+
if (!data.slice(0, 8).equals(LendingMarket.discriminator)) {
|
|
99
|
+
throw new Error("invalid account discriminator");
|
|
100
|
+
}
|
|
101
|
+
const dec = LendingMarket.layout.decode(data.slice(8));
|
|
102
|
+
return new LendingMarket({
|
|
103
|
+
version: dec.version,
|
|
104
|
+
bumpSeed: dec.bumpSeed,
|
|
105
|
+
lendingMarketOwner: dec.lendingMarketOwner,
|
|
106
|
+
lendingMarketOwnerCached: dec.lendingMarketOwnerCached,
|
|
107
|
+
quoteCurrency: dec.quoteCurrency,
|
|
108
|
+
referralFeeBps: dec.referralFeeBps,
|
|
109
|
+
emergencyMode: dec.emergencyMode,
|
|
110
|
+
autodeleverageEnabled: dec.autodeleverageEnabled,
|
|
111
|
+
borrowDisabled: dec.borrowDisabled,
|
|
112
|
+
priceRefreshTriggerToMaxAgePct: dec.priceRefreshTriggerToMaxAgePct,
|
|
113
|
+
liquidationMaxDebtCloseFactorPct: dec.liquidationMaxDebtCloseFactorPct,
|
|
114
|
+
insolvencyRiskUnhealthyLtvPct: dec.insolvencyRiskUnhealthyLtvPct,
|
|
115
|
+
minFullLiquidationValueThreshold: dec.minFullLiquidationValueThreshold,
|
|
116
|
+
maxLiquidatableDebtMarketValueAtOnce: dec.maxLiquidatableDebtMarketValueAtOnce,
|
|
117
|
+
globalUnhealthyBorrowValue: dec.globalUnhealthyBorrowValue,
|
|
118
|
+
globalAllowedBorrowValue: dec.globalAllowedBorrowValue,
|
|
119
|
+
riskCouncil: dec.riskCouncil,
|
|
120
|
+
multiplierPointsTagBoost: dec.multiplierPointsTagBoost,
|
|
121
|
+
elevationGroups: dec.elevationGroups.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => types.ElevationGroup.fromDecoded(item)),
|
|
122
|
+
elevationGroupPadding: dec.elevationGroupPadding,
|
|
123
|
+
padding1: dec.padding1,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
toJSON() {
|
|
127
|
+
return {
|
|
128
|
+
version: this.version.toString(),
|
|
129
|
+
bumpSeed: this.bumpSeed.toString(),
|
|
130
|
+
lendingMarketOwner: this.lendingMarketOwner.toString(),
|
|
131
|
+
lendingMarketOwnerCached: this.lendingMarketOwnerCached.toString(),
|
|
132
|
+
quoteCurrency: this.quoteCurrency,
|
|
133
|
+
referralFeeBps: this.referralFeeBps,
|
|
134
|
+
emergencyMode: this.emergencyMode,
|
|
135
|
+
autodeleverageEnabled: this.autodeleverageEnabled,
|
|
136
|
+
borrowDisabled: this.borrowDisabled,
|
|
137
|
+
priceRefreshTriggerToMaxAgePct: this.priceRefreshTriggerToMaxAgePct,
|
|
138
|
+
liquidationMaxDebtCloseFactorPct: this.liquidationMaxDebtCloseFactorPct,
|
|
139
|
+
insolvencyRiskUnhealthyLtvPct: this.insolvencyRiskUnhealthyLtvPct,
|
|
140
|
+
minFullLiquidationValueThreshold: this.minFullLiquidationValueThreshold.toString(),
|
|
141
|
+
maxLiquidatableDebtMarketValueAtOnce: this.maxLiquidatableDebtMarketValueAtOnce.toString(),
|
|
142
|
+
globalUnhealthyBorrowValue: this.globalUnhealthyBorrowValue.toString(),
|
|
143
|
+
globalAllowedBorrowValue: this.globalAllowedBorrowValue.toString(),
|
|
144
|
+
riskCouncil: this.riskCouncil.toString(),
|
|
145
|
+
multiplierPointsTagBoost: this.multiplierPointsTagBoost,
|
|
146
|
+
elevationGroups: this.elevationGroups.map((item) => item.toJSON()),
|
|
147
|
+
elevationGroupPadding: this.elevationGroupPadding.map((item) => item.toString()),
|
|
148
|
+
padding1: this.padding1.map((item) => item.toString()),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
static fromJSON(obj) {
|
|
152
|
+
return new LendingMarket({
|
|
153
|
+
version: new bn_js_1.default(obj.version),
|
|
154
|
+
bumpSeed: new bn_js_1.default(obj.bumpSeed),
|
|
155
|
+
lendingMarketOwner: new web3_js_1.PublicKey(obj.lendingMarketOwner),
|
|
156
|
+
lendingMarketOwnerCached: new web3_js_1.PublicKey(obj.lendingMarketOwnerCached),
|
|
157
|
+
quoteCurrency: obj.quoteCurrency,
|
|
158
|
+
referralFeeBps: obj.referralFeeBps,
|
|
159
|
+
emergencyMode: obj.emergencyMode,
|
|
160
|
+
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
161
|
+
borrowDisabled: obj.borrowDisabled,
|
|
162
|
+
priceRefreshTriggerToMaxAgePct: obj.priceRefreshTriggerToMaxAgePct,
|
|
163
|
+
liquidationMaxDebtCloseFactorPct: obj.liquidationMaxDebtCloseFactorPct,
|
|
164
|
+
insolvencyRiskUnhealthyLtvPct: obj.insolvencyRiskUnhealthyLtvPct,
|
|
165
|
+
minFullLiquidationValueThreshold: new bn_js_1.default(obj.minFullLiquidationValueThreshold),
|
|
166
|
+
maxLiquidatableDebtMarketValueAtOnce: new bn_js_1.default(obj.maxLiquidatableDebtMarketValueAtOnce),
|
|
167
|
+
globalUnhealthyBorrowValue: new bn_js_1.default(obj.globalUnhealthyBorrowValue),
|
|
168
|
+
globalAllowedBorrowValue: new bn_js_1.default(obj.globalAllowedBorrowValue),
|
|
169
|
+
riskCouncil: new web3_js_1.PublicKey(obj.riskCouncil),
|
|
170
|
+
multiplierPointsTagBoost: obj.multiplierPointsTagBoost,
|
|
171
|
+
elevationGroups: obj.elevationGroups.map((item) => types.ElevationGroup.fromJSON(item)),
|
|
172
|
+
elevationGroupPadding: obj.elevationGroupPadding.map((item) => new bn_js_1.default(item)),
|
|
173
|
+
padding1: obj.padding1.map((item) => new bn_js_1.default(item)),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.LendingMarket = LendingMarket;
|
|
178
|
+
LendingMarket.discriminator = Buffer.from([
|
|
179
|
+
246, 114, 50, 98, 72, 157, 28, 120,
|
|
180
|
+
]);
|
|
181
|
+
LendingMarket.layout = borsh.struct([
|
|
182
|
+
borsh.u64("version"),
|
|
183
|
+
borsh.u64("bumpSeed"),
|
|
184
|
+
borsh.publicKey("lendingMarketOwner"),
|
|
185
|
+
borsh.publicKey("lendingMarketOwnerCached"),
|
|
186
|
+
borsh.array(borsh.u8(), 32, "quoteCurrency"),
|
|
187
|
+
borsh.u16("referralFeeBps"),
|
|
188
|
+
borsh.u8("emergencyMode"),
|
|
189
|
+
borsh.u8("autodeleverageEnabled"),
|
|
190
|
+
borsh.u8("borrowDisabled"),
|
|
191
|
+
borsh.u8("priceRefreshTriggerToMaxAgePct"),
|
|
192
|
+
borsh.u8("liquidationMaxDebtCloseFactorPct"),
|
|
193
|
+
borsh.u8("insolvencyRiskUnhealthyLtvPct"),
|
|
194
|
+
borsh.u64("minFullLiquidationValueThreshold"),
|
|
195
|
+
borsh.u64("maxLiquidatableDebtMarketValueAtOnce"),
|
|
196
|
+
borsh.u64("globalUnhealthyBorrowValue"),
|
|
197
|
+
borsh.u64("globalAllowedBorrowValue"),
|
|
198
|
+
borsh.publicKey("riskCouncil"),
|
|
199
|
+
borsh.array(borsh.u8(), 8, "multiplierPointsTagBoost"),
|
|
200
|
+
borsh.array(types.ElevationGroup.layout(), 32, "elevationGroups"),
|
|
201
|
+
borsh.array(borsh.u64(), 90, "elevationGroupPadding"),
|
|
202
|
+
borsh.array(borsh.u64(), 180, "padding1"),
|
|
203
|
+
]);
|
|
204
|
+
//# sourceMappingURL=LendingMarket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LendingMarket.js","sourceRoot":"","sources":["../../../src/idl_codegen/accounts/LendingMarket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuD;AACvD,kDAAsB,CAAC,wDAAwD;AAC/E,wDAAyC,CAAC,wDAAwD;AAClG,gDAAiC,CAAC,wDAAwD;AAC1F,4CAAyC;AAkGzC,MAAa,aAAa;IA2ExB,YAAY,MAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;QAC/B,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAA;QACnD,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,wBAAwB,CAAA;QAC/D,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;QAC3C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAA;QACzD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;QAC3C,IAAI,CAAC,8BAA8B,GAAG,MAAM,CAAC,8BAA8B,CAAA;QAC3E,IAAI,CAAC,gCAAgC;YACnC,MAAM,CAAC,gCAAgC,CAAA;QACzC,IAAI,CAAC,6BAA6B,GAAG,MAAM,CAAC,6BAA6B,CAAA;QACzE,IAAI,CAAC,gCAAgC;YACnC,MAAM,CAAC,gCAAgC,CAAA;QACzC,IAAI,CAAC,oCAAoC;YACvC,MAAM,CAAC,oCAAoC,CAAA;QAC7C,IAAI,CAAC,0BAA0B,GAAG,MAAM,CAAC,0BAA0B,CAAA;QACnE,IAAI,CAAC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,+BAA+B,CAAC;IACzC,KAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC;IAC7C,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC;IACjD,KAAK,CAAC,GAAG,CAAC,4BAA4B,CAAC;IACvC,KAAK,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACrC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAC9B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,0BAA0B,CAAC;IACtD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,iBAAiB,CAAC;IACjE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,uBAAuB,CAAC;IACrD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC;CAC1C,CAAC,CAAA","sourcesContent":["import { PublicKey, Connection } from \"@solana/web3.js\"\nimport BN from \"bn.js\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as borsh from \"@coral-xyz/borsh\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as types from \"../types\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport { PROGRAM_ID } from \"../programId\"\n\nexport interface LendingMarketFields {\n /** Version of lending market */\n version: BN\n /** Bump seed for derived authority address */\n bumpSeed: BN\n /** Owner authority which can add new reserves */\n lendingMarketOwner: PublicKey\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n lendingMarketOwnerCached: PublicKey\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n referralFeeBps: number\n emergencyMode: number\n autodeleverageEnabled: number\n /** Padding used for alignment */\n borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n minFullLiquidationValueThreshold: BN\n /** Max allowed liquidation value in one ix call */\n maxLiquidatableDebtMarketValueAtOnce: BN\n /** Global maximum unhealthy borrow value allowed for any obligation */\n globalUnhealthyBorrowValue: BN\n /** Global maximum allowed borrow value allowed for any obligation */\n globalAllowedBorrowValue: BN\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n riskCouncil: PublicKey\n /** Reward points multiplier per obligation type */\n multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n elevationGroups: Array<types.ElevationGroupFields>\n elevationGroupPadding: Array<BN>\n padding1: Array<BN>\n}\n\nexport interface LendingMarketJSON {\n /** Version of lending market */\n version: string\n /** Bump seed for derived authority address */\n bumpSeed: string\n /** Owner authority which can add new reserves */\n lendingMarketOwner: string\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n lendingMarketOwnerCached: string\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n referralFeeBps: number\n emergencyMode: number\n autodeleverageEnabled: number\n /** Padding used for alignment */\n borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n minFullLiquidationValueThreshold: string\n /** Max allowed liquidation value in one ix call */\n maxLiquidatableDebtMarketValueAtOnce: string\n /** Global maximum unhealthy borrow value allowed for any obligation */\n globalUnhealthyBorrowValue: string\n /** Global maximum allowed borrow value allowed for any obligation */\n globalAllowedBorrowValue: string\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n riskCouncil: string\n /** Reward points multiplier per obligation type */\n multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n elevationGroups: Array<types.ElevationGroupJSON>\n elevationGroupPadding: Array<string>\n padding1: Array<string>\n}\n\nexport class LendingMarket {\n /** Version of lending market */\n readonly version: BN\n /** Bump seed for derived authority address */\n readonly bumpSeed: BN\n /** Owner authority which can add new reserves */\n readonly lendingMarketOwner: PublicKey\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n readonly lendingMarketOwnerCached: PublicKey\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n readonly quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n readonly referralFeeBps: number\n readonly emergencyMode: number\n readonly autodeleverageEnabled: number\n /** Padding used for alignment */\n readonly borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n readonly priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n readonly liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n readonly insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n readonly minFullLiquidationValueThreshold: BN\n /** Max allowed liquidation value in one ix call */\n readonly maxLiquidatableDebtMarketValueAtOnce: BN\n /** Global maximum unhealthy borrow value allowed for any obligation */\n readonly globalUnhealthyBorrowValue: BN\n /** Global maximum allowed borrow value allowed for any obligation */\n readonly globalAllowedBorrowValue: BN\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n readonly riskCouncil: PublicKey\n /** Reward points multiplier per obligation type */\n readonly multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n readonly elevationGroups: Array<types.ElevationGroup>\n readonly elevationGroupPadding: Array<BN>\n readonly padding1: Array<BN>\n\n static readonly discriminator = Buffer.from([\n 246, 114, 50, 98, 72, 157, 28, 120,\n ])\n\n static readonly layout = borsh.struct([\n borsh.u64(\"version\"),\n borsh.u64(\"bumpSeed\"),\n borsh.publicKey(\"lendingMarketOwner\"),\n borsh.publicKey(\"lendingMarketOwnerCached\"),\n borsh.array(borsh.u8(), 32, \"quoteCurrency\"),\n borsh.u16(\"referralFeeBps\"),\n borsh.u8(\"emergencyMode\"),\n borsh.u8(\"autodeleverageEnabled\"),\n borsh.u8(\"borrowDisabled\"),\n borsh.u8(\"priceRefreshTriggerToMaxAgePct\"),\n borsh.u8(\"liquidationMaxDebtCloseFactorPct\"),\n borsh.u8(\"insolvencyRiskUnhealthyLtvPct\"),\n borsh.u64(\"minFullLiquidationValueThreshold\"),\n borsh.u64(\"maxLiquidatableDebtMarketValueAtOnce\"),\n borsh.u64(\"globalUnhealthyBorrowValue\"),\n borsh.u64(\"globalAllowedBorrowValue\"),\n borsh.publicKey(\"riskCouncil\"),\n borsh.array(borsh.u8(), 8, \"multiplierPointsTagBoost\"),\n borsh.array(types.ElevationGroup.layout(), 32, \"elevationGroups\"),\n borsh.array(borsh.u64(), 90, \"elevationGroupPadding\"),\n borsh.array(borsh.u64(), 180, \"padding1\"),\n ])\n\n constructor(fields: LendingMarketFields) {\n this.version = fields.version\n this.bumpSeed = fields.bumpSeed\n this.lendingMarketOwner = fields.lendingMarketOwner\n this.lendingMarketOwnerCached = fields.lendingMarketOwnerCached\n this.quoteCurrency = fields.quoteCurrency\n this.referralFeeBps = fields.referralFeeBps\n this.emergencyMode = fields.emergencyMode\n this.autodeleverageEnabled = fields.autodeleverageEnabled\n this.borrowDisabled = fields.borrowDisabled\n this.priceRefreshTriggerToMaxAgePct = fields.priceRefreshTriggerToMaxAgePct\n this.liquidationMaxDebtCloseFactorPct =\n fields.liquidationMaxDebtCloseFactorPct\n this.insolvencyRiskUnhealthyLtvPct = fields.insolvencyRiskUnhealthyLtvPct\n this.minFullLiquidationValueThreshold =\n fields.minFullLiquidationValueThreshold\n this.maxLiquidatableDebtMarketValueAtOnce =\n fields.maxLiquidatableDebtMarketValueAtOnce\n this.globalUnhealthyBorrowValue = fields.globalUnhealthyBorrowValue\n this.globalAllowedBorrowValue = fields.globalAllowedBorrowValue\n this.riskCouncil = fields.riskCouncil\n this.multiplierPointsTagBoost = fields.multiplierPointsTagBoost\n this.elevationGroups = fields.elevationGroups.map(\n (item) => new types.ElevationGroup({ ...item })\n )\n this.elevationGroupPadding = fields.elevationGroupPadding\n this.padding1 = fields.padding1\n }\n\n static async fetch(\n c: Connection,\n address: PublicKey,\n programId: PublicKey = PROGRAM_ID\n ): Promise<LendingMarket | null> {\n const info = await c.getAccountInfo(address)\n\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n }\n\n static async fetchMultiple(\n c: Connection,\n addresses: PublicKey[],\n programId: PublicKey = PROGRAM_ID\n ): Promise<Array<LendingMarket | null>> {\n const infos = await c.getMultipleAccountsInfo(addresses)\n\n return infos.map((info) => {\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n })\n }\n\n static decode(data: Buffer): LendingMarket {\n if (!data.slice(0, 8).equals(LendingMarket.discriminator)) {\n throw new Error(\"invalid account discriminator\")\n }\n\n const dec = LendingMarket.layout.decode(data.slice(8))\n\n return new LendingMarket({\n version: dec.version,\n bumpSeed: dec.bumpSeed,\n lendingMarketOwner: dec.lendingMarketOwner,\n lendingMarketOwnerCached: dec.lendingMarketOwnerCached,\n quoteCurrency: dec.quoteCurrency,\n referralFeeBps: dec.referralFeeBps,\n emergencyMode: dec.emergencyMode,\n autodeleverageEnabled: dec.autodeleverageEnabled,\n borrowDisabled: dec.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: dec.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: dec.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: dec.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold: dec.minFullLiquidationValueThreshold,\n maxLiquidatableDebtMarketValueAtOnce:\n dec.maxLiquidatableDebtMarketValueAtOnce,\n globalUnhealthyBorrowValue: dec.globalUnhealthyBorrowValue,\n globalAllowedBorrowValue: dec.globalAllowedBorrowValue,\n riskCouncil: dec.riskCouncil,\n multiplierPointsTagBoost: dec.multiplierPointsTagBoost,\n elevationGroups: dec.elevationGroups.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ElevationGroup.fromDecoded(item)\n ),\n elevationGroupPadding: dec.elevationGroupPadding,\n padding1: dec.padding1,\n })\n }\n\n toJSON(): LendingMarketJSON {\n return {\n version: this.version.toString(),\n bumpSeed: this.bumpSeed.toString(),\n lendingMarketOwner: this.lendingMarketOwner.toString(),\n lendingMarketOwnerCached: this.lendingMarketOwnerCached.toString(),\n quoteCurrency: this.quoteCurrency,\n referralFeeBps: this.referralFeeBps,\n emergencyMode: this.emergencyMode,\n autodeleverageEnabled: this.autodeleverageEnabled,\n borrowDisabled: this.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: this.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: this.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: this.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold:\n this.minFullLiquidationValueThreshold.toString(),\n maxLiquidatableDebtMarketValueAtOnce:\n this.maxLiquidatableDebtMarketValueAtOnce.toString(),\n globalUnhealthyBorrowValue: this.globalUnhealthyBorrowValue.toString(),\n globalAllowedBorrowValue: this.globalAllowedBorrowValue.toString(),\n riskCouncil: this.riskCouncil.toString(),\n multiplierPointsTagBoost: this.multiplierPointsTagBoost,\n elevationGroups: this.elevationGroups.map((item) => item.toJSON()),\n elevationGroupPadding: this.elevationGroupPadding.map((item) =>\n item.toString()\n ),\n padding1: this.padding1.map((item) => item.toString()),\n }\n }\n\n static fromJSON(obj: LendingMarketJSON): LendingMarket {\n return new LendingMarket({\n version: new BN(obj.version),\n bumpSeed: new BN(obj.bumpSeed),\n lendingMarketOwner: new PublicKey(obj.lendingMarketOwner),\n lendingMarketOwnerCached: new PublicKey(obj.lendingMarketOwnerCached),\n quoteCurrency: obj.quoteCurrency,\n referralFeeBps: obj.referralFeeBps,\n emergencyMode: obj.emergencyMode,\n autodeleverageEnabled: obj.autodeleverageEnabled,\n borrowDisabled: obj.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: obj.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: obj.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: obj.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold: new BN(\n obj.minFullLiquidationValueThreshold\n ),\n maxLiquidatableDebtMarketValueAtOnce: new BN(\n obj.maxLiquidatableDebtMarketValueAtOnce\n ),\n globalUnhealthyBorrowValue: new BN(obj.globalUnhealthyBorrowValue),\n globalAllowedBorrowValue: new BN(obj.globalAllowedBorrowValue),\n riskCouncil: new PublicKey(obj.riskCouncil),\n multiplierPointsTagBoost: obj.multiplierPointsTagBoost,\n elevationGroups: obj.elevationGroups.map((item) =>\n types.ElevationGroup.fromJSON(item)\n ),\n elevationGroupPadding: obj.elevationGroupPadding.map(\n (item) => new BN(item)\n ),\n padding1: obj.padding1.map((item) => new BN(item)),\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { PublicKey, Connection } from "@solana/web3.js";
|
|
3
|
+
import BN from "bn.js";
|
|
4
|
+
import * as types from "../types";
|
|
5
|
+
export interface ObligationFields {
|
|
6
|
+
/** Version of the struct */
|
|
7
|
+
tag: BN;
|
|
8
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
9
|
+
lastUpdate: types.LastUpdateFields;
|
|
10
|
+
/** Lending market address */
|
|
11
|
+
lendingMarket: PublicKey;
|
|
12
|
+
/** Owner authority which can borrow liquidity */
|
|
13
|
+
owner: PublicKey;
|
|
14
|
+
/**
|
|
15
|
+
* TODO: Does this break the stack size when copied onto the stack, if too big?
|
|
16
|
+
* Deposited collateral for the obligation, unique by deposit reserve address
|
|
17
|
+
*/
|
|
18
|
+
deposits: Array<types.ObligationCollateralFields>;
|
|
19
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
20
|
+
lowestReserveDepositLtv: BN;
|
|
21
|
+
/** Market value of deposits (scaled fraction) */
|
|
22
|
+
depositedValueSf: BN;
|
|
23
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
24
|
+
borrows: Array<types.ObligationLiquidityFields>;
|
|
25
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
26
|
+
borrowFactorAdjustedDebtValueSf: BN;
|
|
27
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
28
|
+
borrowedAssetsMarketValueSf: BN;
|
|
29
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
30
|
+
allowedBorrowValueSf: BN;
|
|
31
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
32
|
+
unhealthyBorrowValueSf: BN;
|
|
33
|
+
/** The asset tier of the deposits */
|
|
34
|
+
depositsAssetTiers: Array<number>;
|
|
35
|
+
/** The asset tier of the borrows */
|
|
36
|
+
borrowsAssetTiers: Array<number>;
|
|
37
|
+
/** The elevation group id the obligation opted into. */
|
|
38
|
+
elevationGroup: number;
|
|
39
|
+
/** The number of deprecated reserves the obligation has a deposit */
|
|
40
|
+
numOfObsoleteReserves: number;
|
|
41
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
42
|
+
hasDebt: number;
|
|
43
|
+
/** Wallet address of the referrer */
|
|
44
|
+
referrer: PublicKey;
|
|
45
|
+
padding3: Array<BN>;
|
|
46
|
+
}
|
|
47
|
+
export interface ObligationJSON {
|
|
48
|
+
/** Version of the struct */
|
|
49
|
+
tag: string;
|
|
50
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
51
|
+
lastUpdate: types.LastUpdateJSON;
|
|
52
|
+
/** Lending market address */
|
|
53
|
+
lendingMarket: string;
|
|
54
|
+
/** Owner authority which can borrow liquidity */
|
|
55
|
+
owner: string;
|
|
56
|
+
/**
|
|
57
|
+
* TODO: Does this break the stack size when copied onto the stack, if too big?
|
|
58
|
+
* Deposited collateral for the obligation, unique by deposit reserve address
|
|
59
|
+
*/
|
|
60
|
+
deposits: Array<types.ObligationCollateralJSON>;
|
|
61
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
62
|
+
lowestReserveDepositLtv: string;
|
|
63
|
+
/** Market value of deposits (scaled fraction) */
|
|
64
|
+
depositedValueSf: string;
|
|
65
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
66
|
+
borrows: Array<types.ObligationLiquidityJSON>;
|
|
67
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
68
|
+
borrowFactorAdjustedDebtValueSf: string;
|
|
69
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
70
|
+
borrowedAssetsMarketValueSf: string;
|
|
71
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
72
|
+
allowedBorrowValueSf: string;
|
|
73
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
74
|
+
unhealthyBorrowValueSf: string;
|
|
75
|
+
/** The asset tier of the deposits */
|
|
76
|
+
depositsAssetTiers: Array<number>;
|
|
77
|
+
/** The asset tier of the borrows */
|
|
78
|
+
borrowsAssetTiers: Array<number>;
|
|
79
|
+
/** The elevation group id the obligation opted into. */
|
|
80
|
+
elevationGroup: number;
|
|
81
|
+
/** The number of deprecated reserves the obligation has a deposit */
|
|
82
|
+
numOfObsoleteReserves: number;
|
|
83
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
84
|
+
hasDebt: number;
|
|
85
|
+
/** Wallet address of the referrer */
|
|
86
|
+
referrer: string;
|
|
87
|
+
padding3: Array<string>;
|
|
88
|
+
}
|
|
89
|
+
/** Lending market obligation state */
|
|
90
|
+
export declare class Obligation {
|
|
91
|
+
/** Version of the struct */
|
|
92
|
+
readonly tag: BN;
|
|
93
|
+
/** Last update to collateral, liquidity, or their market values */
|
|
94
|
+
readonly lastUpdate: types.LastUpdate;
|
|
95
|
+
/** Lending market address */
|
|
96
|
+
readonly lendingMarket: PublicKey;
|
|
97
|
+
/** Owner authority which can borrow liquidity */
|
|
98
|
+
readonly owner: PublicKey;
|
|
99
|
+
/**
|
|
100
|
+
* TODO: Does this break the stack size when copied onto the stack, if too big?
|
|
101
|
+
* Deposited collateral for the obligation, unique by deposit reserve address
|
|
102
|
+
*/
|
|
103
|
+
readonly deposits: Array<types.ObligationCollateral>;
|
|
104
|
+
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
105
|
+
readonly lowestReserveDepositLtv: BN;
|
|
106
|
+
/** Market value of deposits (scaled fraction) */
|
|
107
|
+
readonly depositedValueSf: BN;
|
|
108
|
+
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
109
|
+
readonly borrows: Array<types.ObligationLiquidity>;
|
|
110
|
+
/** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */
|
|
111
|
+
readonly borrowFactorAdjustedDebtValueSf: BN;
|
|
112
|
+
/** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */
|
|
113
|
+
readonly borrowedAssetsMarketValueSf: BN;
|
|
114
|
+
/** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */
|
|
115
|
+
readonly allowedBorrowValueSf: BN;
|
|
116
|
+
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
117
|
+
readonly unhealthyBorrowValueSf: BN;
|
|
118
|
+
/** The asset tier of the deposits */
|
|
119
|
+
readonly depositsAssetTiers: Array<number>;
|
|
120
|
+
/** The asset tier of the borrows */
|
|
121
|
+
readonly borrowsAssetTiers: Array<number>;
|
|
122
|
+
/** The elevation group id the obligation opted into. */
|
|
123
|
+
readonly elevationGroup: number;
|
|
124
|
+
/** The number of deprecated reserves the obligation has a deposit */
|
|
125
|
+
readonly numOfObsoleteReserves: number;
|
|
126
|
+
/** Marked = 1 if borrows array is not empty, 0 = borrows empty */
|
|
127
|
+
readonly hasDebt: number;
|
|
128
|
+
/** Wallet address of the referrer */
|
|
129
|
+
readonly referrer: PublicKey;
|
|
130
|
+
readonly padding3: Array<BN>;
|
|
131
|
+
static readonly discriminator: Buffer;
|
|
132
|
+
static readonly layout: any;
|
|
133
|
+
constructor(fields: ObligationFields);
|
|
134
|
+
static fetch(c: Connection, address: PublicKey, programId?: PublicKey): Promise<Obligation | null>;
|
|
135
|
+
static fetchMultiple(c: Connection, addresses: PublicKey[], programId?: PublicKey): Promise<Array<Obligation | null>>;
|
|
136
|
+
static decode(data: Buffer): Obligation;
|
|
137
|
+
toJSON(): ObligationJSON;
|
|
138
|
+
static fromJSON(obj: ObligationJSON): Obligation;
|
|
139
|
+
}
|