@exponent-labs/klend-idl 0.9.25 → 0.9.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/accounts/GlobalConfig.d.ts +27 -0
- package/build/accounts/GlobalConfig.js +112 -0
- package/build/accounts/GlobalConfig.js.map +1 -0
- package/build/accounts/LendingMarket.d.ts +94 -12
- package/build/accounts/LendingMarket.js +219 -27
- package/build/accounts/LendingMarket.js.map +1 -1
- package/build/accounts/Obligation.d.ts +34 -12
- package/build/accounts/Obligation.js +86 -27
- package/build/accounts/Obligation.js.map +1 -1
- package/build/accounts/ReferrerState.d.ts +1 -3
- package/build/accounts/ReferrerState.js +24 -9
- package/build/accounts/ReferrerState.js.map +1 -1
- package/build/accounts/ReferrerTokenState.d.ts +1 -3
- package/build/accounts/ReferrerTokenState.js +20 -8
- package/build/accounts/ReferrerTokenState.js.map +1 -1
- package/build/accounts/Reserve.d.ts +4 -3
- package/build/accounts/Reserve.js +25 -9
- package/build/accounts/Reserve.js.map +1 -1
- package/build/accounts/ShortUrl.d.ts +1 -3
- package/build/accounts/ShortUrl.js +24 -9
- package/build/accounts/ShortUrl.js.map +1 -1
- package/build/accounts/UserMetadata.d.ts +1 -3
- package/build/accounts/UserMetadata.js +20 -8
- package/build/accounts/UserMetadata.js.map +1 -1
- package/build/accounts/UserState.d.ts +1 -3
- package/build/accounts/UserState.js +20 -8
- package/build/accounts/UserState.js.map +1 -1
- package/build/accounts/WithdrawTicket.d.ts +49 -0
- package/build/accounts/WithdrawTicket.js +158 -0
- package/build/accounts/WithdrawTicket.js.map +1 -0
- package/build/accounts/index.d.ts +4 -0
- package/build/accounts/index.js +5 -1
- package/build/accounts/index.js.map +1 -1
- package/build/errors/anchor.js +2 -2
- package/build/errors/anchor.js.map +1 -1
- package/build/errors/custom.d.ts +605 -13
- package/build/errors/custom.js +1064 -27
- package/build/errors/custom.js.map +1 -1
- package/build/errors/index.js +19 -10
- package/build/errors/index.js.map +1 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +20 -14
- package/build/index.js.map +1 -1
- package/build/instructions/abortObligationOwnershipTransfer.d.ts +7 -0
- package/build/instructions/abortObligationOwnershipTransfer.js +21 -0
- package/build/instructions/abortObligationOwnershipTransfer.js.map +1 -0
- package/build/instructions/acceptObligationOwnership.d.ts +7 -0
- package/build/instructions/acceptObligationOwnership.js +21 -0
- package/build/instructions/acceptObligationOwnership.js.map +1 -0
- package/build/instructions/approveObligationOwnershipTransfer.d.ts +9 -0
- package/build/instructions/approveObligationOwnershipTransfer.js +23 -0
- package/build/instructions/approveObligationOwnershipTransfer.js.map +1 -0
- package/build/instructions/borrowObligationLiquidity.d.ts +1 -1
- package/build/instructions/borrowObligationLiquidity.js +28 -11
- package/build/instructions/borrowObligationLiquidity.js.map +1 -1
- package/build/instructions/borrowObligationLiquidityV2.js +45 -15
- package/build/instructions/borrowObligationLiquidityV2.js.map +1 -1
- package/build/instructions/calculateCtokenExchangeRate.d.ts +5 -0
- package/build/instructions/calculateCtokenExchangeRate.js +15 -0
- package/build/instructions/calculateCtokenExchangeRate.js.map +1 -0
- package/build/instructions/cancelWithdrawTicket.d.ts +19 -0
- package/build/instructions/cancelWithdrawTicket.js +87 -0
- package/build/instructions/cancelWithdrawTicket.js.map +1 -0
- package/build/instructions/cloneReserveConfig.d.ts +14 -0
- package/build/instructions/cloneReserveConfig.js +70 -0
- package/build/instructions/cloneReserveConfig.js.map +1 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.js +1 -2
- package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -1
- package/build/instructions/depositAndWithdraw.d.ts +51 -0
- package/build/instructions/depositAndWithdraw.js +202 -0
- package/build/instructions/depositAndWithdraw.js.map +1 -0
- package/build/instructions/depositObligationCollateral.js +19 -9
- package/build/instructions/depositObligationCollateral.js.map +1 -1
- package/build/instructions/depositObligationCollateralV2.d.ts +25 -0
- package/build/instructions/depositObligationCollateralV2.js +109 -0
- package/build/instructions/depositObligationCollateralV2.js.map +1 -0
- package/build/instructions/depositReserveLiquidity.js +20 -10
- package/build/instructions/depositReserveLiquidity.js.map +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +28 -15
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +45 -15
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -1
- package/build/instructions/enqueueToWithdraw.d.ts +26 -0
- package/build/instructions/enqueueToWithdraw.js +113 -0
- package/build/instructions/enqueueToWithdraw.js.map +1 -0
- package/build/instructions/fillBorrowOrder.d.ts +25 -0
- package/build/instructions/fillBorrowOrder.js +82 -0
- package/build/instructions/fillBorrowOrder.js.map +1 -0
- package/build/instructions/fillBorrowOrderV2.d.ts +29 -0
- package/build/instructions/fillBorrowOrderV2.js +122 -0
- package/build/instructions/fillBorrowOrderV2.js.map +1 -0
- package/build/instructions/flashBorrowReserveLiquidity.d.ts +2 -2
- package/build/instructions/flashBorrowReserveLiquidity.js +28 -11
- package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -1
- package/build/instructions/flashRepayReserveLiquidity.d.ts +2 -2
- package/build/instructions/flashRepayReserveLiquidity.js +32 -12
- package/build/instructions/flashRepayReserveLiquidity.js.map +1 -1
- package/build/instructions/idlMissingTypes.d.ts +3 -2
- package/build/instructions/idlMissingTypes.js +26 -12
- package/build/instructions/idlMissingTypes.js.map +1 -1
- package/build/instructions/index.d.ts +61 -3
- package/build/instructions/index.js +62 -3
- package/build/instructions/index.js.map +1 -1
- package/build/instructions/initFarmsForReserve.d.ts +1 -0
- package/build/instructions/initFarmsForReserve.js +25 -10
- package/build/instructions/initFarmsForReserve.js.map +1 -1
- package/build/instructions/initGlobalConfig.d.ts +10 -0
- package/build/instructions/initGlobalConfig.js +24 -0
- package/build/instructions/initGlobalConfig.js.map +1 -0
- package/build/instructions/initLendingMarket.d.ts +1 -0
- package/build/instructions/initLendingMarket.js +27 -10
- package/build/instructions/initLendingMarket.js.map +1 -1
- package/build/instructions/initObligation.js +19 -9
- package/build/instructions/initObligation.js.map +1 -1
- package/build/instructions/initObligationFarmsForReserve.js +20 -10
- package/build/instructions/initObligationFarmsForReserve.js.map +1 -1
- package/build/instructions/initReferrerStateAndShortUrl.js +19 -9
- package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -1
- package/build/instructions/initReferrerTokenState.d.ts +2 -5
- package/build/instructions/initReferrerTokenState.js +4 -33
- package/build/instructions/initReferrerTokenState.js.map +1 -1
- package/build/instructions/initReserve.d.ts +3 -1
- package/build/instructions/initReserve.js +12 -3
- package/build/instructions/initReserve.js.map +1 -1
- package/build/instructions/initUserMetadata.d.ts +1 -1
- package/build/instructions/initUserMetadata.js +27 -14
- package/build/instructions/initUserMetadata.js.map +1 -1
- package/build/instructions/initiateObligationOwnershipTransfer.d.ts +11 -0
- package/build/instructions/initiateObligationOwnershipTransfer.js +61 -0
- package/build/instructions/initiateObligationOwnershipTransfer.js.map +1 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +21 -11
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
- package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +42 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +172 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -0
- package/build/instructions/markObligationForDeleveraging.d.ts +12 -0
- package/build/instructions/markObligationForDeleveraging.js +62 -0
- package/build/instructions/markObligationForDeleveraging.js.map +1 -0
- package/build/instructions/recoverInvalidTicketCollateral.d.ts +20 -0
- package/build/instructions/recoverInvalidTicketCollateral.js +89 -0
- package/build/instructions/recoverInvalidTicketCollateral.js.map +1 -0
- package/build/instructions/redeemFees.js +2 -3
- package/build/instructions/redeemFees.js.map +1 -1
- package/build/instructions/redeemReserveCollateral.js +20 -10
- package/build/instructions/redeemReserveCollateral.js.map +1 -1
- package/build/instructions/refreshObligation.js +1 -2
- package/build/instructions/refreshObligation.js.map +1 -1
- package/build/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
- package/build/instructions/refreshObligationFarmsForReserve.js +42 -16
- package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -1
- package/build/instructions/refreshReserve.d.ts +4 -4
- package/build/instructions/refreshReserve.js +12 -14
- package/build/instructions/refreshReserve.js.map +1 -1
- package/build/instructions/refreshReservesBatch.js +19 -9
- package/build/instructions/refreshReservesBatch.js.map +1 -1
- package/build/instructions/repayAndWithdrawAndRedeem.d.ts +46 -0
- package/build/instructions/repayAndWithdrawAndRedeem.js +177 -0
- package/build/instructions/repayAndWithdrawAndRedeem.js.map +1 -0
- package/build/instructions/repayObligationLiquidity.js +20 -10
- package/build/instructions/repayObligationLiquidity.js.map +1 -1
- package/build/instructions/repayObligationLiquidityV2.js +50 -16
- package/build/instructions/repayObligationLiquidityV2.js.map +1 -1
- package/build/instructions/requestElevationGroup.js +19 -9
- package/build/instructions/requestElevationGroup.js.map +1 -1
- package/build/instructions/rolloverFixedTermBorrow.d.ts +25 -0
- package/build/instructions/rolloverFixedTermBorrow.js +76 -0
- package/build/instructions/rolloverFixedTermBorrow.js.map +1 -0
- package/build/instructions/seedDepositOnInitReserve.d.ts +11 -0
- package/build/instructions/seedDepositOnInitReserve.js +37 -0
- package/build/instructions/seedDepositOnInitReserve.js.map +1 -0
- package/build/instructions/setBorrowOrder.d.ts +20 -0
- package/build/instructions/setBorrowOrder.js +76 -0
- package/build/instructions/setBorrowOrder.js.map +1 -0
- package/build/instructions/setBorrowOrderV2.d.ts +21 -0
- package/build/instructions/setBorrowOrderV2.js +78 -0
- package/build/instructions/setBorrowOrderV2.js.map +1 -0
- package/build/instructions/setObligationOrder.d.ts +13 -0
- package/build/instructions/setObligationOrder.js +62 -0
- package/build/instructions/setObligationOrder.js.map +1 -0
- package/build/instructions/socializeLoss.d.ts +1 -1
- package/build/instructions/socializeLoss.js +20 -10
- package/build/instructions/socializeLoss.js.map +1 -1
- package/build/instructions/socializeLossV2.d.ts +22 -0
- package/build/instructions/socializeLossV2.js +94 -0
- package/build/instructions/socializeLossV2.js.map +1 -0
- package/build/instructions/topupReserveRewards.d.ts +16 -0
- package/build/instructions/topupReserveRewards.js +73 -0
- package/build/instructions/topupReserveRewards.js.map +1 -0
- package/build/instructions/updateGlobalConfig.d.ts +13 -0
- package/build/instructions/updateGlobalConfig.js +66 -0
- package/build/instructions/updateGlobalConfig.js.map +1 -0
- package/build/instructions/updateGlobalConfigAdmin.d.ts +7 -0
- package/build/instructions/updateGlobalConfigAdmin.js +21 -0
- package/build/instructions/updateGlobalConfigAdmin.js.map +1 -0
- package/build/instructions/updateLendingMarket.d.ts +2 -1
- package/build/instructions/updateLendingMarket.js +29 -11
- package/build/instructions/updateLendingMarket.js.map +1 -1
- package/build/instructions/updateLendingMarketOwner.d.ts +1 -0
- package/build/instructions/updateLendingMarketOwner.js +6 -2
- package/build/instructions/updateLendingMarketOwner.js.map +1 -1
- package/build/instructions/updateObligationConfig.d.ts +15 -0
- package/build/instructions/updateObligationConfig.js +71 -0
- package/build/instructions/updateObligationConfig.js.map +1 -0
- package/build/instructions/updateReserveConfig.d.ts +6 -4
- package/build/instructions/updateReserveConfig.js +34 -13
- package/build/instructions/updateReserveConfig.js.map +1 -1
- package/build/instructions/withdrawObligationCollateral.js +20 -10
- package/build/instructions/withdrawObligationCollateral.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +28 -15
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +40 -14
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralV2.d.ts +25 -0
- package/build/instructions/withdrawObligationCollateralV2.js +109 -0
- package/build/instructions/withdrawObligationCollateralV2.js.map +1 -0
- package/build/instructions/withdrawProtocolFee.d.ts +3 -2
- package/build/instructions/withdrawProtocolFee.js +25 -14
- package/build/instructions/withdrawProtocolFee.js.map +1 -1
- package/build/instructions/withdrawQueuedLiquidity.d.ts +23 -0
- package/build/instructions/withdrawQueuedLiquidity.js +80 -0
- package/build/instructions/withdrawQueuedLiquidity.js.map +1 -0
- package/build/instructions/withdrawReferrerFees.js +2 -3
- package/build/instructions/withdrawReferrerFees.js.map +1 -1
- package/build/kamino_lending.d.ts +5753 -2295
- package/build/kamino_lending.js +5 -3936
- package/build/kamino_lending.js.map +1 -1
- package/build/kamino_lending.json +1856 -645
- package/build/types/AssetTier.js +21 -11
- package/build/types/AssetTier.js.map +1 -1
- package/build/types/BigFractionBytes.d.ts +2 -1
- package/build/types/BigFractionBytes.js +21 -8
- package/build/types/BigFractionBytes.js.map +1 -1
- package/build/types/BorrowOrder.d.ts +83 -0
- package/build/types/BorrowOrder.js +164 -0
- package/build/types/BorrowOrder.js.map +1 -0
- package/build/types/BorrowOrderConfigArgs.d.ts +42 -0
- package/build/types/BorrowOrderConfigArgs.js +107 -0
- package/build/types/BorrowOrderConfigArgs.js.map +1 -0
- package/build/types/BorrowRateCurve.js +17 -7
- package/build/types/BorrowRateCurve.js.map +1 -1
- package/build/types/CurvePoint.d.ts +2 -1
- package/build/types/CurvePoint.js +17 -7
- package/build/types/CurvePoint.js.map +1 -1
- package/build/types/ElevationGroup.d.ts +2 -1
- package/build/types/ElevationGroup.js +17 -7
- package/build/types/ElevationGroup.js.map +1 -1
- package/build/types/ExchangeRateWithDecimals.d.ts +27 -0
- package/build/types/ExchangeRateWithDecimals.js +82 -0
- package/build/types/ExchangeRateWithDecimals.js.map +1 -0
- package/build/types/FeeCalculation.js +25 -12
- package/build/types/FeeCalculation.js.map +1 -1
- package/build/types/FixedTermBorrowRolloverConfig.d.ts +47 -0
- package/build/types/FixedTermBorrowRolloverConfig.js +114 -0
- package/build/types/FixedTermBorrowRolloverConfig.js.map +1 -0
- package/build/types/InitObligationArgs.d.ts +2 -1
- package/build/types/InitObligationArgs.js +17 -7
- package/build/types/InitObligationArgs.js.map +1 -1
- package/build/types/LastUpdate.d.ts +12 -6
- package/build/types/LastUpdate.js +36 -14
- package/build/types/LastUpdate.js.map +1 -1
- package/build/types/ObligationCollateral.js +17 -7
- package/build/types/ObligationCollateral.js.map +1 -1
- package/build/types/ObligationLiquidity.d.ts +29 -5
- package/build/types/ObligationLiquidity.js +42 -15
- package/build/types/ObligationLiquidity.js.map +1 -1
- package/build/types/ObligationOrder.d.ts +57 -0
- package/build/types/ObligationOrder.js +127 -0
- package/build/types/ObligationOrder.js.map +1 -0
- package/build/types/PriceHeuristic.js +17 -7
- package/build/types/PriceHeuristic.js.map +1 -1
- package/build/types/ProgressCallbackType.d.ts +31 -0
- package/build/types/ProgressCallbackType.js +108 -0
- package/build/types/ProgressCallbackType.js.map +1 -0
- package/build/types/PythConfiguration.js +17 -7
- package/build/types/PythConfiguration.js.map +1 -1
- package/build/types/ReserveCollateral.js +17 -7
- package/build/types/ReserveCollateral.js.map +1 -1
- package/build/types/ReserveConfig.d.ts +87 -32
- package/build/types/ReserveConfig.js +139 -51
- package/build/types/ReserveConfig.js.map +1 -1
- package/build/types/ReserveConfigCustomizationArgs.d.ts +42 -0
- package/build/types/ReserveConfigCustomizationArgs.js +106 -0
- package/build/types/ReserveConfigCustomizationArgs.js.map +1 -0
- package/build/types/ReserveFarmKind.js +21 -11
- package/build/types/ReserveFarmKind.js.map +1 -1
- package/build/types/ReserveFees.d.ts +5 -5
- package/build/types/ReserveFees.js +24 -14
- package/build/types/ReserveFees.js.map +1 -1
- package/build/types/ReserveLiquidity.d.ts +20 -15
- package/build/types/ReserveLiquidity.js +46 -29
- package/build/types/ReserveLiquidity.js.map +1 -1
- package/build/types/ReserveStatus.js +21 -11
- package/build/types/ReserveStatus.js.map +1 -1
- package/build/types/ScopeConfiguration.js +17 -7
- package/build/types/ScopeConfiguration.js.map +1 -1
- package/build/types/SwitchboardConfiguration.js +17 -7
- package/build/types/SwitchboardConfiguration.js.map +1 -1
- package/build/types/TokenInfo.js +17 -7
- package/build/types/TokenInfo.js.map +1 -1
- package/build/types/UpdateConfigMode.d.ts +232 -63
- package/build/types/UpdateConfigMode.js +433 -110
- package/build/types/UpdateConfigMode.js.map +1 -1
- package/build/types/UpdateGlobalConfigMode.d.ts +31 -0
- package/build/types/UpdateGlobalConfigMode.js +108 -0
- package/build/types/UpdateGlobalConfigMode.js.map +1 -0
- package/build/types/UpdateLendingMarketConfigValue.d.ts +20 -0
- package/build/types/UpdateLendingMarketConfigValue.js +53 -11
- package/build/types/UpdateLendingMarketConfigValue.js.map +1 -1
- package/build/types/UpdateLendingMarketMode.d.ts +400 -23
- package/build/types/UpdateLendingMarketMode.js +752 -46
- package/build/types/UpdateLendingMarketMode.js.map +1 -1
- package/build/types/UpdateObligationConfigMode.d.ts +83 -0
- package/build/types/UpdateObligationConfigMode.js +204 -0
- package/build/types/UpdateObligationConfigMode.js.map +1 -0
- package/build/types/WithdrawQueue.d.ts +32 -0
- package/build/types/WithdrawQueue.js +93 -0
- package/build/types/WithdrawQueue.js.map +1 -0
- package/build/types/WithdrawalCaps.js +17 -7
- package/build/types/WithdrawalCaps.js.map +1 -1
- package/build/types/index.d.ts +32 -10
- package/build/types/index.js +38 -10
- package/build/types/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/generate-idl-module.mjs +18 -0
- package/scripts/patch-optional-accounts.mjs +98 -0
- package/scripts/verify-idl-provenance.mjs +16 -0
- package/src/accounts/GlobalConfig.ts +113 -0
- package/src/accounts/LendingMarket.ts +300 -29
- package/src/accounts/Obligation.ts +111 -26
- package/src/accounts/ReferrerState.ts +11 -4
- package/src/accounts/ReferrerTokenState.ts +6 -3
- package/src/accounts/Reserve.ts +10 -2
- package/src/accounts/ShortUrl.ts +15 -4
- package/src/accounts/UserMetadata.ts +6 -3
- package/src/accounts/UserState.ts +24 -8
- package/src/accounts/WithdrawTicket.ts +173 -0
- package/src/accounts/index.ts +4 -0
- package/src/errors/custom.ts +1177 -24
- package/src/index.ts +2 -4
- package/src/instructions/abortObligationOwnershipTransfer.ts +30 -0
- package/src/instructions/acceptObligationOwnership.ts +30 -0
- package/src/instructions/approveObligationOwnershipTransfer.ts +34 -0
- package/src/instructions/borrowObligationLiquidity.ts +18 -5
- package/src/instructions/borrowObligationLiquidityV2.ts +30 -9
- package/src/instructions/calculateCtokenExchangeRate.ts +22 -0
- package/src/instructions/cancelWithdrawTicket.ts +77 -0
- package/src/instructions/cloneReserveConfig.ts +56 -0
- package/src/instructions/deleteReferrerStateAndShortUrl.ts +4 -1
- package/src/instructions/depositAndWithdraw.ts +229 -0
- package/src/instructions/depositObligationCollateral.ts +3 -2
- package/src/instructions/depositObligationCollateralV2.ts +110 -0
- package/src/instructions/depositReserveLiquidity.ts +4 -3
- package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +18 -9
- package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +31 -14
- package/src/instructions/enqueueToWithdraw.ts +113 -0
- package/src/instructions/fillBorrowOrder.ts +114 -0
- package/src/instructions/fillBorrowOrderV2.ts +128 -0
- package/src/instructions/flashBorrowReserveLiquidity.ts +19 -6
- package/src/instructions/flashRepayReserveLiquidity.ts +23 -7
- package/src/instructions/idlMissingTypes.ts +17 -9
- package/src/instructions/index.ts +118 -6
- package/src/instructions/initFarmsForReserve.ts +11 -3
- package/src/instructions/initGlobalConfig.ts +36 -0
- package/src/instructions/initLendingMarket.ts +13 -3
- package/src/instructions/initObligation.ts +3 -2
- package/src/instructions/initObligationFarmsForReserve.ts +5 -3
- package/src/instructions/initReferrerStateAndShortUrl.ts +4 -2
- package/src/instructions/initReferrerTokenState.ts +6 -16
- package/src/instructions/initReserve.ts +21 -3
- package/src/instructions/initUserMetadata.ts +18 -8
- package/src/instructions/initiateObligationOwnershipTransfer.ts +44 -0
- package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +7 -5
- package/src/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +191 -0
- package/src/instructions/markObligationForDeleveraging.ts +46 -0
- package/src/instructions/recoverInvalidTicketCollateral.ts +80 -0
- package/src/instructions/redeemFees.ts +8 -2
- package/src/instructions/redeemReserveCollateral.ts +4 -3
- package/src/instructions/refreshObligation.ts +7 -1
- package/src/instructions/refreshObligationFarmsForReserve.ts +35 -15
- package/src/instructions/refreshReserve.ts +27 -17
- package/src/instructions/refreshReservesBatch.ts +7 -2
- package/src/instructions/repayAndWithdrawAndRedeem.ts +199 -0
- package/src/instructions/repayObligationLiquidity.ts +4 -3
- package/src/instructions/repayObligationLiquidityV2.ts +35 -10
- package/src/instructions/requestElevationGroup.ts +4 -2
- package/src/instructions/rolloverFixedTermBorrow.ts +108 -0
- package/src/instructions/seedDepositOnInitReserve.ts +50 -0
- package/src/instructions/setBorrowOrder.ts +66 -0
- package/src/instructions/setBorrowOrderV2.ts +69 -0
- package/src/instructions/setObligationOrder.ts +45 -0
- package/src/instructions/socializeLoss.ts +5 -4
- package/src/instructions/socializeLossV2.ts +92 -0
- package/src/instructions/topupReserveRewards.ts +60 -0
- package/src/instructions/updateGlobalConfig.ts +53 -0
- package/src/instructions/updateGlobalConfigAdmin.ts +30 -0
- package/src/instructions/updateLendingMarket.ts +15 -5
- package/src/instructions/updateLendingMarketOwner.ts +10 -1
- package/src/instructions/updateObligationConfig.ts +65 -0
- package/src/instructions/updateReserveConfig.ts +27 -10
- package/src/instructions/withdrawObligationCollateral.ts +4 -3
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +18 -9
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +26 -13
- package/src/instructions/withdrawObligationCollateralV2.ts +110 -0
- package/src/instructions/withdrawProtocolFee.ts +12 -9
- package/src/instructions/withdrawQueuedLiquidity.ts +110 -0
- package/src/instructions/withdrawReferrerFees.ts +8 -2
- package/src/kamino_lending.json +1856 -645
- package/src/kamino_lending.ts +5558 -6034
- package/src/types/BigFractionBytes.ts +9 -1
- package/src/types/BorrowOrder.ts +168 -0
- package/src/types/BorrowOrderConfigArgs.ts +96 -0
- package/src/types/BorrowRateCurve.ts +10 -3
- package/src/types/CurvePoint.ts +7 -1
- package/src/types/ElevationGroup.ts +2 -1
- package/src/types/ExchangeRateWithDecimals.ts +64 -0
- package/src/types/FeeCalculation.ts +9 -2
- package/src/types/FixedTermBorrowRolloverConfig.ts +110 -0
- package/src/types/InitObligationArgs.ts +3 -0
- package/src/types/LastUpdate.ts +26 -10
- package/src/types/ObligationLiquidity.ts +43 -10
- package/src/types/ObligationOrder.ts +121 -0
- package/src/types/ProgressCallbackType.ts +90 -0
- package/src/types/ReserveConfig.ts +169 -62
- package/src/types/ReserveConfigCustomizationArgs.ts +96 -0
- package/src/types/ReserveFees.ts +9 -9
- package/src/types/ReserveLiquidity.ts +38 -28
- package/src/types/UpdateConfigMode.ts +507 -117
- package/src/types/UpdateGlobalConfigMode.ts +90 -0
- package/src/types/UpdateLendingMarketConfigValue.ts +43 -0
- package/src/types/UpdateLendingMarketMode.ts +912 -41
- package/src/types/UpdateObligationConfigMode.ts +210 -0
- package/src/types/WithdrawQueue.ts +85 -0
- package/src/types/index.ts +175 -34
- package/src/types/AssetTier.ts +0 -116
package/build/types/index.d.ts
CHANGED
|
@@ -1,32 +1,49 @@
|
|
|
1
1
|
import * as UpdateConfigMode from "./UpdateConfigMode";
|
|
2
2
|
import * as UpdateLendingMarketConfigValue from "./UpdateLendingMarketConfigValue";
|
|
3
3
|
import * as UpdateLendingMarketMode from "./UpdateLendingMarketMode";
|
|
4
|
-
import * as
|
|
4
|
+
import * as UpdateGlobalConfigMode from "./UpdateGlobalConfigMode";
|
|
5
|
+
import * as UpdateObligationConfigMode from "./UpdateObligationConfigMode";
|
|
5
6
|
import * as FeeCalculation from "./FeeCalculation";
|
|
6
7
|
import * as ReserveFarmKind from "./ReserveFarmKind";
|
|
7
8
|
import * as ReserveStatus from "./ReserveStatus";
|
|
9
|
+
import * as ProgressCallbackType from "./ProgressCallbackType";
|
|
10
|
+
export { ExchangeRateWithDecimals } from "./ExchangeRateWithDecimals";
|
|
11
|
+
export type { ExchangeRateWithDecimalsFields, ExchangeRateWithDecimalsJSON, } from "./ExchangeRateWithDecimals";
|
|
12
|
+
export { ReserveConfigCustomizationArgs } from "./ReserveConfigCustomizationArgs";
|
|
13
|
+
export type { ReserveConfigCustomizationArgsFields, ReserveConfigCustomizationArgsJSON, } from "./ReserveConfigCustomizationArgs";
|
|
14
|
+
export { BorrowOrderConfigArgs } from "./BorrowOrderConfigArgs";
|
|
15
|
+
export type { BorrowOrderConfigArgsFields, BorrowOrderConfigArgsJSON, } from "./BorrowOrderConfigArgs";
|
|
8
16
|
export { UpdateConfigMode };
|
|
9
|
-
export type UpdateConfigModeKind = UpdateConfigMode.UpdateLoanToValuePct | UpdateConfigMode.UpdateMaxLiquidationBonusBps | UpdateConfigMode.UpdateLiquidationThresholdPct | UpdateConfigMode.UpdateProtocolLiquidationFee | UpdateConfigMode.UpdateProtocolTakeRate | UpdateConfigMode.
|
|
10
|
-
export type UpdateConfigModeJSON = UpdateConfigMode.UpdateLoanToValuePctJSON | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON | UpdateConfigMode.UpdateLiquidationThresholdPctJSON | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON | UpdateConfigMode.UpdateProtocolTakeRateJSON | UpdateConfigMode.
|
|
17
|
+
export type UpdateConfigModeKind = UpdateConfigMode.UpdateLoanToValuePct | UpdateConfigMode.UpdateMaxLiquidationBonusBps | UpdateConfigMode.UpdateLiquidationThresholdPct | UpdateConfigMode.UpdateProtocolLiquidationFee | UpdateConfigMode.UpdateProtocolTakeRate | UpdateConfigMode.UpdateFeesOriginationFee | UpdateConfigMode.UpdateFeesFlashLoanFee | UpdateConfigMode.DeprecatedUpdateFeesReferralFeeBps | 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.DeprecatedUpdateEntireReserveConfig | UpdateConfigMode.UpdateDebtWithdrawalCap | UpdateConfigMode.UpdateDepositWithdrawalCap | UpdateConfigMode.DeprecatedUpdateDebtWithdrawalCapCurrentTotal | UpdateConfigMode.DeprecatedUpdateDepositWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateBadDebtLiquidationBonusBps | UpdateConfigMode.UpdateMinLiquidationBonusBps | UpdateConfigMode.UpdateDeleveragingMarginCallPeriod | UpdateConfigMode.UpdateBorrowFactor | UpdateConfigMode.DeprecatedUpdateAssetTier | UpdateConfigMode.UpdateElevationGroup | UpdateConfigMode.UpdateDeleveragingThresholdDecreaseBpsPerDay | UpdateConfigMode.DeprecatedUpdateMultiplierSideBoost | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoost | UpdateConfigMode.UpdateReserveStatus | UpdateConfigMode.UpdateFarmCollateral | UpdateConfigMode.UpdateFarmDebt | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPct | UpdateConfigMode.UpdateBlockPriceUsage | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroup | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserve | UpdateConfigMode.UpdateHostFixedInterestRateBps | UpdateConfigMode.UpdateAutodeleverageEnabled | UpdateConfigMode.UpdateDeleveragingBonusIncreaseBpsPerDay | UpdateConfigMode.UpdateProtocolOrderExecutionFee | UpdateConfigMode.UpdateProposerAuthorityLock | UpdateConfigMode.UpdateMinDeleveragingBonusBps | UpdateConfigMode.UpdateBlockCTokenUsage | UpdateConfigMode.UpdateDebtMaturityTimestamp | UpdateConfigMode.UpdateDebtTermSeconds | UpdateConfigMode.UpdateEarlyRepayRemainingInterestPct | UpdateConfigMode.UpdateReserveEmergencyMode | UpdateConfigMode.UpdateRewardsAmountPerAccrualUnit | UpdateConfigMode.UpdateReservePermissionedOps | UpdateConfigMode.UpdateInterestRateBasis;
|
|
18
|
+
export type UpdateConfigModeJSON = UpdateConfigMode.UpdateLoanToValuePctJSON | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON | UpdateConfigMode.UpdateLiquidationThresholdPctJSON | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON | UpdateConfigMode.UpdateProtocolTakeRateJSON | UpdateConfigMode.UpdateFeesOriginationFeeJSON | UpdateConfigMode.UpdateFeesFlashLoanFeeJSON | UpdateConfigMode.DeprecatedUpdateFeesReferralFeeBpsJSON | 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.DeprecatedUpdateEntireReserveConfigJSON | UpdateConfigMode.UpdateDebtWithdrawalCapJSON | UpdateConfigMode.UpdateDepositWithdrawalCapJSON | UpdateConfigMode.DeprecatedUpdateDebtWithdrawalCapCurrentTotalJSON | UpdateConfigMode.DeprecatedUpdateDepositWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateBadDebtLiquidationBonusBpsJSON | UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON | UpdateConfigMode.UpdateDeleveragingMarginCallPeriodJSON | UpdateConfigMode.UpdateBorrowFactorJSON | UpdateConfigMode.DeprecatedUpdateAssetTierJSON | UpdateConfigMode.UpdateElevationGroupJSON | UpdateConfigMode.UpdateDeleveragingThresholdDecreaseBpsPerDayJSON | UpdateConfigMode.DeprecatedUpdateMultiplierSideBoostJSON | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoostJSON | UpdateConfigMode.UpdateReserveStatusJSON | UpdateConfigMode.UpdateFarmCollateralJSON | UpdateConfigMode.UpdateFarmDebtJSON | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmodeJSON | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPctJSON | UpdateConfigMode.UpdateBlockPriceUsageJSON | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroupJSON | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserveJSON | UpdateConfigMode.UpdateHostFixedInterestRateBpsJSON | UpdateConfigMode.UpdateAutodeleverageEnabledJSON | UpdateConfigMode.UpdateDeleveragingBonusIncreaseBpsPerDayJSON | UpdateConfigMode.UpdateProtocolOrderExecutionFeeJSON | UpdateConfigMode.UpdateProposerAuthorityLockJSON | UpdateConfigMode.UpdateMinDeleveragingBonusBpsJSON | UpdateConfigMode.UpdateBlockCTokenUsageJSON | UpdateConfigMode.UpdateDebtMaturityTimestampJSON | UpdateConfigMode.UpdateDebtTermSecondsJSON | UpdateConfigMode.UpdateEarlyRepayRemainingInterestPctJSON | UpdateConfigMode.UpdateReserveEmergencyModeJSON | UpdateConfigMode.UpdateRewardsAmountPerAccrualUnitJSON | UpdateConfigMode.UpdateReservePermissionedOpsJSON | UpdateConfigMode.UpdateInterestRateBasisJSON;
|
|
11
19
|
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;
|
|
20
|
+
export type UpdateLendingMarketConfigValueKind = UpdateLendingMarketConfigValue.Bool | UpdateLendingMarketConfigValue.U8 | UpdateLendingMarketConfigValue.U8Array | UpdateLendingMarketConfigValue.U16 | UpdateLendingMarketConfigValue.U64 | UpdateLendingMarketConfigValue.U128 | UpdateLendingMarketConfigValue.Pubkey | UpdateLendingMarketConfigValue.ElevationGroup | UpdateLendingMarketConfigValue.Name;
|
|
21
|
+
export type UpdateLendingMarketConfigValueJSON = UpdateLendingMarketConfigValue.BoolJSON | UpdateLendingMarketConfigValue.U8JSON | UpdateLendingMarketConfigValue.U8ArrayJSON | UpdateLendingMarketConfigValue.U16JSON | UpdateLendingMarketConfigValue.U64JSON | UpdateLendingMarketConfigValue.U128JSON | UpdateLendingMarketConfigValue.PubkeyJSON | UpdateLendingMarketConfigValue.ElevationGroupJSON | UpdateLendingMarketConfigValue.NameJSON;
|
|
14
22
|
export { UpdateLendingMarketMode };
|
|
15
|
-
export type UpdateLendingMarketModeKind = UpdateLendingMarketMode.UpdateOwner | UpdateLendingMarketMode.UpdateEmergencyMode | UpdateLendingMarketMode.UpdateLiquidationCloseFactor | UpdateLendingMarketMode.UpdateLiquidationMaxValue | UpdateLendingMarketMode.
|
|
16
|
-
export type UpdateLendingMarketModeJSON = UpdateLendingMarketMode.UpdateOwnerJSON | UpdateLendingMarketMode.UpdateEmergencyModeJSON | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON | UpdateLendingMarketMode.
|
|
23
|
+
export type UpdateLendingMarketModeKind = UpdateLendingMarketMode.UpdateOwner | UpdateLendingMarketMode.UpdateEmergencyMode | UpdateLendingMarketMode.UpdateLiquidationCloseFactor | UpdateLendingMarketMode.UpdateLiquidationMaxValue | UpdateLendingMarketMode.DeprecatedUpdateGlobalUnhealthyBorrow | UpdateLendingMarketMode.UpdateGlobalAllowedBorrow | UpdateLendingMarketMode.UpdateEmergencyCouncil | UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold | UpdateLendingMarketMode.UpdateInsolvencyRiskLtv | UpdateLendingMarketMode.UpdateElevationGroup | UpdateLendingMarketMode.UpdateReferralFeeBps | UpdateLendingMarketMode.DeprecatedUpdateMultiplierPoints | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct | UpdateLendingMarketMode.UpdateAutodeleverageEnabled | UpdateLendingMarketMode.UpdateBorrowingDisabled | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction | UpdateLendingMarketMode.UpdateMinValueLtvSkipPriorityLiqCheck | UpdateLendingMarketMode.UpdateMinValueBfSkipPriorityLiqCheck | UpdateLendingMarketMode.UpdatePaddingFields | UpdateLendingMarketMode.UpdateName | UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecs | UpdateLendingMarketMode.UpdateInitialDepositAmount | UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabled | UpdateLendingMarketMode.UpdateImmutableFlag | UpdateLendingMarketMode.UpdateObligationOrderCreationEnabled | UpdateLendingMarketMode.UpdateProposerAuthority | UpdateLendingMarketMode.UpdatePriceTriggeredLiquidationDisabled | UpdateLendingMarketMode.UpdateMatureReserveDebtLiquidationEnabled | UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabled | UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabled | UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabled | UpdateLendingMarketMode.UpdateMinBorrowOrderFillValue | UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabled | UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabled | UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValue | UpdateLendingMarketMode.UpdateFixedTermRolloverWindowDurationSeconds | UpdateLendingMarketMode.UpdateOpenTermRolloverWindowDurationSeconds | UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabled | UpdateLendingMarketMode.UpdateTermBasedFullLiquidationDurationSecs | UpdateLendingMarketMode.UpdateObligationBorrowMigrationToFixedExecutionEnabled | UpdateLendingMarketMode.UpdateMinPartialRolloverValue | UpdateLendingMarketMode.UpdateWithdrawTicketCancellationEnabled | UpdateLendingMarketMode.UpdatePermissioningAuthority | UpdateLendingMarketMode.UpdatePermissionedOps | UpdateLendingMarketMode.DeprecatedUpdateReserveRewardsMaxAprPct | UpdateLendingMarketMode.UpdateReserveRewardsMaxAprBps | UpdateLendingMarketMode.UpdateDisableNonceBlock;
|
|
24
|
+
export type UpdateLendingMarketModeJSON = UpdateLendingMarketMode.UpdateOwnerJSON | UpdateLendingMarketMode.UpdateEmergencyModeJSON | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON | UpdateLendingMarketMode.DeprecatedUpdateGlobalUnhealthyBorrowJSON | UpdateLendingMarketMode.UpdateGlobalAllowedBorrowJSON | UpdateLendingMarketMode.UpdateEmergencyCouncilJSON | UpdateLendingMarketMode.UpdateMinFullLiquidationThresholdJSON | UpdateLendingMarketMode.UpdateInsolvencyRiskLtvJSON | UpdateLendingMarketMode.UpdateElevationGroupJSON | UpdateLendingMarketMode.UpdateReferralFeeBpsJSON | UpdateLendingMarketMode.DeprecatedUpdateMultiplierPointsJSON | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON | UpdateLendingMarketMode.UpdateMinValueLtvSkipPriorityLiqCheckJSON | UpdateLendingMarketMode.UpdateMinValueBfSkipPriorityLiqCheckJSON | UpdateLendingMarketMode.UpdatePaddingFieldsJSON | UpdateLendingMarketMode.UpdateNameJSON | UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecsJSON | UpdateLendingMarketMode.UpdateInitialDepositAmountJSON | UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabledJSON | UpdateLendingMarketMode.UpdateImmutableFlagJSON | UpdateLendingMarketMode.UpdateObligationOrderCreationEnabledJSON | UpdateLendingMarketMode.UpdateProposerAuthorityJSON | UpdateLendingMarketMode.UpdatePriceTriggeredLiquidationDisabledJSON | UpdateLendingMarketMode.UpdateMatureReserveDebtLiquidationEnabledJSON | UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabledJSON | UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabledJSON | UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabledJSON | UpdateLendingMarketMode.UpdateMinBorrowOrderFillValueJSON | UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabledJSON | UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabledJSON | UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValueJSON | UpdateLendingMarketMode.UpdateFixedTermRolloverWindowDurationSecondsJSON | UpdateLendingMarketMode.UpdateOpenTermRolloverWindowDurationSecondsJSON | UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabledJSON | UpdateLendingMarketMode.UpdateTermBasedFullLiquidationDurationSecsJSON | UpdateLendingMarketMode.UpdateObligationBorrowMigrationToFixedExecutionEnabledJSON | UpdateLendingMarketMode.UpdateMinPartialRolloverValueJSON | UpdateLendingMarketMode.UpdateWithdrawTicketCancellationEnabledJSON | UpdateLendingMarketMode.UpdatePermissioningAuthorityJSON | UpdateLendingMarketMode.UpdatePermissionedOpsJSON | UpdateLendingMarketMode.DeprecatedUpdateReserveRewardsMaxAprPctJSON | UpdateLendingMarketMode.UpdateReserveRewardsMaxAprBpsJSON | UpdateLendingMarketMode.UpdateDisableNonceBlockJSON;
|
|
25
|
+
export { UpdateGlobalConfigMode };
|
|
26
|
+
export type UpdateGlobalConfigModeKind = UpdateGlobalConfigMode.PendingAdmin | UpdateGlobalConfigMode.FeeCollector;
|
|
27
|
+
export type UpdateGlobalConfigModeJSON = UpdateGlobalConfigMode.PendingAdminJSON | UpdateGlobalConfigMode.FeeCollectorJSON;
|
|
17
28
|
export { LastUpdate } from "./LastUpdate";
|
|
18
29
|
export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate";
|
|
19
30
|
export { ElevationGroup } from "./ElevationGroup";
|
|
20
31
|
export type { ElevationGroupFields, ElevationGroupJSON } from "./ElevationGroup";
|
|
32
|
+
export { BorrowOrder } from "./BorrowOrder";
|
|
33
|
+
export type { BorrowOrderFields, BorrowOrderJSON } from "./BorrowOrder";
|
|
34
|
+
export { FixedTermBorrowRolloverConfig } from "./FixedTermBorrowRolloverConfig";
|
|
35
|
+
export type { FixedTermBorrowRolloverConfigFields, FixedTermBorrowRolloverConfigJSON, } from "./FixedTermBorrowRolloverConfig";
|
|
21
36
|
export { InitObligationArgs } from "./InitObligationArgs";
|
|
22
37
|
export type { InitObligationArgsFields, InitObligationArgsJSON, } from "./InitObligationArgs";
|
|
23
38
|
export { ObligationCollateral } from "./ObligationCollateral";
|
|
24
39
|
export type { ObligationCollateralFields, ObligationCollateralJSON, } from "./ObligationCollateral";
|
|
25
40
|
export { ObligationLiquidity } from "./ObligationLiquidity";
|
|
26
41
|
export type { ObligationLiquidityFields, ObligationLiquidityJSON, } from "./ObligationLiquidity";
|
|
27
|
-
export {
|
|
28
|
-
export type
|
|
29
|
-
export
|
|
42
|
+
export { ObligationOrder } from "./ObligationOrder";
|
|
43
|
+
export type { ObligationOrderFields, ObligationOrderJSON, } from "./ObligationOrder";
|
|
44
|
+
export { UpdateObligationConfigMode };
|
|
45
|
+
export type UpdateObligationConfigModeKind = UpdateObligationConfigMode.FixedTermRolloverEnabled | UpdateObligationConfigMode.FixedTermRolloverMaxBorrowRateBps | UpdateObligationConfigMode.FixedTermRolloverMinDebtTermSeconds | UpdateObligationConfigMode.FixedTermRolloverOpenTermAllowed | UpdateObligationConfigMode.MigrationToFixedEnabled | UpdateObligationConfigMode.FixedTermRolloverWindowDurationDays;
|
|
46
|
+
export type UpdateObligationConfigModeJSON = UpdateObligationConfigMode.FixedTermRolloverEnabledJSON | UpdateObligationConfigMode.FixedTermRolloverMaxBorrowRateBpsJSON | UpdateObligationConfigMode.FixedTermRolloverMinDebtTermSecondsJSON | UpdateObligationConfigMode.FixedTermRolloverOpenTermAllowedJSON | UpdateObligationConfigMode.MigrationToFixedEnabledJSON | UpdateObligationConfigMode.FixedTermRolloverWindowDurationDaysJSON;
|
|
30
47
|
export { BigFractionBytes } from "./BigFractionBytes";
|
|
31
48
|
export type { BigFractionBytesFields, BigFractionBytesJSON, } from "./BigFractionBytes";
|
|
32
49
|
export { FeeCalculation };
|
|
@@ -46,6 +63,8 @@ export type { ReserveLiquidityFields, ReserveLiquidityJSON, } from "./ReserveLiq
|
|
|
46
63
|
export { ReserveStatus };
|
|
47
64
|
export type ReserveStatusKind = ReserveStatus.Active | ReserveStatus.Obsolete | ReserveStatus.Hidden;
|
|
48
65
|
export type ReserveStatusJSON = ReserveStatus.ActiveJSON | ReserveStatus.ObsoleteJSON | ReserveStatus.HiddenJSON;
|
|
66
|
+
export { WithdrawQueue } from "./WithdrawQueue";
|
|
67
|
+
export type { WithdrawQueueFields, WithdrawQueueJSON } from "./WithdrawQueue";
|
|
49
68
|
export { WithdrawalCaps } from "./WithdrawalCaps";
|
|
50
69
|
export type { WithdrawalCapsFields, WithdrawalCapsJSON } from "./WithdrawalCaps";
|
|
51
70
|
export { PriceHeuristic } from "./PriceHeuristic";
|
|
@@ -58,6 +77,9 @@ export { SwitchboardConfiguration } from "./SwitchboardConfiguration";
|
|
|
58
77
|
export type { SwitchboardConfigurationFields, SwitchboardConfigurationJSON, } from "./SwitchboardConfiguration";
|
|
59
78
|
export { TokenInfo } from "./TokenInfo";
|
|
60
79
|
export type { TokenInfoFields, TokenInfoJSON } from "./TokenInfo";
|
|
80
|
+
export { ProgressCallbackType };
|
|
81
|
+
export type ProgressCallbackTypeKind = ProgressCallbackType.None | ProgressCallbackType.KlendQueueAccountingHandlerOnKvault;
|
|
82
|
+
export type ProgressCallbackTypeJSON = ProgressCallbackType.NoneJSON | ProgressCallbackType.KlendQueueAccountingHandlerOnKvaultJSON;
|
|
61
83
|
export { BorrowRateCurve } from "./BorrowRateCurve";
|
|
62
84
|
export type { BorrowRateCurveFields, BorrowRateCurveJSON, } from "./BorrowRateCurve";
|
|
63
85
|
export { CurvePoint } from "./CurvePoint";
|
package/build/types/index.js
CHANGED
|
@@ -15,39 +15,65 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
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.
|
|
36
|
+
exports.CurvePoint = exports.BorrowRateCurve = exports.ProgressCallbackType = exports.TokenInfo = exports.SwitchboardConfiguration = exports.ScopeConfiguration = exports.PythConfiguration = exports.PriceHeuristic = exports.WithdrawalCaps = exports.WithdrawQueue = exports.ReserveStatus = exports.ReserveLiquidity = exports.ReserveFees = exports.ReserveFarmKind = exports.ReserveConfig = exports.ReserveCollateral = exports.FeeCalculation = exports.BigFractionBytes = exports.UpdateObligationConfigMode = exports.ObligationOrder = exports.ObligationLiquidity = exports.ObligationCollateral = exports.InitObligationArgs = exports.FixedTermBorrowRolloverConfig = exports.BorrowOrder = exports.ElevationGroup = exports.LastUpdate = exports.UpdateGlobalConfigMode = exports.UpdateLendingMarketMode = exports.UpdateLendingMarketConfigValue = exports.UpdateConfigMode = exports.BorrowOrderConfigArgs = exports.ReserveConfigCustomizationArgs = exports.ExchangeRateWithDecimals = void 0;
|
|
27
37
|
const UpdateConfigMode = __importStar(require("./UpdateConfigMode"));
|
|
28
38
|
exports.UpdateConfigMode = UpdateConfigMode;
|
|
29
39
|
const UpdateLendingMarketConfigValue = __importStar(require("./UpdateLendingMarketConfigValue"));
|
|
30
40
|
exports.UpdateLendingMarketConfigValue = UpdateLendingMarketConfigValue;
|
|
31
41
|
const UpdateLendingMarketMode = __importStar(require("./UpdateLendingMarketMode"));
|
|
32
42
|
exports.UpdateLendingMarketMode = UpdateLendingMarketMode;
|
|
33
|
-
const
|
|
34
|
-
exports.
|
|
43
|
+
const UpdateGlobalConfigMode = __importStar(require("./UpdateGlobalConfigMode"));
|
|
44
|
+
exports.UpdateGlobalConfigMode = UpdateGlobalConfigMode;
|
|
45
|
+
const UpdateObligationConfigMode = __importStar(require("./UpdateObligationConfigMode"));
|
|
46
|
+
exports.UpdateObligationConfigMode = UpdateObligationConfigMode;
|
|
35
47
|
const FeeCalculation = __importStar(require("./FeeCalculation"));
|
|
36
48
|
exports.FeeCalculation = FeeCalculation;
|
|
37
49
|
const ReserveFarmKind = __importStar(require("./ReserveFarmKind"));
|
|
38
50
|
exports.ReserveFarmKind = ReserveFarmKind;
|
|
39
51
|
const ReserveStatus = __importStar(require("./ReserveStatus"));
|
|
40
52
|
exports.ReserveStatus = ReserveStatus;
|
|
53
|
+
const ProgressCallbackType = __importStar(require("./ProgressCallbackType"));
|
|
54
|
+
exports.ProgressCallbackType = ProgressCallbackType;
|
|
55
|
+
var ExchangeRateWithDecimals_1 = require("./ExchangeRateWithDecimals");
|
|
56
|
+
Object.defineProperty(exports, "ExchangeRateWithDecimals", { enumerable: true, get: function () { return ExchangeRateWithDecimals_1.ExchangeRateWithDecimals; } });
|
|
57
|
+
var ReserveConfigCustomizationArgs_1 = require("./ReserveConfigCustomizationArgs");
|
|
58
|
+
Object.defineProperty(exports, "ReserveConfigCustomizationArgs", { enumerable: true, get: function () { return ReserveConfigCustomizationArgs_1.ReserveConfigCustomizationArgs; } });
|
|
59
|
+
var BorrowOrderConfigArgs_1 = require("./BorrowOrderConfigArgs");
|
|
60
|
+
Object.defineProperty(exports, "BorrowOrderConfigArgs", { enumerable: true, get: function () { return BorrowOrderConfigArgs_1.BorrowOrderConfigArgs; } });
|
|
41
61
|
var LastUpdate_1 = require("./LastUpdate");
|
|
42
62
|
Object.defineProperty(exports, "LastUpdate", { enumerable: true, get: function () { return LastUpdate_1.LastUpdate; } });
|
|
43
63
|
var ElevationGroup_1 = require("./ElevationGroup");
|
|
44
64
|
Object.defineProperty(exports, "ElevationGroup", { enumerable: true, get: function () { return ElevationGroup_1.ElevationGroup; } });
|
|
65
|
+
var BorrowOrder_1 = require("./BorrowOrder");
|
|
66
|
+
Object.defineProperty(exports, "BorrowOrder", { enumerable: true, get: function () { return BorrowOrder_1.BorrowOrder; } });
|
|
67
|
+
var FixedTermBorrowRolloverConfig_1 = require("./FixedTermBorrowRolloverConfig");
|
|
68
|
+
Object.defineProperty(exports, "FixedTermBorrowRolloverConfig", { enumerable: true, get: function () { return FixedTermBorrowRolloverConfig_1.FixedTermBorrowRolloverConfig; } });
|
|
45
69
|
var InitObligationArgs_1 = require("./InitObligationArgs");
|
|
46
70
|
Object.defineProperty(exports, "InitObligationArgs", { enumerable: true, get: function () { return InitObligationArgs_1.InitObligationArgs; } });
|
|
47
71
|
var ObligationCollateral_1 = require("./ObligationCollateral");
|
|
48
72
|
Object.defineProperty(exports, "ObligationCollateral", { enumerable: true, get: function () { return ObligationCollateral_1.ObligationCollateral; } });
|
|
49
73
|
var ObligationLiquidity_1 = require("./ObligationLiquidity");
|
|
50
74
|
Object.defineProperty(exports, "ObligationLiquidity", { enumerable: true, get: function () { return ObligationLiquidity_1.ObligationLiquidity; } });
|
|
75
|
+
var ObligationOrder_1 = require("./ObligationOrder");
|
|
76
|
+
Object.defineProperty(exports, "ObligationOrder", { enumerable: true, get: function () { return ObligationOrder_1.ObligationOrder; } });
|
|
51
77
|
var BigFractionBytes_1 = require("./BigFractionBytes");
|
|
52
78
|
Object.defineProperty(exports, "BigFractionBytes", { enumerable: true, get: function () { return BigFractionBytes_1.BigFractionBytes; } });
|
|
53
79
|
var ReserveCollateral_1 = require("./ReserveCollateral");
|
|
@@ -58,6 +84,8 @@ var ReserveFees_1 = require("./ReserveFees");
|
|
|
58
84
|
Object.defineProperty(exports, "ReserveFees", { enumerable: true, get: function () { return ReserveFees_1.ReserveFees; } });
|
|
59
85
|
var ReserveLiquidity_1 = require("./ReserveLiquidity");
|
|
60
86
|
Object.defineProperty(exports, "ReserveLiquidity", { enumerable: true, get: function () { return ReserveLiquidity_1.ReserveLiquidity; } });
|
|
87
|
+
var WithdrawQueue_1 = require("./WithdrawQueue");
|
|
88
|
+
Object.defineProperty(exports, "WithdrawQueue", { enumerable: true, get: function () { return WithdrawQueue_1.WithdrawQueue; } });
|
|
61
89
|
var WithdrawalCaps_1 = require("./WithdrawalCaps");
|
|
62
90
|
Object.defineProperty(exports, "WithdrawalCaps", { enumerable: true, get: function () { return WithdrawalCaps_1.WithdrawalCaps; } });
|
|
63
91
|
var PriceHeuristic_1 = require("./PriceHeuristic");
|
package/build/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAsD;AAyB7C,4CAAgB;AAxBzB,iGAAkF;AAqJzE,wEAA8B;AApJvC,mFAAoE;AA2K3D,0DAAuB;AA1KhC,iFAAkE;AA6QzD,wDAAsB;AA5Q/B,yFAA0E;AAoTjE,gEAA0B;AAnTnC,iEAAkD;AAyUzC,wCAAc;AAxUvB,mEAAoD;AAwV3C,0CAAe;AAvVxB,+DAAgD;AAuWvC,sCAAa;AAtWtB,6EAA8D;AAwYrD,oDAAoB;AAtY7B,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AAKjC,mFAAiF;AAAxE,gJAAA,8BAA8B,OAAA;AAKvC,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA;AAqQ9B,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AAEpB,iFAA+E;AAAtE,8IAAA,6BAA6B,OAAA;AAKtC,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAK7B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAK5B,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AAsBxB,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,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAEtB,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;AAWlB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AAKxB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exponent-labs/klend-idl",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.26",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "AGPL-3.0",
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc --build",
|
|
40
|
-
"gen": "anchor-client-gen ./src/kamino_lending.json ./src --program-id=KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
|
|
40
|
+
"gen": "node ./scripts/verify-idl-provenance.mjs && rm -rf src/accounts src/errors src/instructions src/types src/programId.ts && anchor-client-gen ./src/kamino_lending.json ./src --program-id=KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD && node ./scripts/patch-optional-accounts.mjs && node ./scripts/generate-idl-module.mjs && prettier --write ./src/kamino_lending.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@coral-xyz/borsh": "^0.28.0",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"bn.js": "^5.2.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"anchor-client-gen": "0.28.1",
|
|
48
49
|
"typescript": "5.4.5"
|
|
49
50
|
}
|
|
50
51
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs"
|
|
2
|
+
import { dirname, join } from "node:path"
|
|
3
|
+
import { fileURLToPath } from "node:url"
|
|
4
|
+
|
|
5
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
6
|
+
const idlPath = join(packageRoot, "src", "kamino_lending.json")
|
|
7
|
+
const modulePath = join(packageRoot, "src", "kamino_lending.ts")
|
|
8
|
+
const idl = JSON.parse(readFileSync(idlPath, "utf8"))
|
|
9
|
+
|
|
10
|
+
const source = `import idl from "./kamino_lending.json"
|
|
11
|
+
|
|
12
|
+
type KaminoLendingIdl = ${JSON.stringify(idl, null, 2)}
|
|
13
|
+
|
|
14
|
+
export const IDL = idl as KaminoLendingIdl
|
|
15
|
+
export type KaminoLending = typeof IDL
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
writeFileSync(modulePath, source)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs"
|
|
2
|
+
import { dirname, join } from "node:path"
|
|
3
|
+
import { fileURLToPath } from "node:url"
|
|
4
|
+
|
|
5
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
6
|
+
const idlPath = join(packageRoot, "src", "kamino_lending.json")
|
|
7
|
+
const idl = JSON.parse(readFileSync(idlPath, "utf8"))
|
|
8
|
+
|
|
9
|
+
const OPTIONAL_ACCOUNT_META = `function optionalAccountMeta(
|
|
10
|
+
pubkey: PublicKey | null | undefined,
|
|
11
|
+
isWritable: boolean,
|
|
12
|
+
programId: PublicKey
|
|
13
|
+
): AccountMeta {
|
|
14
|
+
return {
|
|
15
|
+
pubkey: pubkey ?? programId,
|
|
16
|
+
isSigner: false,
|
|
17
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
18
|
+
}
|
|
19
|
+
}`
|
|
20
|
+
|
|
21
|
+
function escapeRegExp(value) {
|
|
22
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function collectOptionalAccounts(accounts, parentPath = []) {
|
|
26
|
+
return accounts.flatMap((account) => {
|
|
27
|
+
const accountPath = [...parentPath, account.name]
|
|
28
|
+
if (account.accounts) {
|
|
29
|
+
return collectOptionalAccounts(account.accounts, accountPath)
|
|
30
|
+
}
|
|
31
|
+
return account.isOptional ? [{ ...account, path: accountPath }] : []
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function replaceAndCount(source, pattern, replacement) {
|
|
36
|
+
let count = 0
|
|
37
|
+
return {
|
|
38
|
+
source: source.replace(pattern, (...args) => {
|
|
39
|
+
count += 1
|
|
40
|
+
return typeof replacement === "function" ? replacement(...args) : replacement
|
|
41
|
+
}),
|
|
42
|
+
count,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const instruction of idl.instructions) {
|
|
47
|
+
const optionalAccounts = collectOptionalAccounts(instruction.accounts)
|
|
48
|
+
if (optionalAccounts.length === 0) continue
|
|
49
|
+
|
|
50
|
+
const instructionPath = join(packageRoot, "src", "instructions", `${instruction.name}.ts`)
|
|
51
|
+
let source = readFileSync(instructionPath, "utf8")
|
|
52
|
+
const optionalNameCounts = new Map()
|
|
53
|
+
|
|
54
|
+
for (const account of optionalAccounts) {
|
|
55
|
+
optionalNameCounts.set(account.name, (optionalNameCounts.get(account.name) ?? 0) + 1)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const [accountName, expectedCount] of optionalNameCounts) {
|
|
59
|
+
const propertyPattern = new RegExp(`(^\\s+${escapeRegExp(accountName)}): PublicKey$`, "gm")
|
|
60
|
+
const result = replaceAndCount(source, propertyPattern, (_match, propertyPrefix) => {
|
|
61
|
+
return `${propertyPrefix}?: PublicKey | null`
|
|
62
|
+
})
|
|
63
|
+
if (result.count !== expectedCount) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`Expected ${expectedCount} optional ${accountName} properties in ${instruction.name}, found ${result.count}`,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
source = result.source
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
for (const account of optionalAccounts) {
|
|
72
|
+
const accountExpression = `accounts.${account.path.join(".")}`
|
|
73
|
+
const metaPattern = new RegExp(
|
|
74
|
+
`\\{\\s*pubkey: ${escapeRegExp(accountExpression)},\\s*isSigner: false,\\s*isWritable: (true|false),?\\s*\\}`,
|
|
75
|
+
"g",
|
|
76
|
+
)
|
|
77
|
+
const result = replaceAndCount(source, metaPattern, (_match, generatedWritable) => {
|
|
78
|
+
if (generatedWritable !== String(account.isMut)) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Generated writable metadata differs from the IDL for ${instruction.name}.${account.path.join(".")}`,
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
return `optionalAccountMeta(${accountExpression}, ${account.isMut}, programId)`
|
|
84
|
+
})
|
|
85
|
+
if (result.count !== 1) {
|
|
86
|
+
throw new Error(`Expected one optional account meta for ${instruction.name}.${account.path.join(".")}`)
|
|
87
|
+
}
|
|
88
|
+
source = result.source
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const functionMarker = "export function "
|
|
92
|
+
const markerIndex = source.indexOf(functionMarker)
|
|
93
|
+
if (markerIndex < 0) {
|
|
94
|
+
throw new Error(`Unable to find the instruction builder in ${instruction.name}`)
|
|
95
|
+
}
|
|
96
|
+
source = `${source.slice(0, markerIndex)}${OPTIONAL_ACCOUNT_META}\n\n${source.slice(markerIndex)}`
|
|
97
|
+
writeFileSync(instructionPath, source)
|
|
98
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createHash } from "node:crypto"
|
|
2
|
+
import { readFileSync } from "node:fs"
|
|
3
|
+
import { dirname, join } from "node:path"
|
|
4
|
+
import { fileURLToPath } from "node:url"
|
|
5
|
+
|
|
6
|
+
const KLEND_SDK_VERSION = "11.0.2"
|
|
7
|
+
const EXPECTED_IDL_SHA256 = "8227dbd383940cb42f93cee9623f2127192b988f75aa5cb8dbc477b938930c62"
|
|
8
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
9
|
+
const idlPath = join(packageRoot, "src", "kamino_lending.json")
|
|
10
|
+
const actualIdlSha256 = createHash("sha256").update(readFileSync(idlPath)).digest("hex")
|
|
11
|
+
|
|
12
|
+
if (actualIdlSha256 !== EXPECTED_IDL_SHA256) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`KLend IDL does not match @kamino-finance/klend-sdk@${KLEND_SDK_VERSION}: expected ${EXPECTED_IDL_SHA256}, received ${actualIdlSha256}`,
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
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 GlobalConfigFields {
|
|
8
|
+
globalAdmin: PublicKey
|
|
9
|
+
pendingAdmin: PublicKey
|
|
10
|
+
feeCollector: PublicKey
|
|
11
|
+
padding: Array<number>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface GlobalConfigJSON {
|
|
15
|
+
globalAdmin: string
|
|
16
|
+
pendingAdmin: string
|
|
17
|
+
feeCollector: string
|
|
18
|
+
padding: Array<number>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class GlobalConfig {
|
|
22
|
+
readonly globalAdmin: PublicKey
|
|
23
|
+
readonly pendingAdmin: PublicKey
|
|
24
|
+
readonly feeCollector: PublicKey
|
|
25
|
+
readonly padding: Array<number>
|
|
26
|
+
|
|
27
|
+
static readonly discriminator = Buffer.from([
|
|
28
|
+
149, 8, 156, 202, 160, 252, 176, 217,
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
static readonly layout = borsh.struct([
|
|
32
|
+
borsh.publicKey("globalAdmin"),
|
|
33
|
+
borsh.publicKey("pendingAdmin"),
|
|
34
|
+
borsh.publicKey("feeCollector"),
|
|
35
|
+
borsh.array(borsh.u8(), 928, "padding"),
|
|
36
|
+
])
|
|
37
|
+
|
|
38
|
+
constructor(fields: GlobalConfigFields) {
|
|
39
|
+
this.globalAdmin = fields.globalAdmin
|
|
40
|
+
this.pendingAdmin = fields.pendingAdmin
|
|
41
|
+
this.feeCollector = fields.feeCollector
|
|
42
|
+
this.padding = fields.padding
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static async fetch(
|
|
46
|
+
c: Connection,
|
|
47
|
+
address: PublicKey,
|
|
48
|
+
programId: PublicKey = PROGRAM_ID
|
|
49
|
+
): Promise<GlobalConfig | null> {
|
|
50
|
+
const info = await c.getAccountInfo(address)
|
|
51
|
+
|
|
52
|
+
if (info === null) {
|
|
53
|
+
return null
|
|
54
|
+
}
|
|
55
|
+
if (!info.owner.equals(programId)) {
|
|
56
|
+
throw new Error("account doesn't belong to this program")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return this.decode(info.data)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static async fetchMultiple(
|
|
63
|
+
c: Connection,
|
|
64
|
+
addresses: PublicKey[],
|
|
65
|
+
programId: PublicKey = PROGRAM_ID
|
|
66
|
+
): Promise<Array<GlobalConfig | null>> {
|
|
67
|
+
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
68
|
+
|
|
69
|
+
return infos.map((info) => {
|
|
70
|
+
if (info === null) {
|
|
71
|
+
return null
|
|
72
|
+
}
|
|
73
|
+
if (!info.owner.equals(programId)) {
|
|
74
|
+
throw new Error("account doesn't belong to this program")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return this.decode(info.data)
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static decode(data: Buffer): GlobalConfig {
|
|
82
|
+
if (!data.slice(0, 8).equals(GlobalConfig.discriminator)) {
|
|
83
|
+
throw new Error("invalid account discriminator")
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const dec = GlobalConfig.layout.decode(data.slice(8))
|
|
87
|
+
|
|
88
|
+
return new GlobalConfig({
|
|
89
|
+
globalAdmin: dec.globalAdmin,
|
|
90
|
+
pendingAdmin: dec.pendingAdmin,
|
|
91
|
+
feeCollector: dec.feeCollector,
|
|
92
|
+
padding: dec.padding,
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
toJSON(): GlobalConfigJSON {
|
|
97
|
+
return {
|
|
98
|
+
globalAdmin: this.globalAdmin.toString(),
|
|
99
|
+
pendingAdmin: this.pendingAdmin.toString(),
|
|
100
|
+
feeCollector: this.feeCollector.toString(),
|
|
101
|
+
padding: this.padding,
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static fromJSON(obj: GlobalConfigJSON): GlobalConfig {
|
|
106
|
+
return new GlobalConfig({
|
|
107
|
+
globalAdmin: new PublicKey(obj.globalAdmin),
|
|
108
|
+
pendingAdmin: new PublicKey(obj.pendingAdmin),
|
|
109
|
+
feeCollector: new PublicKey(obj.feeCollector),
|
|
110
|
+
padding: obj.padding,
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
}
|