@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
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
5
|
import { PROGRAM_ID } from "../programId"
|
|
3
6
|
|
|
4
7
|
export interface InitReserveAccounts {
|
|
5
|
-
|
|
8
|
+
signer: PublicKey
|
|
6
9
|
lendingMarket: PublicKey
|
|
7
10
|
lendingMarketAuthority: PublicKey
|
|
8
11
|
reserve: PublicKey
|
|
@@ -11,15 +14,20 @@ export interface InitReserveAccounts {
|
|
|
11
14
|
feeReceiver: PublicKey
|
|
12
15
|
reserveCollateralMint: PublicKey
|
|
13
16
|
reserveCollateralSupply: PublicKey
|
|
17
|
+
initialLiquiditySource: PublicKey
|
|
14
18
|
rent: PublicKey
|
|
15
19
|
liquidityTokenProgram: PublicKey
|
|
16
20
|
collateralTokenProgram: PublicKey
|
|
17
21
|
systemProgram: PublicKey
|
|
22
|
+
instructionSysvarAccount: PublicKey
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
export function initReserve(
|
|
25
|
+
export function initReserve(
|
|
26
|
+
accounts: InitReserveAccounts,
|
|
27
|
+
programId: PublicKey = PROGRAM_ID
|
|
28
|
+
) {
|
|
21
29
|
const keys: Array<AccountMeta> = [
|
|
22
|
-
{ pubkey: accounts.
|
|
30
|
+
{ pubkey: accounts.signer, isSigner: true, isWritable: true },
|
|
23
31
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
24
32
|
{
|
|
25
33
|
pubkey: accounts.lendingMarketAuthority,
|
|
@@ -48,6 +56,11 @@ export function initReserve(accounts: InitReserveAccounts, programId: PublicKey
|
|
|
48
56
|
isSigner: false,
|
|
49
57
|
isWritable: true,
|
|
50
58
|
},
|
|
59
|
+
{
|
|
60
|
+
pubkey: accounts.initialLiquiditySource,
|
|
61
|
+
isSigner: false,
|
|
62
|
+
isWritable: true,
|
|
63
|
+
},
|
|
51
64
|
{ pubkey: accounts.rent, isSigner: false, isWritable: false },
|
|
52
65
|
{
|
|
53
66
|
pubkey: accounts.liquidityTokenProgram,
|
|
@@ -60,6 +73,11 @@ export function initReserve(accounts: InitReserveAccounts, programId: PublicKey
|
|
|
60
73
|
isWritable: false,
|
|
61
74
|
},
|
|
62
75
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
76
|
+
{
|
|
77
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
78
|
+
isSigner: false,
|
|
79
|
+
isWritable: false,
|
|
80
|
+
},
|
|
63
81
|
]
|
|
64
82
|
const identifier = Buffer.from([138, 245, 71, 225, 153, 4, 3, 43])
|
|
65
83
|
const data = identifier
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
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
|
|
3
5
|
import { PROGRAM_ID } from "../programId"
|
|
4
6
|
|
|
5
7
|
export interface InitUserMetadataArgs {
|
|
@@ -10,27 +12,35 @@ export interface InitUserMetadataAccounts {
|
|
|
10
12
|
owner: PublicKey
|
|
11
13
|
feePayer: PublicKey
|
|
12
14
|
userMetadata: PublicKey
|
|
13
|
-
referrerUserMetadata
|
|
15
|
+
referrerUserMetadata?: PublicKey | null
|
|
14
16
|
rent: PublicKey
|
|
15
17
|
systemProgram: PublicKey
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export const layout = borsh.struct([borsh.publicKey("userLookupTable")])
|
|
19
21
|
|
|
22
|
+
function optionalAccountMeta(
|
|
23
|
+
pubkey: PublicKey | null | undefined,
|
|
24
|
+
isWritable: boolean,
|
|
25
|
+
programId: PublicKey
|
|
26
|
+
): AccountMeta {
|
|
27
|
+
return {
|
|
28
|
+
pubkey: pubkey ?? programId,
|
|
29
|
+
isSigner: false,
|
|
30
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
export function initUserMetadata(
|
|
21
35
|
args: InitUserMetadataArgs,
|
|
22
36
|
accounts: InitUserMetadataAccounts,
|
|
23
|
-
programId: PublicKey = PROGRAM_ID
|
|
37
|
+
programId: PublicKey = PROGRAM_ID
|
|
24
38
|
) {
|
|
25
39
|
const keys: Array<AccountMeta> = [
|
|
26
40
|
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
27
41
|
{ pubkey: accounts.feePayer, isSigner: true, isWritable: true },
|
|
28
42
|
{ pubkey: accounts.userMetadata, isSigner: false, isWritable: true },
|
|
29
|
-
|
|
30
|
-
pubkey: accounts.referrerUserMetadata,
|
|
31
|
-
isSigner: false,
|
|
32
|
-
isWritable: false,
|
|
33
|
-
},
|
|
43
|
+
optionalAccountMeta(accounts.referrerUserMetadata, false, programId),
|
|
34
44
|
{ pubkey: accounts.rent, isSigner: false, isWritable: false },
|
|
35
45
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
36
46
|
]
|
|
@@ -40,7 +50,7 @@ export function initUserMetadata(
|
|
|
40
50
|
{
|
|
41
51
|
userLookupTable: args.userLookupTable,
|
|
42
52
|
},
|
|
43
|
-
buffer
|
|
53
|
+
buffer
|
|
44
54
|
)
|
|
45
55
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
46
56
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface InitiateObligationOwnershipTransferArgs {
|
|
8
|
+
newOwner: PublicKey
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface InitiateObligationOwnershipTransferAccounts {
|
|
12
|
+
owner: PublicKey
|
|
13
|
+
obligation: PublicKey
|
|
14
|
+
instructionSysvarAccount: PublicKey
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const layout = borsh.struct([borsh.publicKey("newOwner")])
|
|
18
|
+
|
|
19
|
+
export function initiateObligationOwnershipTransfer(
|
|
20
|
+
args: InitiateObligationOwnershipTransferArgs,
|
|
21
|
+
accounts: InitiateObligationOwnershipTransferAccounts,
|
|
22
|
+
programId: PublicKey = PROGRAM_ID
|
|
23
|
+
) {
|
|
24
|
+
const keys: Array<AccountMeta> = [
|
|
25
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
26
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
27
|
+
{
|
|
28
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
29
|
+
isSigner: false,
|
|
30
|
+
isWritable: false,
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
const identifier = Buffer.from([127, 42, 81, 218, 147, 171, 76, 153])
|
|
34
|
+
const buffer = Buffer.alloc(1000)
|
|
35
|
+
const len = layout.encode(
|
|
36
|
+
{
|
|
37
|
+
newOwner: args.newOwner,
|
|
38
|
+
},
|
|
39
|
+
buffer
|
|
40
|
+
)
|
|
41
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
42
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
43
|
+
return ix
|
|
44
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
3
|
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
5
|
import { PROGRAM_ID } from "../programId"
|
|
5
6
|
|
|
6
7
|
export interface LiquidateObligationAndRedeemReserveCollateralArgs {
|
|
@@ -41,7 +42,7 @@ export const layout = borsh.struct([
|
|
|
41
42
|
export function liquidateObligationAndRedeemReserveCollateral(
|
|
42
43
|
args: LiquidateObligationAndRedeemReserveCollateralArgs,
|
|
43
44
|
accounts: LiquidateObligationAndRedeemReserveCollateralAccounts,
|
|
44
|
-
programId: PublicKey = PROGRAM_ID
|
|
45
|
+
programId: PublicKey = PROGRAM_ID
|
|
45
46
|
) {
|
|
46
47
|
const keys: Array<AccountMeta> = [
|
|
47
48
|
{ pubkey: accounts.liquidator, isSigner: true, isWritable: false },
|
|
@@ -56,7 +57,7 @@ export function liquidateObligationAndRedeemReserveCollateral(
|
|
|
56
57
|
{
|
|
57
58
|
pubkey: accounts.repayReserveLiquidityMint,
|
|
58
59
|
isSigner: false,
|
|
59
|
-
isWritable:
|
|
60
|
+
isWritable: false,
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
63
|
pubkey: accounts.repayReserveLiquiditySupply,
|
|
@@ -67,7 +68,7 @@ export function liquidateObligationAndRedeemReserveCollateral(
|
|
|
67
68
|
{
|
|
68
69
|
pubkey: accounts.withdrawReserveLiquidityMint,
|
|
69
70
|
isSigner: false,
|
|
70
|
-
isWritable:
|
|
71
|
+
isWritable: false,
|
|
71
72
|
},
|
|
72
73
|
{
|
|
73
74
|
pubkey: accounts.withdrawReserveCollateralMint,
|
|
@@ -126,10 +127,11 @@ export function liquidateObligationAndRedeemReserveCollateral(
|
|
|
126
127
|
const len = layout.encode(
|
|
127
128
|
{
|
|
128
129
|
liquidityAmount: args.liquidityAmount,
|
|
129
|
-
minAcceptableReceivedLiquidityAmount:
|
|
130
|
+
minAcceptableReceivedLiquidityAmount:
|
|
131
|
+
args.minAcceptableReceivedLiquidityAmount,
|
|
130
132
|
maxAllowedLtvOverridePercent: args.maxAllowedLtvOverridePercent,
|
|
131
133
|
},
|
|
132
|
-
buffer
|
|
134
|
+
buffer
|
|
133
135
|
)
|
|
134
136
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
135
137
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface LiquidateObligationAndRedeemReserveCollateralV2Args {
|
|
8
|
+
liquidityAmount: BN
|
|
9
|
+
minAcceptableReceivedLiquidityAmount: BN
|
|
10
|
+
maxAllowedLtvOverridePercent: BN
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface LiquidateObligationAndRedeemReserveCollateralV2Accounts {
|
|
14
|
+
liquidationAccounts: {
|
|
15
|
+
liquidator: PublicKey
|
|
16
|
+
obligation: PublicKey
|
|
17
|
+
lendingMarket: PublicKey
|
|
18
|
+
lendingMarketAuthority: PublicKey
|
|
19
|
+
repayReserve: PublicKey
|
|
20
|
+
repayReserveLiquidityMint: PublicKey
|
|
21
|
+
repayReserveLiquiditySupply: PublicKey
|
|
22
|
+
withdrawReserve: PublicKey
|
|
23
|
+
withdrawReserveLiquidityMint: PublicKey
|
|
24
|
+
withdrawReserveCollateralMint: PublicKey
|
|
25
|
+
withdrawReserveCollateralSupply: PublicKey
|
|
26
|
+
withdrawReserveLiquiditySupply: PublicKey
|
|
27
|
+
withdrawReserveLiquidityFeeReceiver: PublicKey
|
|
28
|
+
userSourceLiquidity: PublicKey
|
|
29
|
+
userDestinationCollateral: PublicKey
|
|
30
|
+
userDestinationLiquidity: PublicKey
|
|
31
|
+
collateralTokenProgram: PublicKey
|
|
32
|
+
repayLiquidityTokenProgram: PublicKey
|
|
33
|
+
withdrawLiquidityTokenProgram: PublicKey
|
|
34
|
+
instructionSysvarAccount: PublicKey
|
|
35
|
+
}
|
|
36
|
+
collateralFarmsAccounts: {
|
|
37
|
+
obligationFarmUserState?: PublicKey | null
|
|
38
|
+
reserveFarmState?: PublicKey | null
|
|
39
|
+
}
|
|
40
|
+
debtFarmsAccounts: {
|
|
41
|
+
obligationFarmUserState?: PublicKey | null
|
|
42
|
+
reserveFarmState?: PublicKey | null
|
|
43
|
+
}
|
|
44
|
+
farmsProgram: PublicKey
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const layout = borsh.struct([
|
|
48
|
+
borsh.u64("liquidityAmount"),
|
|
49
|
+
borsh.u64("minAcceptableReceivedLiquidityAmount"),
|
|
50
|
+
borsh.u64("maxAllowedLtvOverridePercent"),
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
function optionalAccountMeta(
|
|
54
|
+
pubkey: PublicKey | null | undefined,
|
|
55
|
+
isWritable: boolean,
|
|
56
|
+
programId: PublicKey
|
|
57
|
+
): AccountMeta {
|
|
58
|
+
return {
|
|
59
|
+
pubkey: pubkey ?? programId,
|
|
60
|
+
isSigner: false,
|
|
61
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function liquidateObligationAndRedeemReserveCollateralV2(
|
|
66
|
+
args: LiquidateObligationAndRedeemReserveCollateralV2Args,
|
|
67
|
+
accounts: LiquidateObligationAndRedeemReserveCollateralV2Accounts,
|
|
68
|
+
programId: PublicKey = PROGRAM_ID
|
|
69
|
+
) {
|
|
70
|
+
const keys: Array<AccountMeta> = [
|
|
71
|
+
{
|
|
72
|
+
pubkey: accounts.liquidationAccounts.liquidator,
|
|
73
|
+
isSigner: true,
|
|
74
|
+
isWritable: false,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
pubkey: accounts.liquidationAccounts.obligation,
|
|
78
|
+
isSigner: false,
|
|
79
|
+
isWritable: true,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
pubkey: accounts.liquidationAccounts.lendingMarket,
|
|
83
|
+
isSigner: false,
|
|
84
|
+
isWritable: false,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
pubkey: accounts.liquidationAccounts.lendingMarketAuthority,
|
|
88
|
+
isSigner: false,
|
|
89
|
+
isWritable: false,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pubkey: accounts.liquidationAccounts.repayReserve,
|
|
93
|
+
isSigner: false,
|
|
94
|
+
isWritable: true,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
pubkey: accounts.liquidationAccounts.repayReserveLiquidityMint,
|
|
98
|
+
isSigner: false,
|
|
99
|
+
isWritable: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
pubkey: accounts.liquidationAccounts.repayReserveLiquiditySupply,
|
|
103
|
+
isSigner: false,
|
|
104
|
+
isWritable: true,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
pubkey: accounts.liquidationAccounts.withdrawReserve,
|
|
108
|
+
isSigner: false,
|
|
109
|
+
isWritable: true,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
pubkey: accounts.liquidationAccounts.withdrawReserveLiquidityMint,
|
|
113
|
+
isSigner: false,
|
|
114
|
+
isWritable: false,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
pubkey: accounts.liquidationAccounts.withdrawReserveCollateralMint,
|
|
118
|
+
isSigner: false,
|
|
119
|
+
isWritable: true,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
pubkey: accounts.liquidationAccounts.withdrawReserveCollateralSupply,
|
|
123
|
+
isSigner: false,
|
|
124
|
+
isWritable: true,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
pubkey: accounts.liquidationAccounts.withdrawReserveLiquiditySupply,
|
|
128
|
+
isSigner: false,
|
|
129
|
+
isWritable: true,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
pubkey: accounts.liquidationAccounts.withdrawReserveLiquidityFeeReceiver,
|
|
133
|
+
isSigner: false,
|
|
134
|
+
isWritable: true,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
pubkey: accounts.liquidationAccounts.userSourceLiquidity,
|
|
138
|
+
isSigner: false,
|
|
139
|
+
isWritable: true,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
pubkey: accounts.liquidationAccounts.userDestinationCollateral,
|
|
143
|
+
isSigner: false,
|
|
144
|
+
isWritable: true,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
pubkey: accounts.liquidationAccounts.userDestinationLiquidity,
|
|
148
|
+
isSigner: false,
|
|
149
|
+
isWritable: true,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
pubkey: accounts.liquidationAccounts.collateralTokenProgram,
|
|
153
|
+
isSigner: false,
|
|
154
|
+
isWritable: false,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
pubkey: accounts.liquidationAccounts.repayLiquidityTokenProgram,
|
|
158
|
+
isSigner: false,
|
|
159
|
+
isWritable: false,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
pubkey: accounts.liquidationAccounts.withdrawLiquidityTokenProgram,
|
|
163
|
+
isSigner: false,
|
|
164
|
+
isWritable: false,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
pubkey: accounts.liquidationAccounts.instructionSysvarAccount,
|
|
168
|
+
isSigner: false,
|
|
169
|
+
isWritable: false,
|
|
170
|
+
},
|
|
171
|
+
optionalAccountMeta(accounts.collateralFarmsAccounts.obligationFarmUserState, true, programId),
|
|
172
|
+
optionalAccountMeta(accounts.collateralFarmsAccounts.reserveFarmState, true, programId),
|
|
173
|
+
optionalAccountMeta(accounts.debtFarmsAccounts.obligationFarmUserState, true, programId),
|
|
174
|
+
optionalAccountMeta(accounts.debtFarmsAccounts.reserveFarmState, true, programId),
|
|
175
|
+
{ pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
|
|
176
|
+
]
|
|
177
|
+
const identifier = Buffer.from([162, 161, 35, 143, 30, 187, 185, 103])
|
|
178
|
+
const buffer = Buffer.alloc(1000)
|
|
179
|
+
const len = layout.encode(
|
|
180
|
+
{
|
|
181
|
+
liquidityAmount: args.liquidityAmount,
|
|
182
|
+
minAcceptableReceivedLiquidityAmount:
|
|
183
|
+
args.minAcceptableReceivedLiquidityAmount,
|
|
184
|
+
maxAllowedLtvOverridePercent: args.maxAllowedLtvOverridePercent,
|
|
185
|
+
},
|
|
186
|
+
buffer
|
|
187
|
+
)
|
|
188
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
189
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
190
|
+
return ix
|
|
191
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface MarkObligationForDeleveragingArgs {
|
|
8
|
+
autodeleverageTargetLtvPct: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface MarkObligationForDeleveragingAccounts {
|
|
12
|
+
lendingMarketOwner: PublicKey
|
|
13
|
+
obligation: PublicKey
|
|
14
|
+
lendingMarket: PublicKey
|
|
15
|
+
instructionSysvarAccount: PublicKey
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const layout = borsh.struct([borsh.u8("autodeleverageTargetLtvPct")])
|
|
19
|
+
|
|
20
|
+
export function markObligationForDeleveraging(
|
|
21
|
+
args: MarkObligationForDeleveragingArgs,
|
|
22
|
+
accounts: MarkObligationForDeleveragingAccounts,
|
|
23
|
+
programId: PublicKey = PROGRAM_ID
|
|
24
|
+
) {
|
|
25
|
+
const keys: Array<AccountMeta> = [
|
|
26
|
+
{ pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
|
|
27
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
28
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
29
|
+
{
|
|
30
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
31
|
+
isSigner: false,
|
|
32
|
+
isWritable: false,
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
const identifier = Buffer.from([164, 35, 182, 19, 0, 116, 243, 127])
|
|
36
|
+
const buffer = Buffer.alloc(1000)
|
|
37
|
+
const len = layout.encode(
|
|
38
|
+
{
|
|
39
|
+
autodeleverageTargetLtvPct: args.autodeleverageTargetLtvPct,
|
|
40
|
+
},
|
|
41
|
+
buffer
|
|
42
|
+
)
|
|
43
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
44
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
45
|
+
return ix
|
|
46
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface RecoverInvalidTicketCollateralArgs {
|
|
8
|
+
ticketSequenceNumber: BN
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RecoverInvalidTicketCollateralAccounts {
|
|
12
|
+
payer: PublicKey
|
|
13
|
+
lendingMarket: PublicKey
|
|
14
|
+
lendingMarketAuthority: PublicKey
|
|
15
|
+
reserve: PublicKey
|
|
16
|
+
reserveCollateralMint: PublicKey
|
|
17
|
+
ownerQueuedCollateralVault: PublicKey
|
|
18
|
+
userSourceCollateral: PublicKey
|
|
19
|
+
collateralTokenProgram: PublicKey
|
|
20
|
+
withdrawTicket: PublicKey
|
|
21
|
+
withdrawTicketOwner: PublicKey
|
|
22
|
+
instructionSysvarAccount: PublicKey
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const layout = borsh.struct([borsh.u64("ticketSequenceNumber")])
|
|
26
|
+
|
|
27
|
+
export function recoverInvalidTicketCollateral(
|
|
28
|
+
args: RecoverInvalidTicketCollateralArgs,
|
|
29
|
+
accounts: RecoverInvalidTicketCollateralAccounts,
|
|
30
|
+
programId: PublicKey = PROGRAM_ID
|
|
31
|
+
) {
|
|
32
|
+
const keys: Array<AccountMeta> = [
|
|
33
|
+
{ pubkey: accounts.payer, isSigner: true, isWritable: false },
|
|
34
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
35
|
+
{
|
|
36
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
37
|
+
isSigner: false,
|
|
38
|
+
isWritable: false,
|
|
39
|
+
},
|
|
40
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: false },
|
|
41
|
+
{
|
|
42
|
+
pubkey: accounts.reserveCollateralMint,
|
|
43
|
+
isSigner: false,
|
|
44
|
+
isWritable: false,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
pubkey: accounts.ownerQueuedCollateralVault,
|
|
48
|
+
isSigner: false,
|
|
49
|
+
isWritable: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
pubkey: accounts.userSourceCollateral,
|
|
53
|
+
isSigner: false,
|
|
54
|
+
isWritable: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
pubkey: accounts.collateralTokenProgram,
|
|
58
|
+
isSigner: false,
|
|
59
|
+
isWritable: false,
|
|
60
|
+
},
|
|
61
|
+
{ pubkey: accounts.withdrawTicket, isSigner: false, isWritable: true },
|
|
62
|
+
{ pubkey: accounts.withdrawTicketOwner, isSigner: false, isWritable: true },
|
|
63
|
+
{
|
|
64
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
65
|
+
isSigner: false,
|
|
66
|
+
isWritable: false,
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
const identifier = Buffer.from([28, 48, 176, 102, 159, 206, 210, 246])
|
|
70
|
+
const buffer = Buffer.alloc(1000)
|
|
71
|
+
const len = layout.encode(
|
|
72
|
+
{
|
|
73
|
+
ticketSequenceNumber: args.ticketSequenceNumber,
|
|
74
|
+
},
|
|
75
|
+
buffer
|
|
76
|
+
)
|
|
77
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
78
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
79
|
+
return ix
|
|
80
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
5
|
import { PROGRAM_ID } from "../programId"
|
|
3
6
|
|
|
4
7
|
export interface RedeemFeesAccounts {
|
|
@@ -11,13 +14,16 @@ export interface RedeemFeesAccounts {
|
|
|
11
14
|
tokenProgram: PublicKey
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
export function redeemFees(
|
|
17
|
+
export function redeemFees(
|
|
18
|
+
accounts: RedeemFeesAccounts,
|
|
19
|
+
programId: PublicKey = PROGRAM_ID
|
|
20
|
+
) {
|
|
15
21
|
const keys: Array<AccountMeta> = [
|
|
16
22
|
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
17
23
|
{
|
|
18
24
|
pubkey: accounts.reserveLiquidityMint,
|
|
19
25
|
isSigner: false,
|
|
20
|
-
isWritable:
|
|
26
|
+
isWritable: false,
|
|
21
27
|
},
|
|
22
28
|
{
|
|
23
29
|
pubkey: accounts.reserveLiquidityFeeReceiver,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
3
|
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
5
|
import { PROGRAM_ID } from "../programId"
|
|
5
6
|
|
|
6
7
|
export interface RedeemReserveCollateralArgs {
|
|
@@ -27,7 +28,7 @@ export const layout = borsh.struct([borsh.u64("collateralAmount")])
|
|
|
27
28
|
export function redeemReserveCollateral(
|
|
28
29
|
args: RedeemReserveCollateralArgs,
|
|
29
30
|
accounts: RedeemReserveCollateralAccounts,
|
|
30
|
-
programId: PublicKey = PROGRAM_ID
|
|
31
|
+
programId: PublicKey = PROGRAM_ID
|
|
31
32
|
) {
|
|
32
33
|
const keys: Array<AccountMeta> = [
|
|
33
34
|
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
@@ -41,7 +42,7 @@ export function redeemReserveCollateral(
|
|
|
41
42
|
{
|
|
42
43
|
pubkey: accounts.reserveLiquidityMint,
|
|
43
44
|
isSigner: false,
|
|
44
|
-
isWritable:
|
|
45
|
+
isWritable: false,
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
48
|
pubkey: accounts.reserveCollateralMint,
|
|
@@ -85,7 +86,7 @@ export function redeemReserveCollateral(
|
|
|
85
86
|
{
|
|
86
87
|
collateralAmount: args.collateralAmount,
|
|
87
88
|
},
|
|
88
|
-
buffer
|
|
89
|
+
buffer
|
|
89
90
|
)
|
|
90
91
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
91
92
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
5
|
import { PROGRAM_ID } from "../programId"
|
|
3
6
|
|
|
4
7
|
export interface RefreshObligationAccounts {
|
|
@@ -6,7 +9,10 @@ export interface RefreshObligationAccounts {
|
|
|
6
9
|
obligation: PublicKey
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
export function refreshObligation(
|
|
12
|
+
export function refreshObligation(
|
|
13
|
+
accounts: RefreshObligationAccounts,
|
|
14
|
+
programId: PublicKey = PROGRAM_ID
|
|
15
|
+
) {
|
|
10
16
|
const keys: Array<AccountMeta> = [
|
|
11
17
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
12
18
|
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|