@exponent-labs/klend-idl 0.9.25 → 0.9.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/accounts/GlobalConfig.d.ts +27 -0
- package/build/accounts/GlobalConfig.js +112 -0
- package/build/accounts/GlobalConfig.js.map +1 -0
- package/build/accounts/LendingMarket.d.ts +94 -12
- package/build/accounts/LendingMarket.js +219 -27
- package/build/accounts/LendingMarket.js.map +1 -1
- package/build/accounts/Obligation.d.ts +34 -12
- package/build/accounts/Obligation.js +86 -27
- package/build/accounts/Obligation.js.map +1 -1
- package/build/accounts/ReferrerState.d.ts +1 -3
- package/build/accounts/ReferrerState.js +24 -9
- package/build/accounts/ReferrerState.js.map +1 -1
- package/build/accounts/ReferrerTokenState.d.ts +1 -3
- package/build/accounts/ReferrerTokenState.js +20 -8
- package/build/accounts/ReferrerTokenState.js.map +1 -1
- package/build/accounts/Reserve.d.ts +4 -3
- package/build/accounts/Reserve.js +25 -9
- package/build/accounts/Reserve.js.map +1 -1
- package/build/accounts/ShortUrl.d.ts +1 -3
- package/build/accounts/ShortUrl.js +24 -9
- package/build/accounts/ShortUrl.js.map +1 -1
- package/build/accounts/UserMetadata.d.ts +1 -3
- package/build/accounts/UserMetadata.js +20 -8
- package/build/accounts/UserMetadata.js.map +1 -1
- package/build/accounts/UserState.d.ts +1 -3
- package/build/accounts/UserState.js +20 -8
- package/build/accounts/UserState.js.map +1 -1
- package/build/accounts/WithdrawTicket.d.ts +49 -0
- package/build/accounts/WithdrawTicket.js +158 -0
- package/build/accounts/WithdrawTicket.js.map +1 -0
- package/build/accounts/index.d.ts +4 -0
- package/build/accounts/index.js +5 -1
- package/build/accounts/index.js.map +1 -1
- package/build/errors/anchor.js +2 -2
- package/build/errors/anchor.js.map +1 -1
- package/build/errors/custom.d.ts +605 -13
- package/build/errors/custom.js +1064 -27
- package/build/errors/custom.js.map +1 -1
- package/build/errors/index.js +19 -10
- package/build/errors/index.js.map +1 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +20 -14
- package/build/index.js.map +1 -1
- package/build/instructions/abortObligationOwnershipTransfer.d.ts +7 -0
- package/build/instructions/abortObligationOwnershipTransfer.js +21 -0
- package/build/instructions/abortObligationOwnershipTransfer.js.map +1 -0
- package/build/instructions/acceptObligationOwnership.d.ts +7 -0
- package/build/instructions/acceptObligationOwnership.js +21 -0
- package/build/instructions/acceptObligationOwnership.js.map +1 -0
- package/build/instructions/approveObligationOwnershipTransfer.d.ts +9 -0
- package/build/instructions/approveObligationOwnershipTransfer.js +23 -0
- package/build/instructions/approveObligationOwnershipTransfer.js.map +1 -0
- package/build/instructions/borrowObligationLiquidity.d.ts +1 -1
- package/build/instructions/borrowObligationLiquidity.js +28 -11
- package/build/instructions/borrowObligationLiquidity.js.map +1 -1
- package/build/instructions/borrowObligationLiquidityV2.js +45 -15
- package/build/instructions/borrowObligationLiquidityV2.js.map +1 -1
- package/build/instructions/calculateCtokenExchangeRate.d.ts +5 -0
- package/build/instructions/calculateCtokenExchangeRate.js +15 -0
- package/build/instructions/calculateCtokenExchangeRate.js.map +1 -0
- package/build/instructions/cancelWithdrawTicket.d.ts +19 -0
- package/build/instructions/cancelWithdrawTicket.js +87 -0
- package/build/instructions/cancelWithdrawTicket.js.map +1 -0
- package/build/instructions/cloneReserveConfig.d.ts +14 -0
- package/build/instructions/cloneReserveConfig.js +70 -0
- package/build/instructions/cloneReserveConfig.js.map +1 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.js +1 -2
- package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -1
- package/build/instructions/depositAndWithdraw.d.ts +51 -0
- package/build/instructions/depositAndWithdraw.js +202 -0
- package/build/instructions/depositAndWithdraw.js.map +1 -0
- package/build/instructions/depositObligationCollateral.js +19 -9
- package/build/instructions/depositObligationCollateral.js.map +1 -1
- package/build/instructions/depositObligationCollateralV2.d.ts +25 -0
- package/build/instructions/depositObligationCollateralV2.js +109 -0
- package/build/instructions/depositObligationCollateralV2.js.map +1 -0
- package/build/instructions/depositReserveLiquidity.js +20 -10
- package/build/instructions/depositReserveLiquidity.js.map +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +28 -15
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +45 -15
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -1
- package/build/instructions/enqueueToWithdraw.d.ts +26 -0
- package/build/instructions/enqueueToWithdraw.js +113 -0
- package/build/instructions/enqueueToWithdraw.js.map +1 -0
- package/build/instructions/fillBorrowOrder.d.ts +25 -0
- package/build/instructions/fillBorrowOrder.js +82 -0
- package/build/instructions/fillBorrowOrder.js.map +1 -0
- package/build/instructions/fillBorrowOrderV2.d.ts +29 -0
- package/build/instructions/fillBorrowOrderV2.js +122 -0
- package/build/instructions/fillBorrowOrderV2.js.map +1 -0
- package/build/instructions/flashBorrowReserveLiquidity.d.ts +2 -2
- package/build/instructions/flashBorrowReserveLiquidity.js +28 -11
- package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -1
- package/build/instructions/flashRepayReserveLiquidity.d.ts +2 -2
- package/build/instructions/flashRepayReserveLiquidity.js +32 -12
- package/build/instructions/flashRepayReserveLiquidity.js.map +1 -1
- package/build/instructions/idlMissingTypes.d.ts +3 -2
- package/build/instructions/idlMissingTypes.js +26 -12
- package/build/instructions/idlMissingTypes.js.map +1 -1
- package/build/instructions/index.d.ts +61 -3
- package/build/instructions/index.js +62 -3
- package/build/instructions/index.js.map +1 -1
- package/build/instructions/initFarmsForReserve.d.ts +1 -0
- package/build/instructions/initFarmsForReserve.js +25 -10
- package/build/instructions/initFarmsForReserve.js.map +1 -1
- package/build/instructions/initGlobalConfig.d.ts +10 -0
- package/build/instructions/initGlobalConfig.js +24 -0
- package/build/instructions/initGlobalConfig.js.map +1 -0
- package/build/instructions/initLendingMarket.d.ts +1 -0
- package/build/instructions/initLendingMarket.js +27 -10
- package/build/instructions/initLendingMarket.js.map +1 -1
- package/build/instructions/initObligation.js +19 -9
- package/build/instructions/initObligation.js.map +1 -1
- package/build/instructions/initObligationFarmsForReserve.js +20 -10
- package/build/instructions/initObligationFarmsForReserve.js.map +1 -1
- package/build/instructions/initReferrerStateAndShortUrl.js +19 -9
- package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -1
- package/build/instructions/initReferrerTokenState.d.ts +2 -5
- package/build/instructions/initReferrerTokenState.js +4 -33
- package/build/instructions/initReferrerTokenState.js.map +1 -1
- package/build/instructions/initReserve.d.ts +3 -1
- package/build/instructions/initReserve.js +12 -3
- package/build/instructions/initReserve.js.map +1 -1
- package/build/instructions/initUserMetadata.d.ts +1 -1
- package/build/instructions/initUserMetadata.js +27 -14
- package/build/instructions/initUserMetadata.js.map +1 -1
- package/build/instructions/initiateObligationOwnershipTransfer.d.ts +11 -0
- package/build/instructions/initiateObligationOwnershipTransfer.js +61 -0
- package/build/instructions/initiateObligationOwnershipTransfer.js.map +1 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +21 -11
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
- package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +42 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +172 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -0
- package/build/instructions/markObligationForDeleveraging.d.ts +12 -0
- package/build/instructions/markObligationForDeleveraging.js +62 -0
- package/build/instructions/markObligationForDeleveraging.js.map +1 -0
- package/build/instructions/recoverInvalidTicketCollateral.d.ts +20 -0
- package/build/instructions/recoverInvalidTicketCollateral.js +89 -0
- package/build/instructions/recoverInvalidTicketCollateral.js.map +1 -0
- package/build/instructions/redeemFees.js +2 -3
- package/build/instructions/redeemFees.js.map +1 -1
- package/build/instructions/redeemReserveCollateral.js +20 -10
- package/build/instructions/redeemReserveCollateral.js.map +1 -1
- package/build/instructions/refreshObligation.js +1 -2
- package/build/instructions/refreshObligation.js.map +1 -1
- package/build/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
- package/build/instructions/refreshObligationFarmsForReserve.js +42 -16
- package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -1
- package/build/instructions/refreshReserve.d.ts +4 -4
- package/build/instructions/refreshReserve.js +12 -14
- package/build/instructions/refreshReserve.js.map +1 -1
- package/build/instructions/refreshReservesBatch.js +19 -9
- package/build/instructions/refreshReservesBatch.js.map +1 -1
- package/build/instructions/repayAndWithdrawAndRedeem.d.ts +46 -0
- package/build/instructions/repayAndWithdrawAndRedeem.js +177 -0
- package/build/instructions/repayAndWithdrawAndRedeem.js.map +1 -0
- package/build/instructions/repayObligationLiquidity.js +20 -10
- package/build/instructions/repayObligationLiquidity.js.map +1 -1
- package/build/instructions/repayObligationLiquidityV2.js +50 -16
- package/build/instructions/repayObligationLiquidityV2.js.map +1 -1
- package/build/instructions/requestElevationGroup.js +19 -9
- package/build/instructions/requestElevationGroup.js.map +1 -1
- package/build/instructions/rolloverFixedTermBorrow.d.ts +25 -0
- package/build/instructions/rolloverFixedTermBorrow.js +76 -0
- package/build/instructions/rolloverFixedTermBorrow.js.map +1 -0
- package/build/instructions/seedDepositOnInitReserve.d.ts +11 -0
- package/build/instructions/seedDepositOnInitReserve.js +37 -0
- package/build/instructions/seedDepositOnInitReserve.js.map +1 -0
- package/build/instructions/setBorrowOrder.d.ts +20 -0
- package/build/instructions/setBorrowOrder.js +76 -0
- package/build/instructions/setBorrowOrder.js.map +1 -0
- package/build/instructions/setBorrowOrderV2.d.ts +21 -0
- package/build/instructions/setBorrowOrderV2.js +78 -0
- package/build/instructions/setBorrowOrderV2.js.map +1 -0
- package/build/instructions/setObligationOrder.d.ts +13 -0
- package/build/instructions/setObligationOrder.js +62 -0
- package/build/instructions/setObligationOrder.js.map +1 -0
- package/build/instructions/socializeLoss.d.ts +1 -1
- package/build/instructions/socializeLoss.js +20 -10
- package/build/instructions/socializeLoss.js.map +1 -1
- package/build/instructions/socializeLossV2.d.ts +22 -0
- package/build/instructions/socializeLossV2.js +94 -0
- package/build/instructions/socializeLossV2.js.map +1 -0
- package/build/instructions/topupReserveRewards.d.ts +16 -0
- package/build/instructions/topupReserveRewards.js +73 -0
- package/build/instructions/topupReserveRewards.js.map +1 -0
- package/build/instructions/updateGlobalConfig.d.ts +13 -0
- package/build/instructions/updateGlobalConfig.js +66 -0
- package/build/instructions/updateGlobalConfig.js.map +1 -0
- package/build/instructions/updateGlobalConfigAdmin.d.ts +7 -0
- package/build/instructions/updateGlobalConfigAdmin.js +21 -0
- package/build/instructions/updateGlobalConfigAdmin.js.map +1 -0
- package/build/instructions/updateLendingMarket.d.ts +2 -1
- package/build/instructions/updateLendingMarket.js +29 -11
- package/build/instructions/updateLendingMarket.js.map +1 -1
- package/build/instructions/updateLendingMarketOwner.d.ts +1 -0
- package/build/instructions/updateLendingMarketOwner.js +6 -2
- package/build/instructions/updateLendingMarketOwner.js.map +1 -1
- package/build/instructions/updateObligationConfig.d.ts +15 -0
- package/build/instructions/updateObligationConfig.js +71 -0
- package/build/instructions/updateObligationConfig.js.map +1 -0
- package/build/instructions/updateReserveConfig.d.ts +6 -4
- package/build/instructions/updateReserveConfig.js +34 -13
- package/build/instructions/updateReserveConfig.js.map +1 -1
- package/build/instructions/withdrawObligationCollateral.js +20 -10
- package/build/instructions/withdrawObligationCollateral.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +28 -15
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +40 -14
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -1
- package/build/instructions/withdrawObligationCollateralV2.d.ts +25 -0
- package/build/instructions/withdrawObligationCollateralV2.js +109 -0
- package/build/instructions/withdrawObligationCollateralV2.js.map +1 -0
- package/build/instructions/withdrawProtocolFee.d.ts +3 -2
- package/build/instructions/withdrawProtocolFee.js +25 -14
- package/build/instructions/withdrawProtocolFee.js.map +1 -1
- package/build/instructions/withdrawQueuedLiquidity.d.ts +23 -0
- package/build/instructions/withdrawQueuedLiquidity.js +80 -0
- package/build/instructions/withdrawQueuedLiquidity.js.map +1 -0
- package/build/instructions/withdrawReferrerFees.js +2 -3
- package/build/instructions/withdrawReferrerFees.js.map +1 -1
- package/build/kamino_lending.d.ts +5753 -2295
- package/build/kamino_lending.js +5 -3936
- package/build/kamino_lending.js.map +1 -1
- package/build/kamino_lending.json +1856 -645
- package/build/types/AssetTier.js +21 -11
- package/build/types/AssetTier.js.map +1 -1
- package/build/types/BigFractionBytes.d.ts +2 -1
- package/build/types/BigFractionBytes.js +21 -8
- package/build/types/BigFractionBytes.js.map +1 -1
- package/build/types/BorrowOrder.d.ts +83 -0
- package/build/types/BorrowOrder.js +164 -0
- package/build/types/BorrowOrder.js.map +1 -0
- package/build/types/BorrowOrderConfigArgs.d.ts +42 -0
- package/build/types/BorrowOrderConfigArgs.js +107 -0
- package/build/types/BorrowOrderConfigArgs.js.map +1 -0
- package/build/types/BorrowRateCurve.js +17 -7
- package/build/types/BorrowRateCurve.js.map +1 -1
- package/build/types/CurvePoint.d.ts +2 -1
- package/build/types/CurvePoint.js +17 -7
- package/build/types/CurvePoint.js.map +1 -1
- package/build/types/ElevationGroup.d.ts +2 -1
- package/build/types/ElevationGroup.js +17 -7
- package/build/types/ElevationGroup.js.map +1 -1
- package/build/types/ExchangeRateWithDecimals.d.ts +27 -0
- package/build/types/ExchangeRateWithDecimals.js +82 -0
- package/build/types/ExchangeRateWithDecimals.js.map +1 -0
- package/build/types/FeeCalculation.js +25 -12
- package/build/types/FeeCalculation.js.map +1 -1
- package/build/types/FixedTermBorrowRolloverConfig.d.ts +47 -0
- package/build/types/FixedTermBorrowRolloverConfig.js +114 -0
- package/build/types/FixedTermBorrowRolloverConfig.js.map +1 -0
- package/build/types/InitObligationArgs.d.ts +2 -1
- package/build/types/InitObligationArgs.js +17 -7
- package/build/types/InitObligationArgs.js.map +1 -1
- package/build/types/LastUpdate.d.ts +12 -6
- package/build/types/LastUpdate.js +36 -14
- package/build/types/LastUpdate.js.map +1 -1
- package/build/types/ObligationCollateral.js +17 -7
- package/build/types/ObligationCollateral.js.map +1 -1
- package/build/types/ObligationLiquidity.d.ts +29 -5
- package/build/types/ObligationLiquidity.js +42 -15
- package/build/types/ObligationLiquidity.js.map +1 -1
- package/build/types/ObligationOrder.d.ts +57 -0
- package/build/types/ObligationOrder.js +127 -0
- package/build/types/ObligationOrder.js.map +1 -0
- package/build/types/PriceHeuristic.js +17 -7
- package/build/types/PriceHeuristic.js.map +1 -1
- package/build/types/ProgressCallbackType.d.ts +31 -0
- package/build/types/ProgressCallbackType.js +108 -0
- package/build/types/ProgressCallbackType.js.map +1 -0
- package/build/types/PythConfiguration.js +17 -7
- package/build/types/PythConfiguration.js.map +1 -1
- package/build/types/ReserveCollateral.js +17 -7
- package/build/types/ReserveCollateral.js.map +1 -1
- package/build/types/ReserveConfig.d.ts +87 -32
- package/build/types/ReserveConfig.js +139 -51
- package/build/types/ReserveConfig.js.map +1 -1
- package/build/types/ReserveConfigCustomizationArgs.d.ts +42 -0
- package/build/types/ReserveConfigCustomizationArgs.js +106 -0
- package/build/types/ReserveConfigCustomizationArgs.js.map +1 -0
- package/build/types/ReserveFarmKind.js +21 -11
- package/build/types/ReserveFarmKind.js.map +1 -1
- package/build/types/ReserveFees.d.ts +5 -5
- package/build/types/ReserveFees.js +24 -14
- package/build/types/ReserveFees.js.map +1 -1
- package/build/types/ReserveLiquidity.d.ts +20 -15
- package/build/types/ReserveLiquidity.js +46 -29
- package/build/types/ReserveLiquidity.js.map +1 -1
- package/build/types/ReserveStatus.js +21 -11
- package/build/types/ReserveStatus.js.map +1 -1
- package/build/types/ScopeConfiguration.js +17 -7
- package/build/types/ScopeConfiguration.js.map +1 -1
- package/build/types/SwitchboardConfiguration.js +17 -7
- package/build/types/SwitchboardConfiguration.js.map +1 -1
- package/build/types/TokenInfo.js +17 -7
- package/build/types/TokenInfo.js.map +1 -1
- package/build/types/UpdateConfigMode.d.ts +232 -63
- package/build/types/UpdateConfigMode.js +433 -110
- package/build/types/UpdateConfigMode.js.map +1 -1
- package/build/types/UpdateGlobalConfigMode.d.ts +31 -0
- package/build/types/UpdateGlobalConfigMode.js +108 -0
- package/build/types/UpdateGlobalConfigMode.js.map +1 -0
- package/build/types/UpdateLendingMarketConfigValue.d.ts +20 -0
- package/build/types/UpdateLendingMarketConfigValue.js +53 -11
- package/build/types/UpdateLendingMarketConfigValue.js.map +1 -1
- package/build/types/UpdateLendingMarketMode.d.ts +400 -23
- package/build/types/UpdateLendingMarketMode.js +752 -46
- package/build/types/UpdateLendingMarketMode.js.map +1 -1
- package/build/types/UpdateObligationConfigMode.d.ts +83 -0
- package/build/types/UpdateObligationConfigMode.js +204 -0
- package/build/types/UpdateObligationConfigMode.js.map +1 -0
- package/build/types/WithdrawQueue.d.ts +32 -0
- package/build/types/WithdrawQueue.js +93 -0
- package/build/types/WithdrawQueue.js.map +1 -0
- package/build/types/WithdrawalCaps.js +17 -7
- package/build/types/WithdrawalCaps.js.map +1 -1
- package/build/types/index.d.ts +32 -10
- package/build/types/index.js +38 -10
- package/build/types/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/generate-idl-module.mjs +18 -0
- package/scripts/patch-optional-accounts.mjs +98 -0
- package/scripts/verify-idl-provenance.mjs +16 -0
- package/src/accounts/GlobalConfig.ts +113 -0
- package/src/accounts/LendingMarket.ts +300 -29
- package/src/accounts/Obligation.ts +111 -26
- package/src/accounts/ReferrerState.ts +11 -4
- package/src/accounts/ReferrerTokenState.ts +6 -3
- package/src/accounts/Reserve.ts +10 -2
- package/src/accounts/ShortUrl.ts +15 -4
- package/src/accounts/UserMetadata.ts +6 -3
- package/src/accounts/UserState.ts +24 -8
- package/src/accounts/WithdrawTicket.ts +173 -0
- package/src/accounts/index.ts +4 -0
- package/src/errors/custom.ts +1177 -24
- package/src/index.ts +2 -4
- package/src/instructions/abortObligationOwnershipTransfer.ts +30 -0
- package/src/instructions/acceptObligationOwnership.ts +30 -0
- package/src/instructions/approveObligationOwnershipTransfer.ts +34 -0
- package/src/instructions/borrowObligationLiquidity.ts +18 -5
- package/src/instructions/borrowObligationLiquidityV2.ts +30 -9
- package/src/instructions/calculateCtokenExchangeRate.ts +22 -0
- package/src/instructions/cancelWithdrawTicket.ts +77 -0
- package/src/instructions/cloneReserveConfig.ts +56 -0
- package/src/instructions/deleteReferrerStateAndShortUrl.ts +4 -1
- package/src/instructions/depositAndWithdraw.ts +229 -0
- package/src/instructions/depositObligationCollateral.ts +3 -2
- package/src/instructions/depositObligationCollateralV2.ts +110 -0
- package/src/instructions/depositReserveLiquidity.ts +4 -3
- package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +18 -9
- package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +31 -14
- package/src/instructions/enqueueToWithdraw.ts +113 -0
- package/src/instructions/fillBorrowOrder.ts +114 -0
- package/src/instructions/fillBorrowOrderV2.ts +128 -0
- package/src/instructions/flashBorrowReserveLiquidity.ts +19 -6
- package/src/instructions/flashRepayReserveLiquidity.ts +23 -7
- package/src/instructions/idlMissingTypes.ts +17 -9
- package/src/instructions/index.ts +118 -6
- package/src/instructions/initFarmsForReserve.ts +11 -3
- package/src/instructions/initGlobalConfig.ts +36 -0
- package/src/instructions/initLendingMarket.ts +13 -3
- package/src/instructions/initObligation.ts +3 -2
- package/src/instructions/initObligationFarmsForReserve.ts +5 -3
- package/src/instructions/initReferrerStateAndShortUrl.ts +4 -2
- package/src/instructions/initReferrerTokenState.ts +6 -16
- package/src/instructions/initReserve.ts +21 -3
- package/src/instructions/initUserMetadata.ts +18 -8
- package/src/instructions/initiateObligationOwnershipTransfer.ts +44 -0
- package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +7 -5
- package/src/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +191 -0
- package/src/instructions/markObligationForDeleveraging.ts +46 -0
- package/src/instructions/recoverInvalidTicketCollateral.ts +80 -0
- package/src/instructions/redeemFees.ts +8 -2
- package/src/instructions/redeemReserveCollateral.ts +4 -3
- package/src/instructions/refreshObligation.ts +7 -1
- package/src/instructions/refreshObligationFarmsForReserve.ts +35 -15
- package/src/instructions/refreshReserve.ts +27 -17
- package/src/instructions/refreshReservesBatch.ts +7 -2
- package/src/instructions/repayAndWithdrawAndRedeem.ts +199 -0
- package/src/instructions/repayObligationLiquidity.ts +4 -3
- package/src/instructions/repayObligationLiquidityV2.ts +35 -10
- package/src/instructions/requestElevationGroup.ts +4 -2
- package/src/instructions/rolloverFixedTermBorrow.ts +108 -0
- package/src/instructions/seedDepositOnInitReserve.ts +50 -0
- package/src/instructions/setBorrowOrder.ts +66 -0
- package/src/instructions/setBorrowOrderV2.ts +69 -0
- package/src/instructions/setObligationOrder.ts +45 -0
- package/src/instructions/socializeLoss.ts +5 -4
- package/src/instructions/socializeLossV2.ts +92 -0
- package/src/instructions/topupReserveRewards.ts +60 -0
- package/src/instructions/updateGlobalConfig.ts +53 -0
- package/src/instructions/updateGlobalConfigAdmin.ts +30 -0
- package/src/instructions/updateLendingMarket.ts +15 -5
- package/src/instructions/updateLendingMarketOwner.ts +10 -1
- package/src/instructions/updateObligationConfig.ts +65 -0
- package/src/instructions/updateReserveConfig.ts +27 -10
- package/src/instructions/withdrawObligationCollateral.ts +4 -3
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +18 -9
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +26 -13
- package/src/instructions/withdrawObligationCollateralV2.ts +110 -0
- package/src/instructions/withdrawProtocolFee.ts +12 -9
- package/src/instructions/withdrawQueuedLiquidity.ts +110 -0
- package/src/instructions/withdrawReferrerFees.ts +8 -2
- package/src/kamino_lending.json +1856 -645
- package/src/kamino_lending.ts +5558 -6034
- package/src/types/BigFractionBytes.ts +9 -1
- package/src/types/BorrowOrder.ts +168 -0
- package/src/types/BorrowOrderConfigArgs.ts +96 -0
- package/src/types/BorrowRateCurve.ts +10 -3
- package/src/types/CurvePoint.ts +7 -1
- package/src/types/ElevationGroup.ts +2 -1
- package/src/types/ExchangeRateWithDecimals.ts +64 -0
- package/src/types/FeeCalculation.ts +9 -2
- package/src/types/FixedTermBorrowRolloverConfig.ts +110 -0
- package/src/types/InitObligationArgs.ts +3 -0
- package/src/types/LastUpdate.ts +26 -10
- package/src/types/ObligationLiquidity.ts +43 -10
- package/src/types/ObligationOrder.ts +121 -0
- package/src/types/ProgressCallbackType.ts +90 -0
- package/src/types/ReserveConfig.ts +169 -62
- package/src/types/ReserveConfigCustomizationArgs.ts +96 -0
- package/src/types/ReserveFees.ts +9 -9
- package/src/types/ReserveLiquidity.ts +38 -28
- package/src/types/UpdateConfigMode.ts +507 -117
- package/src/types/UpdateGlobalConfigMode.ts +90 -0
- package/src/types/UpdateLendingMarketConfigValue.ts +43 -0
- package/src/types/UpdateLendingMarketMode.ts +912 -41
- package/src/types/UpdateObligationConfigMode.ts +210 -0
- package/src/types/WithdrawQueue.ts +85 -0
- package/src/types/index.ts +175 -34
- package/src/types/AssetTier.ts +0 -116
package/src/index.ts
CHANGED
|
@@ -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 AbortObligationOwnershipTransferAccounts {
|
|
8
|
+
owner: PublicKey
|
|
9
|
+
obligation: PublicKey
|
|
10
|
+
instructionSysvarAccount: PublicKey
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function abortObligationOwnershipTransfer(
|
|
14
|
+
accounts: AbortObligationOwnershipTransferAccounts,
|
|
15
|
+
programId: PublicKey = PROGRAM_ID
|
|
16
|
+
) {
|
|
17
|
+
const keys: Array<AccountMeta> = [
|
|
18
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
19
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
20
|
+
{
|
|
21
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
22
|
+
isSigner: false,
|
|
23
|
+
isWritable: false,
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
const identifier = Buffer.from([103, 217, 83, 65, 164, 5, 195, 227])
|
|
27
|
+
const data = identifier
|
|
28
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
29
|
+
return ix
|
|
30
|
+
}
|
|
@@ -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 AcceptObligationOwnershipAccounts {
|
|
8
|
+
pendingOwner: PublicKey
|
|
9
|
+
obligation: PublicKey
|
|
10
|
+
instructionSysvarAccount: PublicKey
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function acceptObligationOwnership(
|
|
14
|
+
accounts: AcceptObligationOwnershipAccounts,
|
|
15
|
+
programId: PublicKey = PROGRAM_ID
|
|
16
|
+
) {
|
|
17
|
+
const keys: Array<AccountMeta> = [
|
|
18
|
+
{ pubkey: accounts.pendingOwner, isSigner: true, isWritable: false },
|
|
19
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
20
|
+
{
|
|
21
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
22
|
+
isSigner: false,
|
|
23
|
+
isWritable: false,
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
const identifier = Buffer.from([249, 130, 70, 176, 151, 187, 239, 6])
|
|
27
|
+
const data = identifier
|
|
28
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
29
|
+
return ix
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 ApproveObligationOwnershipTransferAccounts {
|
|
8
|
+
globalAdmin: PublicKey
|
|
9
|
+
globalConfig: PublicKey
|
|
10
|
+
obligation: PublicKey
|
|
11
|
+
pendingOwner: PublicKey
|
|
12
|
+
instructionSysvarAccount: PublicKey
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function approveObligationOwnershipTransfer(
|
|
16
|
+
accounts: ApproveObligationOwnershipTransferAccounts,
|
|
17
|
+
programId: PublicKey = PROGRAM_ID
|
|
18
|
+
) {
|
|
19
|
+
const keys: Array<AccountMeta> = [
|
|
20
|
+
{ pubkey: accounts.globalAdmin, isSigner: true, isWritable: false },
|
|
21
|
+
{ pubkey: accounts.globalConfig, isSigner: false, isWritable: false },
|
|
22
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
23
|
+
{ pubkey: accounts.pendingOwner, isSigner: false, isWritable: false },
|
|
24
|
+
{
|
|
25
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
26
|
+
isSigner: false,
|
|
27
|
+
isWritable: false,
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
const identifier = Buffer.from([61, 227, 231, 46, 196, 124, 60, 161])
|
|
31
|
+
const data = identifier
|
|
32
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
33
|
+
return ix
|
|
34
|
+
}
|
|
@@ -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 BorrowObligationLiquidityArgs {
|
|
@@ -17,17 +18,29 @@ export interface BorrowObligationLiquidityAccounts {
|
|
|
17
18
|
reserveSourceLiquidity: PublicKey
|
|
18
19
|
borrowReserveLiquidityFeeReceiver: PublicKey
|
|
19
20
|
userDestinationLiquidity: PublicKey
|
|
20
|
-
referrerTokenState
|
|
21
|
+
referrerTokenState?: PublicKey | null
|
|
21
22
|
tokenProgram: PublicKey
|
|
22
23
|
instructionSysvarAccount: PublicKey
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const layout = borsh.struct([borsh.u64("liquidityAmount")])
|
|
26
27
|
|
|
28
|
+
function optionalAccountMeta(
|
|
29
|
+
pubkey: PublicKey | null | undefined,
|
|
30
|
+
isWritable: boolean,
|
|
31
|
+
programId: PublicKey
|
|
32
|
+
): AccountMeta {
|
|
33
|
+
return {
|
|
34
|
+
pubkey: pubkey ?? programId,
|
|
35
|
+
isSigner: false,
|
|
36
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
export function borrowObligationLiquidity(
|
|
28
41
|
args: BorrowObligationLiquidityArgs,
|
|
29
42
|
accounts: BorrowObligationLiquidityAccounts,
|
|
30
|
-
programId: PublicKey = PROGRAM_ID
|
|
43
|
+
programId: PublicKey = PROGRAM_ID
|
|
31
44
|
) {
|
|
32
45
|
const keys: Array<AccountMeta> = [
|
|
33
46
|
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
@@ -42,7 +55,7 @@ export function borrowObligationLiquidity(
|
|
|
42
55
|
{
|
|
43
56
|
pubkey: accounts.borrowReserveLiquidityMint,
|
|
44
57
|
isSigner: false,
|
|
45
|
-
isWritable:
|
|
58
|
+
isWritable: false,
|
|
46
59
|
},
|
|
47
60
|
{
|
|
48
61
|
pubkey: accounts.reserveSourceLiquidity,
|
|
@@ -59,7 +72,7 @@ export function borrowObligationLiquidity(
|
|
|
59
72
|
isSigner: false,
|
|
60
73
|
isWritable: true,
|
|
61
74
|
},
|
|
62
|
-
|
|
75
|
+
optionalAccountMeta(accounts.referrerTokenState, true, programId),
|
|
63
76
|
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
64
77
|
{
|
|
65
78
|
pubkey: accounts.instructionSysvarAccount,
|
|
@@ -73,7 +86,7 @@ export function borrowObligationLiquidity(
|
|
|
73
86
|
{
|
|
74
87
|
liquidityAmount: args.liquidityAmount,
|
|
75
88
|
},
|
|
76
|
-
buffer
|
|
89
|
+
buffer
|
|
77
90
|
)
|
|
78
91
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
79
92
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -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 BorrowObligationLiquidityV2Args {
|
|
@@ -34,30 +35,46 @@ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
|
|
|
34
35
|
function optionalAccountMeta(
|
|
35
36
|
pubkey: PublicKey | null | undefined,
|
|
36
37
|
isWritable: boolean,
|
|
37
|
-
programId: PublicKey
|
|
38
|
+
programId: PublicKey
|
|
38
39
|
): AccountMeta {
|
|
39
40
|
return {
|
|
40
41
|
pubkey: pubkey ?? programId,
|
|
41
42
|
isSigner: false,
|
|
42
|
-
isWritable,
|
|
43
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export function borrowObligationLiquidityV2(
|
|
47
48
|
args: BorrowObligationLiquidityV2Args,
|
|
48
49
|
accounts: BorrowObligationLiquidityV2Accounts,
|
|
49
|
-
programId: PublicKey = PROGRAM_ID
|
|
50
|
+
programId: PublicKey = PROGRAM_ID
|
|
50
51
|
) {
|
|
51
52
|
const keys: Array<AccountMeta> = [
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
{
|
|
54
|
+
pubkey: accounts.borrowAccounts.owner,
|
|
55
|
+
isSigner: true,
|
|
56
|
+
isWritable: false,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
pubkey: accounts.borrowAccounts.obligation,
|
|
60
|
+
isSigner: false,
|
|
61
|
+
isWritable: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
pubkey: accounts.borrowAccounts.lendingMarket,
|
|
65
|
+
isSigner: false,
|
|
66
|
+
isWritable: false,
|
|
67
|
+
},
|
|
55
68
|
{
|
|
56
69
|
pubkey: accounts.borrowAccounts.lendingMarketAuthority,
|
|
57
70
|
isSigner: false,
|
|
58
71
|
isWritable: false,
|
|
59
72
|
},
|
|
60
|
-
{
|
|
73
|
+
{
|
|
74
|
+
pubkey: accounts.borrowAccounts.borrowReserve,
|
|
75
|
+
isSigner: false,
|
|
76
|
+
isWritable: true,
|
|
77
|
+
},
|
|
61
78
|
{
|
|
62
79
|
pubkey: accounts.borrowAccounts.borrowReserveLiquidityMint,
|
|
63
80
|
isSigner: false,
|
|
@@ -79,7 +96,11 @@ export function borrowObligationLiquidityV2(
|
|
|
79
96
|
isWritable: true,
|
|
80
97
|
},
|
|
81
98
|
optionalAccountMeta(accounts.borrowAccounts.referrerTokenState, true, programId),
|
|
82
|
-
{
|
|
99
|
+
{
|
|
100
|
+
pubkey: accounts.borrowAccounts.tokenProgram,
|
|
101
|
+
isSigner: false,
|
|
102
|
+
isWritable: false,
|
|
103
|
+
},
|
|
83
104
|
{
|
|
84
105
|
pubkey: accounts.borrowAccounts.instructionSysvarAccount,
|
|
85
106
|
isSigner: false,
|
|
@@ -95,7 +116,7 @@ export function borrowObligationLiquidityV2(
|
|
|
95
116
|
{
|
|
96
117
|
liquidityAmount: args.liquidityAmount,
|
|
97
118
|
},
|
|
98
|
-
buffer
|
|
119
|
+
buffer
|
|
99
120
|
)
|
|
100
121
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
101
122
|
const ix = new TransactionInstruction({ keys, programId, data })
|
|
@@ -0,0 +1,22 @@
|
|
|
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 CalculateCtokenExchangeRateAccounts {
|
|
8
|
+
reserve: PublicKey
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function calculateCtokenExchangeRate(
|
|
12
|
+
accounts: CalculateCtokenExchangeRateAccounts,
|
|
13
|
+
programId: PublicKey = PROGRAM_ID
|
|
14
|
+
) {
|
|
15
|
+
const keys: Array<AccountMeta> = [
|
|
16
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: false },
|
|
17
|
+
]
|
|
18
|
+
const identifier = Buffer.from([32, 253, 220, 13, 19, 165, 131, 188])
|
|
19
|
+
const data = identifier
|
|
20
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
21
|
+
return ix
|
|
22
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 CancelWithdrawTicketArgs {
|
|
8
|
+
ticketSequenceNumber: BN
|
|
9
|
+
collateralAmountToCancel: BN
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface CancelWithdrawTicketAccounts {
|
|
13
|
+
owner: PublicKey
|
|
14
|
+
lendingMarket: PublicKey
|
|
15
|
+
lendingMarketAuthority: PublicKey
|
|
16
|
+
reserve: PublicKey
|
|
17
|
+
reserveCollateralMint: PublicKey
|
|
18
|
+
ownerQueuedCollateralVault: PublicKey
|
|
19
|
+
userDestinationCollateral: PublicKey
|
|
20
|
+
collateralTokenProgram: PublicKey
|
|
21
|
+
withdrawTicket: PublicKey
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const layout = borsh.struct([
|
|
25
|
+
borsh.u64("ticketSequenceNumber"),
|
|
26
|
+
borsh.u64("collateralAmountToCancel"),
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
export function cancelWithdrawTicket(
|
|
30
|
+
args: CancelWithdrawTicketArgs,
|
|
31
|
+
accounts: CancelWithdrawTicketAccounts,
|
|
32
|
+
programId: PublicKey = PROGRAM_ID
|
|
33
|
+
) {
|
|
34
|
+
const keys: Array<AccountMeta> = [
|
|
35
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
36
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
37
|
+
{
|
|
38
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable: false,
|
|
41
|
+
},
|
|
42
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
43
|
+
{
|
|
44
|
+
pubkey: accounts.reserveCollateralMint,
|
|
45
|
+
isSigner: false,
|
|
46
|
+
isWritable: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
pubkey: accounts.ownerQueuedCollateralVault,
|
|
50
|
+
isSigner: false,
|
|
51
|
+
isWritable: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pubkey: accounts.userDestinationCollateral,
|
|
55
|
+
isSigner: false,
|
|
56
|
+
isWritable: true,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
pubkey: accounts.collateralTokenProgram,
|
|
60
|
+
isSigner: false,
|
|
61
|
+
isWritable: false,
|
|
62
|
+
},
|
|
63
|
+
{ pubkey: accounts.withdrawTicket, isSigner: false, isWritable: true },
|
|
64
|
+
]
|
|
65
|
+
const identifier = Buffer.from([180, 83, 122, 44, 120, 211, 47, 22])
|
|
66
|
+
const buffer = Buffer.alloc(1000)
|
|
67
|
+
const len = layout.encode(
|
|
68
|
+
{
|
|
69
|
+
ticketSequenceNumber: args.ticketSequenceNumber,
|
|
70
|
+
collateralAmountToCancel: args.collateralAmountToCancel,
|
|
71
|
+
},
|
|
72
|
+
buffer
|
|
73
|
+
)
|
|
74
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
75
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
76
|
+
return ix
|
|
77
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 CloneReserveConfigArgs {
|
|
8
|
+
customizations: types.ReserveConfigCustomizationArgsFields
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CloneReserveConfigAccounts {
|
|
12
|
+
signer: PublicKey
|
|
13
|
+
targetLendingMarket: PublicKey
|
|
14
|
+
sourceReserve: PublicKey
|
|
15
|
+
targetReserve: PublicKey
|
|
16
|
+
instructionSysvarAccount: PublicKey
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const layout = borsh.struct([
|
|
20
|
+
types.ReserveConfigCustomizationArgs.layout("customizations"),
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
export function cloneReserveConfig(
|
|
24
|
+
args: CloneReserveConfigArgs,
|
|
25
|
+
accounts: CloneReserveConfigAccounts,
|
|
26
|
+
programId: PublicKey = PROGRAM_ID
|
|
27
|
+
) {
|
|
28
|
+
const keys: Array<AccountMeta> = [
|
|
29
|
+
{ pubkey: accounts.signer, isSigner: true, isWritable: false },
|
|
30
|
+
{
|
|
31
|
+
pubkey: accounts.targetLendingMarket,
|
|
32
|
+
isSigner: false,
|
|
33
|
+
isWritable: false,
|
|
34
|
+
},
|
|
35
|
+
{ pubkey: accounts.sourceReserve, isSigner: false, isWritable: false },
|
|
36
|
+
{ pubkey: accounts.targetReserve, isSigner: false, isWritable: true },
|
|
37
|
+
{
|
|
38
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable: false,
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
const identifier = Buffer.from([244, 5, 198, 113, 17, 10, 71, 33])
|
|
44
|
+
const buffer = Buffer.alloc(1000)
|
|
45
|
+
const len = layout.encode(
|
|
46
|
+
{
|
|
47
|
+
customizations: types.ReserveConfigCustomizationArgs.toEncodable(
|
|
48
|
+
args.customizations
|
|
49
|
+
),
|
|
50
|
+
},
|
|
51
|
+
buffer
|
|
52
|
+
)
|
|
53
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
54
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
55
|
+
return ix
|
|
56
|
+
}
|
|
@@ -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 DeleteReferrerStateAndShortUrlAccounts {
|
|
@@ -11,7 +14,7 @@ export interface DeleteReferrerStateAndShortUrlAccounts {
|
|
|
11
14
|
|
|
12
15
|
export function deleteReferrerStateAndShortUrl(
|
|
13
16
|
accounts: DeleteReferrerStateAndShortUrlAccounts,
|
|
14
|
-
programId: PublicKey = PROGRAM_ID
|
|
17
|
+
programId: PublicKey = PROGRAM_ID
|
|
15
18
|
) {
|
|
16
19
|
const keys: Array<AccountMeta> = [
|
|
17
20
|
{ pubkey: accounts.referrer, isSigner: true, isWritable: true },
|
|
@@ -0,0 +1,229 @@
|
|
|
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 DepositAndWithdrawArgs {
|
|
8
|
+
liquidityAmount: BN
|
|
9
|
+
withdrawCollateralAmount: BN
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DepositAndWithdrawAccounts {
|
|
13
|
+
depositAccounts: {
|
|
14
|
+
owner: PublicKey
|
|
15
|
+
obligation: PublicKey
|
|
16
|
+
lendingMarket: PublicKey
|
|
17
|
+
lendingMarketAuthority: PublicKey
|
|
18
|
+
reserve: PublicKey
|
|
19
|
+
reserveLiquidityMint: PublicKey
|
|
20
|
+
reserveLiquiditySupply: PublicKey
|
|
21
|
+
reserveCollateralMint: PublicKey
|
|
22
|
+
reserveDestinationDepositCollateral: PublicKey
|
|
23
|
+
userSourceLiquidity: PublicKey
|
|
24
|
+
placeholderUserDestinationCollateral?: PublicKey | null
|
|
25
|
+
collateralTokenProgram: PublicKey
|
|
26
|
+
liquidityTokenProgram: PublicKey
|
|
27
|
+
instructionSysvarAccount: PublicKey
|
|
28
|
+
}
|
|
29
|
+
withdrawAccounts: {
|
|
30
|
+
owner: PublicKey
|
|
31
|
+
obligation: PublicKey
|
|
32
|
+
lendingMarket: PublicKey
|
|
33
|
+
lendingMarketAuthority: PublicKey
|
|
34
|
+
withdrawReserve: PublicKey
|
|
35
|
+
reserveLiquidityMint: PublicKey
|
|
36
|
+
reserveSourceCollateral: PublicKey
|
|
37
|
+
reserveCollateralMint: PublicKey
|
|
38
|
+
reserveLiquiditySupply: PublicKey
|
|
39
|
+
userDestinationLiquidity: PublicKey
|
|
40
|
+
placeholderUserDestinationCollateral?: PublicKey | null
|
|
41
|
+
collateralTokenProgram: PublicKey
|
|
42
|
+
liquidityTokenProgram: PublicKey
|
|
43
|
+
instructionSysvarAccount: PublicKey
|
|
44
|
+
}
|
|
45
|
+
depositFarmsAccounts: {
|
|
46
|
+
obligationFarmUserState?: PublicKey | null
|
|
47
|
+
reserveFarmState?: PublicKey | null
|
|
48
|
+
}
|
|
49
|
+
withdrawFarmsAccounts: {
|
|
50
|
+
obligationFarmUserState?: PublicKey | null
|
|
51
|
+
reserveFarmState?: PublicKey | null
|
|
52
|
+
}
|
|
53
|
+
farmsProgram: PublicKey
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const layout = borsh.struct([
|
|
57
|
+
borsh.u64("liquidityAmount"),
|
|
58
|
+
borsh.u64("withdrawCollateralAmount"),
|
|
59
|
+
])
|
|
60
|
+
|
|
61
|
+
function optionalAccountMeta(
|
|
62
|
+
pubkey: PublicKey | null | undefined,
|
|
63
|
+
isWritable: boolean,
|
|
64
|
+
programId: PublicKey
|
|
65
|
+
): AccountMeta {
|
|
66
|
+
return {
|
|
67
|
+
pubkey: pubkey ?? programId,
|
|
68
|
+
isSigner: false,
|
|
69
|
+
isWritable: pubkey === null || pubkey === undefined ? false : isWritable,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function depositAndWithdraw(
|
|
74
|
+
args: DepositAndWithdrawArgs,
|
|
75
|
+
accounts: DepositAndWithdrawAccounts,
|
|
76
|
+
programId: PublicKey = PROGRAM_ID
|
|
77
|
+
) {
|
|
78
|
+
const keys: Array<AccountMeta> = [
|
|
79
|
+
{
|
|
80
|
+
pubkey: accounts.depositAccounts.owner,
|
|
81
|
+
isSigner: true,
|
|
82
|
+
isWritable: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
pubkey: accounts.depositAccounts.obligation,
|
|
86
|
+
isSigner: false,
|
|
87
|
+
isWritable: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
pubkey: accounts.depositAccounts.lendingMarket,
|
|
91
|
+
isSigner: false,
|
|
92
|
+
isWritable: false,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
pubkey: accounts.depositAccounts.lendingMarketAuthority,
|
|
96
|
+
isSigner: false,
|
|
97
|
+
isWritable: false,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
pubkey: accounts.depositAccounts.reserve,
|
|
101
|
+
isSigner: false,
|
|
102
|
+
isWritable: true,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
pubkey: accounts.depositAccounts.reserveLiquidityMint,
|
|
106
|
+
isSigner: false,
|
|
107
|
+
isWritable: false,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
pubkey: accounts.depositAccounts.reserveLiquiditySupply,
|
|
111
|
+
isSigner: false,
|
|
112
|
+
isWritable: true,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
pubkey: accounts.depositAccounts.reserveCollateralMint,
|
|
116
|
+
isSigner: false,
|
|
117
|
+
isWritable: true,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
pubkey: accounts.depositAccounts.reserveDestinationDepositCollateral,
|
|
121
|
+
isSigner: false,
|
|
122
|
+
isWritable: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
pubkey: accounts.depositAccounts.userSourceLiquidity,
|
|
126
|
+
isSigner: false,
|
|
127
|
+
isWritable: true,
|
|
128
|
+
},
|
|
129
|
+
optionalAccountMeta(accounts.depositAccounts.placeholderUserDestinationCollateral, false, programId),
|
|
130
|
+
{
|
|
131
|
+
pubkey: accounts.depositAccounts.collateralTokenProgram,
|
|
132
|
+
isSigner: false,
|
|
133
|
+
isWritable: false,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
pubkey: accounts.depositAccounts.liquidityTokenProgram,
|
|
137
|
+
isSigner: false,
|
|
138
|
+
isWritable: false,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
pubkey: accounts.depositAccounts.instructionSysvarAccount,
|
|
142
|
+
isSigner: false,
|
|
143
|
+
isWritable: false,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
pubkey: accounts.withdrawAccounts.owner,
|
|
147
|
+
isSigner: true,
|
|
148
|
+
isWritable: true,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
pubkey: accounts.withdrawAccounts.obligation,
|
|
152
|
+
isSigner: false,
|
|
153
|
+
isWritable: true,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
pubkey: accounts.withdrawAccounts.lendingMarket,
|
|
157
|
+
isSigner: false,
|
|
158
|
+
isWritable: false,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
pubkey: accounts.withdrawAccounts.lendingMarketAuthority,
|
|
162
|
+
isSigner: false,
|
|
163
|
+
isWritable: false,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
pubkey: accounts.withdrawAccounts.withdrawReserve,
|
|
167
|
+
isSigner: false,
|
|
168
|
+
isWritable: true,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
pubkey: accounts.withdrawAccounts.reserveLiquidityMint,
|
|
172
|
+
isSigner: false,
|
|
173
|
+
isWritable: false,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
pubkey: accounts.withdrawAccounts.reserveSourceCollateral,
|
|
177
|
+
isSigner: false,
|
|
178
|
+
isWritable: true,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
pubkey: accounts.withdrawAccounts.reserveCollateralMint,
|
|
182
|
+
isSigner: false,
|
|
183
|
+
isWritable: true,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
pubkey: accounts.withdrawAccounts.reserveLiquiditySupply,
|
|
187
|
+
isSigner: false,
|
|
188
|
+
isWritable: true,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
pubkey: accounts.withdrawAccounts.userDestinationLiquidity,
|
|
192
|
+
isSigner: false,
|
|
193
|
+
isWritable: true,
|
|
194
|
+
},
|
|
195
|
+
optionalAccountMeta(accounts.withdrawAccounts.placeholderUserDestinationCollateral, false, programId),
|
|
196
|
+
{
|
|
197
|
+
pubkey: accounts.withdrawAccounts.collateralTokenProgram,
|
|
198
|
+
isSigner: false,
|
|
199
|
+
isWritable: false,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
pubkey: accounts.withdrawAccounts.liquidityTokenProgram,
|
|
203
|
+
isSigner: false,
|
|
204
|
+
isWritable: false,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
pubkey: accounts.withdrawAccounts.instructionSysvarAccount,
|
|
208
|
+
isSigner: false,
|
|
209
|
+
isWritable: false,
|
|
210
|
+
},
|
|
211
|
+
optionalAccountMeta(accounts.depositFarmsAccounts.obligationFarmUserState, true, programId),
|
|
212
|
+
optionalAccountMeta(accounts.depositFarmsAccounts.reserveFarmState, true, programId),
|
|
213
|
+
optionalAccountMeta(accounts.withdrawFarmsAccounts.obligationFarmUserState, true, programId),
|
|
214
|
+
optionalAccountMeta(accounts.withdrawFarmsAccounts.reserveFarmState, true, programId),
|
|
215
|
+
{ pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
|
|
216
|
+
]
|
|
217
|
+
const identifier = Buffer.from([141, 153, 39, 15, 64, 61, 88, 84])
|
|
218
|
+
const buffer = Buffer.alloc(1000)
|
|
219
|
+
const len = layout.encode(
|
|
220
|
+
{
|
|
221
|
+
liquidityAmount: args.liquidityAmount,
|
|
222
|
+
withdrawCollateralAmount: args.withdrawCollateralAmount,
|
|
223
|
+
},
|
|
224
|
+
buffer
|
|
225
|
+
)
|
|
226
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
227
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
228
|
+
return ix
|
|
229
|
+
}
|
|
@@ -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 DepositObligationCollateralArgs {
|
|
@@ -23,7 +24,7 @@ export const layout = borsh.struct([borsh.u64("collateralAmount")])
|
|
|
23
24
|
export function depositObligationCollateral(
|
|
24
25
|
args: DepositObligationCollateralArgs,
|
|
25
26
|
accounts: DepositObligationCollateralAccounts,
|
|
26
|
-
programId: PublicKey = PROGRAM_ID
|
|
27
|
+
programId: PublicKey = PROGRAM_ID
|
|
27
28
|
) {
|
|
28
29
|
const keys: Array<AccountMeta> = [
|
|
29
30
|
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
@@ -53,7 +54,7 @@ export function depositObligationCollateral(
|
|
|
53
54
|
{
|
|
54
55
|
collateralAmount: args.collateralAmount,
|
|
55
56
|
},
|
|
56
|
-
buffer
|
|
57
|
+
buffer
|
|
57
58
|
)
|
|
58
59
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
59
60
|
const ix = new TransactionInstruction({ keys, programId, data })
|