@exponent-labs/klend-idl 0.9.24 → 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 +93 -9
- package/build/accounts/LendingMarket.js +202 -20
- package/build/accounts/LendingMarket.js.map +1 -1
- package/build/accounts/Obligation.d.ts +33 -9
- package/build/accounts/Obligation.js +69 -20
- package/build/accounts/Obligation.js.map +1 -1
- package/build/accounts/ReferrerState.js +7 -2
- package/build/accounts/ReferrerState.js.map +1 -1
- package/build/accounts/ReferrerTokenState.js +3 -1
- package/build/accounts/ReferrerTokenState.js.map +1 -1
- package/build/accounts/Reserve.d.ts +3 -0
- package/build/accounts/Reserve.js +8 -2
- package/build/accounts/Reserve.js.map +1 -1
- package/build/accounts/ShortUrl.js +7 -2
- package/build/accounts/ShortUrl.js.map +1 -1
- package/build/accounts/UserMetadata.js +3 -1
- package/build/accounts/UserMetadata.js.map +1 -1
- package/build/accounts/UserState.js +3 -1
- 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/custom.d.ts +605 -13
- package/build/errors/custom.js +1063 -26
- package/build/errors/custom.js.map +1 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +3 -7
- 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 +9 -2
- package/build/instructions/borrowObligationLiquidity.js.map +1 -1
- package/build/instructions/borrowObligationLiquidityV2.js +26 -6
- 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.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.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 +1 -1
- package/build/instructions/depositReserveLiquidity.js.map +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +9 -6
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +26 -6
- 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 +9 -2
- package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -1
- package/build/instructions/flashRepayReserveLiquidity.d.ts +2 -2
- package/build/instructions/flashRepayReserveLiquidity.js +13 -3
- package/build/instructions/flashRepayReserveLiquidity.js.map +1 -1
- package/build/instructions/idlMissingTypes.d.ts +3 -2
- package/build/instructions/idlMissingTypes.js +7 -3
- 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 +6 -1
- 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 +8 -1
- package/build/instructions/initLendingMarket.js.map +1 -1
- package/build/instructions/initObligation.js.map +1 -1
- package/build/instructions/initObligationFarmsForReserve.js +1 -1
- package/build/instructions/initObligationFarmsForReserve.js.map +1 -1
- package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -1
- package/build/instructions/initReferrerTokenState.d.ts +2 -5
- package/build/instructions/initReferrerTokenState.js +3 -42
- package/build/instructions/initReferrerTokenState.js.map +1 -1
- package/build/instructions/initReserve.d.ts +3 -1
- package/build/instructions/initReserve.js +11 -1
- package/build/instructions/initReserve.js.map +1 -1
- package/build/instructions/initUserMetadata.d.ts +1 -1
- package/build/instructions/initUserMetadata.js +8 -5
- 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 +2 -2
- 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 +1 -1
- package/build/instructions/redeemFees.js.map +1 -1
- package/build/instructions/redeemReserveCollateral.js +1 -1
- package/build/instructions/redeemReserveCollateral.js.map +1 -1
- package/build/instructions/refreshObligation.js.map +1 -1
- package/build/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
- package/build/instructions/refreshObligationFarmsForReserve.js +23 -7
- package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -1
- package/build/instructions/refreshReserve.d.ts +4 -4
- package/build/instructions/refreshReserve.js +11 -12
- package/build/instructions/refreshReserve.js.map +1 -1
- 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 +1 -1
- package/build/instructions/repayObligationLiquidity.js.map +1 -1
- package/build/instructions/repayObligationLiquidityV2.js +31 -7
- package/build/instructions/repayObligationLiquidityV2.js.map +1 -1
- 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 +1 -1
- 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 +10 -2
- package/build/instructions/updateLendingMarket.js.map +1 -1
- package/build/instructions/updateLendingMarketOwner.d.ts +1 -0
- package/build/instructions/updateLendingMarketOwner.js +5 -0
- 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 +15 -4
- package/build/instructions/updateReserveConfig.js.map +1 -1
- package/build/instructions/withdrawObligationCollateral.js +1 -1
- package/build/instructions/withdrawObligationCollateral.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +9 -6
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +21 -5
- 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 +6 -5
- 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 +1 -1
- 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/BigFractionBytes.d.ts +2 -1
- package/build/types/BigFractionBytes.js +4 -1
- 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.map +1 -1
- package/build/types/CurvePoint.d.ts +2 -1
- package/build/types/CurvePoint.js.map +1 -1
- package/build/types/ElevationGroup.d.ts +2 -1
- 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 +4 -1
- 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.map +1 -1
- package/build/types/LastUpdate.d.ts +12 -6
- package/build/types/LastUpdate.js +19 -7
- package/build/types/LastUpdate.js.map +1 -1
- package/build/types/ObligationLiquidity.d.ts +29 -5
- package/build/types/ObligationLiquidity.js +25 -8
- 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/ProgressCallbackType.d.ts +31 -0
- package/build/types/ProgressCallbackType.js +108 -0
- package/build/types/ProgressCallbackType.js.map +1 -0
- package/build/types/ReserveConfig.d.ts +87 -32
- package/build/types/ReserveConfig.js +122 -44
- 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/ReserveFees.d.ts +5 -5
- package/build/types/ReserveFees.js +7 -7
- package/build/types/ReserveFees.js.map +1 -1
- package/build/types/ReserveLiquidity.d.ts +20 -15
- package/build/types/ReserveLiquidity.js +29 -22
- package/build/types/ReserveLiquidity.js.map +1 -1
- package/build/types/UpdateConfigMode.d.ts +232 -63
- package/build/types/UpdateConfigMode.js +413 -100
- 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 +33 -1
- package/build/types/UpdateLendingMarketConfigValue.js.map +1 -1
- package/build/types/UpdateLendingMarketMode.d.ts +400 -23
- package/build/types/UpdateLendingMarketMode.js +732 -36
- 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/index.d.ts +32 -10
- package/build/types/index.js +21 -3
- 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
|
@@ -0,0 +1,66 @@
|
|
|
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 SetBorrowOrderArgs {
|
|
8
|
+
orderConfig: types.BorrowOrderConfigArgsFields
|
|
9
|
+
minExpectedCurrentRemainingDebtAmount: BN
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SetBorrowOrderAccounts {
|
|
13
|
+
owner: PublicKey
|
|
14
|
+
obligation: PublicKey
|
|
15
|
+
lendingMarket: PublicKey
|
|
16
|
+
reserve: PublicKey
|
|
17
|
+
filledDebtDestination: PublicKey
|
|
18
|
+
debtLiquidityMint: PublicKey
|
|
19
|
+
instructionSysvarAccount: PublicKey
|
|
20
|
+
eventAuthority: PublicKey
|
|
21
|
+
program: PublicKey
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const layout = borsh.struct([
|
|
25
|
+
types.BorrowOrderConfigArgs.layout("orderConfig"),
|
|
26
|
+
borsh.u64("minExpectedCurrentRemainingDebtAmount"),
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
export function setBorrowOrder(
|
|
30
|
+
args: SetBorrowOrderArgs,
|
|
31
|
+
accounts: SetBorrowOrderAccounts,
|
|
32
|
+
programId: PublicKey = PROGRAM_ID
|
|
33
|
+
) {
|
|
34
|
+
const keys: Array<AccountMeta> = [
|
|
35
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
36
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
37
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
38
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: false },
|
|
39
|
+
{
|
|
40
|
+
pubkey: accounts.filledDebtDestination,
|
|
41
|
+
isSigner: false,
|
|
42
|
+
isWritable: false,
|
|
43
|
+
},
|
|
44
|
+
{ pubkey: accounts.debtLiquidityMint, isSigner: false, isWritable: false },
|
|
45
|
+
{
|
|
46
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
47
|
+
isSigner: false,
|
|
48
|
+
isWritable: false,
|
|
49
|
+
},
|
|
50
|
+
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
51
|
+
{ pubkey: accounts.program, isSigner: false, isWritable: false },
|
|
52
|
+
]
|
|
53
|
+
const identifier = Buffer.from([177, 186, 45, 61, 235, 91, 68, 139])
|
|
54
|
+
const buffer = Buffer.alloc(1000)
|
|
55
|
+
const len = layout.encode(
|
|
56
|
+
{
|
|
57
|
+
orderConfig: types.BorrowOrderConfigArgs.toEncodable(args.orderConfig),
|
|
58
|
+
minExpectedCurrentRemainingDebtAmount:
|
|
59
|
+
args.minExpectedCurrentRemainingDebtAmount,
|
|
60
|
+
},
|
|
61
|
+
buffer
|
|
62
|
+
)
|
|
63
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
64
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
65
|
+
return ix
|
|
66
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 SetBorrowOrderV2Args {
|
|
8
|
+
orderIdx: number
|
|
9
|
+
orderConfig: types.BorrowOrderConfigArgsFields
|
|
10
|
+
minExpectedCurrentRemainingDebtAmount: BN
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SetBorrowOrderV2Accounts {
|
|
14
|
+
owner: PublicKey
|
|
15
|
+
obligation: PublicKey
|
|
16
|
+
lendingMarket: PublicKey
|
|
17
|
+
reserve: PublicKey
|
|
18
|
+
filledDebtDestination: PublicKey
|
|
19
|
+
debtLiquidityMint: PublicKey
|
|
20
|
+
instructionSysvarAccount: PublicKey
|
|
21
|
+
eventAuthority: PublicKey
|
|
22
|
+
program: PublicKey
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const layout = borsh.struct([
|
|
26
|
+
borsh.u8("orderIdx"),
|
|
27
|
+
types.BorrowOrderConfigArgs.layout("orderConfig"),
|
|
28
|
+
borsh.u64("minExpectedCurrentRemainingDebtAmount"),
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
export function setBorrowOrderV2(
|
|
32
|
+
args: SetBorrowOrderV2Args,
|
|
33
|
+
accounts: SetBorrowOrderV2Accounts,
|
|
34
|
+
programId: PublicKey = PROGRAM_ID
|
|
35
|
+
) {
|
|
36
|
+
const keys: Array<AccountMeta> = [
|
|
37
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
38
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
39
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
40
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: false },
|
|
41
|
+
{
|
|
42
|
+
pubkey: accounts.filledDebtDestination,
|
|
43
|
+
isSigner: false,
|
|
44
|
+
isWritable: false,
|
|
45
|
+
},
|
|
46
|
+
{ pubkey: accounts.debtLiquidityMint, isSigner: false, isWritable: false },
|
|
47
|
+
{
|
|
48
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
49
|
+
isSigner: false,
|
|
50
|
+
isWritable: false,
|
|
51
|
+
},
|
|
52
|
+
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
53
|
+
{ pubkey: accounts.program, isSigner: false, isWritable: false },
|
|
54
|
+
]
|
|
55
|
+
const identifier = Buffer.from([87, 255, 30, 4, 156, 230, 167, 126])
|
|
56
|
+
const buffer = Buffer.alloc(1000)
|
|
57
|
+
const len = layout.encode(
|
|
58
|
+
{
|
|
59
|
+
orderIdx: args.orderIdx,
|
|
60
|
+
orderConfig: types.BorrowOrderConfigArgs.toEncodable(args.orderConfig),
|
|
61
|
+
minExpectedCurrentRemainingDebtAmount:
|
|
62
|
+
args.minExpectedCurrentRemainingDebtAmount,
|
|
63
|
+
},
|
|
64
|
+
buffer
|
|
65
|
+
)
|
|
66
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
67
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
68
|
+
return ix
|
|
69
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 SetObligationOrderArgs {
|
|
8
|
+
index: number
|
|
9
|
+
order: types.ObligationOrderFields
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SetObligationOrderAccounts {
|
|
13
|
+
owner: PublicKey
|
|
14
|
+
obligation: PublicKey
|
|
15
|
+
lendingMarket: PublicKey
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const layout = borsh.struct([
|
|
19
|
+
borsh.u8("index"),
|
|
20
|
+
types.ObligationOrder.layout("order"),
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
export function setObligationOrder(
|
|
24
|
+
args: SetObligationOrderArgs,
|
|
25
|
+
accounts: SetObligationOrderAccounts,
|
|
26
|
+
programId: PublicKey = PROGRAM_ID
|
|
27
|
+
) {
|
|
28
|
+
const keys: Array<AccountMeta> = [
|
|
29
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
30
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
31
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
32
|
+
]
|
|
33
|
+
const identifier = Buffer.from([81, 1, 99, 156, 211, 83, 78, 46])
|
|
34
|
+
const buffer = Buffer.alloc(1000)
|
|
35
|
+
const len = layout.encode(
|
|
36
|
+
{
|
|
37
|
+
index: args.index,
|
|
38
|
+
order: types.ObligationOrder.toEncodable(args.order),
|
|
39
|
+
},
|
|
40
|
+
buffer
|
|
41
|
+
)
|
|
42
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
43
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
44
|
+
return ix
|
|
45
|
+
}
|
|
@@ -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 SocializeLossArgs {
|
|
@@ -8,7 +9,7 @@ export interface SocializeLossArgs {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface SocializeLossAccounts {
|
|
11
|
-
|
|
12
|
+
lendingMarketOwner: PublicKey
|
|
12
13
|
obligation: PublicKey
|
|
13
14
|
lendingMarket: PublicKey
|
|
14
15
|
reserve: PublicKey
|
|
@@ -20,10 +21,10 @@ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
|
|
|
20
21
|
export function socializeLoss(
|
|
21
22
|
args: SocializeLossArgs,
|
|
22
23
|
accounts: SocializeLossAccounts,
|
|
23
|
-
programId: PublicKey = PROGRAM_ID
|
|
24
|
+
programId: PublicKey = PROGRAM_ID
|
|
24
25
|
) {
|
|
25
26
|
const keys: Array<AccountMeta> = [
|
|
26
|
-
{ pubkey: accounts.
|
|
27
|
+
{ pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
|
|
27
28
|
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
28
29
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
29
30
|
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
@@ -39,7 +40,7 @@ export function socializeLoss(
|
|
|
39
40
|
{
|
|
40
41
|
liquidityAmount: args.liquidityAmount,
|
|
41
42
|
},
|
|
42
|
-
buffer
|
|
43
|
+
buffer
|
|
43
44
|
)
|
|
44
45
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
45
46
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -0,0 +1,92 @@
|
|
|
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 SocializeLossV2Args {
|
|
8
|
+
liquidityAmount: BN
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SocializeLossV2Accounts {
|
|
12
|
+
socializeLossAccounts: {
|
|
13
|
+
lendingMarketOwner: PublicKey
|
|
14
|
+
obligation: PublicKey
|
|
15
|
+
lendingMarket: PublicKey
|
|
16
|
+
reserve: PublicKey
|
|
17
|
+
instructionSysvarAccount: PublicKey
|
|
18
|
+
}
|
|
19
|
+
farmsAccounts: {
|
|
20
|
+
obligationFarmUserState?: PublicKey | null
|
|
21
|
+
reserveFarmState?: PublicKey | null
|
|
22
|
+
}
|
|
23
|
+
lendingMarketAuthority: PublicKey
|
|
24
|
+
farmsProgram: PublicKey
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const layout = borsh.struct([borsh.u64("liquidityAmount")])
|
|
28
|
+
|
|
29
|
+
function optionalAccountMeta(
|
|
30
|
+
pubkey: PublicKey | null | undefined,
|
|
31
|
+
isWritable: boolean,
|
|
32
|
+
programId: PublicKey
|
|
33
|
+
): AccountMeta {
|
|
34
|
+
return {
|
|
35
|
+
pubkey: pubkey ?? programId,
|
|
36
|
+
isSigner: false,
|
|
37
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function socializeLossV2(
|
|
42
|
+
args: SocializeLossV2Args,
|
|
43
|
+
accounts: SocializeLossV2Accounts,
|
|
44
|
+
programId: PublicKey = PROGRAM_ID
|
|
45
|
+
) {
|
|
46
|
+
const keys: Array<AccountMeta> = [
|
|
47
|
+
{
|
|
48
|
+
pubkey: accounts.socializeLossAccounts.lendingMarketOwner,
|
|
49
|
+
isSigner: true,
|
|
50
|
+
isWritable: false,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
pubkey: accounts.socializeLossAccounts.obligation,
|
|
54
|
+
isSigner: false,
|
|
55
|
+
isWritable: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
pubkey: accounts.socializeLossAccounts.lendingMarket,
|
|
59
|
+
isSigner: false,
|
|
60
|
+
isWritable: false,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
pubkey: accounts.socializeLossAccounts.reserve,
|
|
64
|
+
isSigner: false,
|
|
65
|
+
isWritable: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
pubkey: accounts.socializeLossAccounts.instructionSysvarAccount,
|
|
69
|
+
isSigner: false,
|
|
70
|
+
isWritable: false,
|
|
71
|
+
},
|
|
72
|
+
optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
|
|
73
|
+
optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
|
|
74
|
+
{
|
|
75
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
76
|
+
isSigner: false,
|
|
77
|
+
isWritable: false,
|
|
78
|
+
},
|
|
79
|
+
{ pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
|
|
80
|
+
]
|
|
81
|
+
const identifier = Buffer.from([238, 95, 98, 220, 187, 40, 204, 154])
|
|
82
|
+
const buffer = Buffer.alloc(1000)
|
|
83
|
+
const len = layout.encode(
|
|
84
|
+
{
|
|
85
|
+
liquidityAmount: args.liquidityAmount,
|
|
86
|
+
},
|
|
87
|
+
buffer
|
|
88
|
+
)
|
|
89
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
90
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
91
|
+
return ix
|
|
92
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 TopupReserveRewardsArgs {
|
|
8
|
+
amount: BN
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface TopupReserveRewardsAccounts {
|
|
12
|
+
signer: PublicKey
|
|
13
|
+
lendingMarket: PublicKey
|
|
14
|
+
reserve: PublicKey
|
|
15
|
+
reserveLiquidityMint: PublicKey
|
|
16
|
+
reserveLiquiditySupply: PublicKey
|
|
17
|
+
sourceLiquidity: PublicKey
|
|
18
|
+
liquidityTokenProgram: PublicKey
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const layout = borsh.struct([borsh.u64("amount")])
|
|
22
|
+
|
|
23
|
+
export function topupReserveRewards(
|
|
24
|
+
args: TopupReserveRewardsArgs,
|
|
25
|
+
accounts: TopupReserveRewardsAccounts,
|
|
26
|
+
programId: PublicKey = PROGRAM_ID
|
|
27
|
+
) {
|
|
28
|
+
const keys: Array<AccountMeta> = [
|
|
29
|
+
{ pubkey: accounts.signer, isSigner: true, isWritable: false },
|
|
30
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
31
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
32
|
+
{
|
|
33
|
+
pubkey: accounts.reserveLiquidityMint,
|
|
34
|
+
isSigner: false,
|
|
35
|
+
isWritable: false,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
pubkey: accounts.reserveLiquiditySupply,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable: true,
|
|
41
|
+
},
|
|
42
|
+
{ pubkey: accounts.sourceLiquidity, isSigner: false, isWritable: true },
|
|
43
|
+
{
|
|
44
|
+
pubkey: accounts.liquidityTokenProgram,
|
|
45
|
+
isSigner: false,
|
|
46
|
+
isWritable: false,
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
const identifier = Buffer.from([63, 255, 130, 211, 110, 216, 88, 173])
|
|
50
|
+
const buffer = Buffer.alloc(1000)
|
|
51
|
+
const len = layout.encode(
|
|
52
|
+
{
|
|
53
|
+
amount: args.amount,
|
|
54
|
+
},
|
|
55
|
+
buffer
|
|
56
|
+
)
|
|
57
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
58
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
59
|
+
return ix
|
|
60
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 UpdateGlobalConfigArgs {
|
|
8
|
+
mode: types.UpdateGlobalConfigModeKind
|
|
9
|
+
value: Uint8Array
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateGlobalConfigAccounts {
|
|
13
|
+
globalAdmin: PublicKey
|
|
14
|
+
globalConfig: PublicKey
|
|
15
|
+
instructionSysvarAccount: PublicKey
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const layout = borsh.struct([
|
|
19
|
+
types.UpdateGlobalConfigMode.layout("mode"),
|
|
20
|
+
borsh.vecU8("value"),
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
export function updateGlobalConfig(
|
|
24
|
+
args: UpdateGlobalConfigArgs,
|
|
25
|
+
accounts: UpdateGlobalConfigAccounts,
|
|
26
|
+
programId: PublicKey = PROGRAM_ID
|
|
27
|
+
) {
|
|
28
|
+
const keys: Array<AccountMeta> = [
|
|
29
|
+
{ pubkey: accounts.globalAdmin, isSigner: true, isWritable: false },
|
|
30
|
+
{ pubkey: accounts.globalConfig, isSigner: false, isWritable: true },
|
|
31
|
+
{
|
|
32
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
33
|
+
isSigner: false,
|
|
34
|
+
isWritable: false,
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
const identifier = Buffer.from([164, 84, 130, 189, 111, 58, 250, 200])
|
|
38
|
+
const buffer = Buffer.alloc(1000)
|
|
39
|
+
const len = layout.encode(
|
|
40
|
+
{
|
|
41
|
+
mode: args.mode.toEncodable(),
|
|
42
|
+
value: Buffer.from(
|
|
43
|
+
args.value.buffer,
|
|
44
|
+
args.value.byteOffset,
|
|
45
|
+
args.value.length
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
buffer
|
|
49
|
+
)
|
|
50
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
51
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
52
|
+
return ix
|
|
53
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 UpdateGlobalConfigAdminAccounts {
|
|
8
|
+
pendingAdmin: PublicKey
|
|
9
|
+
globalConfig: PublicKey
|
|
10
|
+
instructionSysvarAccount: PublicKey
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function updateGlobalConfigAdmin(
|
|
14
|
+
accounts: UpdateGlobalConfigAdminAccounts,
|
|
15
|
+
programId: PublicKey = PROGRAM_ID
|
|
16
|
+
) {
|
|
17
|
+
const keys: Array<AccountMeta> = [
|
|
18
|
+
{ pubkey: accounts.pendingAdmin, isSigner: true, isWritable: false },
|
|
19
|
+
{ pubkey: accounts.globalConfig, isSigner: false, isWritable: true },
|
|
20
|
+
{
|
|
21
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
22
|
+
isSigner: false,
|
|
23
|
+
isWritable: false,
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
const identifier = Buffer.from([184, 87, 23, 193, 156, 238, 175, 119])
|
|
27
|
+
const data = identifier
|
|
28
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
29
|
+
return ix
|
|
30
|
+
}
|
|
@@ -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 UpdateLendingMarketArgs {
|
|
@@ -9,20 +10,29 @@ export interface UpdateLendingMarketArgs {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface UpdateLendingMarketAccounts {
|
|
12
|
-
|
|
13
|
+
signer: PublicKey
|
|
13
14
|
lendingMarket: PublicKey
|
|
15
|
+
instructionSysvarAccount: PublicKey
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
export const layout = borsh.struct([
|
|
18
|
+
export const layout = borsh.struct([
|
|
19
|
+
borsh.u64("mode"),
|
|
20
|
+
borsh.array(borsh.u8(), 72, "value"),
|
|
21
|
+
])
|
|
17
22
|
|
|
18
23
|
export function updateLendingMarket(
|
|
19
24
|
args: UpdateLendingMarketArgs,
|
|
20
25
|
accounts: UpdateLendingMarketAccounts,
|
|
21
|
-
programId: PublicKey = PROGRAM_ID
|
|
26
|
+
programId: PublicKey = PROGRAM_ID
|
|
22
27
|
) {
|
|
23
28
|
const keys: Array<AccountMeta> = [
|
|
24
|
-
{ pubkey: accounts.
|
|
29
|
+
{ pubkey: accounts.signer, isSigner: true, isWritable: false },
|
|
25
30
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: true },
|
|
31
|
+
{
|
|
32
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
33
|
+
isSigner: false,
|
|
34
|
+
isWritable: false,
|
|
35
|
+
},
|
|
26
36
|
]
|
|
27
37
|
const identifier = Buffer.from([209, 157, 53, 210, 97, 180, 31, 45])
|
|
28
38
|
const buffer = Buffer.alloc(1000)
|
|
@@ -31,7 +41,7 @@ export function updateLendingMarket(
|
|
|
31
41
|
mode: args.mode,
|
|
32
42
|
value: args.value,
|
|
33
43
|
},
|
|
34
|
-
buffer
|
|
44
|
+
buffer
|
|
35
45
|
)
|
|
36
46
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
37
47
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -1,14 +1,18 @@
|
|
|
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 UpdateLendingMarketOwnerAccounts {
|
|
5
8
|
lendingMarketOwnerCached: PublicKey
|
|
6
9
|
lendingMarket: PublicKey
|
|
10
|
+
instructionSysvarAccount: PublicKey
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
export function updateLendingMarketOwner(
|
|
10
14
|
accounts: UpdateLendingMarketOwnerAccounts,
|
|
11
|
-
programId: PublicKey = PROGRAM_ID
|
|
15
|
+
programId: PublicKey = PROGRAM_ID
|
|
12
16
|
) {
|
|
13
17
|
const keys: Array<AccountMeta> = [
|
|
14
18
|
{
|
|
@@ -17,6 +21,11 @@ export function updateLendingMarketOwner(
|
|
|
17
21
|
isWritable: false,
|
|
18
22
|
},
|
|
19
23
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: true },
|
|
24
|
+
{
|
|
25
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
26
|
+
isSigner: false,
|
|
27
|
+
isWritable: false,
|
|
28
|
+
},
|
|
20
29
|
]
|
|
21
30
|
const identifier = Buffer.from([118, 224, 10, 62, 196, 230, 184, 89])
|
|
22
31
|
const data = identifier
|
|
@@ -0,0 +1,65 @@
|
|
|
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 UpdateObligationConfigArgs {
|
|
8
|
+
mode: types.UpdateObligationConfigModeKind
|
|
9
|
+
value: Uint8Array
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateObligationConfigAccounts {
|
|
13
|
+
owner: PublicKey
|
|
14
|
+
obligation: PublicKey
|
|
15
|
+
borrowReserve?: PublicKey | null
|
|
16
|
+
depositReserve?: PublicKey | null
|
|
17
|
+
lendingMarket: PublicKey
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const layout = borsh.struct([
|
|
21
|
+
types.UpdateObligationConfigMode.layout("mode"),
|
|
22
|
+
borsh.vecU8("value"),
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
function optionalAccountMeta(
|
|
26
|
+
pubkey: PublicKey | null | undefined,
|
|
27
|
+
isWritable: boolean,
|
|
28
|
+
programId: PublicKey
|
|
29
|
+
): AccountMeta {
|
|
30
|
+
return {
|
|
31
|
+
pubkey: pubkey ?? programId,
|
|
32
|
+
isSigner: false,
|
|
33
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function updateObligationConfig(
|
|
38
|
+
args: UpdateObligationConfigArgs,
|
|
39
|
+
accounts: UpdateObligationConfigAccounts,
|
|
40
|
+
programId: PublicKey = PROGRAM_ID
|
|
41
|
+
) {
|
|
42
|
+
const keys: Array<AccountMeta> = [
|
|
43
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
44
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
45
|
+
optionalAccountMeta(accounts.borrowReserve, false, programId),
|
|
46
|
+
optionalAccountMeta(accounts.depositReserve, false, programId),
|
|
47
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
48
|
+
]
|
|
49
|
+
const identifier = Buffer.from([82, 152, 213, 69, 250, 0, 157, 188])
|
|
50
|
+
const buffer = Buffer.alloc(1000)
|
|
51
|
+
const len = layout.encode(
|
|
52
|
+
{
|
|
53
|
+
mode: args.mode.toEncodable(),
|
|
54
|
+
value: Buffer.from(
|
|
55
|
+
args.value.buffer,
|
|
56
|
+
args.value.byteOffset,
|
|
57
|
+
args.value.length
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
buffer
|
|
61
|
+
)
|
|
62
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
63
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
64
|
+
return ix
|
|
65
|
+
}
|
|
@@ -1,41 +1,58 @@
|
|
|
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 UpdateReserveConfigArgs {
|
|
7
|
-
mode:
|
|
8
|
+
mode: types.UpdateConfigModeKind
|
|
8
9
|
value: Uint8Array
|
|
9
|
-
|
|
10
|
+
skipConfigIntegrityValidation: boolean
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface UpdateReserveConfigAccounts {
|
|
13
|
-
|
|
14
|
+
signer: PublicKey
|
|
15
|
+
globalConfig: PublicKey
|
|
14
16
|
lendingMarket: PublicKey
|
|
15
17
|
reserve: PublicKey
|
|
18
|
+
instructionSysvarAccount: PublicKey
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
export const layout = borsh.struct([
|
|
21
|
+
export const layout = borsh.struct([
|
|
22
|
+
types.UpdateConfigMode.layout("mode"),
|
|
23
|
+
borsh.vecU8("value"),
|
|
24
|
+
borsh.bool("skipConfigIntegrityValidation"),
|
|
25
|
+
])
|
|
19
26
|
|
|
20
27
|
export function updateReserveConfig(
|
|
21
28
|
args: UpdateReserveConfigArgs,
|
|
22
29
|
accounts: UpdateReserveConfigAccounts,
|
|
23
|
-
programId: PublicKey = PROGRAM_ID
|
|
30
|
+
programId: PublicKey = PROGRAM_ID
|
|
24
31
|
) {
|
|
25
32
|
const keys: Array<AccountMeta> = [
|
|
26
|
-
{ pubkey: accounts.
|
|
33
|
+
{ pubkey: accounts.signer, isSigner: true, isWritable: false },
|
|
34
|
+
{ pubkey: accounts.globalConfig, isSigner: false, isWritable: false },
|
|
27
35
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
28
36
|
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
37
|
+
{
|
|
38
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable: false,
|
|
41
|
+
},
|
|
29
42
|
]
|
|
30
43
|
const identifier = Buffer.from([61, 148, 100, 70, 143, 107, 17, 13])
|
|
31
44
|
const buffer = Buffer.alloc(1000)
|
|
32
45
|
const len = layout.encode(
|
|
33
46
|
{
|
|
34
|
-
mode: args.mode,
|
|
35
|
-
value: Buffer.from(
|
|
36
|
-
|
|
47
|
+
mode: args.mode.toEncodable(),
|
|
48
|
+
value: Buffer.from(
|
|
49
|
+
args.value.buffer,
|
|
50
|
+
args.value.byteOffset,
|
|
51
|
+
args.value.length
|
|
52
|
+
),
|
|
53
|
+
skipConfigIntegrityValidation: args.skipConfigIntegrityValidation,
|
|
37
54
|
},
|
|
38
|
-
buffer
|
|
55
|
+
buffer
|
|
39
56
|
)
|
|
40
57
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
41
58
|
const ix = new TransactionInstruction({ keys, programId, data })
|