@kamino-finance/klend-sdk 3.2.26 → 4.0.1
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/dist/classes/action.d.ts +1 -0
- package/dist/classes/action.d.ts.map +1 -0
- package/dist/classes/action.js +1132 -1188
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/curve.d.ts +1 -0
- package/dist/classes/curve.d.ts.map +1 -0
- package/dist/classes/curve.js +1 -1
- package/dist/classes/curve.js.map +1 -1
- package/dist/classes/fraction.d.ts +1 -0
- package/dist/classes/fraction.d.ts.map +1 -0
- package/dist/classes/fraction.js +7 -6
- package/dist/classes/fraction.js.map +1 -1
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.d.ts.map +1 -0
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/jupiterPerps.d.ts +1 -0
- package/dist/classes/jupiterPerps.d.ts.map +1 -0
- package/dist/classes/jupiterPerps.js +7 -18
- package/dist/classes/jupiterPerps.js.map +1 -1
- package/dist/classes/manager.d.ts +1 -0
- package/dist/classes/manager.d.ts.map +1 -0
- package/dist/classes/manager.js +132 -159
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +2 -1
- package/dist/classes/market.d.ts.map +1 -0
- package/dist/classes/market.js +622 -716
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.d.ts +1 -0
- package/dist/classes/obligation.d.ts.map +1 -0
- package/dist/classes/obligation.js +60 -62
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +1 -0
- package/dist/classes/reserve.d.ts.map +1 -0
- package/dist/classes/reserve.js +121 -130
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/shared.d.ts +2 -1
- package/dist/classes/shared.d.ts.map +1 -0
- package/dist/classes/shared.js.map +1 -1
- package/dist/classes/utils.d.ts +1 -0
- package/dist/classes/utils.d.ts.map +1 -0
- package/dist/classes/utils.js +3 -3
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +1 -0
- package/dist/classes/vault.d.ts.map +1 -0
- package/dist/classes/vault.js +334 -354
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts +1 -0
- package/dist/client_kamino_manager.d.ts.map +1 -0
- package/dist/client_kamino_manager.js +323 -326
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +1 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/LendingMarket.js +89 -55
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +1 -0
- package/dist/idl_codegen/accounts/Obligation.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/Obligation.js +87 -56
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/accounts/ReferrerState.d.ts +1 -0
- package/dist/idl_codegen/accounts/ReferrerState.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/ReferrerState.js +22 -33
- package/dist/idl_codegen/accounts/ReferrerState.js.map +1 -1
- package/dist/idl_codegen/accounts/ReferrerTokenState.d.ts +1 -0
- package/dist/idl_codegen/accounts/ReferrerTokenState.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/ReferrerTokenState.js +35 -37
- package/dist/idl_codegen/accounts/ReferrerTokenState.js.map +1 -1
- package/dist/idl_codegen/accounts/Reserve.d.ts +1 -0
- package/dist/idl_codegen/accounts/Reserve.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/Reserve.js +60 -49
- package/dist/idl_codegen/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen/accounts/ShortUrl.d.ts +1 -0
- package/dist/idl_codegen/accounts/ShortUrl.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/ShortUrl.js +22 -33
- package/dist/idl_codegen/accounts/ShortUrl.js.map +1 -1
- package/dist/idl_codegen/accounts/UserMetadata.d.ts +1 -0
- package/dist/idl_codegen/accounts/UserMetadata.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/UserMetadata.js +34 -37
- package/dist/idl_codegen/accounts/UserMetadata.js.map +1 -1
- package/dist/idl_codegen/accounts/UserState.d.ts +1 -0
- package/dist/idl_codegen/accounts/UserState.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/UserState.js +77 -48
- package/dist/idl_codegen/accounts/UserState.js.map +1 -1
- package/dist/idl_codegen/accounts/index.d.ts +1 -0
- package/dist/idl_codegen/accounts/index.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/index.js.map +1 -1
- package/dist/idl_codegen/errors/anchor.d.ts +1 -0
- package/dist/idl_codegen/errors/anchor.d.ts.map +1 -0
- package/dist/idl_codegen/errors/anchor.js +270 -216
- package/dist/idl_codegen/errors/anchor.js.map +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +1 -0
- package/dist/idl_codegen/errors/custom.d.ts.map +1 -0
- package/dist/idl_codegen/errors/custom.js +560 -448
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/errors/index.d.ts +1 -0
- package/dist/idl_codegen/errors/index.d.ts.map +1 -0
- package/dist/idl_codegen/errors/index.js.map +1 -1
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/borrowObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/deleteReferrerStateAndShortUrl.d.ts +1 -0
- package/dist/idl_codegen/instructions/deleteReferrerStateAndShortUrl.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/deleteReferrerStateAndShortUrl.js.map +1 -1
- package/dist/idl_codegen/instructions/depositObligationCollateral.d.ts +1 -0
- package/dist/idl_codegen/instructions/depositObligationCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/depositObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts +1 -0
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/idlMissingTypes.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +1 -0
- package/dist/idl_codegen/instructions/index.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initFarmsForReserve.d.ts +1 -0
- package/dist/idl_codegen/instructions/initFarmsForReserve.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initLendingMarket.d.ts +1 -0
- package/dist/idl_codegen/instructions/initLendingMarket.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initLendingMarket.js.map +1 -1
- package/dist/idl_codegen/instructions/initObligation.d.ts +1 -0
- package/dist/idl_codegen/instructions/initObligation.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initObligation.js.map +1 -1
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.d.ts +1 -0
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initReferrerStateAndShortUrl.d.ts +1 -0
- package/dist/idl_codegen/instructions/initReferrerStateAndShortUrl.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initReferrerStateAndShortUrl.js.map +1 -1
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts +1 -0
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initReferrerTokenState.js.map +1 -1
- package/dist/idl_codegen/instructions/initReserve.d.ts +1 -0
- package/dist/idl_codegen/instructions/initReserve.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/initUserMetadata.d.ts +1 -0
- package/dist/idl_codegen/instructions/initUserMetadata.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initUserMetadata.js.map +1 -1
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +1 -0
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/redeemFees.d.ts +1 -0
- package/dist/idl_codegen/instructions/redeemFees.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/redeemFees.js.map +1 -1
- package/dist/idl_codegen/instructions/redeemReserveCollateral.d.ts +1 -0
- package/dist/idl_codegen/instructions/redeemReserveCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/redeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/refreshObligation.d.ts +1 -0
- package/dist/idl_codegen/instructions/refreshObligation.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/refreshObligation.js.map +1 -1
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts +1 -0
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/refreshReserve.d.ts +1 -0
- package/dist/idl_codegen/instructions/refreshReserve.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/refreshReserve.js.map +1 -1
- package/dist/idl_codegen/instructions/refreshReservesBatch.d.ts +1 -0
- package/dist/idl_codegen/instructions/refreshReservesBatch.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/refreshReservesBatch.js.map +1 -1
- package/dist/idl_codegen/instructions/repayObligationLiquidity.d.ts +1 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/repayObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/instructions/requestElevationGroup.d.ts +1 -0
- package/dist/idl_codegen/instructions/requestElevationGroup.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/requestElevationGroup.js.map +1 -1
- package/dist/idl_codegen/instructions/socializeLoss.d.ts +1 -0
- package/dist/idl_codegen/instructions/socializeLoss.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/socializeLoss.js.map +1 -1
- package/dist/idl_codegen/instructions/updateEntireReserveConfig.d.ts +1 -0
- package/dist/idl_codegen/instructions/updateEntireReserveConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateEntireReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/updateLendingMarket.d.ts +1 -0
- package/dist/idl_codegen/instructions/updateLendingMarket.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateLendingMarket.js.map +1 -1
- package/dist/idl_codegen/instructions/updateLendingMarketOwner.d.ts +1 -0
- package/dist/idl_codegen/instructions/updateLendingMarketOwner.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateLendingMarketOwner.js.map +1 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +1 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/updateSingleReserveConfig.d.ts +1 -0
- package/dist/idl_codegen/instructions/updateSingleReserveConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateSingleReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.d.ts +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts +1 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawReferrerFees.d.ts +1 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/withdrawReferrerFees.js.map +1 -1
- package/dist/idl_codegen/programId.d.ts +1 -0
- package/dist/idl_codegen/programId.d.ts.map +1 -0
- package/dist/idl_codegen/programId.js.map +1 -1
- package/dist/idl_codegen/types/AssetTier.d.ts +1 -0
- package/dist/idl_codegen/types/AssetTier.d.ts.map +1 -0
- package/dist/idl_codegen/types/AssetTier.js +12 -18
- package/dist/idl_codegen/types/AssetTier.js.map +1 -1
- package/dist/idl_codegen/types/BigFractionBytes.d.ts +1 -0
- package/dist/idl_codegen/types/BigFractionBytes.d.ts.map +1 -0
- package/dist/idl_codegen/types/BigFractionBytes.js +2 -0
- package/dist/idl_codegen/types/BigFractionBytes.js.map +1 -1
- package/dist/idl_codegen/types/BorrowRateCurve.d.ts +1 -0
- package/dist/idl_codegen/types/BorrowRateCurve.d.ts.map +1 -0
- package/dist/idl_codegen/types/BorrowRateCurve.js +2 -1
- package/dist/idl_codegen/types/BorrowRateCurve.js.map +1 -1
- package/dist/idl_codegen/types/CurvePoint.d.ts +1 -0
- package/dist/idl_codegen/types/CurvePoint.d.ts.map +1 -0
- package/dist/idl_codegen/types/CurvePoint.js +2 -0
- package/dist/idl_codegen/types/CurvePoint.js.map +1 -1
- package/dist/idl_codegen/types/ElevationGroup.d.ts +1 -0
- package/dist/idl_codegen/types/ElevationGroup.d.ts.map +1 -0
- package/dist/idl_codegen/types/ElevationGroup.js +10 -0
- package/dist/idl_codegen/types/ElevationGroup.js.map +1 -1
- package/dist/idl_codegen/types/FeeCalculation.d.ts +1 -0
- package/dist/idl_codegen/types/FeeCalculation.d.ts.map +1 -0
- package/dist/idl_codegen/types/FeeCalculation.js +8 -12
- package/dist/idl_codegen/types/FeeCalculation.js.map +1 -1
- package/dist/idl_codegen/types/InitObligationArgs.d.ts +1 -0
- package/dist/idl_codegen/types/InitObligationArgs.d.ts.map +1 -0
- package/dist/idl_codegen/types/InitObligationArgs.js +2 -0
- package/dist/idl_codegen/types/InitObligationArgs.js.map +1 -1
- package/dist/idl_codegen/types/LastUpdate.d.ts +1 -0
- package/dist/idl_codegen/types/LastUpdate.d.ts.map +1 -0
- package/dist/idl_codegen/types/LastUpdate.js +7 -0
- package/dist/idl_codegen/types/LastUpdate.js.map +1 -1
- package/dist/idl_codegen/types/ObligationCollateral.d.ts +1 -0
- package/dist/idl_codegen/types/ObligationCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/types/ObligationCollateral.js +14 -0
- package/dist/idl_codegen/types/ObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ObligationLiquidity.d.ts +1 -0
- package/dist/idl_codegen/types/ObligationLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/types/ObligationLiquidity.js +17 -1
- package/dist/idl_codegen/types/ObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/PriceHeuristic.d.ts +1 -0
- package/dist/idl_codegen/types/PriceHeuristic.d.ts.map +1 -0
- package/dist/idl_codegen/types/PriceHeuristic.js +6 -0
- package/dist/idl_codegen/types/PriceHeuristic.js.map +1 -1
- package/dist/idl_codegen/types/PythConfiguration.d.ts +1 -0
- package/dist/idl_codegen/types/PythConfiguration.d.ts.map +1 -0
- package/dist/idl_codegen/types/PythConfiguration.js +2 -0
- package/dist/idl_codegen/types/PythConfiguration.js.map +1 -1
- package/dist/idl_codegen/types/ReserveCollateral.d.ts +1 -0
- package/dist/idl_codegen/types/ReserveCollateral.d.ts.map +1 -0
- package/dist/idl_codegen/types/ReserveCollateral.js +8 -0
- package/dist/idl_codegen/types/ReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.d.ts +1 -0
- package/dist/idl_codegen/types/ReserveConfig.d.ts.map +1 -0
- package/dist/idl_codegen/types/ReserveConfig.js +78 -5
- package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen/types/ReserveFarmKind.d.ts +1 -0
- package/dist/idl_codegen/types/ReserveFarmKind.d.ts.map +1 -0
- package/dist/idl_codegen/types/ReserveFarmKind.js +8 -12
- package/dist/idl_codegen/types/ReserveFarmKind.js.map +1 -1
- package/dist/idl_codegen/types/ReserveFees.d.ts +1 -0
- package/dist/idl_codegen/types/ReserveFees.d.ts.map +1 -0
- package/dist/idl_codegen/types/ReserveFees.js +16 -0
- package/dist/idl_codegen/types/ReserveFees.js.map +1 -1
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts +1 -0
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen/types/ReserveLiquidity.js +43 -1
- package/dist/idl_codegen/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/ReserveStatus.d.ts +1 -0
- package/dist/idl_codegen/types/ReserveStatus.d.ts.map +1 -0
- package/dist/idl_codegen/types/ReserveStatus.js +12 -18
- package/dist/idl_codegen/types/ReserveStatus.js.map +1 -1
- package/dist/idl_codegen/types/ScopeConfiguration.d.ts +1 -0
- package/dist/idl_codegen/types/ScopeConfiguration.d.ts.map +1 -0
- package/dist/idl_codegen/types/ScopeConfiguration.js +6 -0
- package/dist/idl_codegen/types/ScopeConfiguration.js.map +1 -1
- package/dist/idl_codegen/types/SwitchboardConfiguration.d.ts +1 -0
- package/dist/idl_codegen/types/SwitchboardConfiguration.d.ts.map +1 -0
- package/dist/idl_codegen/types/SwitchboardConfiguration.js +3 -0
- package/dist/idl_codegen/types/SwitchboardConfiguration.js.map +1 -1
- package/dist/idl_codegen/types/TokenInfo.d.ts +1 -0
- package/dist/idl_codegen/types/TokenInfo.d.ts.map +1 -0
- package/dist/idl_codegen/types/TokenInfo.js +27 -4
- package/dist/idl_codegen/types/TokenInfo.js.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts +1 -0
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts.map +1 -0
- package/dist/idl_codegen/types/UpdateConfigMode.js +188 -282
- package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts.map +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js +41 -33
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +72 -108
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/WithdrawalCaps.d.ts +1 -0
- package/dist/idl_codegen/types/WithdrawalCaps.d.ts.map +1 -0
- package/dist/idl_codegen/types/WithdrawalCaps.js +4 -0
- package/dist/idl_codegen/types/WithdrawalCaps.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +1 -0
- package/dist/idl_codegen/types/index.d.ts.map +1 -0
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +1 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts.map +1 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.js +83 -54
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
- package/dist/idl_codegen/zero_padding/index.d.ts +1 -0
- package/dist/idl_codegen/zero_padding/index.d.ts.map +1 -0
- package/dist/idl_codegen/zero_padding/index.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.js +39 -42
- package/dist/idl_codegen_jupiter_perps/accounts/Pool.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/accounts/index.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/accounts/index.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/accounts/index.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/programId.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/programId.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/programId.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/types/Fees.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/types/Fees.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/Fees.js +9 -0
- package/dist/idl_codegen_jupiter_perps/types/Fees.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/types/Limit.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/types/Limit.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/Limit.js +3 -0
- package/dist/idl_codegen_jupiter_perps/types/Limit.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.js +3 -0
- package/dist/idl_codegen_jupiter_perps/types/PoolApr.js.map +1 -1
- package/dist/idl_codegen_jupiter_perps/types/index.d.ts +1 -0
- package/dist/idl_codegen_jupiter_perps/types/index.d.ts.map +1 -0
- package/dist/idl_codegen_jupiter_perps/types/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js +58 -47
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +51 -47
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/accounts/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/errors/anchor.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/errors/anchor.js +270 -216
- package/dist/idl_codegen_kamino_vault/errors/anchor.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/errors/custom.js +120 -96
- package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/errors/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/invest.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/programId.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js +2 -0
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js +2 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js +2 -0
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js +7 -0
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js +6 -0
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js +2 -0
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js +8 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js +77 -5
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js +16 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js +41 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js +6 -0
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js +3 -0
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js +27 -4
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js +8 -0
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/WithdrawalCaps.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/WithdrawalCaps.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/WithdrawalCaps.js +4 -0
- package/dist/idl_codegen_kamino_vault/types/WithdrawalCaps.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lending_operations/index.d.ts +1 -0
- package/dist/lending_operations/index.d.ts.map +1 -0
- package/dist/lending_operations/index.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts +1 -0
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts.map +1 -0
- package/dist/lending_operations/repay_with_collateral_calcs.js +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.d.ts +1 -0
- package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -0
- package/dist/lending_operations/repay_with_collateral_operations.js +15 -24
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/leverage/calcs.d.ts +1 -0
- package/dist/leverage/calcs.d.ts.map +1 -0
- package/dist/leverage/calcs.js +119 -132
- package/dist/leverage/calcs.js.map +1 -1
- package/dist/leverage/index.d.ts +1 -0
- package/dist/leverage/index.d.ts.map +1 -0
- package/dist/leverage/index.js.map +1 -1
- package/dist/leverage/instructions.d.ts +1 -0
- package/dist/leverage/instructions.d.ts.map +1 -0
- package/dist/leverage/instructions.js.map +1 -1
- package/dist/leverage/operations.d.ts +1 -0
- package/dist/leverage/operations.d.ts.map +1 -0
- package/dist/leverage/operations.js +75 -84
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/utils.d.ts +1 -0
- package/dist/leverage/utils.d.ts.map +1 -0
- package/dist/leverage/utils.js +73 -88
- package/dist/leverage/utils.js.map +1 -1
- package/dist/lib.d.ts +1 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js.map +1 -1
- package/dist/referrals/index.d.ts +1 -0
- package/dist/referrals/index.d.ts.map +1 -0
- package/dist/referrals/index.js.map +1 -1
- package/dist/referrals/instructions.d.ts +1 -0
- package/dist/referrals/instructions.d.ts.map +1 -0
- package/dist/referrals/instructions.js +8 -17
- package/dist/referrals/instructions.js.map +1 -1
- package/dist/referrals/operations.d.ts +2 -1
- package/dist/referrals/operations.d.ts.map +1 -0
- package/dist/referrals/operations.js +119 -143
- package/dist/referrals/operations.js.map +1 -1
- package/dist/utils/ObligationType.d.ts +1 -0
- package/dist/utils/ObligationType.d.ts.map +1 -0
- package/dist/utils/ObligationType.js +16 -7
- package/dist/utils/ObligationType.js.map +1 -1
- package/dist/utils/api.d.ts +1 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +10 -21
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/ata.d.ts +1 -0
- package/dist/utils/ata.d.ts.map +1 -0
- package/dist/utils/ata.js +25 -38
- package/dist/utils/ata.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/idl.d.ts +1 -0
- package/dist/utils/idl.d.ts.map +1 -0
- package/dist/utils/idl.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/instruction.d.ts +1 -0
- package/dist/utils/instruction.d.ts.map +1 -0
- package/dist/utils/instruction.js +116 -143
- package/dist/utils/instruction.js.map +1 -1
- package/dist/utils/kamino.d.ts +1 -0
- package/dist/utils/kamino.d.ts.map +1 -0
- package/dist/utils/kamino.js +4 -15
- package/dist/utils/kamino.js.map +1 -1
- package/dist/utils/layout.d.ts +1 -0
- package/dist/utils/layout.d.ts.map +1 -0
- package/dist/utils/layout.js.map +1 -1
- package/dist/utils/lookupTable.d.ts +1 -0
- package/dist/utils/lookupTable.d.ts.map +1 -0
- package/dist/utils/lookupTable.js +14 -27
- package/dist/utils/lookupTable.js.map +1 -1
- package/dist/utils/managerTypes.d.ts +1 -0
- package/dist/utils/managerTypes.d.ts.map +1 -0
- package/dist/utils/managerTypes.js +32 -3
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/oracle.d.ts +2 -1
- package/dist/utils/oracle.d.ts.map +1 -0
- package/dist/utils/oracle.js +71 -85
- package/dist/utils/oracle.js.map +1 -1
- package/dist/utils/pubkey.d.ts +1 -0
- package/dist/utils/pubkey.d.ts.map +1 -0
- package/dist/utils/pubkey.js +7 -9
- package/dist/utils/pubkey.js.map +1 -1
- package/dist/utils/rpc.d.ts +1 -0
- package/dist/utils/rpc.d.ts.map +1 -0
- package/dist/utils/rpc.js +48 -70
- package/dist/utils/rpc.js.map +1 -1
- package/dist/utils/seeds.d.ts +1 -0
- package/dist/utils/seeds.d.ts.map +1 -0
- package/dist/utils/seeds.js.map +1 -1
- package/dist/utils/sendTransactionsUtils.d.ts +1 -0
- package/dist/utils/sendTransactionsUtils.d.ts.map +1 -0
- package/dist/utils/sendTransactionsUtils.js +82 -82
- package/dist/utils/sendTransactionsUtils.js.map +1 -1
- package/dist/utils/slots.d.ts +1 -0
- package/dist/utils/slots.d.ts.map +1 -0
- package/dist/utils/slots.js.map +1 -1
- package/dist/utils/syncNative.d.ts +1 -0
- package/dist/utils/syncNative.d.ts.map +1 -0
- package/dist/utils/syncNative.js.map +1 -1
- package/dist/utils/userMetadata.d.ts +1 -0
- package/dist/utils/userMetadata.d.ts.map +1 -0
- package/dist/utils/userMetadata.js +41 -53
- package/dist/utils/userMetadata.js.map +1 -1
- package/package.json +14 -8
- package/src/classes/action.ts +2884 -0
- package/src/classes/curve.ts +29 -0
- package/src/classes/fraction.ts +65 -0
- package/src/classes/index.ts +10 -0
- package/src/classes/jupiterPerps.ts +14 -0
- package/src/classes/manager.ts +746 -0
- package/src/classes/market.ts +1459 -0
- package/src/classes/obligation.ts +1315 -0
- package/src/classes/reserve.ts +1980 -0
- package/src/classes/shared.ts +57 -0
- package/src/classes/utils.ts +192 -0
- package/src/classes/vault.ts +808 -0
- package/src/client.ts +446 -0
- package/src/client_kamino_manager.ts +791 -0
- package/src/global.d.ts +1 -0
- package/src/idl_codegen/accounts/LendingMarket.ts +364 -0
- package/src/idl_codegen/accounts/Obligation.ts +349 -0
- package/src/idl_codegen/accounts/ReferrerState.ts +97 -0
- package/src/idl_codegen/accounts/ReferrerTokenState.ts +145 -0
- package/src/idl_codegen/accounts/Reserve.ts +248 -0
- package/src/idl_codegen/accounts/ShortUrl.ts +97 -0
- package/src/idl_codegen/accounts/UserMetadata.ts +142 -0
- package/src/idl_codegen/accounts/UserState.ts +301 -0
- package/src/idl_codegen/accounts/index.ts +19 -0
- package/src/idl_codegen/errors/anchor.ts +773 -0
- package/src/idl_codegen/errors/custom.ts +1633 -0
- package/src/idl_codegen/errors/index.ts +62 -0
- package/src/idl_codegen/instructions/borrowObligationLiquidity.ts +82 -0
- package/src/idl_codegen/instructions/deleteReferrerStateAndShortUrl.ts +30 -0
- package/src/idl_codegen/instructions/depositObligationCollateral.ts +62 -0
- package/src/idl_codegen/instructions/depositReserveLiquidity.ts +90 -0
- package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.ts +98 -0
- package/src/idl_codegen/instructions/flashBorrowReserveLiquidity.ts +82 -0
- package/src/idl_codegen/instructions/flashRepayReserveLiquidity.ts +83 -0
- package/src/idl_codegen/instructions/idlMissingTypes.ts +62 -0
- package/src/idl_codegen/instructions/index.ts +138 -0
- package/src/idl_codegen/instructions/initFarmsForReserve.ts +62 -0
- package/src/idl_codegen/instructions/initLendingMarket.ts +50 -0
- package/src/idl_codegen/instructions/initObligation.ts +52 -0
- package/src/idl_codegen/instructions/initObligationFarmsForReserve.ts +60 -0
- package/src/idl_codegen/instructions/initReferrerStateAndShortUrl.ts +50 -0
- package/src/idl_codegen/instructions/initReferrerTokenState.ts +46 -0
- package/src/idl_codegen/instructions/initReserve.ts +74 -0
- package/src/idl_codegen/instructions/initUserMetadata.ts +50 -0
- package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.ts +139 -0
- package/src/idl_codegen/instructions/redeemFees.ts +50 -0
- package/src/idl_codegen/instructions/redeemReserveCollateral.ts +94 -0
- package/src/idl_codegen/instructions/refreshObligation.ts +24 -0
- package/src/idl_codegen/instructions/refreshObligationFarmsForReserve.ts +62 -0
- package/src/idl_codegen/instructions/refreshReserve.ts +40 -0
- package/src/idl_codegen/instructions/refreshReservesBatch.ts +29 -0
- package/src/idl_codegen/instructions/repayObligationLiquidity.ts +64 -0
- package/src/idl_codegen/instructions/requestElevationGroup.ts +40 -0
- package/src/idl_codegen/instructions/socializeLoss.ts +48 -0
- package/src/idl_codegen/instructions/updateEntireReserveConfig.ts +45 -0
- package/src/idl_codegen/instructions/updateLendingMarket.ts +43 -0
- package/src/idl_codegen/instructions/updateLendingMarketOwner.ts +28 -0
- package/src/idl_codegen/instructions/updateReserveConfig.ts +52 -0
- package/src/idl_codegen/instructions/updateSingleReserveConfig.ts +48 -0
- package/src/idl_codegen/instructions/withdrawObligationCollateral.ts +68 -0
- package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +102 -0
- package/src/idl_codegen/instructions/withdrawProtocolFee.ts +62 -0
- package/src/idl_codegen/instructions/withdrawReferrerFees.ts +54 -0
- package/src/idl_codegen/programId.ts +13 -0
- package/src/idl_codegen/types/AssetTier.ts +118 -0
- package/src/idl_codegen/types/BigFractionBytes.ts +67 -0
- package/src/idl_codegen/types/BorrowRateCurve.ts +60 -0
- package/src/idl_codegen/types/CurvePoint.ts +64 -0
- package/src/idl_codegen/types/ElevationGroup.ts +133 -0
- package/src/idl_codegen/types/FeeCalculation.ts +90 -0
- package/src/idl_codegen/types/InitObligationArgs.ts +61 -0
- package/src/idl_codegen/types/LastUpdate.ts +95 -0
- package/src/idl_codegen/types/ObligationCollateral.ts +128 -0
- package/src/idl_codegen/types/ObligationLiquidity.ts +159 -0
- package/src/idl_codegen/types/PriceHeuristic.ts +81 -0
- package/src/idl_codegen/types/PythConfiguration.ts +56 -0
- package/src/idl_codegen/types/ReserveCollateral.ts +104 -0
- package/src/idl_codegen/types/ReserveConfig.ts +467 -0
- package/src/idl_codegen/types/ReserveFarmKind.ts +90 -0
- package/src/idl_codegen/types/ReserveFees.ts +122 -0
- package/src/idl_codegen/types/ReserveLiquidity.ts +286 -0
- package/src/idl_codegen/types/ReserveStatus.ts +120 -0
- package/src/idl_codegen/types/ScopeConfiguration.ts +85 -0
- package/src/idl_codegen/types/SwitchboardConfiguration.ts +67 -0
- package/src/idl_codegen/types/TokenInfo.ts +190 -0
- package/src/idl_codegen/types/UpdateConfigMode.ts +1440 -0
- package/src/idl_codegen/types/UpdateLendingMarketConfigValue.ts +376 -0
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +570 -0
- package/src/idl_codegen/types/WithdrawalCaps.ts +86 -0
- package/src/idl_codegen/types/index.ts +276 -0
- package/src/idl_codegen/zero_padding/ObligationZP.ts +186 -0
- package/src/idl_codegen/zero_padding/index.ts +1 -0
- package/src/idl_codegen_jupiter_perps/accounts/Pool.ts +155 -0
- package/src/idl_codegen_jupiter_perps/accounts/index.ts +2 -0
- package/src/idl_codegen_jupiter_perps/programId.ts +7 -0
- package/src/idl_codegen_jupiter_perps/types/Fees.ts +130 -0
- package/src/idl_codegen_jupiter_perps/types/Limit.ts +72 -0
- package/src/idl_codegen_jupiter_perps/types/PoolApr.ts +69 -0
- package/src/idl_codegen_jupiter_perps/types/index.ts +6 -0
- package/src/idl_codegen_kamino_vault/accounts/Reserve.ts +221 -0
- package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +214 -0
- package/src/idl_codegen_kamino_vault/accounts/index.ts +4 -0
- package/src/idl_codegen_kamino_vault/errors/anchor.ts +764 -0
- package/src/idl_codegen_kamino_vault/errors/custom.ts +344 -0
- package/src/idl_codegen_kamino_vault/errors/index.ts +49 -0
- package/src/idl_codegen_kamino_vault/instructions/deposit.ts +54 -0
- package/src/idl_codegen_kamino_vault/instructions/index.ts +10 -0
- package/src/idl_codegen_kamino_vault/instructions/initVault.ts +35 -0
- package/src/idl_codegen_kamino_vault/instructions/invest.ts +60 -0
- package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +58 -0
- package/src/idl_codegen_kamino_vault/instructions/withdraw.ts +81 -0
- package/src/idl_codegen_kamino_vault/programId.ts +7 -0
- package/src/idl_codegen_kamino_vault/types/BigFractionBytes.ts +61 -0
- package/src/idl_codegen_kamino_vault/types/BorrowRateCurve.ts +55 -0
- package/src/idl_codegen_kamino_vault/types/CurvePoint.ts +61 -0
- package/src/idl_codegen_kamino_vault/types/LastUpdate.ts +90 -0
- package/src/idl_codegen_kamino_vault/types/PriceHeuristic.ts +78 -0
- package/src/idl_codegen_kamino_vault/types/PythConfiguration.ts +56 -0
- package/src/idl_codegen_kamino_vault/types/ReserveCollateral.ts +104 -0
- package/src/idl_codegen_kamino_vault/types/ReserveConfig.ts +426 -0
- package/src/idl_codegen_kamino_vault/types/ReserveFees.ts +118 -0
- package/src/idl_codegen_kamino_vault/types/ReserveLiquidity.ts +268 -0
- package/src/idl_codegen_kamino_vault/types/ScopeConfiguration.ts +85 -0
- package/src/idl_codegen_kamino_vault/types/SwitchboardConfiguration.ts +64 -0
- package/src/idl_codegen_kamino_vault/types/TokenInfo.ts +172 -0
- package/src/idl_codegen_kamino_vault/types/VaultAllocation.ts +115 -0
- package/src/idl_codegen_kamino_vault/types/WithdrawalCaps.ts +86 -0
- package/src/idl_codegen_kamino_vault/types/index.ts +30 -0
- package/src/index.ts +1 -0
- package/src/lending_operations/index.ts +2 -0
- package/src/lending_operations/repay_with_collateral_calcs.ts +71 -0
- package/src/lending_operations/repay_with_collateral_operations.ts +318 -0
- package/src/leverage/calcs.ts +465 -0
- package/src/leverage/index.ts +4 -0
- package/src/leverage/instructions.ts +144 -0
- package/src/leverage/operations.ts +1814 -0
- package/src/leverage/utils.ts +273 -0
- package/src/lib.ts +9 -0
- package/src/referrals/index.ts +2 -0
- package/src/referrals/instructions.ts +114 -0
- package/src/referrals/operations.ts +325 -0
- package/src/utils/ObligationType.ts +171 -0
- package/src/utils/api.ts +59 -0
- package/src/utils/ata.ts +195 -0
- package/src/utils/constants.ts +81 -0
- package/src/utils/idl.ts +4 -0
- package/src/utils/index.ts +16 -0
- package/src/utils/instruction.ts +258 -0
- package/src/utils/kamino.ts +12 -0
- package/src/utils/layout.ts +118 -0
- package/src/utils/lookupTable.ts +55 -0
- package/src/utils/managerTypes.ts +456 -0
- package/src/utils/oracle.ts +337 -0
- package/src/utils/pubkey.ts +261 -0
- package/src/utils/rpc.ts +108 -0
- package/src/utils/seeds.ts +183 -0
- package/src/utils/sendTransactionsUtils.ts +207 -0
- package/src/utils/slots.ts +28 -0
- package/src/utils/syncNative.ts +22 -0
- package/src/utils/userMetadata.ts +401 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PublicKey,
|
|
3
|
+
TransactionInstruction,
|
|
4
|
+
SYSVAR_RENT_PUBKEY,
|
|
5
|
+
SystemProgram,
|
|
6
|
+
Connection,
|
|
7
|
+
GetProgramAccountsFilter,
|
|
8
|
+
} from '@solana/web3.js';
|
|
9
|
+
import { KaminoMarket, KaminoObligation } from '../classes';
|
|
10
|
+
import {
|
|
11
|
+
LeverageObligation,
|
|
12
|
+
MultiplyObligation,
|
|
13
|
+
WRAPPED_SOL_MINT,
|
|
14
|
+
createLookupTableIx,
|
|
15
|
+
extendLookupTableIxs,
|
|
16
|
+
getAssociatedTokenAddress,
|
|
17
|
+
initUserMetadata,
|
|
18
|
+
referrerTokenStatePda,
|
|
19
|
+
userMetadataPda,
|
|
20
|
+
isNotNullPubkey,
|
|
21
|
+
UserMetadata,
|
|
22
|
+
PublicKeySet,
|
|
23
|
+
} from '../lib';
|
|
24
|
+
import { farmsId } from '@kamino-finance/farms-sdk';
|
|
25
|
+
import { KaminoReserve } from '../classes/reserve';
|
|
26
|
+
|
|
27
|
+
export type KaminoUserMetadata = {
|
|
28
|
+
address: PublicKey;
|
|
29
|
+
state: UserMetadata;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getUserLutAddressAndSetupIxns = async (
|
|
33
|
+
kaminoMarket: KaminoMarket,
|
|
34
|
+
user: PublicKey,
|
|
35
|
+
referrer: PublicKey = PublicKey.default,
|
|
36
|
+
withExtendLut: boolean = true,
|
|
37
|
+
multiplyMints: { coll: PublicKey; debt: PublicKey }[] = [],
|
|
38
|
+
leverageMints: { coll: PublicKey; debt: PublicKey }[] = [],
|
|
39
|
+
repayWithCollObligation: KaminoObligation | undefined = undefined,
|
|
40
|
+
payer: PublicKey = PublicKey.default
|
|
41
|
+
): Promise<[PublicKey, TransactionInstruction[][]]> => {
|
|
42
|
+
const [userMetadataAddress, userMetadataState] = await kaminoMarket.getUserMetadata(user);
|
|
43
|
+
const initUserMetadataIxs: TransactionInstruction[] = [];
|
|
44
|
+
let userLookupTableAddress: PublicKey;
|
|
45
|
+
|
|
46
|
+
const referrerUserMetadata = referrer.equals(PublicKey.default)
|
|
47
|
+
? kaminoMarket.programId
|
|
48
|
+
: (await kaminoMarket.getUserMetadata(referrer))[0];
|
|
49
|
+
|
|
50
|
+
if (!userMetadataState) {
|
|
51
|
+
const [createLutIx, lookupTableAddress] = await createLookupTableIx(kaminoMarket.getConnection(), user);
|
|
52
|
+
userLookupTableAddress = lookupTableAddress;
|
|
53
|
+
initUserMetadataIxs.push(createLutIx);
|
|
54
|
+
initUserMetadataIxs.push(
|
|
55
|
+
initUserMetadata(
|
|
56
|
+
{
|
|
57
|
+
userLookupTable: lookupTableAddress,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
owner: user,
|
|
61
|
+
feePayer: payer.equals(PublicKey.default) ? user : payer,
|
|
62
|
+
userMetadata: userMetadataAddress,
|
|
63
|
+
referrerUserMetadata: referrerUserMetadata,
|
|
64
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
65
|
+
systemProgram: SystemProgram.programId,
|
|
66
|
+
},
|
|
67
|
+
kaminoMarket.programId
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
} else {
|
|
71
|
+
userLookupTableAddress = userMetadataState.userLookupTable;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const setupUserMetadataIxs = [initUserMetadataIxs];
|
|
75
|
+
|
|
76
|
+
if (withExtendLut) {
|
|
77
|
+
const dedupUserLutAddresses = await getDedupUserLookupTableAddresses(
|
|
78
|
+
kaminoMarket,
|
|
79
|
+
userLookupTableAddress,
|
|
80
|
+
user,
|
|
81
|
+
referrer,
|
|
82
|
+
multiplyMints,
|
|
83
|
+
leverageMints,
|
|
84
|
+
userMetadataState !== null,
|
|
85
|
+
repayWithCollObligation
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const extendLookupTableChunkIxs = extendLookupTableIxs(user, userLookupTableAddress, dedupUserLutAddresses, payer);
|
|
89
|
+
|
|
90
|
+
for (const extendLutIx of extendLookupTableChunkIxs) {
|
|
91
|
+
setupUserMetadataIxs.push([extendLutIx]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return [userLookupTableAddress, setupUserMetadataIxs];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const getDedupUserLookupTableAddresses = async (
|
|
99
|
+
kaminoMarket: KaminoMarket,
|
|
100
|
+
table_pk: PublicKey,
|
|
101
|
+
user: PublicKey,
|
|
102
|
+
referrer: PublicKey,
|
|
103
|
+
multiplyMints: { coll: PublicKey; debt: PublicKey }[] = [],
|
|
104
|
+
leverageMints: { coll: PublicKey; debt: PublicKey }[] = [],
|
|
105
|
+
tableExists: boolean,
|
|
106
|
+
repayWithCollObligation: KaminoObligation | undefined = undefined
|
|
107
|
+
): Promise<PublicKey[]> => {
|
|
108
|
+
const requiredAddresses = await getUserLookupTableAddresses(
|
|
109
|
+
kaminoMarket,
|
|
110
|
+
user,
|
|
111
|
+
referrer,
|
|
112
|
+
multiplyMints,
|
|
113
|
+
leverageMints,
|
|
114
|
+
repayWithCollObligation
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if (tableExists) {
|
|
118
|
+
const userLookupTable = (await kaminoMarket.getConnection().getAddressLookupTable(table_pk)).value?.state!;
|
|
119
|
+
const addressesAndLogsNotInLut = requiredAddresses.filter(
|
|
120
|
+
(addressAndLogs) => userLookupTable.addresses.filter((a) => a.equals(addressAndLogs.address)).length === 0
|
|
121
|
+
);
|
|
122
|
+
console.log('Addresses to be added in LUT:');
|
|
123
|
+
const addressNotInLut = addressesAndLogsNotInLut.map((addressAndLogs) => {
|
|
124
|
+
console.log(addressAndLogs.log);
|
|
125
|
+
return addressAndLogs.address;
|
|
126
|
+
});
|
|
127
|
+
return new PublicKeySet(addressNotInLut).toArray();
|
|
128
|
+
} else {
|
|
129
|
+
const addressNotInLut = requiredAddresses.map((addressAndLogs) => {
|
|
130
|
+
console.log(addressAndLogs.log);
|
|
131
|
+
return addressAndLogs.address;
|
|
132
|
+
});
|
|
133
|
+
return new PublicKeySet(addressNotInLut).toArray();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const getUserLookupTableAddresses = async (
|
|
138
|
+
kaminoMarket: KaminoMarket,
|
|
139
|
+
user: PublicKey,
|
|
140
|
+
referrer: PublicKey,
|
|
141
|
+
multiplyMints: { coll: PublicKey; debt: PublicKey }[] = [],
|
|
142
|
+
leverageMints: { coll: PublicKey; debt: PublicKey }[] = [],
|
|
143
|
+
repayWithCollObligation: KaminoObligation | undefined = undefined
|
|
144
|
+
): Promise<{ address: PublicKey; log: string }[]> => {
|
|
145
|
+
const addresses: { address: PublicKey; log: string }[] = [];
|
|
146
|
+
addresses.push({ address: user, log: 'user address' });
|
|
147
|
+
const [userMetadataAddress] = userMetadataPda(user, kaminoMarket.programId);
|
|
148
|
+
addresses.push({ address: userMetadataAddress, log: 'userMetadata address' });
|
|
149
|
+
|
|
150
|
+
const allMints: PublicKey[] = [];
|
|
151
|
+
multiplyMints.forEach(({ coll: collMint, debt: debtMint }) => {
|
|
152
|
+
allMints.push(collMint);
|
|
153
|
+
allMints.push(debtMint);
|
|
154
|
+
});
|
|
155
|
+
leverageMints.forEach(({ coll: collMint, debt: debtMint }) => {
|
|
156
|
+
allMints.push(collMint);
|
|
157
|
+
allMints.push(debtMint);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
if (repayWithCollObligation) {
|
|
161
|
+
repayWithCollObligation.borrows.forEach((borrow) => {
|
|
162
|
+
allMints.push(borrow.mintAddress);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
repayWithCollObligation.deposits.forEach((deposit) => {
|
|
166
|
+
allMints.push(deposit.mintAddress);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const dedupMints = [...new PublicKeySet(allMints).toArray()];
|
|
171
|
+
const reserves: KaminoReserve[] = [];
|
|
172
|
+
dedupMints.forEach((mint) => {
|
|
173
|
+
const kaminoReserve = kaminoMarket.getReserveByMint(mint);
|
|
174
|
+
if (kaminoReserve) {
|
|
175
|
+
reserves.push(kaminoReserve);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// reserve mint ATAs
|
|
180
|
+
const mintsAtas: { address: PublicKey; log: string }[] = await Promise.all(
|
|
181
|
+
dedupMints.map(async (mint) => {
|
|
182
|
+
return { address: await getAssociatedTokenAddress(mint, user), log: 'ata for mint ' + mint.toString() };
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
addresses.push(...mintsAtas);
|
|
186
|
+
// ctoken ATAs
|
|
187
|
+
const ctokenMintsAtas: { address: PublicKey; log: string }[] = await Promise.all(
|
|
188
|
+
reserves.map(async (reserve) => {
|
|
189
|
+
const ctokenMint = reserve.getCTokenMint();
|
|
190
|
+
return {
|
|
191
|
+
address: await getAssociatedTokenAddress(ctokenMint, user),
|
|
192
|
+
log: 'ctoken ata for reserve ' + reserve.address.toString(),
|
|
193
|
+
};
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
addresses.push(...ctokenMintsAtas);
|
|
197
|
+
// farm states
|
|
198
|
+
const farmCollateralStates: PublicKey[] = reserves.map((reserve) => reserve.state.farmCollateral);
|
|
199
|
+
const farmDebtStates: PublicKey[] = reserves.map((reserve) => reserve.state.farmDebt);
|
|
200
|
+
const farmStates = new PublicKeySet(
|
|
201
|
+
farmCollateralStates.concat(farmDebtStates).filter((address) => isNotNullPubkey(address))
|
|
202
|
+
);
|
|
203
|
+
const farmStatesAdressesAndLogs = farmStates.toArray().map((address) => {
|
|
204
|
+
return { address: address, log: 'farm state' };
|
|
205
|
+
});
|
|
206
|
+
addresses.push(...farmStatesAdressesAndLogs);
|
|
207
|
+
// referrer token states
|
|
208
|
+
const referrerTokenStates: { address: PublicKey; log: string }[] = reserves.map((reserve) => {
|
|
209
|
+
return {
|
|
210
|
+
address: referrerTokenStatePda(referrer, reserve.address, kaminoMarket.programId)[0],
|
|
211
|
+
log: 'referrer token state for reserve ' + reserve.address,
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
if (!referrer.equals(PublicKey.default)) {
|
|
215
|
+
addresses.push(...referrerTokenStates);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const [multiplyObligations, multiplyObligationsFarmUserStates] = getMultiplyObligationAndObligationFarmStateAddresses(
|
|
219
|
+
kaminoMarket,
|
|
220
|
+
user,
|
|
221
|
+
multiplyMints
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
addresses.push(...multiplyObligations);
|
|
225
|
+
addresses.push(...multiplyObligationsFarmUserStates);
|
|
226
|
+
|
|
227
|
+
const [leverageObligations, leverageObligationsFarmUserStates] = getLeverageObligationAndObligationFarmStateAddresses(
|
|
228
|
+
kaminoMarket,
|
|
229
|
+
user,
|
|
230
|
+
leverageMints
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
addresses.push(...leverageObligations);
|
|
234
|
+
addresses.push(...leverageObligationsFarmUserStates);
|
|
235
|
+
|
|
236
|
+
if (repayWithCollObligation) {
|
|
237
|
+
const repayWithCollFarmUserStates = getRepayWithCollObligationFarmStateAddresses(
|
|
238
|
+
kaminoMarket,
|
|
239
|
+
repayWithCollObligation
|
|
240
|
+
);
|
|
241
|
+
addresses.push(...repayWithCollFarmUserStates);
|
|
242
|
+
addresses.push({ address: repayWithCollObligation.obligationAddress, log: 'repay with coll obligation' });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return addresses;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
function getMultiplyObligationAndObligationFarmStateAddresses(
|
|
249
|
+
kaminoMarket: KaminoMarket,
|
|
250
|
+
user: PublicKey,
|
|
251
|
+
mints: { coll: PublicKey; debt: PublicKey }[]
|
|
252
|
+
): [{ address: PublicKey; log: string }[], { address: PublicKey; log: string }[]] {
|
|
253
|
+
const obligationPdas: { address: PublicKey; log: string }[] = [];
|
|
254
|
+
const farmUserStates: { address: PublicKey; log: string }[] = [];
|
|
255
|
+
|
|
256
|
+
for (const { coll: collMint, debt: debtMint } of mints) {
|
|
257
|
+
const collReserve = kaminoMarket.getReserveByMint(collMint);
|
|
258
|
+
const debtReserve = kaminoMarket.getReserveByMint(debtMint);
|
|
259
|
+
const collMintString = collMint.toString();
|
|
260
|
+
const debtMintString = debtMint.toString();
|
|
261
|
+
if (collReserve && debtReserve) {
|
|
262
|
+
const multiplyObligation = new MultiplyObligation(collMint, WRAPPED_SOL_MINT, kaminoMarket.programId);
|
|
263
|
+
obligationPdas.push({
|
|
264
|
+
address: multiplyObligation.toPda(kaminoMarket.getAddress(), user),
|
|
265
|
+
log: 'multiply obligation coll: ' + collMintString + ' debt: ' + debtMintString,
|
|
266
|
+
});
|
|
267
|
+
if (!collReserve.state.farmCollateral.equals(PublicKey.default)) {
|
|
268
|
+
farmUserStates.push({
|
|
269
|
+
address: getPdaFarmsUserState(
|
|
270
|
+
collReserve.state.farmCollateral!,
|
|
271
|
+
multiplyObligation.toPda(kaminoMarket.getAddress(), user)
|
|
272
|
+
),
|
|
273
|
+
log: 'collReserve farmState for multiply obligation coll: ' + collMintString + ' debt: ' + debtMintString,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (!debtReserve.state.farmDebt.equals(PublicKey.default)) {
|
|
277
|
+
farmUserStates.push({
|
|
278
|
+
address: getPdaFarmsUserState(
|
|
279
|
+
debtReserve.state.farmDebt!,
|
|
280
|
+
multiplyObligation.toPda(kaminoMarket.getAddress(), user)
|
|
281
|
+
),
|
|
282
|
+
log: 'debtReserve farmState for multiply obligation coll: ' + collMintString + ' debt: ' + debtMintString,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return [obligationPdas, farmUserStates];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function getLeverageObligationAndObligationFarmStateAddresses(
|
|
292
|
+
kaminoMarket: KaminoMarket,
|
|
293
|
+
user: PublicKey,
|
|
294
|
+
mints: { coll: PublicKey; debt: PublicKey }[]
|
|
295
|
+
): [{ address: PublicKey; log: string }[], { address: PublicKey; log: string }[]] {
|
|
296
|
+
const obligationPdas: { address: PublicKey; log: string }[] = [];
|
|
297
|
+
const farmUserStates: { address: PublicKey; log: string }[] = [];
|
|
298
|
+
|
|
299
|
+
for (const { coll: collMint, debt: debtMint } of mints) {
|
|
300
|
+
const collReserve = kaminoMarket.getReserveByMint(collMint);
|
|
301
|
+
const debtReserve = kaminoMarket.getReserveByMint(debtMint);
|
|
302
|
+
const collMintString = collMint.toString();
|
|
303
|
+
const debtMintString = debtMint.toString();
|
|
304
|
+
if (collReserve && debtReserve) {
|
|
305
|
+
const leverageObligation = new LeverageObligation(collMint, debtMint, kaminoMarket.programId);
|
|
306
|
+
obligationPdas.push({
|
|
307
|
+
address: leverageObligation.toPda(kaminoMarket.getAddress(), user),
|
|
308
|
+
log: 'leverage obligation coll: ' + collMintString + ' debt: ' + debtMintString,
|
|
309
|
+
});
|
|
310
|
+
if (!collReserve.state.farmCollateral.equals(PublicKey.default)) {
|
|
311
|
+
farmUserStates.push({
|
|
312
|
+
address: getPdaFarmsUserState(
|
|
313
|
+
collReserve.state.farmCollateral!,
|
|
314
|
+
leverageObligation.toPda(kaminoMarket.getAddress(), user)
|
|
315
|
+
),
|
|
316
|
+
log: 'collReserve farmState for leverage obligation coll: ' + collMintString + ' debt: ' + debtMintString,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
if (!debtReserve.state.farmDebt.equals(PublicKey.default)) {
|
|
320
|
+
farmUserStates.push({
|
|
321
|
+
address: getPdaFarmsUserState(
|
|
322
|
+
debtReserve.state.farmDebt!,
|
|
323
|
+
leverageObligation.toPda(kaminoMarket.getAddress(), user)
|
|
324
|
+
),
|
|
325
|
+
log: 'debtReserve farmState for leverage obligation coll: ' + collMintString + ' debt: ' + debtMintString,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return [obligationPdas, farmUserStates];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function getRepayWithCollObligationFarmStateAddresses(
|
|
335
|
+
kaminoMarket: KaminoMarket,
|
|
336
|
+
obligation: KaminoObligation
|
|
337
|
+
): { address: PublicKey; log: string }[] {
|
|
338
|
+
const farmUserStates: { address: PublicKey; log: string }[] = [];
|
|
339
|
+
const obligationString = obligation.obligationAddress.toString();
|
|
340
|
+
|
|
341
|
+
obligation.borrows.forEach((borrow) => {
|
|
342
|
+
const borrowReserve = kaminoMarket.getReserveByMint(borrow.mintAddress)!;
|
|
343
|
+
if (!borrowReserve.state.farmDebt.equals(PublicKey.default)) {
|
|
344
|
+
farmUserStates.push({
|
|
345
|
+
address: getPdaFarmsUserState(borrowReserve.state.farmDebt!, obligation.obligationAddress),
|
|
346
|
+
log: 'debtReserve farmState for vanilla obligation: ' + obligationString,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
obligation.deposits.forEach((deposit) => {
|
|
352
|
+
const depositReserve = kaminoMarket.getReserveByMint(deposit.mintAddress)!;
|
|
353
|
+
if (!depositReserve.state.farmCollateral.equals(PublicKey.default)) {
|
|
354
|
+
farmUserStates.push({
|
|
355
|
+
address: getPdaFarmsUserState(depositReserve.state.farmCollateral!, obligation.obligationAddress),
|
|
356
|
+
log: 'collReserve farmState for vanilla obligation' + obligationString,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
return farmUserStates;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const BASE_SEED_USER_STATE = Buffer.from('user');
|
|
365
|
+
|
|
366
|
+
const getPdaFarmsUserState = (farm: PublicKey, obligation: PublicKey) =>
|
|
367
|
+
PublicKey.findProgramAddressSync([BASE_SEED_USER_STATE, farm.toBytes(), obligation.toBytes()], farmsId)[0];
|
|
368
|
+
|
|
369
|
+
export async function getAllUserMetadatasWithFilter(
|
|
370
|
+
connection: Connection,
|
|
371
|
+
filter: GetProgramAccountsFilter[],
|
|
372
|
+
programId: PublicKey
|
|
373
|
+
): Promise<KaminoUserMetadata[]> {
|
|
374
|
+
const filters = [
|
|
375
|
+
{
|
|
376
|
+
dataSize: UserMetadata.layout.span + 8,
|
|
377
|
+
},
|
|
378
|
+
...filter,
|
|
379
|
+
];
|
|
380
|
+
|
|
381
|
+
const userMetadatas = await connection.getProgramAccounts(programId, {
|
|
382
|
+
filters,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
return userMetadatas.map((userMetadata) => {
|
|
386
|
+
if (userMetadata.account === null) {
|
|
387
|
+
throw new Error('Invalid account');
|
|
388
|
+
}
|
|
389
|
+
if (!userMetadata.account.owner.equals(programId)) {
|
|
390
|
+
throw new Error("account doesn't belong to this program");
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const userMetadataAccount = UserMetadata.decode(userMetadata.account.data);
|
|
394
|
+
|
|
395
|
+
if (!userMetadataAccount) {
|
|
396
|
+
throw Error('Could not parse user metadata.');
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return { address: userMetadata.pubkey, state: userMetadataAccount };
|
|
400
|
+
});
|
|
401
|
+
}
|