@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PublicKey, Connection } from "@solana/web3.js"
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
3
|
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
5
|
import { PROGRAM_ID } from "../programId"
|
|
4
6
|
|
|
5
7
|
export interface ReferrerStateFields {
|
|
@@ -16,9 +18,14 @@ export class ReferrerState {
|
|
|
16
18
|
readonly shortUrl: PublicKey
|
|
17
19
|
readonly owner: PublicKey
|
|
18
20
|
|
|
19
|
-
static readonly discriminator = Buffer.from([
|
|
21
|
+
static readonly discriminator = Buffer.from([
|
|
22
|
+
194, 81, 217, 103, 12, 19, 12, 66,
|
|
23
|
+
])
|
|
20
24
|
|
|
21
|
-
static readonly layout = borsh.struct([
|
|
25
|
+
static readonly layout = borsh.struct([
|
|
26
|
+
borsh.publicKey("shortUrl"),
|
|
27
|
+
borsh.publicKey("owner"),
|
|
28
|
+
])
|
|
22
29
|
|
|
23
30
|
constructor(fields: ReferrerStateFields) {
|
|
24
31
|
this.shortUrl = fields.shortUrl
|
|
@@ -28,7 +35,7 @@ export class ReferrerState {
|
|
|
28
35
|
static async fetch(
|
|
29
36
|
c: Connection,
|
|
30
37
|
address: PublicKey,
|
|
31
|
-
programId: PublicKey = PROGRAM_ID
|
|
38
|
+
programId: PublicKey = PROGRAM_ID
|
|
32
39
|
): Promise<ReferrerState | null> {
|
|
33
40
|
const info = await c.getAccountInfo(address)
|
|
34
41
|
|
|
@@ -45,7 +52,7 @@ export class ReferrerState {
|
|
|
45
52
|
static async fetchMultiple(
|
|
46
53
|
c: Connection,
|
|
47
54
|
addresses: PublicKey[],
|
|
48
|
-
programId: PublicKey = PROGRAM_ID
|
|
55
|
+
programId: PublicKey = PROGRAM_ID
|
|
49
56
|
): Promise<Array<ReferrerState | null>> {
|
|
50
57
|
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
51
58
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PublicKey, Connection } from "@solana/web3.js"
|
|
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 ReferrerTokenStateFields {
|
|
@@ -29,7 +30,9 @@ export class ReferrerTokenState {
|
|
|
29
30
|
readonly bump: BN
|
|
30
31
|
readonly padding: Array<BN>
|
|
31
32
|
|
|
32
|
-
static readonly discriminator = Buffer.from([
|
|
33
|
+
static readonly discriminator = Buffer.from([
|
|
34
|
+
39, 15, 208, 77, 32, 195, 105, 56,
|
|
35
|
+
])
|
|
33
36
|
|
|
34
37
|
static readonly layout = borsh.struct([
|
|
35
38
|
borsh.publicKey("referrer"),
|
|
@@ -52,7 +55,7 @@ export class ReferrerTokenState {
|
|
|
52
55
|
static async fetch(
|
|
53
56
|
c: Connection,
|
|
54
57
|
address: PublicKey,
|
|
55
|
-
programId: PublicKey = PROGRAM_ID
|
|
58
|
+
programId: PublicKey = PROGRAM_ID
|
|
56
59
|
): Promise<ReferrerTokenState | null> {
|
|
57
60
|
const info = await c.getAccountInfo(address)
|
|
58
61
|
|
|
@@ -69,7 +72,7 @@ export class ReferrerTokenState {
|
|
|
69
72
|
static async fetchMultiple(
|
|
70
73
|
c: Connection,
|
|
71
74
|
addresses: PublicKey[],
|
|
72
|
-
programId: PublicKey = PROGRAM_ID
|
|
75
|
+
programId: PublicKey = PROGRAM_ID
|
|
73
76
|
): Promise<Array<ReferrerTokenState | null>> {
|
|
74
77
|
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
75
78
|
|
package/src/accounts/Reserve.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface ReserveFields {
|
|
|
18
18
|
configPadding: Array<BN>
|
|
19
19
|
borrowedAmountOutsideElevationGroup: BN
|
|
20
20
|
borrowedAmountsAgainstThisReserveInElevationGroups: Array<BN>
|
|
21
|
+
withdrawQueue: types.WithdrawQueueFields
|
|
21
22
|
padding: Array<BN>
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -35,6 +36,7 @@ export interface ReserveJSON {
|
|
|
35
36
|
configPadding: Array<string>
|
|
36
37
|
borrowedAmountOutsideElevationGroup: string
|
|
37
38
|
borrowedAmountsAgainstThisReserveInElevationGroups: Array<string>
|
|
39
|
+
withdrawQueue: types.WithdrawQueueJSON
|
|
38
40
|
padding: Array<string>
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -52,6 +54,7 @@ export class Reserve {
|
|
|
52
54
|
readonly configPadding: Array<BN>
|
|
53
55
|
readonly borrowedAmountOutsideElevationGroup: BN
|
|
54
56
|
readonly borrowedAmountsAgainstThisReserveInElevationGroups: Array<BN>
|
|
57
|
+
readonly withdrawQueue: types.WithdrawQueue
|
|
55
58
|
readonly padding: Array<BN>
|
|
56
59
|
|
|
57
60
|
static readonly discriminator = Buffer.from([
|
|
@@ -69,14 +72,15 @@ export class Reserve {
|
|
|
69
72
|
types.ReserveCollateral.layout("collateral"),
|
|
70
73
|
borsh.array(borsh.u64(), 150, "reserveCollateralPadding"),
|
|
71
74
|
types.ReserveConfig.layout("config"),
|
|
72
|
-
borsh.array(borsh.u64(),
|
|
75
|
+
borsh.array(borsh.u64(), 112, "configPadding"),
|
|
73
76
|
borsh.u64("borrowedAmountOutsideElevationGroup"),
|
|
74
77
|
borsh.array(
|
|
75
78
|
borsh.u64(),
|
|
76
79
|
32,
|
|
77
80
|
"borrowedAmountsAgainstThisReserveInElevationGroups"
|
|
78
81
|
),
|
|
79
|
-
|
|
82
|
+
types.WithdrawQueue.layout("withdrawQueue"),
|
|
83
|
+
borsh.array(borsh.u64(), 204, "padding"),
|
|
80
84
|
])
|
|
81
85
|
|
|
82
86
|
constructor(fields: ReserveFields) {
|
|
@@ -95,6 +99,7 @@ export class Reserve {
|
|
|
95
99
|
fields.borrowedAmountOutsideElevationGroup
|
|
96
100
|
this.borrowedAmountsAgainstThisReserveInElevationGroups =
|
|
97
101
|
fields.borrowedAmountsAgainstThisReserveInElevationGroups
|
|
102
|
+
this.withdrawQueue = new types.WithdrawQueue({ ...fields.withdrawQueue })
|
|
98
103
|
this.padding = fields.padding
|
|
99
104
|
}
|
|
100
105
|
|
|
@@ -157,6 +162,7 @@ export class Reserve {
|
|
|
157
162
|
dec.borrowedAmountOutsideElevationGroup,
|
|
158
163
|
borrowedAmountsAgainstThisReserveInElevationGroups:
|
|
159
164
|
dec.borrowedAmountsAgainstThisReserveInElevationGroups,
|
|
165
|
+
withdrawQueue: types.WithdrawQueue.fromDecoded(dec.withdrawQueue),
|
|
160
166
|
padding: dec.padding,
|
|
161
167
|
})
|
|
162
168
|
}
|
|
@@ -184,6 +190,7 @@ export class Reserve {
|
|
|
184
190
|
this.borrowedAmountsAgainstThisReserveInElevationGroups.map((item) =>
|
|
185
191
|
item.toString()
|
|
186
192
|
),
|
|
193
|
+
withdrawQueue: this.withdrawQueue.toJSON(),
|
|
187
194
|
padding: this.padding.map((item) => item.toString()),
|
|
188
195
|
}
|
|
189
196
|
}
|
|
@@ -212,6 +219,7 @@ export class Reserve {
|
|
|
212
219
|
obj.borrowedAmountsAgainstThisReserveInElevationGroups.map(
|
|
213
220
|
(item) => new BN(item)
|
|
214
221
|
),
|
|
222
|
+
withdrawQueue: types.WithdrawQueue.fromJSON(obj.withdrawQueue),
|
|
215
223
|
padding: obj.padding.map((item) => new BN(item)),
|
|
216
224
|
})
|
|
217
225
|
}
|
package/src/accounts/ShortUrl.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PublicKey, Connection } from "@solana/web3.js"
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
3
|
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
5
|
import { PROGRAM_ID } from "../programId"
|
|
4
6
|
|
|
5
7
|
export interface ShortUrlFields {
|
|
@@ -16,16 +18,25 @@ export class ShortUrl {
|
|
|
16
18
|
readonly referrer: PublicKey
|
|
17
19
|
readonly shortUrl: string
|
|
18
20
|
|
|
19
|
-
static readonly discriminator = Buffer.from([
|
|
21
|
+
static readonly discriminator = Buffer.from([
|
|
22
|
+
28, 89, 174, 25, 226, 124, 126, 212,
|
|
23
|
+
])
|
|
20
24
|
|
|
21
|
-
static readonly layout = borsh.struct([
|
|
25
|
+
static readonly layout = borsh.struct([
|
|
26
|
+
borsh.publicKey("referrer"),
|
|
27
|
+
borsh.str("shortUrl"),
|
|
28
|
+
])
|
|
22
29
|
|
|
23
30
|
constructor(fields: ShortUrlFields) {
|
|
24
31
|
this.referrer = fields.referrer
|
|
25
32
|
this.shortUrl = fields.shortUrl
|
|
26
33
|
}
|
|
27
34
|
|
|
28
|
-
static async fetch(
|
|
35
|
+
static async fetch(
|
|
36
|
+
c: Connection,
|
|
37
|
+
address: PublicKey,
|
|
38
|
+
programId: PublicKey = PROGRAM_ID
|
|
39
|
+
): Promise<ShortUrl | null> {
|
|
29
40
|
const info = await c.getAccountInfo(address)
|
|
30
41
|
|
|
31
42
|
if (info === null) {
|
|
@@ -41,7 +52,7 @@ export class ShortUrl {
|
|
|
41
52
|
static async fetchMultiple(
|
|
42
53
|
c: Connection,
|
|
43
54
|
addresses: PublicKey[],
|
|
44
|
-
programId: PublicKey = PROGRAM_ID
|
|
55
|
+
programId: PublicKey = PROGRAM_ID
|
|
45
56
|
): Promise<Array<ShortUrl | null>> {
|
|
46
57
|
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
47
58
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PublicKey, Connection } from "@solana/web3.js"
|
|
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 UserMetadataFields {
|
|
@@ -29,7 +30,9 @@ export class UserMetadata {
|
|
|
29
30
|
readonly padding1: Array<BN>
|
|
30
31
|
readonly padding2: Array<BN>
|
|
31
32
|
|
|
32
|
-
static readonly discriminator = Buffer.from([
|
|
33
|
+
static readonly discriminator = Buffer.from([
|
|
34
|
+
157, 214, 220, 235, 98, 135, 171, 28,
|
|
35
|
+
])
|
|
33
36
|
|
|
34
37
|
static readonly layout = borsh.struct([
|
|
35
38
|
borsh.publicKey("referrer"),
|
|
@@ -52,7 +55,7 @@ export class UserMetadata {
|
|
|
52
55
|
static async fetch(
|
|
53
56
|
c: Connection,
|
|
54
57
|
address: PublicKey,
|
|
55
|
-
programId: PublicKey = PROGRAM_ID
|
|
58
|
+
programId: PublicKey = PROGRAM_ID
|
|
56
59
|
): Promise<UserMetadata | null> {
|
|
57
60
|
const info = await c.getAccountInfo(address)
|
|
58
61
|
|
|
@@ -69,7 +72,7 @@ export class UserMetadata {
|
|
|
69
72
|
static async fetchMultiple(
|
|
70
73
|
c: Connection,
|
|
71
74
|
addresses: PublicKey[],
|
|
72
|
-
programId: PublicKey = PROGRAM_ID
|
|
75
|
+
programId: PublicKey = PROGRAM_ID
|
|
73
76
|
): Promise<Array<UserMetadata | null>> {
|
|
74
77
|
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
75
78
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PublicKey, Connection } from "@solana/web3.js"
|
|
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 UserStateFields {
|
|
@@ -62,7 +63,9 @@ export class UserState {
|
|
|
62
63
|
readonly lastStakeTs: BN
|
|
63
64
|
readonly padding1: Array<BN>
|
|
64
65
|
|
|
65
|
-
static readonly discriminator = Buffer.from([
|
|
66
|
+
static readonly discriminator = Buffer.from([
|
|
67
|
+
72, 177, 85, 249, 76, 167, 186, 126,
|
|
68
|
+
])
|
|
66
69
|
|
|
67
70
|
static readonly layout = borsh.struct([
|
|
68
71
|
borsh.u64("userId"),
|
|
@@ -104,7 +107,11 @@ export class UserState {
|
|
|
104
107
|
this.padding1 = fields.padding1
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
static async fetch(
|
|
110
|
+
static async fetch(
|
|
111
|
+
c: Connection,
|
|
112
|
+
address: PublicKey,
|
|
113
|
+
programId: PublicKey = PROGRAM_ID
|
|
114
|
+
): Promise<UserState | null> {
|
|
108
115
|
const info = await c.getAccountInfo(address)
|
|
109
116
|
|
|
110
117
|
if (info === null) {
|
|
@@ -120,7 +127,7 @@ export class UserState {
|
|
|
120
127
|
static async fetchMultiple(
|
|
121
128
|
c: Connection,
|
|
122
129
|
addresses: PublicKey[],
|
|
123
|
-
programId: PublicKey = PROGRAM_ID
|
|
130
|
+
programId: PublicKey = PROGRAM_ID
|
|
124
131
|
): Promise<Array<UserState | null>> {
|
|
125
132
|
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
126
133
|
|
|
@@ -171,13 +178,18 @@ export class UserState {
|
|
|
171
178
|
owner: this.owner.toString(),
|
|
172
179
|
isFarmDelegated: this.isFarmDelegated,
|
|
173
180
|
padding0: this.padding0,
|
|
174
|
-
rewardsTallyScaled: this.rewardsTallyScaled.map((item) =>
|
|
175
|
-
|
|
181
|
+
rewardsTallyScaled: this.rewardsTallyScaled.map((item) =>
|
|
182
|
+
item.toString()
|
|
183
|
+
),
|
|
184
|
+
rewardsIssuedUnclaimed: this.rewardsIssuedUnclaimed.map((item) =>
|
|
185
|
+
item.toString()
|
|
186
|
+
),
|
|
176
187
|
lastClaimTs: this.lastClaimTs.map((item) => item.toString()),
|
|
177
188
|
activeStakeScaled: this.activeStakeScaled.toString(),
|
|
178
189
|
pendingDepositStakeScaled: this.pendingDepositStakeScaled.toString(),
|
|
179
190
|
pendingDepositStakeTs: this.pendingDepositStakeTs.toString(),
|
|
180
|
-
pendingWithdrawalUnstakeScaled:
|
|
191
|
+
pendingWithdrawalUnstakeScaled:
|
|
192
|
+
this.pendingWithdrawalUnstakeScaled.toString(),
|
|
181
193
|
pendingWithdrawalUnstakeTs: this.pendingWithdrawalUnstakeTs.toString(),
|
|
182
194
|
bump: this.bump.toString(),
|
|
183
195
|
delegatee: this.delegatee.toString(),
|
|
@@ -194,12 +206,16 @@ export class UserState {
|
|
|
194
206
|
isFarmDelegated: obj.isFarmDelegated,
|
|
195
207
|
padding0: obj.padding0,
|
|
196
208
|
rewardsTallyScaled: obj.rewardsTallyScaled.map((item) => new BN(item)),
|
|
197
|
-
rewardsIssuedUnclaimed: obj.rewardsIssuedUnclaimed.map(
|
|
209
|
+
rewardsIssuedUnclaimed: obj.rewardsIssuedUnclaimed.map(
|
|
210
|
+
(item) => new BN(item)
|
|
211
|
+
),
|
|
198
212
|
lastClaimTs: obj.lastClaimTs.map((item) => new BN(item)),
|
|
199
213
|
activeStakeScaled: new BN(obj.activeStakeScaled),
|
|
200
214
|
pendingDepositStakeScaled: new BN(obj.pendingDepositStakeScaled),
|
|
201
215
|
pendingDepositStakeTs: new BN(obj.pendingDepositStakeTs),
|
|
202
|
-
pendingWithdrawalUnstakeScaled: new BN(
|
|
216
|
+
pendingWithdrawalUnstakeScaled: new BN(
|
|
217
|
+
obj.pendingWithdrawalUnstakeScaled
|
|
218
|
+
),
|
|
203
219
|
pendingWithdrawalUnstakeTs: new BN(obj.pendingWithdrawalUnstakeTs),
|
|
204
220
|
bump: new BN(obj.bump),
|
|
205
221
|
delegatee: new PublicKey(obj.delegatee),
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { PublicKey, Connection } from "@solana/web3.js"
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface WithdrawTicketFields {
|
|
8
|
+
sequenceNumber: BN
|
|
9
|
+
owner: PublicKey
|
|
10
|
+
reserve: PublicKey
|
|
11
|
+
userDestinationLiquidityTa: PublicKey
|
|
12
|
+
queuedCollateralAmount: BN
|
|
13
|
+
createdAtTimestamp: BN
|
|
14
|
+
invalid: number
|
|
15
|
+
progressCallbackType: number
|
|
16
|
+
alignmentPadding: Array<number>
|
|
17
|
+
progressCallbackCustomAccounts: Array<PublicKey>
|
|
18
|
+
endPadding: Array<BN>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface WithdrawTicketJSON {
|
|
22
|
+
sequenceNumber: string
|
|
23
|
+
owner: string
|
|
24
|
+
reserve: string
|
|
25
|
+
userDestinationLiquidityTa: string
|
|
26
|
+
queuedCollateralAmount: string
|
|
27
|
+
createdAtTimestamp: string
|
|
28
|
+
invalid: number
|
|
29
|
+
progressCallbackType: number
|
|
30
|
+
alignmentPadding: Array<number>
|
|
31
|
+
progressCallbackCustomAccounts: Array<string>
|
|
32
|
+
endPadding: Array<string>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class WithdrawTicket {
|
|
36
|
+
readonly sequenceNumber: BN
|
|
37
|
+
readonly owner: PublicKey
|
|
38
|
+
readonly reserve: PublicKey
|
|
39
|
+
readonly userDestinationLiquidityTa: PublicKey
|
|
40
|
+
readonly queuedCollateralAmount: BN
|
|
41
|
+
readonly createdAtTimestamp: BN
|
|
42
|
+
readonly invalid: number
|
|
43
|
+
readonly progressCallbackType: number
|
|
44
|
+
readonly alignmentPadding: Array<number>
|
|
45
|
+
readonly progressCallbackCustomAccounts: Array<PublicKey>
|
|
46
|
+
readonly endPadding: Array<BN>
|
|
47
|
+
|
|
48
|
+
static readonly discriminator = Buffer.from([
|
|
49
|
+
237, 23, 164, 58, 53, 248, 240, 94,
|
|
50
|
+
])
|
|
51
|
+
|
|
52
|
+
static readonly layout = borsh.struct([
|
|
53
|
+
borsh.u64("sequenceNumber"),
|
|
54
|
+
borsh.publicKey("owner"),
|
|
55
|
+
borsh.publicKey("reserve"),
|
|
56
|
+
borsh.publicKey("userDestinationLiquidityTa"),
|
|
57
|
+
borsh.u64("queuedCollateralAmount"),
|
|
58
|
+
borsh.u64("createdAtTimestamp"),
|
|
59
|
+
borsh.u8("invalid"),
|
|
60
|
+
borsh.u8("progressCallbackType"),
|
|
61
|
+
borsh.array(borsh.u8(), 6, "alignmentPadding"),
|
|
62
|
+
borsh.array(borsh.publicKey(), 2, "progressCallbackCustomAccounts"),
|
|
63
|
+
borsh.array(borsh.u64(), 40, "endPadding"),
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
constructor(fields: WithdrawTicketFields) {
|
|
67
|
+
this.sequenceNumber = fields.sequenceNumber
|
|
68
|
+
this.owner = fields.owner
|
|
69
|
+
this.reserve = fields.reserve
|
|
70
|
+
this.userDestinationLiquidityTa = fields.userDestinationLiquidityTa
|
|
71
|
+
this.queuedCollateralAmount = fields.queuedCollateralAmount
|
|
72
|
+
this.createdAtTimestamp = fields.createdAtTimestamp
|
|
73
|
+
this.invalid = fields.invalid
|
|
74
|
+
this.progressCallbackType = fields.progressCallbackType
|
|
75
|
+
this.alignmentPadding = fields.alignmentPadding
|
|
76
|
+
this.progressCallbackCustomAccounts = fields.progressCallbackCustomAccounts
|
|
77
|
+
this.endPadding = fields.endPadding
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static async fetch(
|
|
81
|
+
c: Connection,
|
|
82
|
+
address: PublicKey,
|
|
83
|
+
programId: PublicKey = PROGRAM_ID
|
|
84
|
+
): Promise<WithdrawTicket | null> {
|
|
85
|
+
const info = await c.getAccountInfo(address)
|
|
86
|
+
|
|
87
|
+
if (info === null) {
|
|
88
|
+
return null
|
|
89
|
+
}
|
|
90
|
+
if (!info.owner.equals(programId)) {
|
|
91
|
+
throw new Error("account doesn't belong to this program")
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return this.decode(info.data)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static async fetchMultiple(
|
|
98
|
+
c: Connection,
|
|
99
|
+
addresses: PublicKey[],
|
|
100
|
+
programId: PublicKey = PROGRAM_ID
|
|
101
|
+
): Promise<Array<WithdrawTicket | null>> {
|
|
102
|
+
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
103
|
+
|
|
104
|
+
return infos.map((info) => {
|
|
105
|
+
if (info === null) {
|
|
106
|
+
return null
|
|
107
|
+
}
|
|
108
|
+
if (!info.owner.equals(programId)) {
|
|
109
|
+
throw new Error("account doesn't belong to this program")
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return this.decode(info.data)
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static decode(data: Buffer): WithdrawTicket {
|
|
117
|
+
if (!data.slice(0, 8).equals(WithdrawTicket.discriminator)) {
|
|
118
|
+
throw new Error("invalid account discriminator")
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const dec = WithdrawTicket.layout.decode(data.slice(8))
|
|
122
|
+
|
|
123
|
+
return new WithdrawTicket({
|
|
124
|
+
sequenceNumber: dec.sequenceNumber,
|
|
125
|
+
owner: dec.owner,
|
|
126
|
+
reserve: dec.reserve,
|
|
127
|
+
userDestinationLiquidityTa: dec.userDestinationLiquidityTa,
|
|
128
|
+
queuedCollateralAmount: dec.queuedCollateralAmount,
|
|
129
|
+
createdAtTimestamp: dec.createdAtTimestamp,
|
|
130
|
+
invalid: dec.invalid,
|
|
131
|
+
progressCallbackType: dec.progressCallbackType,
|
|
132
|
+
alignmentPadding: dec.alignmentPadding,
|
|
133
|
+
progressCallbackCustomAccounts: dec.progressCallbackCustomAccounts,
|
|
134
|
+
endPadding: dec.endPadding,
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
toJSON(): WithdrawTicketJSON {
|
|
139
|
+
return {
|
|
140
|
+
sequenceNumber: this.sequenceNumber.toString(),
|
|
141
|
+
owner: this.owner.toString(),
|
|
142
|
+
reserve: this.reserve.toString(),
|
|
143
|
+
userDestinationLiquidityTa: this.userDestinationLiquidityTa.toString(),
|
|
144
|
+
queuedCollateralAmount: this.queuedCollateralAmount.toString(),
|
|
145
|
+
createdAtTimestamp: this.createdAtTimestamp.toString(),
|
|
146
|
+
invalid: this.invalid,
|
|
147
|
+
progressCallbackType: this.progressCallbackType,
|
|
148
|
+
alignmentPadding: this.alignmentPadding,
|
|
149
|
+
progressCallbackCustomAccounts: this.progressCallbackCustomAccounts.map(
|
|
150
|
+
(item) => item.toString()
|
|
151
|
+
),
|
|
152
|
+
endPadding: this.endPadding.map((item) => item.toString()),
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static fromJSON(obj: WithdrawTicketJSON): WithdrawTicket {
|
|
157
|
+
return new WithdrawTicket({
|
|
158
|
+
sequenceNumber: new BN(obj.sequenceNumber),
|
|
159
|
+
owner: new PublicKey(obj.owner),
|
|
160
|
+
reserve: new PublicKey(obj.reserve),
|
|
161
|
+
userDestinationLiquidityTa: new PublicKey(obj.userDestinationLiquidityTa),
|
|
162
|
+
queuedCollateralAmount: new BN(obj.queuedCollateralAmount),
|
|
163
|
+
createdAtTimestamp: new BN(obj.createdAtTimestamp),
|
|
164
|
+
invalid: obj.invalid,
|
|
165
|
+
progressCallbackType: obj.progressCallbackType,
|
|
166
|
+
alignmentPadding: obj.alignmentPadding,
|
|
167
|
+
progressCallbackCustomAccounts: obj.progressCallbackCustomAccounts.map(
|
|
168
|
+
(item) => new PublicKey(item)
|
|
169
|
+
),
|
|
170
|
+
endPadding: obj.endPadding.map((item) => new BN(item)),
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
}
|
package/src/accounts/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { UserState } from "./UserState"
|
|
2
2
|
export type { UserStateFields, UserStateJSON } from "./UserState"
|
|
3
|
+
export { GlobalConfig } from "./GlobalConfig"
|
|
4
|
+
export type { GlobalConfigFields, GlobalConfigJSON } from "./GlobalConfig"
|
|
3
5
|
export { LendingMarket } from "./LendingMarket"
|
|
4
6
|
export type { LendingMarketFields, LendingMarketJSON } from "./LendingMarket"
|
|
5
7
|
export { Obligation } from "./Obligation"
|
|
@@ -17,3 +19,5 @@ export { UserMetadata } from "./UserMetadata"
|
|
|
17
19
|
export type { UserMetadataFields, UserMetadataJSON } from "./UserMetadata"
|
|
18
20
|
export { Reserve } from "./Reserve"
|
|
19
21
|
export type { ReserveFields, ReserveJSON } from "./Reserve"
|
|
22
|
+
export { WithdrawTicket } from "./WithdrawTicket"
|
|
23
|
+
export type { WithdrawTicketFields, WithdrawTicketJSON } from "./WithdrawTicket"
|