@kamino-finance/kliquidity-sdk 8.1.3 → 8.2.0
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/@codegen/kliquidity/accounts/CollateralInfos.d.ts +20 -0
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.js +96 -0
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.d.ts +89 -0
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.js +242 -0
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.d.ts +84 -0
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.js +178 -0
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/PoolState.d.ts +213 -0
- package/dist/@codegen/kliquidity/accounts/PoolState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/PoolState.js +346 -0
- package/dist/@codegen/kliquidity/accounts/PoolState.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/Position.d.ts +48 -0
- package/dist/@codegen/kliquidity/accounts/Position.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/Position.js +156 -0
- package/dist/@codegen/kliquidity/accounts/Position.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.d.ts +80 -0
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.js +171 -0
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.d.ts +19 -0
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.js +95 -0
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/TermsSignature.d.ts +19 -0
- package/dist/@codegen/kliquidity/accounts/TermsSignature.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/TermsSignature.js +95 -0
- package/dist/@codegen/kliquidity/accounts/TermsSignature.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/Whirlpool.d.ts +76 -0
- package/dist/@codegen/kliquidity/accounts/Whirlpool.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/Whirlpool.js +211 -0
- package/dist/@codegen/kliquidity/accounts/Whirlpool.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.d.ts +321 -0
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.js +706 -0
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.js.map +1 -0
- package/dist/@codegen/kliquidity/accounts/index.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/accounts/index.js.map +1 -0
- package/dist/@codegen/kliquidity/errors/anchor.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/errors/anchor.js.map +1 -0
- package/dist/@codegen/kliquidity/errors/custom.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/errors/custom.js.map +1 -0
- package/dist/@codegen/kliquidity/errors/index.d.ts +6 -0
- package/dist/@codegen/kliquidity/errors/index.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/errors/index.js +86 -0
- package/dist/@codegen/kliquidity/errors/index.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.d.ts +18 -0
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.js +68 -0
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/changePool.d.ts +13 -0
- package/dist/@codegen/kliquidity/instructions/changePool.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/changePool.js +25 -0
- package/dist/@codegen/kliquidity/instructions/changePool.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.d.ts +14 -0
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.js +60 -0
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.d.ts +10 -0
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.js +22 -0
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/closeStrategy.d.ts +50 -0
- package/dist/@codegen/kliquidity/instructions/closeStrategy.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/closeStrategy.js +54 -0
- package/dist/@codegen/kliquidity/instructions/closeStrategy.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.d.ts +44 -0
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.js +50 -0
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/deposit.d.ts +34 -0
- package/dist/@codegen/kliquidity/instructions/deposit.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/deposit.js +80 -0
- package/dist/@codegen/kliquidity/instructions/deposit.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.d.ts +43 -0
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.js +92 -0
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/emergencySwap.d.ts +36 -0
- package/dist/@codegen/kliquidity/instructions/emergencySwap.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/emergencySwap.js +83 -0
- package/dist/@codegen/kliquidity/instructions/emergencySwap.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.d.ts +34 -0
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.js +86 -0
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.d.ts +41 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.js +88 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.d.ts +42 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.js +85 -0
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/index.d.ts +73 -0
- package/dist/@codegen/kliquidity/instructions/index.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/index.js +76 -0
- package/dist/@codegen/kliquidity/instructions/index.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.d.ts +9 -0
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.js +21 -0
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.d.ts +8 -0
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.js +20 -0
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.d.ts +21 -0
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.js +75 -0
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.d.ts +20 -0
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.js +72 -0
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.d.ts +30 -0
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.js +80 -0
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.d.ts +15 -0
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.js +65 -0
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/invest.d.ts +31 -0
- package/dist/@codegen/kliquidity/instructions/invest.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/invest.js +43 -0
- package/dist/@codegen/kliquidity/instructions/invest.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.d.ts +47 -0
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.js +102 -0
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/orcaSwap.d.ts +31 -0
- package/dist/@codegen/kliquidity/instructions/orcaSwap.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/orcaSwap.js +80 -0
- package/dist/@codegen/kliquidity/instructions/orcaSwap.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.d.ts +12 -0
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.js +20 -0
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/signTerms.d.ts +13 -0
- package/dist/@codegen/kliquidity/instructions/signTerms.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/signTerms.js +57 -0
- package/dist/@codegen/kliquidity/instructions/signTerms.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.d.ts +43 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.js +92 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.d.ts +34 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.js +80 -0
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/swapRewards.d.ts +38 -0
- package/dist/@codegen/kliquidity/instructions/swapRewards.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/swapRewards.js +87 -0
- package/dist/@codegen/kliquidity/instructions/swapRewards.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.d.ts +15 -0
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.js +66 -0
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.d.ts +14 -0
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.js +66 -0
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.d.ts +21 -0
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.js +72 -0
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.d.ts +18 -0
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.js +70 -0
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.d.ts +7 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.js +19 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.d.ts +15 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.js +66 -0
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.d.ts +18 -0
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.js +62 -0
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/withdraw.d.ts +39 -0
- package/dist/@codegen/kliquidity/instructions/withdraw.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/withdraw.js +86 -0
- package/dist/@codegen/kliquidity/instructions/withdraw.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.d.ts +13 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.js +60 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.js.map +1 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.d.ts +19 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.js +66 -0
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.js.map +1 -0
- package/dist/@codegen/kliquidity/programId.d.ts +4 -0
- package/dist/@codegen/kliquidity/programId.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/programId.js +9 -0
- package/dist/@codegen/kliquidity/programId.js.map +1 -0
- package/dist/@codegen/kliquidity/types/BalanceStatus.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/BalanceStatus.js.map +1 -0
- package/dist/@codegen/kliquidity/types/BinAddLiquidityStrategy.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/BinAddLiquidityStrategy.js.map +1 -0
- package/dist/@codegen/kliquidity/types/CollateralInfo.d.ts +94 -0
- package/dist/@codegen/kliquidity/types/CollateralInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/CollateralInfo.js +178 -0
- package/dist/@codegen/kliquidity/types/CollateralInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.d.ts +84 -0
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.js +164 -0
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.js.map +1 -0
- package/dist/@codegen/kliquidity/types/CollateralTestToken.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/CollateralTestToken.js.map +1 -0
- package/dist/@codegen/kliquidity/types/CreationStatus.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/CreationStatus.js.map +1 -0
- package/dist/@codegen/kliquidity/types/DEX.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/DEX.js.map +1 -0
- package/dist/@codegen/kliquidity/types/DexSpecificPrice.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/DexSpecificPrice.js.map +1 -0
- package/dist/@codegen/kliquidity/types/DriftDirection.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/DriftDirection.js.map +1 -0
- package/dist/@codegen/kliquidity/types/ExecutiveWithdrawAction.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/ExecutiveWithdrawAction.js.map +1 -0
- package/dist/@codegen/kliquidity/types/ExpanderStep.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/ExpanderStep.js.map +1 -0
- package/dist/@codegen/kliquidity/types/GlobalConfigOption.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/GlobalConfigOption.js.map +1 -0
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.d.ts +64 -0
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.js +136 -0
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/types/LiquidityCalculationMode.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/LiquidityCalculationMode.js.map +1 -0
- package/dist/@codegen/kliquidity/types/MintingMethod.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/MintingMethod.js.map +1 -0
- package/dist/@codegen/kliquidity/types/PeriodicRebalanceState.d.ts +23 -0
- package/dist/@codegen/kliquidity/types/PeriodicRebalanceState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/PeriodicRebalanceState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/PositionRewardInfo.d.ts +28 -0
- package/dist/@codegen/kliquidity/types/PositionRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/PositionRewardInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/types/Price.d.ts +28 -0
- package/dist/@codegen/kliquidity/types/Price.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/Price.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAction.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAction.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftParams.d.ts +76 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftParams.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftParams.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftState.d.ts +89 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftStep.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftStep.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftWindow.d.ts +55 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftWindow.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftWindow.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftParams.d.ts +51 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftParams.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftParams.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftState.d.ts +41 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftStep.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceDriftStep.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceEffects.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceEffects.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceExpanderState.d.ts +28 -0
- package/dist/@codegen/kliquidity/types/RebalanceExpanderState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceExpanderState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceManualState.d.ts +15 -0
- package/dist/@codegen/kliquidity/types/RebalanceManualState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceManualState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageState.d.ts +28 -0
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.d.ts +28 -0
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceRaw.d.ts +32 -0
- package/dist/@codegen/kliquidity/types/RebalanceRaw.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceRaw.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitState.d.ts +34 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitState.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitState.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitStep.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitStep.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitToken.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitToken.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceType.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RebalanceType.js.map +1 -0
- package/dist/@codegen/kliquidity/types/ReferencePriceType.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/ReferencePriceType.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RemoveLiquidityMode.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RemoveLiquidityMode.js.map +1 -0
- package/dist/@codegen/kliquidity/types/RewardInfo.d.ts +116 -0
- package/dist/@codegen/kliquidity/types/RewardInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/RewardInfo.js +164 -0
- package/dist/@codegen/kliquidity/types/RewardInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/types/ScopePriceIdTest.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/ScopePriceIdTest.js.map +1 -0
- package/dist/@codegen/kliquidity/types/SimulationPrice.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/SimulationPrice.js.map +1 -0
- package/dist/@codegen/kliquidity/types/StakingRateSource.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/StakingRateSource.js.map +1 -0
- package/dist/@codegen/kliquidity/types/StrategyConfigOption.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/StrategyConfigOption.js.map +1 -0
- package/dist/@codegen/kliquidity/types/StrategyStatus.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/StrategyStatus.js.map +1 -0
- package/dist/@codegen/kliquidity/types/StrategyType.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/StrategyType.js.map +1 -0
- package/dist/@codegen/kliquidity/types/SwapLimit.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/SwapLimit.js.map +1 -0
- package/dist/@codegen/kliquidity/types/UpdateCollateralInfoMode.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/UpdateCollateralInfoMode.js.map +1 -0
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.d.ts +68 -0
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.js +116 -0
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.js.map +1 -0
- package/dist/@codegen/kliquidity/types/WithdrawalCapAccumulatorAction.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/WithdrawalCapAccumulatorAction.js.map +1 -0
- package/dist/@codegen/kliquidity/types/WithdrawalCaps.d.ts +38 -0
- package/dist/@codegen/kliquidity/types/WithdrawalCaps.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/WithdrawalCaps.js.map +1 -0
- package/dist/@codegen/kliquidity/types/index.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/types/index.js.map +1 -0
- package/dist/@codegen/kliquidity/utils/borshAddress.d.ts +4 -0
- package/dist/@codegen/kliquidity/utils/borshAddress.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/utils/borshAddress.js +30 -0
- package/dist/@codegen/kliquidity/utils/borshAddress.js.map +1 -0
- package/dist/@codegen/kliquidity/utils/index.d.ts +2 -0
- package/dist/@codegen/kliquidity/utils/index.d.ts.map +1 -0
- package/dist/@codegen/kliquidity/utils/index.js +18 -0
- package/dist/@codegen/kliquidity/utils/index.js.map +1 -0
- package/dist/@codegen/meteora/accounts/BinArray.d.ts +42 -0
- package/dist/@codegen/meteora/accounts/BinArray.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/BinArray.js +133 -0
- package/dist/@codegen/meteora/accounts/BinArray.js.map +1 -0
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.d.ts +32 -0
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.js +115 -0
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.js.map +1 -0
- package/dist/@codegen/meteora/accounts/LbPair.d.ts +180 -0
- package/dist/@codegen/meteora/accounts/LbPair.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/LbPair.js +300 -0
- package/dist/@codegen/meteora/accounts/LbPair.js.map +1 -0
- package/dist/@codegen/meteora/accounts/Oracle.d.ts +35 -0
- package/dist/@codegen/meteora/accounts/Oracle.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/Oracle.js +115 -0
- package/dist/@codegen/meteora/accounts/Oracle.js.map +1 -0
- package/dist/@codegen/meteora/accounts/Position.d.ts +90 -0
- package/dist/@codegen/meteora/accounts/Position.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/Position.js +180 -0
- package/dist/@codegen/meteora/accounts/Position.js.map +1 -0
- package/dist/@codegen/meteora/accounts/PositionV2.d.ts +114 -0
- package/dist/@codegen/meteora/accounts/PositionV2.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/PositionV2.js +209 -0
- package/dist/@codegen/meteora/accounts/PositionV2.js.map +1 -0
- package/dist/@codegen/meteora/accounts/PresetParameter.d.ts +76 -0
- package/dist/@codegen/meteora/accounts/PresetParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/PresetParameter.js +159 -0
- package/dist/@codegen/meteora/accounts/PresetParameter.js.map +1 -0
- package/dist/@codegen/meteora/accounts/index.d.ts.map +1 -0
- package/dist/@codegen/meteora/accounts/index.js.map +1 -0
- package/dist/@codegen/meteora/errors/anchor.d.ts.map +1 -0
- package/dist/@codegen/meteora/errors/anchor.js.map +1 -0
- package/dist/@codegen/meteora/errors/custom.d.ts.map +1 -0
- package/dist/@codegen/meteora/errors/custom.js.map +1 -0
- package/dist/@codegen/meteora/errors/index.d.ts +6 -0
- package/dist/@codegen/meteora/errors/index.d.ts.map +1 -0
- package/dist/@codegen/meteora/errors/index.js +86 -0
- package/dist/@codegen/meteora/errors/index.js.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidity.d.ts +26 -0
- package/dist/@codegen/meteora/instructions/addLiquidity.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidity.js +76 -0
- package/dist/@codegen/meteora/instructions/addLiquidity.js.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.d.ts +26 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.js +76 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.js.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.d.ts +22 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.js +72 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.js.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.d.ts +26 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.js +76 -0
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.js.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.d.ts +22 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.js +72 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.js.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.d.ts +22 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.js +72 -0
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.js.map +1 -0
- package/dist/@codegen/meteora/instructions/claimFee.d.ts +19 -0
- package/dist/@codegen/meteora/instructions/claimFee.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/claimFee.js +27 -0
- package/dist/@codegen/meteora/instructions/claimFee.js.map +1 -0
- package/dist/@codegen/meteora/instructions/claimReward.d.ts +21 -0
- package/dist/@codegen/meteora/instructions/claimReward.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/claimReward.js +64 -0
- package/dist/@codegen/meteora/instructions/claimReward.js.map +1 -0
- package/dist/@codegen/meteora/instructions/closePosition.d.ts +13 -0
- package/dist/@codegen/meteora/instructions/closePosition.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/closePosition.js +21 -0
- package/dist/@codegen/meteora/instructions/closePosition.js.map +1 -0
- package/dist/@codegen/meteora/instructions/closePresetParameter.d.ts +8 -0
- package/dist/@codegen/meteora/instructions/closePresetParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/closePresetParameter.js +16 -0
- package/dist/@codegen/meteora/instructions/closePresetParameter.js.map +1 -0
- package/dist/@codegen/meteora/instructions/fundReward.d.ts +21 -0
- package/dist/@codegen/meteora/instructions/fundReward.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/fundReward.js +68 -0
- package/dist/@codegen/meteora/instructions/fundReward.js.map +1 -0
- package/dist/@codegen/meteora/instructions/goToABin.d.ts +15 -0
- package/dist/@codegen/meteora/instructions/goToABin.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/goToABin.js +67 -0
- package/dist/@codegen/meteora/instructions/goToABin.js.map +1 -0
- package/dist/@codegen/meteora/instructions/increaseOracleLength.d.ts +15 -0
- package/dist/@codegen/meteora/instructions/increaseOracleLength.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/increaseOracleLength.js +58 -0
- package/dist/@codegen/meteora/instructions/increaseOracleLength.js.map +1 -0
- package/dist/@codegen/meteora/instructions/index.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/index.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeBinArray.d.ts +14 -0
- package/dist/@codegen/meteora/instructions/initializeBinArray.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeBinArray.js +57 -0
- package/dist/@codegen/meteora/instructions/initializeBinArray.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.d.ts +11 -0
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.js +18 -0
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeLbPair.d.ts +24 -0
- package/dist/@codegen/meteora/instructions/initializeLbPair.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeLbPair.js +75 -0
- package/dist/@codegen/meteora/instructions/initializeLbPair.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.d.ts +24 -0
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.js +74 -0
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePosition.d.ts +18 -0
- package/dist/@codegen/meteora/instructions/initializePosition.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePosition.js +65 -0
- package/dist/@codegen/meteora/instructions/initializePosition.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.d.ts +22 -0
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.js +71 -0
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePositionPda.d.ts +20 -0
- package/dist/@codegen/meteora/instructions/initializePositionPda.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePositionPda.js +66 -0
- package/dist/@codegen/meteora/instructions/initializePositionPda.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePresetParameter.d.ts +14 -0
- package/dist/@codegen/meteora/instructions/initializePresetParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializePresetParameter.js +58 -0
- package/dist/@codegen/meteora/instructions/initializePresetParameter.js.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeReward.d.ts +21 -0
- package/dist/@codegen/meteora/instructions/initializeReward.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/initializeReward.js +69 -0
- package/dist/@codegen/meteora/instructions/initializeReward.js.map +1 -0
- package/dist/@codegen/meteora/instructions/migrateBinArray.d.ts +6 -0
- package/dist/@codegen/meteora/instructions/migrateBinArray.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/migrateBinArray.js +14 -0
- package/dist/@codegen/meteora/instructions/migrateBinArray.js.map +1 -0
- package/dist/@codegen/meteora/instructions/migratePosition.d.ts +15 -0
- package/dist/@codegen/meteora/instructions/migratePosition.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/migratePosition.js +27 -0
- package/dist/@codegen/meteora/instructions/migratePosition.js.map +1 -0
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.d.ts +21 -0
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.js +33 -0
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.js.map +1 -0
- package/dist/@codegen/meteora/instructions/removeLiquidity.d.ts +26 -0
- package/dist/@codegen/meteora/instructions/removeLiquidity.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/removeLiquidity.js +76 -0
- package/dist/@codegen/meteora/instructions/removeLiquidity.js.map +1 -0
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.d.ts +27 -0
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.js +79 -0
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.js.map +1 -0
- package/dist/@codegen/meteora/instructions/setActivationSlot.d.ts +12 -0
- package/dist/@codegen/meteora/instructions/setActivationSlot.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/setActivationSlot.js +55 -0
- package/dist/@codegen/meteora/instructions/setActivationSlot.js.map +1 -0
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.d.ts +15 -0
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.js +58 -0
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.js.map +1 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.d.ts +11 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.js +55 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.js.map +1 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.d.ts +11 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.js +56 -0
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.js.map +1 -0
- package/dist/@codegen/meteora/instructions/swap.d.ts +26 -0
- package/dist/@codegen/meteora/instructions/swap.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/swap.js +78 -0
- package/dist/@codegen/meteora/instructions/swap.js.map +1 -0
- package/dist/@codegen/meteora/instructions/togglePairStatus.d.ts +7 -0
- package/dist/@codegen/meteora/instructions/togglePairStatus.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/togglePairStatus.js +15 -0
- package/dist/@codegen/meteora/instructions/togglePairStatus.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updateFeeOwner.d.ts +8 -0
- package/dist/@codegen/meteora/instructions/updateFeeOwner.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updateFeeOwner.js +16 -0
- package/dist/@codegen/meteora/instructions/updateFeeOwner.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updateFeeParameters.d.ts +14 -0
- package/dist/@codegen/meteora/instructions/updateFeeParameters.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updateFeeParameters.js +58 -0
- package/dist/@codegen/meteora/instructions/updateFeeParameters.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.d.ts +10 -0
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.js +18 -0
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updatePositionOperator.d.ts +13 -0
- package/dist/@codegen/meteora/instructions/updatePositionOperator.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updatePositionOperator.js +58 -0
- package/dist/@codegen/meteora/instructions/updatePositionOperator.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updateRewardDuration.d.ts +16 -0
- package/dist/@codegen/meteora/instructions/updateRewardDuration.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updateRewardDuration.js +62 -0
- package/dist/@codegen/meteora/instructions/updateRewardDuration.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updateRewardFunder.d.ts +15 -0
- package/dist/@codegen/meteora/instructions/updateRewardFunder.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updateRewardFunder.js +62 -0
- package/dist/@codegen/meteora/instructions/updateRewardFunder.js.map +1 -0
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.d.ts +11 -0
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.js +56 -0
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.js.map +1 -0
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.d.ts +19 -0
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.js +62 -0
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.js.map +1 -0
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.d.ts +20 -0
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.d.ts.map +1 -0
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.js +63 -0
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.js.map +1 -0
- package/dist/@codegen/meteora/programId.d.ts +4 -0
- package/dist/@codegen/meteora/programId.d.ts.map +1 -0
- package/dist/@codegen/meteora/programId.js +9 -0
- package/dist/@codegen/meteora/programId.js.map +1 -0
- package/dist/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.d.ts +34 -0
- package/dist/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.js.map +1 -0
- package/dist/@codegen/meteora/types/Bin.d.ts +90 -0
- package/dist/@codegen/meteora/types/Bin.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/Bin.js.map +1 -0
- package/dist/@codegen/meteora/types/BinLiquidityDistribution.d.ts +41 -0
- package/dist/@codegen/meteora/types/BinLiquidityDistribution.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/BinLiquidityDistribution.js.map +1 -0
- package/dist/@codegen/meteora/types/BinLiquidityDistributionByWeight.d.ts +33 -0
- package/dist/@codegen/meteora/types/BinLiquidityDistributionByWeight.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/BinLiquidityDistributionByWeight.js.map +1 -0
- package/dist/@codegen/meteora/types/BinLiquidityReduction.d.ts +27 -0
- package/dist/@codegen/meteora/types/BinLiquidityReduction.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/BinLiquidityReduction.js.map +1 -0
- package/dist/@codegen/meteora/types/CompressedBinDepositAmount.d.ts +27 -0
- package/dist/@codegen/meteora/types/CompressedBinDepositAmount.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/CompressedBinDepositAmount.js.map +1 -0
- package/dist/@codegen/meteora/types/FeeInfo.d.ts +38 -0
- package/dist/@codegen/meteora/types/FeeInfo.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/FeeInfo.js.map +1 -0
- package/dist/@codegen/meteora/types/FeeParameter.d.ts +33 -0
- package/dist/@codegen/meteora/types/FeeParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/FeeParameter.js.map +1 -0
- package/dist/@codegen/meteora/types/InitPermissionPairIx.d.ts +48 -0
- package/dist/@codegen/meteora/types/InitPermissionPairIx.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/InitPermissionPairIx.js.map +1 -0
- package/dist/@codegen/meteora/types/InitPresetParametersIx.d.ts +97 -0
- package/dist/@codegen/meteora/types/InitPresetParametersIx.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/InitPresetParametersIx.js.map +1 -0
- package/dist/@codegen/meteora/types/LayoutVersion.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/LayoutVersion.js.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityOneSideParameter.d.ts +56 -0
- package/dist/@codegen/meteora/types/LiquidityOneSideParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityOneSideParameter.js.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameter.d.ts +50 -0
- package/dist/@codegen/meteora/types/LiquidityParameter.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameter.js.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategy.d.ts +104 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategy.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategy.js.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.d.ts +96 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.js.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByWeight.d.ts +64 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByWeight.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/LiquidityParameterByWeight.js.map +1 -0
- package/dist/@codegen/meteora/types/Observation.d.ts +42 -0
- package/dist/@codegen/meteora/types/Observation.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/Observation.js.map +1 -0
- package/dist/@codegen/meteora/types/PairStatus.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/PairStatus.js.map +1 -0
- package/dist/@codegen/meteora/types/PairType.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/PairType.js.map +1 -0
- package/dist/@codegen/meteora/types/ProtocolFee.d.ts +28 -0
- package/dist/@codegen/meteora/types/ProtocolFee.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/ProtocolFee.js.map +1 -0
- package/dist/@codegen/meteora/types/RewardInfo.d.ts +84 -0
- package/dist/@codegen/meteora/types/RewardInfo.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/RewardInfo.js +139 -0
- package/dist/@codegen/meteora/types/RewardInfo.js.map +1 -0
- package/dist/@codegen/meteora/types/Rounding.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/Rounding.js.map +1 -0
- package/dist/@codegen/meteora/types/StaticParameters.d.ts +98 -0
- package/dist/@codegen/meteora/types/StaticParameters.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/StaticParameters.js.map +1 -0
- package/dist/@codegen/meteora/types/StrategyParameters.d.ts +85 -0
- package/dist/@codegen/meteora/types/StrategyParameters.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/StrategyParameters.js.map +1 -0
- package/dist/@codegen/meteora/types/StrategyType.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/StrategyType.js.map +1 -0
- package/dist/@codegen/meteora/types/UserRewardInfo.d.ts +28 -0
- package/dist/@codegen/meteora/types/UserRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/UserRewardInfo.js.map +1 -0
- package/dist/@codegen/meteora/types/VariableParameters.d.ts +76 -0
- package/dist/@codegen/meteora/types/VariableParameters.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/VariableParameters.js.map +1 -0
- package/dist/@codegen/meteora/types/index.d.ts.map +1 -0
- package/dist/@codegen/meteora/types/index.js.map +1 -0
- package/dist/@codegen/meteora/utils/borshAddress.d.ts +4 -0
- package/dist/@codegen/meteora/utils/borshAddress.d.ts.map +1 -0
- package/dist/@codegen/meteora/utils/borshAddress.js +30 -0
- package/dist/@codegen/meteora/utils/borshAddress.js.map +1 -0
- package/dist/@codegen/meteora/utils/index.d.ts +2 -0
- package/dist/@codegen/meteora/utils/index.d.ts.map +1 -0
- package/dist/@codegen/meteora/utils/index.js +18 -0
- package/dist/@codegen/meteora/utils/index.js.map +1 -0
- package/dist/@codegen/raydium/accounts/AmmConfig.d.ts +47 -0
- package/dist/@codegen/raydium/accounts/AmmConfig.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/AmmConfig.js +155 -0
- package/dist/@codegen/raydium/accounts/AmmConfig.js.map +1 -0
- package/dist/@codegen/raydium/accounts/ObservationState.d.ts +30 -0
- package/dist/@codegen/raydium/accounts/ObservationState.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/ObservationState.js +120 -0
- package/dist/@codegen/raydium/accounts/ObservationState.js.map +1 -0
- package/dist/@codegen/raydium/accounts/OperationState.d.ts +25 -0
- package/dist/@codegen/raydium/accounts/OperationState.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/OperationState.js +108 -0
- package/dist/@codegen/raydium/accounts/OperationState.js.map +1 -0
- package/dist/@codegen/raydium/accounts/PersonalPositionState.d.ts +54 -0
- package/dist/@codegen/raydium/accounts/PersonalPositionState.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/PersonalPositionState.js +168 -0
- package/dist/@codegen/raydium/accounts/PersonalPositionState.js.map +1 -0
- package/dist/@codegen/raydium/accounts/PoolState.d.ts +129 -0
- package/dist/@codegen/raydium/accounts/PoolState.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/PoolState.js +318 -0
- package/dist/@codegen/raydium/accounts/PoolState.js.map +1 -0
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.d.ts +50 -0
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.js +161 -0
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.js.map +1 -0
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.d.ts +26 -0
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.js +113 -0
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.js.map +1 -0
- package/dist/@codegen/raydium/accounts/TickArrayState.d.ts +32 -0
- package/dist/@codegen/raydium/accounts/TickArrayState.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/TickArrayState.js +121 -0
- package/dist/@codegen/raydium/accounts/TickArrayState.js.map +1 -0
- package/dist/@codegen/raydium/accounts/index.d.ts.map +1 -0
- package/dist/@codegen/raydium/accounts/index.js.map +1 -0
- package/dist/@codegen/raydium/errors/anchor.d.ts.map +1 -0
- package/dist/@codegen/raydium/errors/anchor.js.map +1 -0
- package/dist/@codegen/raydium/errors/custom.d.ts.map +1 -0
- package/dist/@codegen/raydium/errors/custom.js.map +1 -0
- package/dist/@codegen/raydium/errors/index.d.ts +6 -0
- package/dist/@codegen/raydium/errors/index.d.ts.map +1 -0
- package/dist/@codegen/raydium/errors/index.js +86 -0
- package/dist/@codegen/raydium/errors/index.js.map +1 -0
- package/dist/@codegen/raydium/instructions/closePosition.d.ts +11 -0
- package/dist/@codegen/raydium/instructions/closePosition.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/closePosition.js +19 -0
- package/dist/@codegen/raydium/instructions/closePosition.js.map +1 -0
- package/dist/@codegen/raydium/instructions/collectFundFee.d.ts +22 -0
- package/dist/@codegen/raydium/instructions/collectFundFee.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/collectFundFee.js +68 -0
- package/dist/@codegen/raydium/instructions/collectFundFee.js.map +1 -0
- package/dist/@codegen/raydium/instructions/collectProtocolFee.d.ts +22 -0
- package/dist/@codegen/raydium/instructions/collectProtocolFee.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/collectProtocolFee.js +68 -0
- package/dist/@codegen/raydium/instructions/collectProtocolFee.js.map +1 -0
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.d.ts +17 -0
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.js +65 -0
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.js.map +1 -0
- package/dist/@codegen/raydium/instructions/createAmmConfig.d.ts +16 -0
- package/dist/@codegen/raydium/instructions/createAmmConfig.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/createAmmConfig.js +66 -0
- package/dist/@codegen/raydium/instructions/createAmmConfig.js.map +1 -0
- package/dist/@codegen/raydium/instructions/createOperationAccount.d.ts +8 -0
- package/dist/@codegen/raydium/instructions/createOperationAccount.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/createOperationAccount.js +16 -0
- package/dist/@codegen/raydium/instructions/createOperationAccount.js.map +1 -0
- package/dist/@codegen/raydium/instructions/createPool.d.ts +24 -0
- package/dist/@codegen/raydium/instructions/createPool.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/createPool.js +74 -0
- package/dist/@codegen/raydium/instructions/createPool.js.map +1 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.d.ts +24 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.js +71 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.js.map +1 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.d.ts +28 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.js +75 -0
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.js.map +1 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidity.d.ts +24 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidity.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidity.js +71 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidity.js.map +1 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.d.ts +28 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.js +76 -0
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.js.map +1 -0
- package/dist/@codegen/raydium/instructions/index.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/index.js.map +1 -0
- package/dist/@codegen/raydium/instructions/initializeReward.d.ts +20 -0
- package/dist/@codegen/raydium/instructions/initializeReward.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/initializeReward.js +70 -0
- package/dist/@codegen/raydium/instructions/initializeReward.js.map +1 -0
- package/dist/@codegen/raydium/instructions/openPosition.d.ts +35 -0
- package/dist/@codegen/raydium/instructions/openPosition.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/openPosition.js +90 -0
- package/dist/@codegen/raydium/instructions/openPosition.js.map +1 -0
- package/dist/@codegen/raydium/instructions/openPositionV2.d.ts +40 -0
- package/dist/@codegen/raydium/instructions/openPositionV2.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/openPositionV2.js +97 -0
- package/dist/@codegen/raydium/instructions/openPositionV2.js.map +1 -0
- package/dist/@codegen/raydium/instructions/setRewardParams.d.ts +19 -0
- package/dist/@codegen/raydium/instructions/setRewardParams.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/setRewardParams.js +71 -0
- package/dist/@codegen/raydium/instructions/setRewardParams.js.map +1 -0
- package/dist/@codegen/raydium/instructions/swap.d.ts +23 -0
- package/dist/@codegen/raydium/instructions/swap.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/swap.js +71 -0
- package/dist/@codegen/raydium/instructions/swap.js.map +1 -0
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.d.ts +17 -0
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.js +63 -0
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.js.map +1 -0
- package/dist/@codegen/raydium/instructions/swapV2.d.ts +26 -0
- package/dist/@codegen/raydium/instructions/swapV2.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/swapV2.js +74 -0
- package/dist/@codegen/raydium/instructions/swapV2.js.map +1 -0
- package/dist/@codegen/raydium/instructions/transferRewardOwner.d.ts +11 -0
- package/dist/@codegen/raydium/instructions/transferRewardOwner.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/transferRewardOwner.js +60 -0
- package/dist/@codegen/raydium/instructions/transferRewardOwner.js.map +1 -0
- package/dist/@codegen/raydium/instructions/updateAmmConfig.d.ts +12 -0
- package/dist/@codegen/raydium/instructions/updateAmmConfig.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/updateAmmConfig.js +56 -0
- package/dist/@codegen/raydium/instructions/updateAmmConfig.js.map +1 -0
- package/dist/@codegen/raydium/instructions/updateOperationAccount.d.ts +13 -0
- package/dist/@codegen/raydium/instructions/updateOperationAccount.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/updateOperationAccount.js +61 -0
- package/dist/@codegen/raydium/instructions/updateOperationAccount.js.map +1 -0
- package/dist/@codegen/raydium/instructions/updatePoolStatus.d.ts +11 -0
- package/dist/@codegen/raydium/instructions/updatePoolStatus.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/updatePoolStatus.js +59 -0
- package/dist/@codegen/raydium/instructions/updatePoolStatus.js.map +1 -0
- package/dist/@codegen/raydium/instructions/updateRewardInfos.d.ts +6 -0
- package/dist/@codegen/raydium/instructions/updateRewardInfos.d.ts.map +1 -0
- package/dist/@codegen/raydium/instructions/updateRewardInfos.js +14 -0
- package/dist/@codegen/raydium/instructions/updateRewardInfos.js.map +1 -0
- package/dist/@codegen/raydium/programId.d.ts +4 -0
- package/dist/@codegen/raydium/programId.d.ts.map +1 -0
- package/dist/@codegen/raydium/programId.js +9 -0
- package/dist/@codegen/raydium/programId.js.map +1 -0
- package/dist/@codegen/raydium/types/InitializeRewardParam.d.ts +33 -0
- package/dist/@codegen/raydium/types/InitializeRewardParam.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/InitializeRewardParam.js.map +1 -0
- package/dist/@codegen/raydium/types/Observation.d.ts +38 -0
- package/dist/@codegen/raydium/types/Observation.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/Observation.js.map +1 -0
- package/dist/@codegen/raydium/types/PoolStatusBitFlag.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/PoolStatusBitFlag.js.map +1 -0
- package/dist/@codegen/raydium/types/PoolStatusBitIndex.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/PoolStatusBitIndex.js.map +1 -0
- package/dist/@codegen/raydium/types/PositionRewardInfo.d.ts +28 -0
- package/dist/@codegen/raydium/types/PositionRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/PositionRewardInfo.js.map +1 -0
- package/dist/@codegen/raydium/types/RewardInfo.d.ts +74 -0
- package/dist/@codegen/raydium/types/RewardInfo.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/RewardInfo.js +150 -0
- package/dist/@codegen/raydium/types/RewardInfo.js.map +1 -0
- package/dist/@codegen/raydium/types/RewardState.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/RewardState.js.map +1 -0
- package/dist/@codegen/raydium/types/TickState.d.ts +53 -0
- package/dist/@codegen/raydium/types/TickState.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/TickState.js.map +1 -0
- package/dist/@codegen/raydium/types/index.d.ts.map +1 -0
- package/dist/@codegen/raydium/types/index.js.map +1 -0
- package/dist/@codegen/raydium/utils/borshAddress.d.ts +4 -0
- package/dist/@codegen/raydium/utils/borshAddress.d.ts.map +1 -0
- package/dist/@codegen/raydium/utils/borshAddress.js +30 -0
- package/dist/@codegen/raydium/utils/borshAddress.js.map +1 -0
- package/dist/@codegen/raydium/utils/index.d.ts +2 -0
- package/dist/@codegen/raydium/utils/index.d.ts.map +1 -0
- package/dist/@codegen/raydium/utils/index.js +18 -0
- package/dist/@codegen/raydium/utils/index.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/FeeTier.d.ts +25 -0
- package/dist/@codegen/whirlpools/accounts/FeeTier.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/FeeTier.js +108 -0
- package/dist/@codegen/whirlpools/accounts/FeeTier.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/Position.d.ts +48 -0
- package/dist/@codegen/whirlpools/accounts/Position.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/Position.js +156 -0
- package/dist/@codegen/whirlpools/accounts/Position.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/PositionBundle.d.ts +22 -0
- package/dist/@codegen/whirlpools/accounts/PositionBundle.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/PositionBundle.js +102 -0
- package/dist/@codegen/whirlpools/accounts/PositionBundle.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/TickArray.d.ts +26 -0
- package/dist/@codegen/whirlpools/accounts/TickArray.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/TickArray.js +109 -0
- package/dist/@codegen/whirlpools/accounts/TickArray.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/TokenBadge.d.ts +22 -0
- package/dist/@codegen/whirlpools/accounts/TokenBadge.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/TokenBadge.js +102 -0
- package/dist/@codegen/whirlpools/accounts/TokenBadge.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/Whirlpool.d.ts +75 -0
- package/dist/@codegen/whirlpools/accounts/Whirlpool.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/Whirlpool.js +210 -0
- package/dist/@codegen/whirlpools/accounts/Whirlpool.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.d.ts +28 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.js +114 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.d.ts +25 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.js +108 -0
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.js.map +1 -0
- package/dist/@codegen/whirlpools/accounts/index.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/accounts/index.js.map +1 -0
- package/dist/@codegen/whirlpools/errors/anchor.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/errors/anchor.js.map +1 -0
- package/dist/@codegen/whirlpools/errors/custom.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/errors/custom.js.map +1 -0
- package/dist/@codegen/whirlpools/errors/index.d.ts +6 -0
- package/dist/@codegen/whirlpools/errors/index.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/errors/index.js +86 -0
- package/dist/@codegen/whirlpools/errors/index.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.d.ts +14 -0
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.js +62 -0
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/closePosition.d.ts +11 -0
- package/dist/@codegen/whirlpools/instructions/closePosition.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/closePosition.js +23 -0
- package/dist/@codegen/whirlpools/instructions/closePosition.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectFees.d.ts +14 -0
- package/dist/@codegen/whirlpools/instructions/collectFees.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectFees.js +26 -0
- package/dist/@codegen/whirlpools/instructions/collectFees.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.d.ts +23 -0
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.js +75 -0
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.d.ts +13 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.js +25 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.d.ts +22 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.js +74 -0
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectReward.d.ts +16 -0
- package/dist/@codegen/whirlpools/instructions/collectReward.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectReward.js +64 -0
- package/dist/@codegen/whirlpools/instructions/collectReward.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.d.ts +20 -0
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.js +73 -0
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.d.ts +23 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.js +74 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.d.ts +29 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.js +83 -0
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.d.ts +11 -0
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.js +23 -0
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.d.ts +11 -0
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.js +23 -0
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.d.ts +23 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.js +74 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.d.ts +29 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.js +83 -0
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/index.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/index.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfig.d.ts +15 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfig.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfig.js +65 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfig.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.d.ts +10 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.js +22 -0
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.d.ts +15 -0
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.js +66 -0
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePool.d.ts +24 -0
- package/dist/@codegen/whirlpools/instructions/initializePool.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePool.js +79 -0
- package/dist/@codegen/whirlpools/instructions/initializePool.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.d.ts +25 -0
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.js +79 -0
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.d.ts +14 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.js +26 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.d.ts +17 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.js +29 -0
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeReward.d.ts +17 -0
- package/dist/@codegen/whirlpools/instructions/initializeReward.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeReward.js +69 -0
- package/dist/@codegen/whirlpools/instructions/initializeReward.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.d.ts +18 -0
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.js +70 -0
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.d.ts +13 -0
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.js +57 -0
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.d.ts +12 -0
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.js +24 -0
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.d.ts +19 -0
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.js +71 -0
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/openPosition.d.ts +22 -0
- package/dist/@codegen/whirlpools/instructions/openPosition.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/openPosition.js +74 -0
- package/dist/@codegen/whirlpools/instructions/openPosition.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.d.ts +25 -0
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.js +77 -0
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.d.ts +8 -0
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.js +20 -0
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.d.ts +9 -0
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.js +21 -0
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.d.ts +12 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.js +60 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.d.ts +11 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.js +59 -0
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.d.ts +8 -0
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.js +20 -0
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setFeeRate.d.ts +12 -0
- package/dist/@codegen/whirlpools/instructions/setFeeRate.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setFeeRate.js +60 -0
- package/dist/@codegen/whirlpools/instructions/setFeeRate.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.d.ts +12 -0
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.js +60 -0
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.d.ts +12 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.js +60 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.d.ts +13 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.js +61 -0
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.d.ts +14 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.js +64 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.d.ts +8 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.js +20 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.d.ts +14 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.js +64 -0
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.d.ts +9 -0
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.js +21 -0
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/swap.d.ts +25 -0
- package/dist/@codegen/whirlpools/instructions/swap.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/swap.js +78 -0
- package/dist/@codegen/whirlpools/instructions/swap.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/swapV2.d.ts +31 -0
- package/dist/@codegen/whirlpools/instructions/swapV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/swapV2.js +87 -0
- package/dist/@codegen/whirlpools/instructions/swapV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.d.ts +36 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.js +91 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.d.ts +42 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.js +100 -0
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.js.map +1 -0
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.d.ts +9 -0
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.js +17 -0
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.js.map +1 -0
- package/dist/@codegen/whirlpools/programId.d.ts +4 -0
- package/dist/@codegen/whirlpools/programId.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/programId.js +9 -0
- package/dist/@codegen/whirlpools/programId.js.map +1 -0
- package/dist/@codegen/whirlpools/types/AccountsType.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/AccountsType.js.map +1 -0
- package/dist/@codegen/whirlpools/types/CurrIndex.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/CurrIndex.js.map +1 -0
- package/dist/@codegen/whirlpools/types/Direction.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/Direction.js.map +1 -0
- package/dist/@codegen/whirlpools/types/OpenPositionBumps.d.ts +22 -0
- package/dist/@codegen/whirlpools/types/OpenPositionBumps.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/OpenPositionBumps.js.map +1 -0
- package/dist/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.d.ts +27 -0
- package/dist/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.js.map +1 -0
- package/dist/@codegen/whirlpools/types/PositionRewardInfo.d.ts +28 -0
- package/dist/@codegen/whirlpools/types/PositionRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/PositionRewardInfo.js.map +1 -0
- package/dist/@codegen/whirlpools/types/RemainingAccountsInfo.d.ts +52 -0
- package/dist/@codegen/whirlpools/types/RemainingAccountsInfo.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/RemainingAccountsInfo.js.map +1 -0
- package/dist/@codegen/whirlpools/types/RemainingAccountsSlice.d.ts +51 -0
- package/dist/@codegen/whirlpools/types/RemainingAccountsSlice.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/RemainingAccountsSlice.js.map +1 -0
- package/dist/@codegen/whirlpools/types/Tick.d.ts +48 -0
- package/dist/@codegen/whirlpools/types/Tick.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/Tick.js.map +1 -0
- package/dist/@codegen/whirlpools/types/TickLabel.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/TickLabel.js.map +1 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolBumps.d.ts +22 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolBumps.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolBumps.js.map +1 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.d.ts +44 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.js +108 -0
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.js.map +1 -0
- package/dist/@codegen/whirlpools/types/index.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/types/index.js.map +1 -0
- package/dist/@codegen/whirlpools/utils/borshAddress.d.ts +4 -0
- package/dist/@codegen/whirlpools/utils/borshAddress.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/utils/borshAddress.js +30 -0
- package/dist/@codegen/whirlpools/utils/borshAddress.js.map +1 -0
- package/dist/@codegen/whirlpools/utils/index.d.ts +2 -0
- package/dist/@codegen/whirlpools/utils/index.d.ts.map +1 -0
- package/dist/@codegen/whirlpools/utils/index.js +18 -0
- package/dist/@codegen/whirlpools/utils/index.js.map +1 -0
- package/dist/Kamino.d.ts +223 -478
- package/dist/Kamino.d.ts.map +1 -1
- package/dist/Kamino.js +1270 -1044
- package/dist/Kamino.js.map +1 -1
- package/dist/constants/deposit_method.d.ts +1 -1
- package/dist/constants/deposit_method.d.ts.map +1 -1
- package/dist/constants/deposit_method.js +2 -2
- package/dist/constants/deposit_method.js.map +1 -1
- package/dist/constants/metadata.d.ts +3 -3
- package/dist/constants/metadata.d.ts.map +1 -1
- package/dist/constants/metadata.js +3 -3
- package/dist/constants/metadata.js.map +1 -1
- package/dist/constants/pubkeys.d.ts +10 -10
- package/dist/constants/pubkeys.d.ts.map +1 -1
- package/dist/constants/pubkeys.js +11 -11
- package/dist/constants/pubkeys.js.map +1 -1
- package/dist/models/EnrichedScopePrice.d.ts +2 -2
- package/dist/models/EnrichedScopePrice.d.ts.map +1 -1
- package/dist/models/KaminoPosition.d.ts +3 -3
- package/dist/models/KaminoPosition.d.ts.map +1 -1
- package/dist/models/KaminoStrategyWithShareMint.d.ts +5 -4
- package/dist/models/KaminoStrategyWithShareMint.d.ts.map +1 -1
- package/dist/models/LbPairWithAddress.d.ts +3 -3
- package/dist/models/LbPairWithAddress.d.ts.map +1 -1
- package/dist/models/RaydiumPoolWithAddress.d.ts +3 -3
- package/dist/models/RaydiumPoolWithAddress.d.ts.map +1 -1
- package/dist/models/ShareData.d.ts +3 -3
- package/dist/models/ShareData.d.ts.map +1 -1
- package/dist/models/StrategyHolder.d.ts +2 -2
- package/dist/models/StrategyHolder.d.ts.map +1 -1
- package/dist/models/StrategyProgramAddress.d.ts +6 -6
- package/dist/models/StrategyProgramAddress.d.ts.map +1 -1
- package/dist/models/StrategyVaultTokens.d.ts +2 -2
- package/dist/models/StrategyVaultTokens.d.ts.map +1 -1
- package/dist/models/StrategyWithAddress.d.ts +3 -3
- package/dist/models/StrategyWithAddress.d.ts.map +1 -1
- package/dist/models/TreasuryFeeVault.d.ts +4 -4
- package/dist/models/TreasuryFeeVault.d.ts.map +1 -1
- package/dist/models/WhirlpoolWithAddress.d.ts +3 -3
- package/dist/models/WhirlpoolWithAddress.d.ts.map +1 -1
- package/dist/rebalance_methods/autodriftRebalance.d.ts +1 -1
- package/dist/rebalance_methods/autodriftRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/driftRebalance.d.ts +1 -1
- package/dist/rebalance_methods/driftRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/expanderRebalance.d.ts +1 -1
- package/dist/rebalance_methods/expanderRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/periodicRebalance.d.ts +1 -1
- package/dist/rebalance_methods/periodicRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/pricePercentageRebalance.d.ts +1 -1
- package/dist/rebalance_methods/pricePercentageRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/pricePercentageWithResetRebalance.d.ts +1 -1
- package/dist/rebalance_methods/pricePercentageWithResetRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/takeProfitRebalance.d.ts +1 -1
- package/dist/rebalance_methods/takeProfitRebalance.d.ts.map +1 -1
- package/dist/rebalance_methods/utils.d.ts +1 -1
- package/dist/rebalance_methods/utils.d.ts.map +1 -1
- package/dist/rebalance_methods/utils.js +1 -1
- package/dist/rebalance_methods/utils.js.map +1 -1
- package/dist/services/JupService.d.ts +23 -18
- package/dist/services/JupService.d.ts.map +1 -1
- package/dist/services/JupService.js +49 -53
- package/dist/services/JupService.js.map +1 -1
- package/dist/services/MeteoraService.d.ts +13 -13
- package/dist/services/MeteoraService.d.ts.map +1 -1
- package/dist/services/MeteoraService.js +30 -25
- package/dist/services/MeteoraService.js.map +1 -1
- package/dist/services/OrcaService.d.ts +14 -12
- package/dist/services/OrcaService.d.ts.map +1 -1
- package/dist/services/OrcaService.js +28 -24
- package/dist/services/OrcaService.js.map +1 -1
- package/dist/services/PoolSimulationService.d.ts +2 -2
- package/dist/services/PoolSimulationService.d.ts.map +1 -1
- package/dist/services/RaydiumPoolsResponse.d.ts +1 -1
- package/dist/services/RaydiumService.d.ts +12 -10
- package/dist/services/RaydiumService.d.ts.map +1 -1
- package/dist/services/RaydiumService.js +20 -17
- package/dist/services/RaydiumService.js.map +1 -1
- package/dist/utils/CreationParameters.d.ts +3 -3
- package/dist/utils/CreationParameters.d.ts.map +1 -1
- package/dist/utils/CreationParameters.js +4 -4
- package/dist/utils/CreationParameters.js.map +1 -1
- package/dist/utils/compat.d.ts +4 -0
- package/dist/utils/compat.d.ts.map +1 -0
- package/dist/utils/compat.js +8 -0
- package/dist/utils/compat.js.map +1 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/jupiter.d.ts +9 -0
- package/dist/utils/jupiter.d.ts.map +1 -0
- package/dist/utils/jupiter.js +32 -0
- package/dist/utils/jupiter.js.map +1 -0
- package/dist/utils/lookupTable.d.ts +5 -3
- package/dist/utils/lookupTable.d.ts.map +1 -1
- package/dist/utils/lookupTable.js +55 -28
- package/dist/utils/lookupTable.js.map +1 -1
- package/dist/utils/meteora.d.ts +6 -5
- package/dist/utils/meteora.d.ts.map +1 -1
- package/dist/utils/meteora.js +8 -3
- package/dist/utils/meteora.js.map +1 -1
- package/dist/utils/orca.d.ts +3 -2
- package/dist/utils/orca.d.ts.map +1 -1
- package/dist/utils/orca.js +7 -3
- package/dist/utils/orca.js.map +1 -1
- package/dist/utils/tokenUtils.d.ts +11 -16
- package/dist/utils/tokenUtils.d.ts.map +1 -1
- package/dist/utils/tokenUtils.js +38 -87
- package/dist/utils/tokenUtils.js.map +1 -1
- package/dist/utils/transactions.d.ts +8 -9
- package/dist/utils/transactions.d.ts.map +1 -1
- package/dist/utils/transactions.js +36 -47
- package/dist/utils/transactions.js.map +1 -1
- package/dist/utils/types.d.ts +35 -35
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/utils/types.js +2 -2
- package/dist/utils/types.js.map +1 -1
- package/dist/utils/utils.d.ts +6 -8
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +11 -28
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/whirlpools.d.ts +14 -0
- package/dist/utils/whirlpools.d.ts.map +1 -0
- package/dist/utils/whirlpools.js +72 -0
- package/dist/utils/whirlpools.js.map +1 -0
- package/package.json +26 -17
- package/src/@codegen/kliquidity/accounts/CollateralInfos.ts +106 -0
- package/src/@codegen/kliquidity/accounts/GlobalConfig.ts +301 -0
- package/src/@codegen/kliquidity/accounts/PersonalPositionState.ts +226 -0
- package/src/@codegen/kliquidity/accounts/PoolState.ts +480 -0
- package/src/@codegen/kliquidity/accounts/Position.ts +180 -0
- package/src/@codegen/kliquidity/accounts/ProtocolPositionState.ts +212 -0
- package/src/@codegen/kliquidity/accounts/ScopeChainAccount.ts +100 -0
- package/src/@codegen/kliquidity/accounts/TermsSignature.ts +100 -0
- package/src/@codegen/kliquidity/accounts/Whirlpool.ts +253 -0
- package/src/@codegen/kliquidity/accounts/WhirlpoolStrategy.ts +929 -0
- package/src/@codegen/kliquidity/errors/index.ts +68 -0
- package/src/@codegen/kliquidity/instructions/addKaminoRewards.ts +68 -0
- package/src/@codegen/kliquidity/instructions/changePool.ts +51 -0
- package/src/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.ts +56 -0
- package/src/@codegen/kliquidity/instructions/closeProgramAccount.ts +45 -0
- package/src/@codegen/kliquidity/instructions/closeStrategy.ts +115 -0
- package/src/@codegen/kliquidity/instructions/collectFeesAndRewards.ts +105 -0
- package/src/@codegen/kliquidity/instructions/deposit.ts +96 -0
- package/src/@codegen/kliquidity/instructions/depositAndInvest.ts +115 -0
- package/src/@codegen/kliquidity/instructions/emergencySwap.ts +101 -0
- package/src/@codegen/kliquidity/instructions/executiveWithdraw.ts +101 -0
- package/src/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.ts +102 -0
- package/src/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.ts +98 -0
- package/src/@codegen/kliquidity/instructions/index.ts +135 -0
- package/src/@codegen/kliquidity/instructions/initializeCollateralInfo.ts +43 -0
- package/src/@codegen/kliquidity/instructions/initializeGlobalConfig.ts +41 -0
- package/src/@codegen/kliquidity/instructions/initializeKaminoReward.ts +78 -0
- package/src/@codegen/kliquidity/instructions/initializeSharesMetadata.ts +75 -0
- package/src/@codegen/kliquidity/instructions/initializeStrategy.ts +92 -0
- package/src/@codegen/kliquidity/instructions/insertCollateralInfo.ts +60 -0
- package/src/@codegen/kliquidity/instructions/invest.ts +85 -0
- package/src/@codegen/kliquidity/instructions/openLiquidityPosition.ts +129 -0
- package/src/@codegen/kliquidity/instructions/orcaSwap.ts +93 -0
- package/src/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.ts +45 -0
- package/src/@codegen/kliquidity/instructions/signTerms.ts +53 -0
- package/src/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.ts +115 -0
- package/src/@codegen/kliquidity/instructions/singleTokenDepositWithMin.ts +96 -0
- package/src/@codegen/kliquidity/instructions/swapRewards.ts +107 -0
- package/src/@codegen/kliquidity/instructions/updateCollateralInfo.ts +63 -0
- package/src/@codegen/kliquidity/instructions/updateGlobalConfig.ts +63 -0
- package/src/@codegen/kliquidity/instructions/updateRewardMapping.ts +76 -0
- package/src/@codegen/kliquidity/instructions/updateSharesMetadata.ts +71 -0
- package/src/@codegen/kliquidity/instructions/updateStrategyAdmin.ts +39 -0
- package/src/@codegen/kliquidity/instructions/updateStrategyConfig.ts +64 -0
- package/src/@codegen/kliquidity/instructions/updateTreasuryFeeVault.ts +63 -0
- package/src/@codegen/kliquidity/instructions/withdraw.ts +105 -0
- package/src/@codegen/kliquidity/instructions/withdrawFromTopup.ts +55 -0
- package/src/@codegen/kliquidity/instructions/withdrawFromTreasury.ts +67 -0
- package/src/@codegen/kliquidity/programId.ts +9 -0
- package/src/@codegen/kliquidity/types/BalanceStatus.ts +91 -0
- package/src/@codegen/kliquidity/types/BinAddLiquidityStrategy.ts +190 -0
- package/src/@codegen/kliquidity/types/CollateralInfo.ts +185 -0
- package/src/@codegen/kliquidity/types/CollateralInfoParams.ts +167 -0
- package/src/@codegen/kliquidity/types/CollateralTestToken.ts +871 -0
- package/src/@codegen/kliquidity/types/CreationStatus.ts +181 -0
- package/src/@codegen/kliquidity/types/DEX.ts +119 -0
- package/src/@codegen/kliquidity/types/DexSpecificPrice.ts +117 -0
- package/src/@codegen/kliquidity/types/DriftDirection.ts +91 -0
- package/src/@codegen/kliquidity/types/ExecutiveWithdrawAction.ts +121 -0
- package/src/@codegen/kliquidity/types/ExpanderStep.ts +102 -0
- package/src/@codegen/kliquidity/types/GlobalConfigOption.ts +721 -0
- package/src/@codegen/kliquidity/types/KaminoRewardInfo.ts +131 -0
- package/src/@codegen/kliquidity/types/LiquidityCalculationMode.ts +91 -0
- package/src/@codegen/kliquidity/types/MintingMethod.ts +91 -0
- package/src/@codegen/kliquidity/types/PeriodicRebalanceState.ts +54 -0
- package/src/@codegen/kliquidity/types/PositionRewardInfo.ts +65 -0
- package/src/@codegen/kliquidity/types/Price.ts +62 -0
- package/src/@codegen/kliquidity/types/RebalanceAction.ts +167 -0
- package/src/@codegen/kliquidity/types/RebalanceAutodriftParams.ts +123 -0
- package/src/@codegen/kliquidity/types/RebalanceAutodriftState.ts +85 -0
- package/src/@codegen/kliquidity/types/RebalanceAutodriftStep.ts +91 -0
- package/src/@codegen/kliquidity/types/RebalanceAutodriftWindow.ts +107 -0
- package/src/@codegen/kliquidity/types/RebalanceDriftParams.ts +95 -0
- package/src/@codegen/kliquidity/types/RebalanceDriftState.ts +77 -0
- package/src/@codegen/kliquidity/types/RebalanceDriftStep.ts +91 -0
- package/src/@codegen/kliquidity/types/RebalanceEffects.ts +105 -0
- package/src/@codegen/kliquidity/types/RebalanceExpanderState.ts +65 -0
- package/src/@codegen/kliquidity/types/RebalanceManualState.ts +38 -0
- package/src/@codegen/kliquidity/types/RebalancePricePercentageState.ts +70 -0
- package/src/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.ts +78 -0
- package/src/@codegen/kliquidity/types/RebalanceRaw.ts +77 -0
- package/src/@codegen/kliquidity/types/RebalanceTakeProfitState.ts +57 -0
- package/src/@codegen/kliquidity/types/RebalanceTakeProfitStep.ts +121 -0
- package/src/@codegen/kliquidity/types/RebalanceTakeProfitToken.ts +88 -0
- package/src/@codegen/kliquidity/types/RebalanceType.ts +271 -0
- package/src/@codegen/kliquidity/types/ReferencePriceType.ts +91 -0
- package/src/@codegen/kliquidity/types/RemoveLiquidityMode.ts +147 -0
- package/src/@codegen/kliquidity/types/RewardInfo.ts +191 -0
- package/src/@codegen/kliquidity/types/ScopePriceIdTest.ts +2131 -0
- package/src/@codegen/kliquidity/types/SimulationPrice.ts +147 -0
- package/src/@codegen/kliquidity/types/StakingRateSource.ts +91 -0
- package/src/@codegen/kliquidity/types/StrategyConfigOption.ts +1591 -0
- package/src/@codegen/kliquidity/types/StrategyStatus.ts +181 -0
- package/src/@codegen/kliquidity/types/StrategyType.ts +119 -0
- package/src/@codegen/kliquidity/types/SwapLimit.ts +158 -0
- package/src/@codegen/kliquidity/types/UpdateCollateralInfoMode.ts +421 -0
- package/src/@codegen/kliquidity/types/WhirlpoolRewardInfo.ts +119 -0
- package/src/@codegen/kliquidity/types/WithdrawalCapAccumulatorAction.ts +93 -0
- package/src/@codegen/kliquidity/types/WithdrawalCaps.ts +86 -0
- package/src/@codegen/kliquidity/utils/borshAddress.ts +43 -0
- package/src/@codegen/kliquidity/utils/index.ts +1 -0
- package/src/@codegen/meteora/accounts/BinArray.ts +145 -0
- package/src/@codegen/meteora/accounts/BinArrayBitmapExtension.ts +130 -0
- package/src/@codegen/meteora/accounts/LbPair.ts +412 -0
- package/src/@codegen/meteora/accounts/Oracle.ts +125 -0
- package/src/@codegen/meteora/accounts/Position.ts +240 -0
- package/src/@codegen/meteora/accounts/PositionV2.ts +288 -0
- package/src/@codegen/meteora/accounts/PresetParameter.ts +202 -0
- package/src/@codegen/meteora/errors/index.ts +68 -0
- package/src/@codegen/meteora/instructions/addLiquidity.ts +83 -0
- package/src/@codegen/meteora/instructions/addLiquidityByStrategy.ts +83 -0
- package/src/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.ts +75 -0
- package/src/@codegen/meteora/instructions/addLiquidityByWeight.ts +83 -0
- package/src/@codegen/meteora/instructions/addLiquidityOneSide.ts +75 -0
- package/src/@codegen/meteora/instructions/addLiquidityOneSidePrecise.ts +75 -0
- package/src/@codegen/meteora/instructions/claimFee.ts +59 -0
- package/src/@codegen/meteora/instructions/claimReward.ts +67 -0
- package/src/@codegen/meteora/instructions/closePosition.ts +47 -0
- package/src/@codegen/meteora/instructions/closePresetParameter.ts +37 -0
- package/src/@codegen/meteora/instructions/fundReward.ts +71 -0
- package/src/@codegen/meteora/instructions/goToABin.ts +63 -0
- package/src/@codegen/meteora/instructions/increaseOracleLength.ts +55 -0
- package/src/@codegen/meteora/instructions/initializeBinArray.ts +53 -0
- package/src/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.ts +42 -0
- package/src/@codegen/meteora/instructions/initializeLbPair.ts +80 -0
- package/src/@codegen/meteora/instructions/initializePermissionLbPair.ts +77 -0
- package/src/@codegen/meteora/instructions/initializePosition.ts +66 -0
- package/src/@codegen/meteora/instructions/initializePositionByOperator.ts +75 -0
- package/src/@codegen/meteora/instructions/initializePositionPda.ts +69 -0
- package/src/@codegen/meteora/instructions/initializePresetParameter.ts +53 -0
- package/src/@codegen/meteora/instructions/initializeReward.ts +71 -0
- package/src/@codegen/meteora/instructions/migrateBinArray.ts +33 -0
- package/src/@codegen/meteora/instructions/migratePosition.ts +55 -0
- package/src/@codegen/meteora/instructions/removeAllLiquidity.ts +65 -0
- package/src/@codegen/meteora/instructions/removeLiquidity.ts +83 -0
- package/src/@codegen/meteora/instructions/removeLiquidityByRange.ts +87 -0
- package/src/@codegen/meteora/instructions/setActivationSlot.ts +49 -0
- package/src/@codegen/meteora/instructions/setLockReleaseSlot.ts +55 -0
- package/src/@codegen/meteora/instructions/setPreActivationSlotDuration.ts +49 -0
- package/src/@codegen/meteora/instructions/setPreActivationSwapAddress.ts +49 -0
- package/src/@codegen/meteora/instructions/swap.ts +84 -0
- package/src/@codegen/meteora/instructions/togglePairStatus.ts +35 -0
- package/src/@codegen/meteora/instructions/updateFeeOwner.ts +37 -0
- package/src/@codegen/meteora/instructions/updateFeeParameters.ts +53 -0
- package/src/@codegen/meteora/instructions/updateFeesAndRewards.ts +41 -0
- package/src/@codegen/meteora/instructions/updatePositionOperator.ts +53 -0
- package/src/@codegen/meteora/instructions/updateRewardDuration.ts +60 -0
- package/src/@codegen/meteora/instructions/updateRewardFunder.ts +58 -0
- package/src/@codegen/meteora/instructions/updateWhitelistedWallet.ts +49 -0
- package/src/@codegen/meteora/instructions/withdrawIneligibleReward.ts +63 -0
- package/src/@codegen/meteora/instructions/withdrawProtocolFee.ts +65 -0
- package/src/@codegen/meteora/programId.ts +9 -0
- package/src/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.ts +80 -0
- package/src/@codegen/meteora/types/Bin.ts +162 -0
- package/src/@codegen/meteora/types/BinLiquidityDistribution.ts +86 -0
- package/src/@codegen/meteora/types/BinLiquidityDistributionByWeight.ts +70 -0
- package/src/@codegen/meteora/types/BinLiquidityReduction.ts +65 -0
- package/src/@codegen/meteora/types/CompressedBinDepositAmount.ts +64 -0
- package/src/@codegen/meteora/types/FeeInfo.ts +86 -0
- package/src/@codegen/meteora/types/FeeParameter.ts +71 -0
- package/src/@codegen/meteora/types/InitPermissionPairIx.ts +104 -0
- package/src/@codegen/meteora/types/InitPresetParametersIx.ts +170 -0
- package/src/@codegen/meteora/types/LayoutVersion.ts +88 -0
- package/src/@codegen/meteora/types/LiquidityOneSideParameter.ts +113 -0
- package/src/@codegen/meteora/types/LiquidityParameter.ts +96 -0
- package/src/@codegen/meteora/types/LiquidityParameterByStrategy.ts +120 -0
- package/src/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.ts +108 -0
- package/src/@codegen/meteora/types/LiquidityParameterByWeight.ts +125 -0
- package/src/@codegen/meteora/types/Observation.ts +86 -0
- package/src/@codegen/meteora/types/PairStatus.ts +89 -0
- package/src/@codegen/meteora/types/PairType.ts +89 -0
- package/src/@codegen/meteora/types/ProtocolFee.ts +62 -0
- package/src/@codegen/meteora/types/RewardInfo.ts +153 -0
- package/src/@codegen/meteora/types/Rounding.ts +86 -0
- package/src/@codegen/meteora/types/StaticParameters.ts +171 -0
- package/src/@codegen/meteora/types/StrategyParameters.ts +98 -0
- package/src/@codegen/meteora/types/StrategyType.ts +299 -0
- package/src/@codegen/meteora/types/UserRewardInfo.ts +72 -0
- package/src/@codegen/meteora/types/VariableParameters.ts +132 -0
- package/src/@codegen/meteora/utils/borshAddress.ts +43 -0
- package/src/@codegen/meteora/utils/index.ts +1 -0
- package/src/@codegen/raydium/accounts/AmmConfig.ts +172 -0
- package/src/@codegen/raydium/accounts/ObservationState.ts +132 -0
- package/src/@codegen/raydium/accounts/OperationState.ts +116 -0
- package/src/@codegen/raydium/accounts/PersonalPositionState.ts +196 -0
- package/src/@codegen/raydium/accounts/PoolState.ts +396 -0
- package/src/@codegen/raydium/accounts/ProtocolPositionState.ts +182 -0
- package/src/@codegen/raydium/accounts/TickArrayBitmapExtension.ts +124 -0
- package/src/@codegen/raydium/accounts/TickArrayState.ts +136 -0
- package/src/@codegen/raydium/errors/index.ts +68 -0
- package/src/@codegen/raydium/instructions/closePosition.ts +43 -0
- package/src/@codegen/raydium/instructions/collectFundFee.ts +72 -0
- package/src/@codegen/raydium/instructions/collectProtocolFee.ts +72 -0
- package/src/@codegen/raydium/instructions/collectRemainingRewards.ts +65 -0
- package/src/@codegen/raydium/instructions/createAmmConfig.ts +65 -0
- package/src/@codegen/raydium/instructions/createOperationAccount.ts +37 -0
- package/src/@codegen/raydium/instructions/createPool.ts +80 -0
- package/src/@codegen/raydium/instructions/decreaseLiquidity.ts +77 -0
- package/src/@codegen/raydium/instructions/decreaseLiquidityV2.ts +85 -0
- package/src/@codegen/raydium/instructions/increaseLiquidity.ts +77 -0
- package/src/@codegen/raydium/instructions/increaseLiquidityV2.ts +86 -0
- package/src/@codegen/raydium/instructions/initializeReward.ts +71 -0
- package/src/@codegen/raydium/instructions/openPosition.ts +107 -0
- package/src/@codegen/raydium/instructions/openPositionV2.ts +119 -0
- package/src/@codegen/raydium/instructions/setRewardParams.ts +72 -0
- package/src/@codegen/raydium/instructions/swap.ts +76 -0
- package/src/@codegen/raydium/instructions/swapRouterBaseIn.ts +62 -0
- package/src/@codegen/raydium/instructions/swapV2.ts +82 -0
- package/src/@codegen/raydium/instructions/transferRewardOwner.ts +53 -0
- package/src/@codegen/raydium/instructions/updateAmmConfig.ts +51 -0
- package/src/@codegen/raydium/instructions/updateOperationAccount.ts +56 -0
- package/src/@codegen/raydium/instructions/updatePoolStatus.ts +53 -0
- package/src/@codegen/raydium/instructions/updateRewardInfos.ts +33 -0
- package/src/@codegen/raydium/programId.ts +9 -0
- package/src/@codegen/raydium/types/InitializeRewardParam.ts +77 -0
- package/src/@codegen/raydium/types/Observation.ts +86 -0
- package/src/@codegen/raydium/types/PoolStatusBitFlag.ts +91 -0
- package/src/@codegen/raydium/types/PoolStatusBitIndex.ts +181 -0
- package/src/@codegen/raydium/types/PositionRewardInfo.ts +65 -0
- package/src/@codegen/raydium/types/RewardInfo.ts +149 -0
- package/src/@codegen/raydium/types/RewardState.ts +149 -0
- package/src/@codegen/raydium/types/TickState.ts +117 -0
- package/src/@codegen/raydium/utils/borshAddress.ts +43 -0
- package/src/@codegen/raydium/utils/index.ts +1 -0
- package/src/@codegen/whirlpools/accounts/FeeTier.ts +116 -0
- package/src/@codegen/whirlpools/accounts/Position.ts +180 -0
- package/src/@codegen/whirlpools/accounts/PositionBundle.ts +108 -0
- package/src/@codegen/whirlpools/accounts/TickArray.ts +120 -0
- package/src/@codegen/whirlpools/accounts/TokenBadge.ts +108 -0
- package/src/@codegen/whirlpools/accounts/Whirlpool.ts +252 -0
- package/src/@codegen/whirlpools/accounts/WhirlpoolsConfig.ts +124 -0
- package/src/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.ts +118 -0
- package/src/@codegen/whirlpools/errors/index.ts +68 -0
- package/src/@codegen/whirlpools/instructions/closeBundledPosition.ts +59 -0
- package/src/@codegen/whirlpools/instructions/closePosition.ts +47 -0
- package/src/@codegen/whirlpools/instructions/collectFees.ts +53 -0
- package/src/@codegen/whirlpools/instructions/collectFeesV2.ts +82 -0
- package/src/@codegen/whirlpools/instructions/collectProtocolFees.ts +51 -0
- package/src/@codegen/whirlpools/instructions/collectProtocolFeesV2.ts +80 -0
- package/src/@codegen/whirlpools/instructions/collectReward.ts +63 -0
- package/src/@codegen/whirlpools/instructions/collectRewardV2.ts +77 -0
- package/src/@codegen/whirlpools/instructions/decreaseLiquidity.ts +79 -0
- package/src/@codegen/whirlpools/instructions/decreaseLiquidityV2.ts +95 -0
- package/src/@codegen/whirlpools/instructions/deletePositionBundle.ts +47 -0
- package/src/@codegen/whirlpools/instructions/deleteTokenBadge.ts +47 -0
- package/src/@codegen/whirlpools/instructions/increaseLiquidity.ts +79 -0
- package/src/@codegen/whirlpools/instructions/increaseLiquidityV2.ts +95 -0
- package/src/@codegen/whirlpools/instructions/initializeConfig.ts +62 -0
- package/src/@codegen/whirlpools/instructions/initializeConfigExtension.ts +45 -0
- package/src/@codegen/whirlpools/instructions/initializeFeeTier.ts +64 -0
- package/src/@codegen/whirlpools/instructions/initializePool.ts +83 -0
- package/src/@codegen/whirlpools/instructions/initializePoolV2.ts +86 -0
- package/src/@codegen/whirlpools/instructions/initializePositionBundle.ts +53 -0
- package/src/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.ts +59 -0
- package/src/@codegen/whirlpools/instructions/initializeReward.ts +69 -0
- package/src/@codegen/whirlpools/instructions/initializeRewardV2.ts +71 -0
- package/src/@codegen/whirlpools/instructions/initializeTickArray.ts +53 -0
- package/src/@codegen/whirlpools/instructions/initializeTokenBadge.ts +49 -0
- package/src/@codegen/whirlpools/instructions/openBundledPosition.ts +73 -0
- package/src/@codegen/whirlpools/instructions/openPosition.ts +77 -0
- package/src/@codegen/whirlpools/instructions/openPositionWithMetadata.ts +83 -0
- package/src/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.ts +41 -0
- package/src/@codegen/whirlpools/instructions/setConfigExtensionAuthority.ts +43 -0
- package/src/@codegen/whirlpools/instructions/setDefaultFeeRate.ts +55 -0
- package/src/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.ts +53 -0
- package/src/@codegen/whirlpools/instructions/setFeeAuthority.ts +41 -0
- package/src/@codegen/whirlpools/instructions/setFeeRate.ts +55 -0
- package/src/@codegen/whirlpools/instructions/setProtocolFeeRate.ts +55 -0
- package/src/@codegen/whirlpools/instructions/setRewardAuthority.ts +55 -0
- package/src/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.ts +57 -0
- package/src/@codegen/whirlpools/instructions/setRewardEmissions.ts +60 -0
- package/src/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.ts +41 -0
- package/src/@codegen/whirlpools/instructions/setRewardEmissionsV2.ts +60 -0
- package/src/@codegen/whirlpools/instructions/setTokenBadgeAuthority.ts +43 -0
- package/src/@codegen/whirlpools/instructions/swap.ts +85 -0
- package/src/@codegen/whirlpools/instructions/swapV2.ts +101 -0
- package/src/@codegen/whirlpools/instructions/twoHopSwap.ts +109 -0
- package/src/@codegen/whirlpools/instructions/twoHopSwapV2.ts +125 -0
- package/src/@codegen/whirlpools/instructions/updateFeesAndRewards.ts +39 -0
- package/src/@codegen/whirlpools/programId.ts +9 -0
- package/src/@codegen/whirlpools/types/AccountsType.ts +209 -0
- package/src/@codegen/whirlpools/types/CurrIndex.ts +119 -0
- package/src/@codegen/whirlpools/types/Direction.ts +89 -0
- package/src/@codegen/whirlpools/types/OpenPositionBumps.ts +54 -0
- package/src/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.ts +67 -0
- package/src/@codegen/whirlpools/types/PositionRewardInfo.ts +65 -0
- package/src/@codegen/whirlpools/types/RemainingAccountsInfo.ts +67 -0
- package/src/@codegen/whirlpools/types/RemainingAccountsSlice.ts +65 -0
- package/src/@codegen/whirlpools/types/Tick.ts +108 -0
- package/src/@codegen/whirlpools/types/TickLabel.ts +89 -0
- package/src/@codegen/whirlpools/types/WhirlpoolBumps.ts +54 -0
- package/src/@codegen/whirlpools/types/WhirlpoolRewardInfo.ts +95 -0
- package/src/@codegen/whirlpools/utils/borshAddress.ts +43 -0
- package/src/@codegen/whirlpools/utils/index.ts +1 -0
- package/src/Kamino.ts +1791 -1714
- package/src/constants/deposit_method.ts +1 -1
- package/src/constants/metadata.ts +3 -3
- package/src/constants/pubkeys.ts +10 -10
- package/src/models/EnrichedScopePrice.ts +2 -2
- package/src/models/KaminoPosition.ts +3 -3
- package/src/models/KaminoStrategyWithShareMint.ts +6 -4
- package/src/models/LbPairWithAddress.ts +3 -3
- package/src/models/RaydiumPoolWithAddress.ts +3 -3
- package/src/models/ShareData.ts +3 -3
- package/src/models/StrategyHolder.ts +2 -2
- package/src/models/StrategyProgramAddress.ts +6 -6
- package/src/models/StrategyVaultTokens.ts +2 -2
- package/src/models/StrategyWithAddress.ts +3 -3
- package/src/models/TreasuryFeeVault.ts +4 -4
- package/src/models/WhirlpoolWithAddress.ts +3 -3
- package/src/rebalance_methods/autodriftRebalance.ts +1 -1
- package/src/rebalance_methods/driftRebalance.ts +1 -1
- package/src/rebalance_methods/expanderRebalance.ts +1 -1
- package/src/rebalance_methods/periodicRebalance.ts +1 -1
- package/src/rebalance_methods/pricePercentageRebalance.ts +1 -1
- package/src/rebalance_methods/pricePercentageWithResetRebalance.ts +1 -1
- package/src/rebalance_methods/takeProfitRebalance.ts +1 -1
- package/src/rebalance_methods/utils.ts +2 -2
- package/src/services/JupService.ts +69 -82
- package/src/services/MeteoraService.ts +42 -37
- package/src/services/OrcaService.ts +47 -36
- package/src/services/PoolSimulationService.ts +2 -2
- package/src/services/RaydiumPoolsResponse.ts +1 -1
- package/src/services/RaydiumService.ts +34 -29
- package/src/utils/CreationParameters.ts +4 -4
- package/src/utils/compat.ts +6 -0
- package/src/utils/index.ts +0 -2
- package/src/utils/jupiter.ts +30 -0
- package/src/utils/lookupTable.ts +69 -42
- package/src/utils/meteora.ts +13 -6
- package/src/utils/orca.ts +12 -9
- package/src/utils/tokenUtils.ts +67 -129
- package/src/utils/transactions.ts +83 -79
- package/src/utils/types.ts +39 -39
- package/src/utils/utils.ts +18 -31
- package/src/utils/whirlpools.ts +119 -0
- package/dist/kamino-client/accounts/CollateralInfos.d.ts +0 -20
- package/dist/kamino-client/accounts/CollateralInfos.d.ts.map +0 -1
- package/dist/kamino-client/accounts/CollateralInfos.js +0 -94
- package/dist/kamino-client/accounts/CollateralInfos.js.map +0 -1
- package/dist/kamino-client/accounts/GlobalConfig.d.ts +0 -89
- package/dist/kamino-client/accounts/GlobalConfig.d.ts.map +0 -1
- package/dist/kamino-client/accounts/GlobalConfig.js +0 -239
- package/dist/kamino-client/accounts/GlobalConfig.js.map +0 -1
- package/dist/kamino-client/accounts/PersonalPositionState.d.ts +0 -84
- package/dist/kamino-client/accounts/PersonalPositionState.d.ts.map +0 -1
- package/dist/kamino-client/accounts/PersonalPositionState.js +0 -175
- package/dist/kamino-client/accounts/PersonalPositionState.js.map +0 -1
- package/dist/kamino-client/accounts/PoolState.d.ts +0 -213
- package/dist/kamino-client/accounts/PoolState.d.ts.map +0 -1
- package/dist/kamino-client/accounts/PoolState.js +0 -343
- package/dist/kamino-client/accounts/PoolState.js.map +0 -1
- package/dist/kamino-client/accounts/Position.d.ts +0 -48
- package/dist/kamino-client/accounts/Position.d.ts.map +0 -1
- package/dist/kamino-client/accounts/Position.js +0 -153
- package/dist/kamino-client/accounts/Position.js.map +0 -1
- package/dist/kamino-client/accounts/ProtocolPositionState.d.ts +0 -80
- package/dist/kamino-client/accounts/ProtocolPositionState.d.ts.map +0 -1
- package/dist/kamino-client/accounts/ProtocolPositionState.js +0 -168
- package/dist/kamino-client/accounts/ProtocolPositionState.js.map +0 -1
- package/dist/kamino-client/accounts/ScopeChainAccount.d.ts +0 -19
- package/dist/kamino-client/accounts/ScopeChainAccount.d.ts.map +0 -1
- package/dist/kamino-client/accounts/ScopeChainAccount.js +0 -93
- package/dist/kamino-client/accounts/ScopeChainAccount.js.map +0 -1
- package/dist/kamino-client/accounts/TermsSignature.d.ts +0 -19
- package/dist/kamino-client/accounts/TermsSignature.d.ts.map +0 -1
- package/dist/kamino-client/accounts/TermsSignature.js +0 -93
- package/dist/kamino-client/accounts/TermsSignature.js.map +0 -1
- package/dist/kamino-client/accounts/Whirlpool.d.ts +0 -76
- package/dist/kamino-client/accounts/Whirlpool.d.ts.map +0 -1
- package/dist/kamino-client/accounts/Whirlpool.js +0 -208
- package/dist/kamino-client/accounts/Whirlpool.js.map +0 -1
- package/dist/kamino-client/accounts/WhirlpoolStrategy.d.ts +0 -321
- package/dist/kamino-client/accounts/WhirlpoolStrategy.d.ts.map +0 -1
- package/dist/kamino-client/accounts/WhirlpoolStrategy.js +0 -703
- package/dist/kamino-client/accounts/WhirlpoolStrategy.js.map +0 -1
- package/dist/kamino-client/accounts/index.d.ts.map +0 -1
- package/dist/kamino-client/accounts/index.js.map +0 -1
- package/dist/kamino-client/errors/anchor.d.ts.map +0 -1
- package/dist/kamino-client/errors/anchor.js.map +0 -1
- package/dist/kamino-client/errors/custom.d.ts.map +0 -1
- package/dist/kamino-client/errors/custom.js.map +0 -1
- package/dist/kamino-client/errors/index.d.ts +0 -6
- package/dist/kamino-client/errors/index.d.ts.map +0 -1
- package/dist/kamino-client/errors/index.js +0 -80
- package/dist/kamino-client/errors/index.js.map +0 -1
- package/dist/kamino-client/idl.json +0 -7038
- package/dist/kamino-client/instructions/addKaminoRewards.d.ts +0 -18
- package/dist/kamino-client/instructions/addKaminoRewards.d.ts.map +0 -1
- package/dist/kamino-client/instructions/addKaminoRewards.js +0 -65
- package/dist/kamino-client/instructions/addKaminoRewards.js.map +0 -1
- package/dist/kamino-client/instructions/changePool.d.ts +0 -13
- package/dist/kamino-client/instructions/changePool.d.ts.map +0 -1
- package/dist/kamino-client/instructions/changePool.js +0 -34
- package/dist/kamino-client/instructions/changePool.js.map +0 -1
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.d.ts +0 -14
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.d.ts.map +0 -1
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.js +0 -61
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.js.map +0 -1
- package/dist/kamino-client/instructions/closeProgramAccount.d.ts +0 -10
- package/dist/kamino-client/instructions/closeProgramAccount.d.ts.map +0 -1
- package/dist/kamino-client/instructions/closeProgramAccount.js +0 -19
- package/dist/kamino-client/instructions/closeProgramAccount.js.map +0 -1
- package/dist/kamino-client/instructions/closeStrategy.d.ts +0 -50
- package/dist/kamino-client/instructions/closeStrategy.d.ts.map +0 -1
- package/dist/kamino-client/instructions/closeStrategy.js +0 -79
- package/dist/kamino-client/instructions/closeStrategy.js.map +0 -1
- package/dist/kamino-client/instructions/collectFeesAndRewards.d.ts +0 -44
- package/dist/kamino-client/instructions/collectFeesAndRewards.d.ts.map +0 -1
- package/dist/kamino-client/instructions/collectFeesAndRewards.js +0 -71
- package/dist/kamino-client/instructions/collectFeesAndRewards.js.map +0 -1
- package/dist/kamino-client/instructions/deposit.d.ts +0 -34
- package/dist/kamino-client/instructions/deposit.d.ts.map +0 -1
- package/dist/kamino-client/instructions/deposit.js +0 -89
- package/dist/kamino-client/instructions/deposit.js.map +0 -1
- package/dist/kamino-client/instructions/depositAndInvest.d.ts +0 -43
- package/dist/kamino-client/instructions/depositAndInvest.d.ts.map +0 -1
- package/dist/kamino-client/instructions/depositAndInvest.js +0 -105
- package/dist/kamino-client/instructions/depositAndInvest.js.map +0 -1
- package/dist/kamino-client/instructions/emergencySwap.d.ts +0 -36
- package/dist/kamino-client/instructions/emergencySwap.d.ts.map +0 -1
- package/dist/kamino-client/instructions/emergencySwap.js +0 -80
- package/dist/kamino-client/instructions/emergencySwap.js.map +0 -1
- package/dist/kamino-client/instructions/executiveWithdraw.d.ts +0 -34
- package/dist/kamino-client/instructions/executiveWithdraw.d.ts.map +0 -1
- package/dist/kamino-client/instructions/executiveWithdraw.js +0 -87
- package/dist/kamino-client/instructions/executiveWithdraw.js.map +0 -1
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.d.ts +0 -41
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.d.ts.map +0 -1
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.js +0 -93
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.js.map +0 -1
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.d.ts +0 -42
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.d.ts.map +0 -1
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.js +0 -90
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.js.map +0 -1
- package/dist/kamino-client/instructions/index.d.ts +0 -75
- package/dist/kamino-client/instructions/index.d.ts.map +0 -1
- package/dist/kamino-client/instructions/index.js +0 -78
- package/dist/kamino-client/instructions/index.js.map +0 -1
- package/dist/kamino-client/instructions/initializeCollateralInfo.d.ts +0 -9
- package/dist/kamino-client/instructions/initializeCollateralInfo.d.ts.map +0 -1
- package/dist/kamino-client/instructions/initializeCollateralInfo.js +0 -18
- package/dist/kamino-client/instructions/initializeCollateralInfo.js.map +0 -1
- package/dist/kamino-client/instructions/initializeGlobalConfig.d.ts +0 -8
- package/dist/kamino-client/instructions/initializeGlobalConfig.d.ts.map +0 -1
- package/dist/kamino-client/instructions/initializeGlobalConfig.js +0 -17
- package/dist/kamino-client/instructions/initializeGlobalConfig.js.map +0 -1
- package/dist/kamino-client/instructions/initializeKaminoReward.d.ts +0 -21
- package/dist/kamino-client/instructions/initializeKaminoReward.d.ts.map +0 -1
- package/dist/kamino-client/instructions/initializeKaminoReward.js +0 -68
- package/dist/kamino-client/instructions/initializeKaminoReward.js.map +0 -1
- package/dist/kamino-client/instructions/initializeSharesMetadata.d.ts +0 -20
- package/dist/kamino-client/instructions/initializeSharesMetadata.d.ts.map +0 -1
- package/dist/kamino-client/instructions/initializeSharesMetadata.js +0 -73
- package/dist/kamino-client/instructions/initializeSharesMetadata.js.map +0 -1
- package/dist/kamino-client/instructions/initializeStrategy.d.ts +0 -30
- package/dist/kamino-client/instructions/initializeStrategy.d.ts.map +0 -1
- package/dist/kamino-client/instructions/initializeStrategy.js +0 -77
- package/dist/kamino-client/instructions/initializeStrategy.js.map +0 -1
- package/dist/kamino-client/instructions/insertCollateralInfo.d.ts +0 -15
- package/dist/kamino-client/instructions/insertCollateralInfo.d.ts.map +0 -1
- package/dist/kamino-client/instructions/insertCollateralInfo.js +0 -62
- package/dist/kamino-client/instructions/insertCollateralInfo.js.map +0 -1
- package/dist/kamino-client/instructions/invest.d.ts +0 -31
- package/dist/kamino-client/instructions/invest.d.ts.map +0 -1
- package/dist/kamino-client/instructions/invest.js +0 -52
- package/dist/kamino-client/instructions/invest.js.map +0 -1
- package/dist/kamino-client/instructions/openLiquidityPosition.d.ts +0 -47
- package/dist/kamino-client/instructions/openLiquidityPosition.d.ts.map +0 -1
- package/dist/kamino-client/instructions/openLiquidityPosition.js +0 -127
- package/dist/kamino-client/instructions/openLiquidityPosition.js.map +0 -1
- package/dist/kamino-client/instructions/orcaSwap.d.ts +0 -31
- package/dist/kamino-client/instructions/orcaSwap.d.ts.map +0 -1
- package/dist/kamino-client/instructions/orcaSwap.js +0 -81
- package/dist/kamino-client/instructions/orcaSwap.js.map +0 -1
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.d.ts +0 -12
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.d.ts.map +0 -1
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.js +0 -25
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.js.map +0 -1
- package/dist/kamino-client/instructions/signTerms.d.ts +0 -13
- package/dist/kamino-client/instructions/signTerms.d.ts.map +0 -1
- package/dist/kamino-client/instructions/signTerms.js +0 -58
- package/dist/kamino-client/instructions/signTerms.js.map +0 -1
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.d.ts +0 -43
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.d.ts.map +0 -1
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.js +0 -105
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.js.map +0 -1
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.d.ts +0 -34
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.d.ts.map +0 -1
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.js +0 -89
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.js.map +0 -1
- package/dist/kamino-client/instructions/swapRewards.d.ts +0 -38
- package/dist/kamino-client/instructions/swapRewards.d.ts.map +0 -1
- package/dist/kamino-client/instructions/swapRewards.js +0 -108
- package/dist/kamino-client/instructions/swapRewards.js.map +0 -1
- package/dist/kamino-client/instructions/swapUnevenVaults.d.ts +0 -43
- package/dist/kamino-client/instructions/swapUnevenVaults.d.ts.map +0 -1
- package/dist/kamino-client/instructions/swapUnevenVaults.js +0 -92
- package/dist/kamino-client/instructions/swapUnevenVaults.js.map +0 -1
- package/dist/kamino-client/instructions/updateCollateralInfo.d.ts +0 -15
- package/dist/kamino-client/instructions/updateCollateralInfo.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateCollateralInfo.js +0 -63
- package/dist/kamino-client/instructions/updateCollateralInfo.js.map +0 -1
- package/dist/kamino-client/instructions/updateGlobalConfig.d.ts +0 -14
- package/dist/kamino-client/instructions/updateGlobalConfig.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateGlobalConfig.js +0 -63
- package/dist/kamino-client/instructions/updateGlobalConfig.js.map +0 -1
- package/dist/kamino-client/instructions/updateRewardMapping.d.ts +0 -21
- package/dist/kamino-client/instructions/updateRewardMapping.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateRewardMapping.js +0 -69
- package/dist/kamino-client/instructions/updateRewardMapping.js.map +0 -1
- package/dist/kamino-client/instructions/updateSharesMetadata.d.ts +0 -18
- package/dist/kamino-client/instructions/updateSharesMetadata.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateSharesMetadata.js +0 -71
- package/dist/kamino-client/instructions/updateSharesMetadata.js.map +0 -1
- package/dist/kamino-client/instructions/updateStrategyAdmin.d.ts +0 -7
- package/dist/kamino-client/instructions/updateStrategyAdmin.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateStrategyAdmin.js +0 -16
- package/dist/kamino-client/instructions/updateStrategyAdmin.js.map +0 -1
- package/dist/kamino-client/instructions/updateStrategyConfig.d.ts +0 -15
- package/dist/kamino-client/instructions/updateStrategyConfig.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateStrategyConfig.js +0 -63
- package/dist/kamino-client/instructions/updateStrategyConfig.js.map +0 -1
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.d.ts +0 -18
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.d.ts.map +0 -1
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.js +0 -67
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.js.map +0 -1
- package/dist/kamino-client/instructions/withdraw.d.ts +0 -39
- package/dist/kamino-client/instructions/withdraw.d.ts.map +0 -1
- package/dist/kamino-client/instructions/withdraw.js +0 -99
- package/dist/kamino-client/instructions/withdraw.js.map +0 -1
- package/dist/kamino-client/instructions/withdrawFromTopup.d.ts +0 -13
- package/dist/kamino-client/instructions/withdrawFromTopup.d.ts.map +0 -1
- package/dist/kamino-client/instructions/withdrawFromTopup.js +0 -57
- package/dist/kamino-client/instructions/withdrawFromTopup.js.map +0 -1
- package/dist/kamino-client/instructions/withdrawFromTreasury.d.ts +0 -19
- package/dist/kamino-client/instructions/withdrawFromTreasury.d.ts.map +0 -1
- package/dist/kamino-client/instructions/withdrawFromTreasury.js +0 -67
- package/dist/kamino-client/instructions/withdrawFromTreasury.js.map +0 -1
- package/dist/kamino-client/programId.d.ts +0 -5
- package/dist/kamino-client/programId.d.ts.map +0 -1
- package/dist/kamino-client/programId.js +0 -13
- package/dist/kamino-client/programId.js.map +0 -1
- package/dist/kamino-client/types/BalanceStatus.d.ts.map +0 -1
- package/dist/kamino-client/types/BalanceStatus.js.map +0 -1
- package/dist/kamino-client/types/BinAddLiquidityStrategy.d.ts.map +0 -1
- package/dist/kamino-client/types/BinAddLiquidityStrategy.js.map +0 -1
- package/dist/kamino-client/types/CollateralInfo.d.ts +0 -94
- package/dist/kamino-client/types/CollateralInfo.d.ts.map +0 -1
- package/dist/kamino-client/types/CollateralInfo.js +0 -177
- package/dist/kamino-client/types/CollateralInfo.js.map +0 -1
- package/dist/kamino-client/types/CollateralInfoParams.d.ts +0 -84
- package/dist/kamino-client/types/CollateralInfoParams.d.ts.map +0 -1
- package/dist/kamino-client/types/CollateralInfoParams.js +0 -163
- package/dist/kamino-client/types/CollateralInfoParams.js.map +0 -1
- package/dist/kamino-client/types/CollateralTestToken.d.ts.map +0 -1
- package/dist/kamino-client/types/CollateralTestToken.js.map +0 -1
- package/dist/kamino-client/types/CreationStatus.d.ts.map +0 -1
- package/dist/kamino-client/types/CreationStatus.js.map +0 -1
- package/dist/kamino-client/types/DEX.d.ts.map +0 -1
- package/dist/kamino-client/types/DEX.js.map +0 -1
- package/dist/kamino-client/types/DexSpecificPrice.d.ts.map +0 -1
- package/dist/kamino-client/types/DexSpecificPrice.js.map +0 -1
- package/dist/kamino-client/types/DriftDirection.d.ts.map +0 -1
- package/dist/kamino-client/types/DriftDirection.js.map +0 -1
- package/dist/kamino-client/types/ExecutiveWithdrawAction.d.ts.map +0 -1
- package/dist/kamino-client/types/ExecutiveWithdrawAction.js.map +0 -1
- package/dist/kamino-client/types/ExpanderStep.d.ts.map +0 -1
- package/dist/kamino-client/types/ExpanderStep.js.map +0 -1
- package/dist/kamino-client/types/GlobalConfigOption.d.ts.map +0 -1
- package/dist/kamino-client/types/GlobalConfigOption.js.map +0 -1
- package/dist/kamino-client/types/KaminoRewardInfo.d.ts +0 -64
- package/dist/kamino-client/types/KaminoRewardInfo.d.ts.map +0 -1
- package/dist/kamino-client/types/KaminoRewardInfo.js +0 -135
- package/dist/kamino-client/types/KaminoRewardInfo.js.map +0 -1
- package/dist/kamino-client/types/LiquidityCalculationMode.d.ts.map +0 -1
- package/dist/kamino-client/types/LiquidityCalculationMode.js.map +0 -1
- package/dist/kamino-client/types/MintingMethod.d.ts.map +0 -1
- package/dist/kamino-client/types/MintingMethod.js.map +0 -1
- package/dist/kamino-client/types/PeriodicRebalanceState.d.ts +0 -23
- package/dist/kamino-client/types/PeriodicRebalanceState.d.ts.map +0 -1
- package/dist/kamino-client/types/PeriodicRebalanceState.js.map +0 -1
- package/dist/kamino-client/types/PositionRewardInfo.d.ts +0 -28
- package/dist/kamino-client/types/PositionRewardInfo.d.ts.map +0 -1
- package/dist/kamino-client/types/PositionRewardInfo.js.map +0 -1
- package/dist/kamino-client/types/Price.d.ts +0 -28
- package/dist/kamino-client/types/Price.d.ts.map +0 -1
- package/dist/kamino-client/types/Price.js.map +0 -1
- package/dist/kamino-client/types/RebalanceAction.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceAction.js.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftParams.d.ts +0 -76
- package/dist/kamino-client/types/RebalanceAutodriftParams.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftParams.js.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftState.d.ts +0 -89
- package/dist/kamino-client/types/RebalanceAutodriftState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftState.js.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftStep.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftStep.js.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftWindow.d.ts +0 -55
- package/dist/kamino-client/types/RebalanceAutodriftWindow.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceAutodriftWindow.js.map +0 -1
- package/dist/kamino-client/types/RebalanceDriftParams.d.ts +0 -51
- package/dist/kamino-client/types/RebalanceDriftParams.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceDriftParams.js.map +0 -1
- package/dist/kamino-client/types/RebalanceDriftState.d.ts +0 -41
- package/dist/kamino-client/types/RebalanceDriftState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceDriftState.js.map +0 -1
- package/dist/kamino-client/types/RebalanceDriftStep.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceDriftStep.js.map +0 -1
- package/dist/kamino-client/types/RebalanceEffects.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceEffects.js.map +0 -1
- package/dist/kamino-client/types/RebalanceExpanderState.d.ts +0 -28
- package/dist/kamino-client/types/RebalanceExpanderState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceExpanderState.js.map +0 -1
- package/dist/kamino-client/types/RebalanceManualState.d.ts +0 -15
- package/dist/kamino-client/types/RebalanceManualState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceManualState.js.map +0 -1
- package/dist/kamino-client/types/RebalancePricePercentageState.d.ts +0 -28
- package/dist/kamino-client/types/RebalancePricePercentageState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalancePricePercentageState.js.map +0 -1
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.d.ts +0 -28
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.js.map +0 -1
- package/dist/kamino-client/types/RebalanceRaw.d.ts +0 -32
- package/dist/kamino-client/types/RebalanceRaw.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceRaw.js.map +0 -1
- package/dist/kamino-client/types/RebalanceTakeProfitState.d.ts +0 -34
- package/dist/kamino-client/types/RebalanceTakeProfitState.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceTakeProfitState.js.map +0 -1
- package/dist/kamino-client/types/RebalanceTakeProfitStep.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceTakeProfitStep.js.map +0 -1
- package/dist/kamino-client/types/RebalanceTakeProfitToken.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceTakeProfitToken.js.map +0 -1
- package/dist/kamino-client/types/RebalanceType.d.ts.map +0 -1
- package/dist/kamino-client/types/RebalanceType.js.map +0 -1
- package/dist/kamino-client/types/ReferencePriceType.d.ts.map +0 -1
- package/dist/kamino-client/types/ReferencePriceType.js.map +0 -1
- package/dist/kamino-client/types/RemoveLiquidityMode.d.ts.map +0 -1
- package/dist/kamino-client/types/RemoveLiquidityMode.js.map +0 -1
- package/dist/kamino-client/types/RewardInfo.d.ts +0 -116
- package/dist/kamino-client/types/RewardInfo.d.ts.map +0 -1
- package/dist/kamino-client/types/RewardInfo.js +0 -163
- package/dist/kamino-client/types/RewardInfo.js.map +0 -1
- package/dist/kamino-client/types/ScopeConversionChain.d.ts +0 -1
- package/dist/kamino-client/types/ScopeConversionChain.d.ts.map +0 -1
- package/dist/kamino-client/types/ScopeConversionChain.js +0 -2
- package/dist/kamino-client/types/ScopeConversionChain.js.map +0 -1
- package/dist/kamino-client/types/ScopePriceIdTest.d.ts.map +0 -1
- package/dist/kamino-client/types/ScopePriceIdTest.js.map +0 -1
- package/dist/kamino-client/types/SimulationPrice.d.ts.map +0 -1
- package/dist/kamino-client/types/SimulationPrice.js.map +0 -1
- package/dist/kamino-client/types/StakingRateSource.d.ts.map +0 -1
- package/dist/kamino-client/types/StakingRateSource.js.map +0 -1
- package/dist/kamino-client/types/StrategyConfigOption.d.ts.map +0 -1
- package/dist/kamino-client/types/StrategyConfigOption.js.map +0 -1
- package/dist/kamino-client/types/StrategyStatus.d.ts.map +0 -1
- package/dist/kamino-client/types/StrategyStatus.js.map +0 -1
- package/dist/kamino-client/types/StrategyType.d.ts.map +0 -1
- package/dist/kamino-client/types/StrategyType.js.map +0 -1
- package/dist/kamino-client/types/SwapLimit.d.ts.map +0 -1
- package/dist/kamino-client/types/SwapLimit.js.map +0 -1
- package/dist/kamino-client/types/UpdateCollateralInfoMode.d.ts.map +0 -1
- package/dist/kamino-client/types/UpdateCollateralInfoMode.js.map +0 -1
- package/dist/kamino-client/types/WhirlpoolRewardInfo.d.ts +0 -68
- package/dist/kamino-client/types/WhirlpoolRewardInfo.d.ts.map +0 -1
- package/dist/kamino-client/types/WhirlpoolRewardInfo.js +0 -115
- package/dist/kamino-client/types/WhirlpoolRewardInfo.js.map +0 -1
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.d.ts.map +0 -1
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.js.map +0 -1
- package/dist/kamino-client/types/WithdrawalCaps.d.ts +0 -38
- package/dist/kamino-client/types/WithdrawalCaps.d.ts.map +0 -1
- package/dist/kamino-client/types/WithdrawalCaps.js.map +0 -1
- package/dist/kamino-client/types/index.d.ts.map +0 -1
- package/dist/kamino-client/types/index.js.map +0 -1
- package/dist/meteora_client/accounts/BinArray.d.ts +0 -42
- package/dist/meteora_client/accounts/BinArray.d.ts.map +0 -1
- package/dist/meteora_client/accounts/BinArray.js +0 -130
- package/dist/meteora_client/accounts/BinArray.js.map +0 -1
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.d.ts +0 -32
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.d.ts.map +0 -1
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.js +0 -112
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.js.map +0 -1
- package/dist/meteora_client/accounts/LbPair.d.ts +0 -180
- package/dist/meteora_client/accounts/LbPair.d.ts.map +0 -1
- package/dist/meteora_client/accounts/LbPair.js +0 -297
- package/dist/meteora_client/accounts/LbPair.js.map +0 -1
- package/dist/meteora_client/accounts/Oracle.d.ts +0 -35
- package/dist/meteora_client/accounts/Oracle.d.ts.map +0 -1
- package/dist/meteora_client/accounts/Oracle.js +0 -112
- package/dist/meteora_client/accounts/Oracle.js.map +0 -1
- package/dist/meteora_client/accounts/Position.d.ts +0 -90
- package/dist/meteora_client/accounts/Position.d.ts.map +0 -1
- package/dist/meteora_client/accounts/Position.js +0 -177
- package/dist/meteora_client/accounts/Position.js.map +0 -1
- package/dist/meteora_client/accounts/PositionV2.d.ts +0 -114
- package/dist/meteora_client/accounts/PositionV2.d.ts.map +0 -1
- package/dist/meteora_client/accounts/PositionV2.js +0 -206
- package/dist/meteora_client/accounts/PositionV2.js.map +0 -1
- package/dist/meteora_client/accounts/PresetParameter.d.ts +0 -76
- package/dist/meteora_client/accounts/PresetParameter.d.ts.map +0 -1
- package/dist/meteora_client/accounts/PresetParameter.js +0 -157
- package/dist/meteora_client/accounts/PresetParameter.js.map +0 -1
- package/dist/meteora_client/accounts/index.d.ts.map +0 -1
- package/dist/meteora_client/accounts/index.js.map +0 -1
- package/dist/meteora_client/errors/anchor.d.ts.map +0 -1
- package/dist/meteora_client/errors/anchor.js.map +0 -1
- package/dist/meteora_client/errors/custom.d.ts.map +0 -1
- package/dist/meteora_client/errors/custom.js.map +0 -1
- package/dist/meteora_client/errors/index.d.ts +0 -6
- package/dist/meteora_client/errors/index.d.ts.map +0 -1
- package/dist/meteora_client/errors/index.js +0 -80
- package/dist/meteora_client/errors/index.js.map +0 -1
- package/dist/meteora_client/instructions/addLiquidity.d.ts +0 -26
- package/dist/meteora_client/instructions/addLiquidity.d.ts.map +0 -1
- package/dist/meteora_client/instructions/addLiquidity.js +0 -77
- package/dist/meteora_client/instructions/addLiquidity.js.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityByStrategy.d.ts +0 -26
- package/dist/meteora_client/instructions/addLiquidityByStrategy.d.ts.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityByStrategy.js +0 -77
- package/dist/meteora_client/instructions/addLiquidityByStrategy.js.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.d.ts +0 -22
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.d.ts.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.js +0 -73
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.js.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityByWeight.d.ts +0 -26
- package/dist/meteora_client/instructions/addLiquidityByWeight.d.ts.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityByWeight.js +0 -77
- package/dist/meteora_client/instructions/addLiquidityByWeight.js.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityOneSide.d.ts +0 -22
- package/dist/meteora_client/instructions/addLiquidityOneSide.d.ts.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityOneSide.js +0 -73
- package/dist/meteora_client/instructions/addLiquidityOneSide.js.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.d.ts +0 -22
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.d.ts.map +0 -1
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.js +0 -73
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.js.map +0 -1
- package/dist/meteora_client/instructions/claimFee.d.ts +0 -19
- package/dist/meteora_client/instructions/claimFee.d.ts.map +0 -1
- package/dist/meteora_client/instructions/claimFee.js +0 -28
- package/dist/meteora_client/instructions/claimFee.js.map +0 -1
- package/dist/meteora_client/instructions/claimReward.d.ts +0 -21
- package/dist/meteora_client/instructions/claimReward.d.ts.map +0 -1
- package/dist/meteora_client/instructions/claimReward.js +0 -65
- package/dist/meteora_client/instructions/claimReward.js.map +0 -1
- package/dist/meteora_client/instructions/closePosition.d.ts +0 -13
- package/dist/meteora_client/instructions/closePosition.d.ts.map +0 -1
- package/dist/meteora_client/instructions/closePosition.js +0 -22
- package/dist/meteora_client/instructions/closePosition.js.map +0 -1
- package/dist/meteora_client/instructions/closePresetParameter.d.ts +0 -8
- package/dist/meteora_client/instructions/closePresetParameter.d.ts.map +0 -1
- package/dist/meteora_client/instructions/closePresetParameter.js +0 -17
- package/dist/meteora_client/instructions/closePresetParameter.js.map +0 -1
- package/dist/meteora_client/instructions/fundReward.d.ts +0 -21
- package/dist/meteora_client/instructions/fundReward.d.ts.map +0 -1
- package/dist/meteora_client/instructions/fundReward.js +0 -69
- package/dist/meteora_client/instructions/fundReward.js.map +0 -1
- package/dist/meteora_client/instructions/goToABin.d.ts +0 -15
- package/dist/meteora_client/instructions/goToABin.d.ts.map +0 -1
- package/dist/meteora_client/instructions/goToABin.js +0 -64
- package/dist/meteora_client/instructions/goToABin.js.map +0 -1
- package/dist/meteora_client/instructions/increaseOracleLength.d.ts +0 -15
- package/dist/meteora_client/instructions/increaseOracleLength.d.ts.map +0 -1
- package/dist/meteora_client/instructions/increaseOracleLength.js +0 -59
- package/dist/meteora_client/instructions/increaseOracleLength.js.map +0 -1
- package/dist/meteora_client/instructions/index.d.ts.map +0 -1
- package/dist/meteora_client/instructions/index.js.map +0 -1
- package/dist/meteora_client/instructions/initializeBinArray.d.ts +0 -14
- package/dist/meteora_client/instructions/initializeBinArray.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializeBinArray.js +0 -58
- package/dist/meteora_client/instructions/initializeBinArray.js.map +0 -1
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.d.ts +0 -11
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.js +0 -23
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.js.map +0 -1
- package/dist/meteora_client/instructions/initializeLbPair.d.ts +0 -24
- package/dist/meteora_client/instructions/initializeLbPair.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializeLbPair.js +0 -76
- package/dist/meteora_client/instructions/initializeLbPair.js.map +0 -1
- package/dist/meteora_client/instructions/initializePermissionLbPair.d.ts +0 -24
- package/dist/meteora_client/instructions/initializePermissionLbPair.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializePermissionLbPair.js +0 -75
- package/dist/meteora_client/instructions/initializePermissionLbPair.js.map +0 -1
- package/dist/meteora_client/instructions/initializePosition.d.ts +0 -18
- package/dist/meteora_client/instructions/initializePosition.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializePosition.js +0 -66
- package/dist/meteora_client/instructions/initializePosition.js.map +0 -1
- package/dist/meteora_client/instructions/initializePositionByOperator.d.ts +0 -22
- package/dist/meteora_client/instructions/initializePositionByOperator.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializePositionByOperator.js +0 -71
- package/dist/meteora_client/instructions/initializePositionByOperator.js.map +0 -1
- package/dist/meteora_client/instructions/initializePositionPda.d.ts +0 -20
- package/dist/meteora_client/instructions/initializePositionPda.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializePositionPda.js +0 -67
- package/dist/meteora_client/instructions/initializePositionPda.js.map +0 -1
- package/dist/meteora_client/instructions/initializePresetParameter.d.ts +0 -14
- package/dist/meteora_client/instructions/initializePresetParameter.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializePresetParameter.js +0 -59
- package/dist/meteora_client/instructions/initializePresetParameter.js.map +0 -1
- package/dist/meteora_client/instructions/initializeReward.d.ts +0 -21
- package/dist/meteora_client/instructions/initializeReward.d.ts.map +0 -1
- package/dist/meteora_client/instructions/initializeReward.js +0 -69
- package/dist/meteora_client/instructions/initializeReward.js.map +0 -1
- package/dist/meteora_client/instructions/migrateBinArray.d.ts +0 -6
- package/dist/meteora_client/instructions/migrateBinArray.d.ts.map +0 -1
- package/dist/meteora_client/instructions/migrateBinArray.js +0 -15
- package/dist/meteora_client/instructions/migrateBinArray.js.map +0 -1
- package/dist/meteora_client/instructions/migratePosition.d.ts +0 -15
- package/dist/meteora_client/instructions/migratePosition.d.ts.map +0 -1
- package/dist/meteora_client/instructions/migratePosition.js +0 -24
- package/dist/meteora_client/instructions/migratePosition.js.map +0 -1
- package/dist/meteora_client/instructions/removeAllLiquidity.d.ts +0 -21
- package/dist/meteora_client/instructions/removeAllLiquidity.d.ts.map +0 -1
- package/dist/meteora_client/instructions/removeAllLiquidity.js +0 -34
- package/dist/meteora_client/instructions/removeAllLiquidity.js.map +0 -1
- package/dist/meteora_client/instructions/removeLiquidity.d.ts +0 -26
- package/dist/meteora_client/instructions/removeLiquidity.d.ts.map +0 -1
- package/dist/meteora_client/instructions/removeLiquidity.js +0 -77
- package/dist/meteora_client/instructions/removeLiquidity.js.map +0 -1
- package/dist/meteora_client/instructions/removeLiquidityByRange.d.ts +0 -27
- package/dist/meteora_client/instructions/removeLiquidityByRange.d.ts.map +0 -1
- package/dist/meteora_client/instructions/removeLiquidityByRange.js +0 -80
- package/dist/meteora_client/instructions/removeLiquidityByRange.js.map +0 -1
- package/dist/meteora_client/instructions/setActivationSlot.d.ts +0 -12
- package/dist/meteora_client/instructions/setActivationSlot.d.ts.map +0 -1
- package/dist/meteora_client/instructions/setActivationSlot.js +0 -56
- package/dist/meteora_client/instructions/setActivationSlot.js.map +0 -1
- package/dist/meteora_client/instructions/setLockReleaseSlot.d.ts +0 -15
- package/dist/meteora_client/instructions/setLockReleaseSlot.d.ts.map +0 -1
- package/dist/meteora_client/instructions/setLockReleaseSlot.js +0 -59
- package/dist/meteora_client/instructions/setLockReleaseSlot.js.map +0 -1
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.d.ts +0 -11
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.d.ts.map +0 -1
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.js +0 -56
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.js.map +0 -1
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.d.ts +0 -11
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.d.ts.map +0 -1
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.js +0 -58
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.js.map +0 -1
- package/dist/meteora_client/instructions/swap.d.ts +0 -26
- package/dist/meteora_client/instructions/swap.d.ts.map +0 -1
- package/dist/meteora_client/instructions/swap.js +0 -77
- package/dist/meteora_client/instructions/swap.js.map +0 -1
- package/dist/meteora_client/instructions/togglePairStatus.d.ts +0 -7
- package/dist/meteora_client/instructions/togglePairStatus.d.ts.map +0 -1
- package/dist/meteora_client/instructions/togglePairStatus.js +0 -16
- package/dist/meteora_client/instructions/togglePairStatus.js.map +0 -1
- package/dist/meteora_client/instructions/updateFeeOwner.d.ts +0 -8
- package/dist/meteora_client/instructions/updateFeeOwner.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updateFeeOwner.js +0 -17
- package/dist/meteora_client/instructions/updateFeeOwner.js.map +0 -1
- package/dist/meteora_client/instructions/updateFeeParameters.d.ts +0 -14
- package/dist/meteora_client/instructions/updateFeeParameters.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updateFeeParameters.js +0 -59
- package/dist/meteora_client/instructions/updateFeeParameters.js.map +0 -1
- package/dist/meteora_client/instructions/updateFeesAndRewards.d.ts +0 -10
- package/dist/meteora_client/instructions/updateFeesAndRewards.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updateFeesAndRewards.js +0 -19
- package/dist/meteora_client/instructions/updateFeesAndRewards.js.map +0 -1
- package/dist/meteora_client/instructions/updatePositionOperator.d.ts +0 -13
- package/dist/meteora_client/instructions/updatePositionOperator.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updatePositionOperator.js +0 -58
- package/dist/meteora_client/instructions/updatePositionOperator.js.map +0 -1
- package/dist/meteora_client/instructions/updateRewardDuration.d.ts +0 -16
- package/dist/meteora_client/instructions/updateRewardDuration.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updateRewardDuration.js +0 -63
- package/dist/meteora_client/instructions/updateRewardDuration.js.map +0 -1
- package/dist/meteora_client/instructions/updateRewardFunder.d.ts +0 -15
- package/dist/meteora_client/instructions/updateRewardFunder.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updateRewardFunder.js +0 -62
- package/dist/meteora_client/instructions/updateRewardFunder.js.map +0 -1
- package/dist/meteora_client/instructions/updateWhitelistedWallet.d.ts +0 -11
- package/dist/meteora_client/instructions/updateWhitelistedWallet.d.ts.map +0 -1
- package/dist/meteora_client/instructions/updateWhitelistedWallet.js +0 -56
- package/dist/meteora_client/instructions/updateWhitelistedWallet.js.map +0 -1
- package/dist/meteora_client/instructions/withdrawIneligibleReward.d.ts +0 -19
- package/dist/meteora_client/instructions/withdrawIneligibleReward.d.ts.map +0 -1
- package/dist/meteora_client/instructions/withdrawIneligibleReward.js +0 -63
- package/dist/meteora_client/instructions/withdrawIneligibleReward.js.map +0 -1
- package/dist/meteora_client/instructions/withdrawProtocolFee.d.ts +0 -20
- package/dist/meteora_client/instructions/withdrawProtocolFee.d.ts.map +0 -1
- package/dist/meteora_client/instructions/withdrawProtocolFee.js +0 -64
- package/dist/meteora_client/instructions/withdrawProtocolFee.js.map +0 -1
- package/dist/meteora_client/programId.d.ts +0 -6
- package/dist/meteora_client/programId.d.ts.map +0 -1
- package/dist/meteora_client/programId.js +0 -15
- package/dist/meteora_client/programId.js.map +0 -1
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.d.ts +0 -34
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.d.ts.map +0 -1
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.js.map +0 -1
- package/dist/meteora_client/types/Bin.d.ts +0 -90
- package/dist/meteora_client/types/Bin.d.ts.map +0 -1
- package/dist/meteora_client/types/Bin.js.map +0 -1
- package/dist/meteora_client/types/BinLiquidityDistribution.d.ts +0 -41
- package/dist/meteora_client/types/BinLiquidityDistribution.d.ts.map +0 -1
- package/dist/meteora_client/types/BinLiquidityDistribution.js.map +0 -1
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.d.ts +0 -33
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.d.ts.map +0 -1
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.js.map +0 -1
- package/dist/meteora_client/types/BinLiquidityReduction.d.ts +0 -27
- package/dist/meteora_client/types/BinLiquidityReduction.d.ts.map +0 -1
- package/dist/meteora_client/types/BinLiquidityReduction.js.map +0 -1
- package/dist/meteora_client/types/CompressedBinDepositAmount.d.ts +0 -27
- package/dist/meteora_client/types/CompressedBinDepositAmount.d.ts.map +0 -1
- package/dist/meteora_client/types/CompressedBinDepositAmount.js.map +0 -1
- package/dist/meteora_client/types/FeeInfo.d.ts +0 -38
- package/dist/meteora_client/types/FeeInfo.d.ts.map +0 -1
- package/dist/meteora_client/types/FeeInfo.js.map +0 -1
- package/dist/meteora_client/types/FeeParameter.d.ts +0 -33
- package/dist/meteora_client/types/FeeParameter.d.ts.map +0 -1
- package/dist/meteora_client/types/FeeParameter.js.map +0 -1
- package/dist/meteora_client/types/InitPermissionPairIx.d.ts +0 -48
- package/dist/meteora_client/types/InitPermissionPairIx.d.ts.map +0 -1
- package/dist/meteora_client/types/InitPermissionPairIx.js.map +0 -1
- package/dist/meteora_client/types/InitPresetParametersIx.d.ts +0 -97
- package/dist/meteora_client/types/InitPresetParametersIx.d.ts.map +0 -1
- package/dist/meteora_client/types/InitPresetParametersIx.js.map +0 -1
- package/dist/meteora_client/types/LayoutVersion.d.ts.map +0 -1
- package/dist/meteora_client/types/LayoutVersion.js.map +0 -1
- package/dist/meteora_client/types/LiquidityOneSideParameter.d.ts +0 -56
- package/dist/meteora_client/types/LiquidityOneSideParameter.d.ts.map +0 -1
- package/dist/meteora_client/types/LiquidityOneSideParameter.js.map +0 -1
- package/dist/meteora_client/types/LiquidityParameter.d.ts +0 -50
- package/dist/meteora_client/types/LiquidityParameter.d.ts.map +0 -1
- package/dist/meteora_client/types/LiquidityParameter.js.map +0 -1
- package/dist/meteora_client/types/LiquidityParameterByStrategy.d.ts +0 -104
- package/dist/meteora_client/types/LiquidityParameterByStrategy.d.ts.map +0 -1
- package/dist/meteora_client/types/LiquidityParameterByStrategy.js.map +0 -1
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.d.ts +0 -96
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.d.ts.map +0 -1
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.js.map +0 -1
- package/dist/meteora_client/types/LiquidityParameterByWeight.d.ts +0 -64
- package/dist/meteora_client/types/LiquidityParameterByWeight.d.ts.map +0 -1
- package/dist/meteora_client/types/LiquidityParameterByWeight.js.map +0 -1
- package/dist/meteora_client/types/Observation.d.ts +0 -42
- package/dist/meteora_client/types/Observation.d.ts.map +0 -1
- package/dist/meteora_client/types/Observation.js.map +0 -1
- package/dist/meteora_client/types/PairStatus.d.ts.map +0 -1
- package/dist/meteora_client/types/PairStatus.js.map +0 -1
- package/dist/meteora_client/types/PairType.d.ts.map +0 -1
- package/dist/meteora_client/types/PairType.js.map +0 -1
- package/dist/meteora_client/types/ProtocolFee.d.ts +0 -28
- package/dist/meteora_client/types/ProtocolFee.d.ts.map +0 -1
- package/dist/meteora_client/types/ProtocolFee.js.map +0 -1
- package/dist/meteora_client/types/RewardInfo.d.ts +0 -84
- package/dist/meteora_client/types/RewardInfo.d.ts.map +0 -1
- package/dist/meteora_client/types/RewardInfo.js +0 -138
- package/dist/meteora_client/types/RewardInfo.js.map +0 -1
- package/dist/meteora_client/types/Rounding.d.ts.map +0 -1
- package/dist/meteora_client/types/Rounding.js.map +0 -1
- package/dist/meteora_client/types/StaticParameters.d.ts +0 -98
- package/dist/meteora_client/types/StaticParameters.d.ts.map +0 -1
- package/dist/meteora_client/types/StaticParameters.js.map +0 -1
- package/dist/meteora_client/types/StrategyParameters.d.ts +0 -85
- package/dist/meteora_client/types/StrategyParameters.d.ts.map +0 -1
- package/dist/meteora_client/types/StrategyParameters.js.map +0 -1
- package/dist/meteora_client/types/StrategyType.d.ts.map +0 -1
- package/dist/meteora_client/types/StrategyType.js.map +0 -1
- package/dist/meteora_client/types/UserRewardInfo.d.ts +0 -28
- package/dist/meteora_client/types/UserRewardInfo.d.ts.map +0 -1
- package/dist/meteora_client/types/UserRewardInfo.js.map +0 -1
- package/dist/meteora_client/types/VariableParameters.d.ts +0 -76
- package/dist/meteora_client/types/VariableParameters.d.ts.map +0 -1
- package/dist/meteora_client/types/VariableParameters.js.map +0 -1
- package/dist/meteora_client/types/index.d.ts.map +0 -1
- package/dist/meteora_client/types/index.js.map +0 -1
- package/dist/raydium_client/accounts/AmmConfig.d.ts +0 -47
- package/dist/raydium_client/accounts/AmmConfig.d.ts.map +0 -1
- package/dist/raydium_client/accounts/AmmConfig.js +0 -152
- package/dist/raydium_client/accounts/AmmConfig.js.map +0 -1
- package/dist/raydium_client/accounts/ObservationState.d.ts +0 -30
- package/dist/raydium_client/accounts/ObservationState.d.ts.map +0 -1
- package/dist/raydium_client/accounts/ObservationState.js +0 -117
- package/dist/raydium_client/accounts/ObservationState.js.map +0 -1
- package/dist/raydium_client/accounts/OperationState.d.ts +0 -25
- package/dist/raydium_client/accounts/OperationState.d.ts.map +0 -1
- package/dist/raydium_client/accounts/OperationState.js +0 -106
- package/dist/raydium_client/accounts/OperationState.js.map +0 -1
- package/dist/raydium_client/accounts/PersonalPositionState.d.ts +0 -54
- package/dist/raydium_client/accounts/PersonalPositionState.d.ts.map +0 -1
- package/dist/raydium_client/accounts/PersonalPositionState.js +0 -165
- package/dist/raydium_client/accounts/PersonalPositionState.js.map +0 -1
- package/dist/raydium_client/accounts/PoolState.d.ts +0 -129
- package/dist/raydium_client/accounts/PoolState.d.ts.map +0 -1
- package/dist/raydium_client/accounts/PoolState.js +0 -315
- package/dist/raydium_client/accounts/PoolState.js.map +0 -1
- package/dist/raydium_client/accounts/ProtocolPositionState.d.ts +0 -50
- package/dist/raydium_client/accounts/ProtocolPositionState.d.ts.map +0 -1
- package/dist/raydium_client/accounts/ProtocolPositionState.js +0 -158
- package/dist/raydium_client/accounts/ProtocolPositionState.js.map +0 -1
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.d.ts +0 -26
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.d.ts.map +0 -1
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.js +0 -110
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.js.map +0 -1
- package/dist/raydium_client/accounts/TickArrayState.d.ts +0 -32
- package/dist/raydium_client/accounts/TickArrayState.d.ts.map +0 -1
- package/dist/raydium_client/accounts/TickArrayState.js +0 -119
- package/dist/raydium_client/accounts/TickArrayState.js.map +0 -1
- package/dist/raydium_client/accounts/index.d.ts.map +0 -1
- package/dist/raydium_client/accounts/index.js.map +0 -1
- package/dist/raydium_client/errors/anchor.d.ts.map +0 -1
- package/dist/raydium_client/errors/anchor.js.map +0 -1
- package/dist/raydium_client/errors/custom.d.ts.map +0 -1
- package/dist/raydium_client/errors/custom.js.map +0 -1
- package/dist/raydium_client/errors/index.d.ts +0 -6
- package/dist/raydium_client/errors/index.d.ts.map +0 -1
- package/dist/raydium_client/errors/index.js +0 -80
- package/dist/raydium_client/errors/index.js.map +0 -1
- package/dist/raydium_client/index.d.ts +0 -5
- package/dist/raydium_client/index.d.ts.map +0 -1
- package/dist/raydium_client/index.js +0 -21
- package/dist/raydium_client/index.js.map +0 -1
- package/dist/raydium_client/instructions/closePosition.d.ts +0 -11
- package/dist/raydium_client/instructions/closePosition.d.ts.map +0 -1
- package/dist/raydium_client/instructions/closePosition.js +0 -20
- package/dist/raydium_client/instructions/closePosition.js.map +0 -1
- package/dist/raydium_client/instructions/collectFundFee.d.ts +0 -22
- package/dist/raydium_client/instructions/collectFundFee.d.ts.map +0 -1
- package/dist/raydium_client/instructions/collectFundFee.js +0 -77
- package/dist/raydium_client/instructions/collectFundFee.js.map +0 -1
- package/dist/raydium_client/instructions/collectProtocolFee.d.ts +0 -22
- package/dist/raydium_client/instructions/collectProtocolFee.d.ts.map +0 -1
- package/dist/raydium_client/instructions/collectProtocolFee.js +0 -77
- package/dist/raydium_client/instructions/collectProtocolFee.js.map +0 -1
- package/dist/raydium_client/instructions/collectRemainingRewards.d.ts +0 -17
- package/dist/raydium_client/instructions/collectRemainingRewards.d.ts.map +0 -1
- package/dist/raydium_client/instructions/collectRemainingRewards.js +0 -62
- package/dist/raydium_client/instructions/collectRemainingRewards.js.map +0 -1
- package/dist/raydium_client/instructions/createAmmConfig.d.ts +0 -16
- package/dist/raydium_client/instructions/createAmmConfig.d.ts.map +0 -1
- package/dist/raydium_client/instructions/createAmmConfig.js +0 -67
- package/dist/raydium_client/instructions/createAmmConfig.js.map +0 -1
- package/dist/raydium_client/instructions/createOperationAccount.d.ts +0 -8
- package/dist/raydium_client/instructions/createOperationAccount.d.ts.map +0 -1
- package/dist/raydium_client/instructions/createOperationAccount.js +0 -17
- package/dist/raydium_client/instructions/createOperationAccount.js.map +0 -1
- package/dist/raydium_client/instructions/createPool.d.ts +0 -24
- package/dist/raydium_client/instructions/createPool.d.ts.map +0 -1
- package/dist/raydium_client/instructions/createPool.js +0 -71
- package/dist/raydium_client/instructions/createPool.js.map +0 -1
- package/dist/raydium_client/instructions/decreaseLiquidity.d.ts +0 -24
- package/dist/raydium_client/instructions/decreaseLiquidity.d.ts.map +0 -1
- package/dist/raydium_client/instructions/decreaseLiquidity.js +0 -80
- package/dist/raydium_client/instructions/decreaseLiquidity.js.map +0 -1
- package/dist/raydium_client/instructions/decreaseLiquidityV2.d.ts +0 -28
- package/dist/raydium_client/instructions/decreaseLiquidityV2.d.ts.map +0 -1
- package/dist/raydium_client/instructions/decreaseLiquidityV2.js +0 -84
- package/dist/raydium_client/instructions/decreaseLiquidityV2.js.map +0 -1
- package/dist/raydium_client/instructions/increaseLiquidity.d.ts +0 -24
- package/dist/raydium_client/instructions/increaseLiquidity.d.ts.map +0 -1
- package/dist/raydium_client/instructions/increaseLiquidity.js +0 -72
- package/dist/raydium_client/instructions/increaseLiquidity.js.map +0 -1
- package/dist/raydium_client/instructions/increaseLiquidityV2.d.ts +0 -28
- package/dist/raydium_client/instructions/increaseLiquidityV2.d.ts.map +0 -1
- package/dist/raydium_client/instructions/increaseLiquidityV2.js +0 -77
- package/dist/raydium_client/instructions/increaseLiquidityV2.js.map +0 -1
- package/dist/raydium_client/instructions/index.d.ts.map +0 -1
- package/dist/raydium_client/instructions/index.js.map +0 -1
- package/dist/raydium_client/instructions/initializeReward.d.ts +0 -20
- package/dist/raydium_client/instructions/initializeReward.d.ts.map +0 -1
- package/dist/raydium_client/instructions/initializeReward.js +0 -67
- package/dist/raydium_client/instructions/initializeReward.js.map +0 -1
- package/dist/raydium_client/instructions/openPosition.d.ts +0 -35
- package/dist/raydium_client/instructions/openPosition.d.ts.map +0 -1
- package/dist/raydium_client/instructions/openPosition.js +0 -91
- package/dist/raydium_client/instructions/openPosition.js.map +0 -1
- package/dist/raydium_client/instructions/openPositionV2.d.ts +0 -40
- package/dist/raydium_client/instructions/openPositionV2.d.ts.map +0 -1
- package/dist/raydium_client/instructions/openPositionV2.js +0 -98
- package/dist/raydium_client/instructions/openPositionV2.js.map +0 -1
- package/dist/raydium_client/instructions/setRewardParams.d.ts +0 -19
- package/dist/raydium_client/instructions/setRewardParams.d.ts.map +0 -1
- package/dist/raydium_client/instructions/setRewardParams.js +0 -68
- package/dist/raydium_client/instructions/setRewardParams.js.map +0 -1
- package/dist/raydium_client/instructions/swap.d.ts +0 -23
- package/dist/raydium_client/instructions/swap.d.ts.map +0 -1
- package/dist/raydium_client/instructions/swap.js +0 -72
- package/dist/raydium_client/instructions/swap.js.map +0 -1
- package/dist/raydium_client/instructions/swapRouterBaseIn.d.ts +0 -17
- package/dist/raydium_client/instructions/swapRouterBaseIn.d.ts.map +0 -1
- package/dist/raydium_client/instructions/swapRouterBaseIn.js +0 -64
- package/dist/raydium_client/instructions/swapRouterBaseIn.js.map +0 -1
- package/dist/raydium_client/instructions/swapV2.d.ts +0 -26
- package/dist/raydium_client/instructions/swapV2.d.ts.map +0 -1
- package/dist/raydium_client/instructions/swapV2.js +0 -75
- package/dist/raydium_client/instructions/swapV2.js.map +0 -1
- package/dist/raydium_client/instructions/transferRewardOwner.d.ts +0 -11
- package/dist/raydium_client/instructions/transferRewardOwner.d.ts.map +0 -1
- package/dist/raydium_client/instructions/transferRewardOwner.js +0 -56
- package/dist/raydium_client/instructions/transferRewardOwner.js.map +0 -1
- package/dist/raydium_client/instructions/updateAmmConfig.d.ts +0 -12
- package/dist/raydium_client/instructions/updateAmmConfig.d.ts.map +0 -1
- package/dist/raydium_client/instructions/updateAmmConfig.js +0 -57
- package/dist/raydium_client/instructions/updateAmmConfig.js.map +0 -1
- package/dist/raydium_client/instructions/updateOperationAccount.d.ts +0 -13
- package/dist/raydium_client/instructions/updateOperationAccount.d.ts.map +0 -1
- package/dist/raydium_client/instructions/updateOperationAccount.js +0 -61
- package/dist/raydium_client/instructions/updateOperationAccount.js.map +0 -1
- package/dist/raydium_client/instructions/updatePoolStatus.d.ts +0 -11
- package/dist/raydium_client/instructions/updatePoolStatus.d.ts.map +0 -1
- package/dist/raydium_client/instructions/updatePoolStatus.js +0 -56
- package/dist/raydium_client/instructions/updatePoolStatus.js.map +0 -1
- package/dist/raydium_client/instructions/updateRewardInfos.d.ts +0 -6
- package/dist/raydium_client/instructions/updateRewardInfos.d.ts.map +0 -1
- package/dist/raydium_client/instructions/updateRewardInfos.js +0 -15
- package/dist/raydium_client/instructions/updateRewardInfos.js.map +0 -1
- package/dist/raydium_client/programId.d.ts +0 -6
- package/dist/raydium_client/programId.d.ts.map +0 -1
- package/dist/raydium_client/programId.js +0 -15
- package/dist/raydium_client/programId.js.map +0 -1
- package/dist/raydium_client/types/InitializeRewardParam.d.ts +0 -33
- package/dist/raydium_client/types/InitializeRewardParam.d.ts.map +0 -1
- package/dist/raydium_client/types/InitializeRewardParam.js.map +0 -1
- package/dist/raydium_client/types/Observation.d.ts +0 -38
- package/dist/raydium_client/types/Observation.d.ts.map +0 -1
- package/dist/raydium_client/types/Observation.js.map +0 -1
- package/dist/raydium_client/types/PoolStatusBitFlag.d.ts.map +0 -1
- package/dist/raydium_client/types/PoolStatusBitFlag.js.map +0 -1
- package/dist/raydium_client/types/PoolStatusBitIndex.d.ts.map +0 -1
- package/dist/raydium_client/types/PoolStatusBitIndex.js.map +0 -1
- package/dist/raydium_client/types/PositionRewardInfo.d.ts +0 -28
- package/dist/raydium_client/types/PositionRewardInfo.d.ts.map +0 -1
- package/dist/raydium_client/types/PositionRewardInfo.js.map +0 -1
- package/dist/raydium_client/types/RewardInfo.d.ts +0 -74
- package/dist/raydium_client/types/RewardInfo.d.ts.map +0 -1
- package/dist/raydium_client/types/RewardInfo.js +0 -149
- package/dist/raydium_client/types/RewardInfo.js.map +0 -1
- package/dist/raydium_client/types/RewardState.d.ts.map +0 -1
- package/dist/raydium_client/types/RewardState.js.map +0 -1
- package/dist/raydium_client/types/TickArryBitmap.d.ts +0 -1
- package/dist/raydium_client/types/TickArryBitmap.d.ts.map +0 -1
- package/dist/raydium_client/types/TickArryBitmap.js +0 -2
- package/dist/raydium_client/types/TickArryBitmap.js.map +0 -1
- package/dist/raydium_client/types/TickState.d.ts +0 -53
- package/dist/raydium_client/types/TickState.d.ts.map +0 -1
- package/dist/raydium_client/types/TickState.js.map +0 -1
- package/dist/raydium_client/types/index.d.ts.map +0 -1
- package/dist/raydium_client/types/index.js.map +0 -1
- package/dist/utils/anchorUtils.d.ts +0 -6
- package/dist/utils/anchorUtils.d.ts.map +0 -1
- package/dist/utils/anchorUtils.js +0 -18
- package/dist/utils/anchorUtils.js.map +0 -1
- package/dist/utils/instructions.d.ts +0 -7
- package/dist/utils/instructions.d.ts.map +0 -1
- package/dist/utils/instructions.js +0 -40
- package/dist/utils/instructions.js.map +0 -1
- package/dist/utils/pubkey.d.ts +0 -66
- package/dist/utils/pubkey.d.ts.map +0 -1
- package/dist/utils/pubkey.js +0 -216
- package/dist/utils/pubkey.js.map +0 -1
- package/dist/whirlpools-client/accounts/FeeTier.d.ts +0 -25
- package/dist/whirlpools-client/accounts/FeeTier.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/FeeTier.js +0 -106
- package/dist/whirlpools-client/accounts/FeeTier.js.map +0 -1
- package/dist/whirlpools-client/accounts/Position.d.ts +0 -48
- package/dist/whirlpools-client/accounts/Position.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/Position.js +0 -153
- package/dist/whirlpools-client/accounts/Position.js.map +0 -1
- package/dist/whirlpools-client/accounts/PositionBundle.d.ts +0 -22
- package/dist/whirlpools-client/accounts/PositionBundle.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/PositionBundle.js +0 -100
- package/dist/whirlpools-client/accounts/PositionBundle.js.map +0 -1
- package/dist/whirlpools-client/accounts/TickArray.d.ts +0 -26
- package/dist/whirlpools-client/accounts/TickArray.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/TickArray.js +0 -107
- package/dist/whirlpools-client/accounts/TickArray.js.map +0 -1
- package/dist/whirlpools-client/accounts/TokenBadge.d.ts +0 -22
- package/dist/whirlpools-client/accounts/TokenBadge.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/TokenBadge.js +0 -100
- package/dist/whirlpools-client/accounts/TokenBadge.js.map +0 -1
- package/dist/whirlpools-client/accounts/Whirlpool.d.ts +0 -75
- package/dist/whirlpools-client/accounts/Whirlpool.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/Whirlpool.js +0 -207
- package/dist/whirlpools-client/accounts/Whirlpool.js.map +0 -1
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.d.ts +0 -28
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.js +0 -112
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.js.map +0 -1
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.d.ts +0 -25
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.js +0 -106
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.js.map +0 -1
- package/dist/whirlpools-client/accounts/index.d.ts.map +0 -1
- package/dist/whirlpools-client/accounts/index.js.map +0 -1
- package/dist/whirlpools-client/errors/anchor.d.ts.map +0 -1
- package/dist/whirlpools-client/errors/anchor.js.map +0 -1
- package/dist/whirlpools-client/errors/custom.d.ts.map +0 -1
- package/dist/whirlpools-client/errors/custom.js.map +0 -1
- package/dist/whirlpools-client/errors/index.d.ts +0 -6
- package/dist/whirlpools-client/errors/index.d.ts.map +0 -1
- package/dist/whirlpools-client/errors/index.js +0 -80
- package/dist/whirlpools-client/errors/index.js.map +0 -1
- package/dist/whirlpools-client/index.d.ts +0 -5
- package/dist/whirlpools-client/index.d.ts.map +0 -1
- package/dist/whirlpools-client/index.js +0 -21
- package/dist/whirlpools-client/index.js.map +0 -1
- package/dist/whirlpools-client/instructions/closeBundledPosition.d.ts +0 -14
- package/dist/whirlpools-client/instructions/closeBundledPosition.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/closeBundledPosition.js +0 -67
- package/dist/whirlpools-client/instructions/closeBundledPosition.js.map +0 -1
- package/dist/whirlpools-client/instructions/closePosition.d.ts +0 -11
- package/dist/whirlpools-client/instructions/closePosition.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/closePosition.js +0 -24
- package/dist/whirlpools-client/instructions/closePosition.js.map +0 -1
- package/dist/whirlpools-client/instructions/collectFees.d.ts +0 -14
- package/dist/whirlpools-client/instructions/collectFees.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/collectFees.js +0 -27
- package/dist/whirlpools-client/instructions/collectFees.js.map +0 -1
- package/dist/whirlpools-client/instructions/collectFeesV2.d.ts +0 -23
- package/dist/whirlpools-client/instructions/collectFeesV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/collectFeesV2.js +0 -76
- package/dist/whirlpools-client/instructions/collectFeesV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/collectProtocolFees.d.ts +0 -13
- package/dist/whirlpools-client/instructions/collectProtocolFees.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/collectProtocolFees.js +0 -26
- package/dist/whirlpools-client/instructions/collectProtocolFees.js.map +0 -1
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.d.ts +0 -22
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.js +0 -75
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/collectReward.d.ts +0 -16
- package/dist/whirlpools-client/instructions/collectReward.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/collectReward.js +0 -65
- package/dist/whirlpools-client/instructions/collectReward.js.map +0 -1
- package/dist/whirlpools-client/instructions/collectRewardV2.d.ts +0 -20
- package/dist/whirlpools-client/instructions/collectRewardV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/collectRewardV2.js +0 -74
- package/dist/whirlpools-client/instructions/collectRewardV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/decreaseLiquidity.d.ts +0 -23
- package/dist/whirlpools-client/instructions/decreaseLiquidity.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/decreaseLiquidity.js +0 -75
- package/dist/whirlpools-client/instructions/decreaseLiquidity.js.map +0 -1
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.d.ts +0 -29
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.js +0 -84
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/deletePositionBundle.d.ts +0 -11
- package/dist/whirlpools-client/instructions/deletePositionBundle.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/deletePositionBundle.js +0 -24
- package/dist/whirlpools-client/instructions/deletePositionBundle.js.map +0 -1
- package/dist/whirlpools-client/instructions/deleteTokenBadge.d.ts +0 -11
- package/dist/whirlpools-client/instructions/deleteTokenBadge.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/deleteTokenBadge.js +0 -24
- package/dist/whirlpools-client/instructions/deleteTokenBadge.js.map +0 -1
- package/dist/whirlpools-client/instructions/increaseLiquidity.d.ts +0 -23
- package/dist/whirlpools-client/instructions/increaseLiquidity.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/increaseLiquidity.js +0 -75
- package/dist/whirlpools-client/instructions/increaseLiquidity.js.map +0 -1
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.d.ts +0 -29
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.js +0 -84
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/index.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/index.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeConfig.d.ts +0 -15
- package/dist/whirlpools-client/instructions/initializeConfig.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeConfig.js +0 -65
- package/dist/whirlpools-client/instructions/initializeConfig.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeConfigExtension.d.ts +0 -10
- package/dist/whirlpools-client/instructions/initializeConfigExtension.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeConfigExtension.js +0 -19
- package/dist/whirlpools-client/instructions/initializeConfigExtension.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeFeeTier.d.ts +0 -15
- package/dist/whirlpools-client/instructions/initializeFeeTier.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeFeeTier.js +0 -63
- package/dist/whirlpools-client/instructions/initializeFeeTier.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializePool.d.ts +0 -24
- package/dist/whirlpools-client/instructions/initializePool.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializePool.js +0 -72
- package/dist/whirlpools-client/instructions/initializePool.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializePoolV2.d.ts +0 -25
- package/dist/whirlpools-client/instructions/initializePoolV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializePoolV2.js +0 -72
- package/dist/whirlpools-client/instructions/initializePoolV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializePositionBundle.d.ts +0 -14
- package/dist/whirlpools-client/instructions/initializePositionBundle.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializePositionBundle.js +0 -35
- package/dist/whirlpools-client/instructions/initializePositionBundle.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.d.ts +0 -17
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.js +0 -42
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeReward.d.ts +0 -17
- package/dist/whirlpools-client/instructions/initializeReward.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeReward.js +0 -62
- package/dist/whirlpools-client/instructions/initializeReward.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeRewardV2.d.ts +0 -18
- package/dist/whirlpools-client/instructions/initializeRewardV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeRewardV2.js +0 -63
- package/dist/whirlpools-client/instructions/initializeRewardV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeTickArray.d.ts +0 -13
- package/dist/whirlpools-client/instructions/initializeTickArray.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeTickArray.js +0 -58
- package/dist/whirlpools-client/instructions/initializeTickArray.js.map +0 -1
- package/dist/whirlpools-client/instructions/initializeTokenBadge.d.ts +0 -12
- package/dist/whirlpools-client/instructions/initializeTokenBadge.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/initializeTokenBadge.js +0 -25
- package/dist/whirlpools-client/instructions/initializeTokenBadge.js.map +0 -1
- package/dist/whirlpools-client/instructions/openBundledPosition.d.ts +0 -19
- package/dist/whirlpools-client/instructions/openBundledPosition.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/openBundledPosition.js +0 -76
- package/dist/whirlpools-client/instructions/openBundledPosition.js.map +0 -1
- package/dist/whirlpools-client/instructions/openPosition.d.ts +0 -22
- package/dist/whirlpools-client/instructions/openPosition.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/openPosition.js +0 -79
- package/dist/whirlpools-client/instructions/openPosition.js.map +0 -1
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.d.ts +0 -25
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.js +0 -86
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.js.map +0 -1
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.d.ts +0 -8
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.js +0 -25
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.d.ts +0 -9
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.js +0 -30
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.d.ts +0 -12
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.js +0 -57
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.js.map +0 -1
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.d.ts +0 -11
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.js +0 -56
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.js.map +0 -1
- package/dist/whirlpools-client/instructions/setFeeAuthority.d.ts +0 -8
- package/dist/whirlpools-client/instructions/setFeeAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setFeeAuthority.js +0 -17
- package/dist/whirlpools-client/instructions/setFeeAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/setFeeRate.d.ts +0 -12
- package/dist/whirlpools-client/instructions/setFeeRate.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setFeeRate.js +0 -57
- package/dist/whirlpools-client/instructions/setFeeRate.js.map +0 -1
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.d.ts +0 -12
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.js +0 -57
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.js.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardAuthority.d.ts +0 -12
- package/dist/whirlpools-client/instructions/setRewardAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardAuthority.js +0 -57
- package/dist/whirlpools-client/instructions/setRewardAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.d.ts +0 -13
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.js +0 -62
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardEmissions.d.ts +0 -14
- package/dist/whirlpools-client/instructions/setRewardEmissions.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardEmissions.js +0 -61
- package/dist/whirlpools-client/instructions/setRewardEmissions.js.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.d.ts +0 -8
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.js +0 -25
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.d.ts +0 -14
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.js +0 -61
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.d.ts +0 -9
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.js +0 -30
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.js.map +0 -1
- package/dist/whirlpools-client/instructions/swap.d.ts +0 -25
- package/dist/whirlpools-client/instructions/swap.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/swap.js +0 -75
- package/dist/whirlpools-client/instructions/swap.js.map +0 -1
- package/dist/whirlpools-client/instructions/swapV2.d.ts +0 -31
- package/dist/whirlpools-client/instructions/swapV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/swapV2.js +0 -84
- package/dist/whirlpools-client/instructions/swapV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/twoHopSwap.d.ts +0 -36
- package/dist/whirlpools-client/instructions/twoHopSwap.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/twoHopSwap.js +0 -104
- package/dist/whirlpools-client/instructions/twoHopSwap.js.map +0 -1
- package/dist/whirlpools-client/instructions/twoHopSwapV2.d.ts +0 -42
- package/dist/whirlpools-client/instructions/twoHopSwapV2.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/twoHopSwapV2.js +0 -121
- package/dist/whirlpools-client/instructions/twoHopSwapV2.js.map +0 -1
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.d.ts +0 -9
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.d.ts.map +0 -1
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.js +0 -18
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.js.map +0 -1
- package/dist/whirlpools-client/programId.d.ts +0 -6
- package/dist/whirlpools-client/programId.d.ts.map +0 -1
- package/dist/whirlpools-client/programId.js +0 -15
- package/dist/whirlpools-client/programId.js.map +0 -1
- package/dist/whirlpools-client/shim/remove-liquidity.d.ts +0 -14
- package/dist/whirlpools-client/shim/remove-liquidity.d.ts.map +0 -1
- package/dist/whirlpools-client/shim/remove-liquidity.js +0 -72
- package/dist/whirlpools-client/shim/remove-liquidity.js.map +0 -1
- package/dist/whirlpools-client/types/AccountsType.d.ts.map +0 -1
- package/dist/whirlpools-client/types/AccountsType.js.map +0 -1
- package/dist/whirlpools-client/types/CurrIndex.d.ts.map +0 -1
- package/dist/whirlpools-client/types/CurrIndex.js.map +0 -1
- package/dist/whirlpools-client/types/Direction.d.ts.map +0 -1
- package/dist/whirlpools-client/types/Direction.js.map +0 -1
- package/dist/whirlpools-client/types/OpenPositionBumps.d.ts +0 -22
- package/dist/whirlpools-client/types/OpenPositionBumps.d.ts.map +0 -1
- package/dist/whirlpools-client/types/OpenPositionBumps.js.map +0 -1
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.d.ts +0 -27
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.d.ts.map +0 -1
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.js.map +0 -1
- package/dist/whirlpools-client/types/PositionRewardInfo.d.ts +0 -28
- package/dist/whirlpools-client/types/PositionRewardInfo.d.ts.map +0 -1
- package/dist/whirlpools-client/types/PositionRewardInfo.js.map +0 -1
- package/dist/whirlpools-client/types/RemainingAccountsInfo.d.ts +0 -52
- package/dist/whirlpools-client/types/RemainingAccountsInfo.d.ts.map +0 -1
- package/dist/whirlpools-client/types/RemainingAccountsInfo.js.map +0 -1
- package/dist/whirlpools-client/types/RemainingAccountsSlice.d.ts +0 -51
- package/dist/whirlpools-client/types/RemainingAccountsSlice.d.ts.map +0 -1
- package/dist/whirlpools-client/types/RemainingAccountsSlice.js.map +0 -1
- package/dist/whirlpools-client/types/Tick.d.ts +0 -48
- package/dist/whirlpools-client/types/Tick.d.ts.map +0 -1
- package/dist/whirlpools-client/types/Tick.js.map +0 -1
- package/dist/whirlpools-client/types/TickLabel.d.ts.map +0 -1
- package/dist/whirlpools-client/types/TickLabel.js.map +0 -1
- package/dist/whirlpools-client/types/WhirlpoolBumps.d.ts +0 -22
- package/dist/whirlpools-client/types/WhirlpoolBumps.d.ts.map +0 -1
- package/dist/whirlpools-client/types/WhirlpoolBumps.js.map +0 -1
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.d.ts +0 -44
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.d.ts.map +0 -1
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.js +0 -107
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.js.map +0 -1
- package/dist/whirlpools-client/types/index.d.ts.map +0 -1
- package/dist/whirlpools-client/types/index.js.map +0 -1
- package/src/kamino-client/accounts/CollateralInfos.ts +0 -95
- package/src/kamino-client/accounts/GlobalConfig.ts +0 -292
- package/src/kamino-client/accounts/PersonalPositionState.ts +0 -215
- package/src/kamino-client/accounts/PoolState.ts +0 -469
- package/src/kamino-client/accounts/Position.ts +0 -169
- package/src/kamino-client/accounts/ProtocolPositionState.ts +0 -201
- package/src/kamino-client/accounts/ScopeChainAccount.ts +0 -89
- package/src/kamino-client/accounts/TermsSignature.ts +0 -89
- package/src/kamino-client/accounts/Whirlpool.ts +0 -242
- package/src/kamino-client/accounts/WhirlpoolStrategy.ts +0 -918
- package/src/kamino-client/errors/index.ts +0 -62
- package/src/kamino-client/instructions/addKaminoRewards.ts +0 -53
- package/src/kamino-client/instructions/changePool.ts +0 -48
- package/src/kamino-client/instructions/checkExpectedVaultsBalances.ts +0 -45
- package/src/kamino-client/instructions/closeProgramAccount.ts +0 -30
- package/src/kamino-client/instructions/closeStrategy.ts +0 -130
- package/src/kamino-client/instructions/collectFeesAndRewards.ts +0 -116
- package/src/kamino-client/instructions/deposit.ts +0 -93
- package/src/kamino-client/instructions/depositAndInvest.ts +0 -118
- package/src/kamino-client/instructions/emergencySwap.ts +0 -86
- package/src/kamino-client/instructions/executiveWithdraw.ts +0 -92
- package/src/kamino-client/instructions/flashSwapUnevenVaultsEnd.ts +0 -95
- package/src/kamino-client/instructions/flashSwapUnevenVaultsStart.ts +0 -91
- package/src/kamino-client/instructions/index.ts +0 -140
- package/src/kamino-client/instructions/initializeCollateralInfo.ts +0 -28
- package/src/kamino-client/instructions/initializeGlobalConfig.ts +0 -26
- package/src/kamino-client/instructions/initializeKaminoReward.ts +0 -59
- package/src/kamino-client/instructions/initializeSharesMetadata.ts +0 -64
- package/src/kamino-client/instructions/initializeStrategy.ts +0 -77
- package/src/kamino-client/instructions/insertCollateralInfo.ts +0 -45
- package/src/kamino-client/instructions/invest.ts +0 -84
- package/src/kamino-client/instructions/openLiquidityPosition.ts +0 -144
- package/src/kamino-client/instructions/orcaSwap.ts +0 -82
- package/src/kamino-client/instructions/permisionlessWithdrawFromTreasury.ts +0 -38
- package/src/kamino-client/instructions/signTerms.ts +0 -42
- package/src/kamino-client/instructions/singleTokenDepositAndInvestWithMin.ts +0 -118
- package/src/kamino-client/instructions/singleTokenDepositWithMin.ts +0 -93
- package/src/kamino-client/instructions/swapRewards.ts +0 -116
- package/src/kamino-client/instructions/swapUnevenVaults.ts +0 -105
- package/src/kamino-client/instructions/updateCollateralInfo.ts +0 -48
- package/src/kamino-client/instructions/updateGlobalConfig.ts +0 -48
- package/src/kamino-client/instructions/updateRewardMapping.ts +0 -61
- package/src/kamino-client/instructions/updateSharesMetadata.ts +0 -60
- package/src/kamino-client/instructions/updateStrategyAdmin.ts +0 -24
- package/src/kamino-client/instructions/updateStrategyConfig.ts +0 -49
- package/src/kamino-client/instructions/updateTreasuryFeeVault.ts +0 -56
- package/src/kamino-client/instructions/withdraw.ts +0 -108
- package/src/kamino-client/instructions/withdrawFromTopup.ts +0 -40
- package/src/kamino-client/instructions/withdrawFromTreasury.ts +0 -56
- package/src/kamino-client/programId.ts +0 -13
- package/src/kamino-client/types/BalanceStatus.ts +0 -90
- package/src/kamino-client/types/BinAddLiquidityStrategy.ts +0 -189
- package/src/kamino-client/types/CollateralInfo.ts +0 -184
- package/src/kamino-client/types/CollateralInfoParams.ts +0 -166
- package/src/kamino-client/types/CollateralTestToken.ts +0 -870
- package/src/kamino-client/types/CreationStatus.ts +0 -180
- package/src/kamino-client/types/DEX.ts +0 -118
- package/src/kamino-client/types/DexSpecificPrice.ts +0 -116
- package/src/kamino-client/types/DriftDirection.ts +0 -90
- package/src/kamino-client/types/ExecutiveWithdrawAction.ts +0 -120
- package/src/kamino-client/types/ExpanderStep.ts +0 -101
- package/src/kamino-client/types/GlobalConfigOption.ts +0 -720
- package/src/kamino-client/types/KaminoRewardInfo.ts +0 -130
- package/src/kamino-client/types/LiquidityCalculationMode.ts +0 -90
- package/src/kamino-client/types/MintingMethod.ts +0 -90
- package/src/kamino-client/types/PeriodicRebalanceState.ts +0 -53
- package/src/kamino-client/types/PositionRewardInfo.ts +0 -64
- package/src/kamino-client/types/Price.ts +0 -61
- package/src/kamino-client/types/RebalanceAction.ts +0 -166
- package/src/kamino-client/types/RebalanceAutodriftParams.ts +0 -122
- package/src/kamino-client/types/RebalanceAutodriftState.ts +0 -84
- package/src/kamino-client/types/RebalanceAutodriftStep.ts +0 -90
- package/src/kamino-client/types/RebalanceAutodriftWindow.ts +0 -106
- package/src/kamino-client/types/RebalanceDriftParams.ts +0 -94
- package/src/kamino-client/types/RebalanceDriftState.ts +0 -76
- package/src/kamino-client/types/RebalanceDriftStep.ts +0 -90
- package/src/kamino-client/types/RebalanceEffects.ts +0 -104
- package/src/kamino-client/types/RebalanceExpanderState.ts +0 -64
- package/src/kamino-client/types/RebalanceManualState.ts +0 -37
- package/src/kamino-client/types/RebalancePricePercentageState.ts +0 -69
- package/src/kamino-client/types/RebalancePricePercentageWithResetState.ts +0 -77
- package/src/kamino-client/types/RebalanceRaw.ts +0 -76
- package/src/kamino-client/types/RebalanceTakeProfitState.ts +0 -56
- package/src/kamino-client/types/RebalanceTakeProfitStep.ts +0 -120
- package/src/kamino-client/types/RebalanceTakeProfitToken.ts +0 -87
- package/src/kamino-client/types/RebalanceType.ts +0 -270
- package/src/kamino-client/types/ReferencePriceType.ts +0 -90
- package/src/kamino-client/types/RemoveLiquidityMode.ts +0 -146
- package/src/kamino-client/types/RewardInfo.ts +0 -190
- package/src/kamino-client/types/ScopeConversionChain.ts +0 -0
- package/src/kamino-client/types/ScopePriceIdTest.ts +0 -2130
- package/src/kamino-client/types/SimulationPrice.ts +0 -146
- package/src/kamino-client/types/StakingRateSource.ts +0 -90
- package/src/kamino-client/types/StrategyConfigOption.ts +0 -1590
- package/src/kamino-client/types/StrategyStatus.ts +0 -180
- package/src/kamino-client/types/StrategyType.ts +0 -118
- package/src/kamino-client/types/SwapLimit.ts +0 -157
- package/src/kamino-client/types/UpdateCollateralInfoMode.ts +0 -420
- package/src/kamino-client/types/WhirlpoolRewardInfo.ts +0 -118
- package/src/kamino-client/types/WithdrawalCapAccumulatorAction.ts +0 -92
- package/src/kamino-client/types/WithdrawalCaps.ts +0 -85
- package/src/meteora_client/accounts/BinArray.ts +0 -134
- package/src/meteora_client/accounts/BinArrayBitmapExtension.ts +0 -119
- package/src/meteora_client/accounts/LbPair.ts +0 -401
- package/src/meteora_client/accounts/Oracle.ts +0 -114
- package/src/meteora_client/accounts/Position.ts +0 -229
- package/src/meteora_client/accounts/PositionV2.ts +0 -277
- package/src/meteora_client/accounts/PresetParameter.ts +0 -191
- package/src/meteora_client/errors/index.ts +0 -62
- package/src/meteora_client/instructions/addLiquidity.ts +0 -74
- package/src/meteora_client/instructions/addLiquidityByStrategy.ts +0 -74
- package/src/meteora_client/instructions/addLiquidityByStrategyOneSide.ts +0 -66
- package/src/meteora_client/instructions/addLiquidityByWeight.ts +0 -74
- package/src/meteora_client/instructions/addLiquidityOneSide.ts +0 -66
- package/src/meteora_client/instructions/addLiquidityOneSidePrecise.ts +0 -66
- package/src/meteora_client/instructions/claimFee.ts +0 -48
- package/src/meteora_client/instructions/claimReward.ts +0 -56
- package/src/meteora_client/instructions/closePosition.ts +0 -36
- package/src/meteora_client/instructions/closePresetParameter.ts +0 -26
- package/src/meteora_client/instructions/fundReward.ts +0 -60
- package/src/meteora_client/instructions/goToABin.ts +0 -50
- package/src/meteora_client/instructions/increaseOracleLength.ts +0 -44
- package/src/meteora_client/instructions/initializeBinArray.ts +0 -42
- package/src/meteora_client/instructions/initializeBinArrayBitmapExtension.ts +0 -35
- package/src/meteora_client/instructions/initializeLbPair.ts +0 -71
- package/src/meteora_client/instructions/initializePermissionLbPair.ts +0 -68
- package/src/meteora_client/instructions/initializePosition.ts +0 -55
- package/src/meteora_client/instructions/initializePositionByOperator.ts +0 -64
- package/src/meteora_client/instructions/initializePositionPda.ts +0 -58
- package/src/meteora_client/instructions/initializePresetParameter.ts +0 -42
- package/src/meteora_client/instructions/initializeReward.ts +0 -60
- package/src/meteora_client/instructions/migrateBinArray.ts +0 -22
- package/src/meteora_client/instructions/migratePosition.ts +0 -40
- package/src/meteora_client/instructions/removeAllLiquidity.ts +0 -56
- package/src/meteora_client/instructions/removeLiquidity.ts +0 -74
- package/src/meteora_client/instructions/removeLiquidityByRange.ts +0 -78
- package/src/meteora_client/instructions/setActivationSlot.ts +0 -38
- package/src/meteora_client/instructions/setLockReleaseSlot.ts +0 -44
- package/src/meteora_client/instructions/setPreActivationSlotDuration.ts +0 -38
- package/src/meteora_client/instructions/setPreActivationSwapAddress.ts +0 -40
- package/src/meteora_client/instructions/swap.ts +0 -73
- package/src/meteora_client/instructions/togglePairStatus.ts +0 -24
- package/src/meteora_client/instructions/updateFeeOwner.ts +0 -26
- package/src/meteora_client/instructions/updateFeeParameters.ts +0 -42
- package/src/meteora_client/instructions/updateFeesAndRewards.ts +0 -30
- package/src/meteora_client/instructions/updatePositionOperator.ts +0 -42
- package/src/meteora_client/instructions/updateRewardDuration.ts +0 -49
- package/src/meteora_client/instructions/updateRewardFunder.ts +0 -47
- package/src/meteora_client/instructions/updateWhitelistedWallet.ts +0 -38
- package/src/meteora_client/instructions/withdrawIneligibleReward.ts +0 -52
- package/src/meteora_client/instructions/withdrawProtocolFee.ts +0 -54
- package/src/meteora_client/programId.ts +0 -14
- package/src/meteora_client/types/AddLiquiditySingleSidePreciseParameter.ts +0 -79
- package/src/meteora_client/types/Bin.ts +0 -161
- package/src/meteora_client/types/BinLiquidityDistribution.ts +0 -85
- package/src/meteora_client/types/BinLiquidityDistributionByWeight.ts +0 -69
- package/src/meteora_client/types/BinLiquidityReduction.ts +0 -64
- package/src/meteora_client/types/CompressedBinDepositAmount.ts +0 -63
- package/src/meteora_client/types/FeeInfo.ts +0 -85
- package/src/meteora_client/types/FeeParameter.ts +0 -70
- package/src/meteora_client/types/InitPermissionPairIx.ts +0 -103
- package/src/meteora_client/types/InitPresetParametersIx.ts +0 -169
- package/src/meteora_client/types/LayoutVersion.ts +0 -87
- package/src/meteora_client/types/LiquidityOneSideParameter.ts +0 -112
- package/src/meteora_client/types/LiquidityParameter.ts +0 -95
- package/src/meteora_client/types/LiquidityParameterByStrategy.ts +0 -119
- package/src/meteora_client/types/LiquidityParameterByStrategyOneSide.ts +0 -107
- package/src/meteora_client/types/LiquidityParameterByWeight.ts +0 -124
- package/src/meteora_client/types/Observation.ts +0 -85
- package/src/meteora_client/types/PairStatus.ts +0 -88
- package/src/meteora_client/types/PairType.ts +0 -88
- package/src/meteora_client/types/ProtocolFee.ts +0 -61
- package/src/meteora_client/types/RewardInfo.ts +0 -152
- package/src/meteora_client/types/Rounding.ts +0 -85
- package/src/meteora_client/types/StaticParameters.ts +0 -170
- package/src/meteora_client/types/StrategyParameters.ts +0 -97
- package/src/meteora_client/types/StrategyType.ts +0 -298
- package/src/meteora_client/types/UserRewardInfo.ts +0 -71
- package/src/meteora_client/types/VariableParameters.ts +0 -131
- package/src/raydium_client/accounts/AmmConfig.ts +0 -161
- package/src/raydium_client/accounts/ObservationState.ts +0 -121
- package/src/raydium_client/accounts/OperationState.ts +0 -105
- package/src/raydium_client/accounts/PersonalPositionState.ts +0 -185
- package/src/raydium_client/accounts/PoolState.ts +0 -385
- package/src/raydium_client/accounts/ProtocolPositionState.ts +0 -171
- package/src/raydium_client/accounts/TickArrayBitmapExtension.ts +0 -113
- package/src/raydium_client/accounts/TickArrayState.ts +0 -125
- package/src/raydium_client/errors/index.ts +0 -62
- package/src/raydium_client/index.ts +0 -4
- package/src/raydium_client/instructions/closePosition.ts +0 -32
- package/src/raydium_client/instructions/collectFundFee.ts +0 -69
- package/src/raydium_client/instructions/collectProtocolFee.ts +0 -69
- package/src/raydium_client/instructions/collectRemainingRewards.ts +0 -50
- package/src/raydium_client/instructions/createAmmConfig.ts +0 -54
- package/src/raydium_client/instructions/createOperationAccount.ts +0 -26
- package/src/raydium_client/instructions/createPool.ts +0 -65
- package/src/raydium_client/instructions/decreaseLiquidity.ts +0 -74
- package/src/raydium_client/instructions/decreaseLiquidityV2.ts +0 -82
- package/src/raydium_client/instructions/increaseLiquidity.ts +0 -66
- package/src/raydium_client/instructions/increaseLiquidityV2.ts +0 -75
- package/src/raydium_client/instructions/initializeReward.ts +0 -56
- package/src/raydium_client/instructions/openPosition.ts +0 -96
- package/src/raydium_client/instructions/openPositionV2.ts +0 -108
- package/src/raydium_client/instructions/setRewardParams.ts +0 -57
- package/src/raydium_client/instructions/swap.ts +0 -65
- package/src/raydium_client/instructions/swapRouterBaseIn.ts +0 -51
- package/src/raydium_client/instructions/swapV2.ts +0 -71
- package/src/raydium_client/instructions/transferRewardOwner.ts +0 -38
- package/src/raydium_client/instructions/updateAmmConfig.ts +0 -40
- package/src/raydium_client/instructions/updateOperationAccount.ts +0 -45
- package/src/raydium_client/instructions/updatePoolStatus.ts +0 -38
- package/src/raydium_client/instructions/updateRewardInfos.ts +0 -22
- package/src/raydium_client/programId.ts +0 -14
- package/src/raydium_client/types/InitializeRewardParam.ts +0 -76
- package/src/raydium_client/types/Observation.ts +0 -85
- package/src/raydium_client/types/PoolStatusBitFlag.ts +0 -90
- package/src/raydium_client/types/PoolStatusBitIndex.ts +0 -180
- package/src/raydium_client/types/PositionRewardInfo.ts +0 -64
- package/src/raydium_client/types/RewardInfo.ts +0 -148
- package/src/raydium_client/types/RewardState.ts +0 -148
- package/src/raydium_client/types/TickArryBitmap.ts +0 -0
- package/src/raydium_client/types/TickState.ts +0 -116
- package/src/utils/anchorUtils.ts +0 -15
- package/src/utils/instructions.ts +0 -38
- package/src/utils/pubkey.ts +0 -249
- package/src/whirlpools-client/accounts/FeeTier.ts +0 -105
- package/src/whirlpools-client/accounts/Position.ts +0 -169
- package/src/whirlpools-client/accounts/PositionBundle.ts +0 -97
- package/src/whirlpools-client/accounts/TickArray.ts +0 -109
- package/src/whirlpools-client/accounts/TokenBadge.ts +0 -97
- package/src/whirlpools-client/accounts/Whirlpool.ts +0 -241
- package/src/whirlpools-client/accounts/WhirlpoolsConfig.ts +0 -119
- package/src/whirlpools-client/accounts/WhirlpoolsConfigExtension.ts +0 -107
- package/src/whirlpools-client/errors/index.ts +0 -62
- package/src/whirlpools-client/index.ts +0 -4
- package/src/whirlpools-client/instructions/closeBundledPosition.ts +0 -52
- package/src/whirlpools-client/instructions/closePosition.ts +0 -36
- package/src/whirlpools-client/instructions/collectFees.ts +0 -42
- package/src/whirlpools-client/instructions/collectFeesV2.ts +0 -71
- package/src/whirlpools-client/instructions/collectProtocolFees.ts +0 -40
- package/src/whirlpools-client/instructions/collectProtocolFeesV2.ts +0 -69
- package/src/whirlpools-client/instructions/collectReward.ts +0 -52
- package/src/whirlpools-client/instructions/collectRewardV2.ts +0 -66
- package/src/whirlpools-client/instructions/decreaseLiquidity.ts +0 -68
- package/src/whirlpools-client/instructions/decreaseLiquidityV2.ts +0 -84
- package/src/whirlpools-client/instructions/deletePositionBundle.ts +0 -36
- package/src/whirlpools-client/instructions/deleteTokenBadge.ts +0 -36
- package/src/whirlpools-client/instructions/increaseLiquidity.ts +0 -68
- package/src/whirlpools-client/instructions/increaseLiquidityV2.ts +0 -84
- package/src/whirlpools-client/instructions/initializeConfig.ts +0 -51
- package/src/whirlpools-client/instructions/initializeConfigExtension.ts +0 -30
- package/src/whirlpools-client/instructions/initializeFeeTier.ts +0 -49
- package/src/whirlpools-client/instructions/initializePool.ts +0 -64
- package/src/whirlpools-client/instructions/initializePoolV2.ts +0 -67
- package/src/whirlpools-client/instructions/initializePositionBundle.ts +0 -50
- package/src/whirlpools-client/instructions/initializePositionBundleWithMetadata.ts +0 -60
- package/src/whirlpools-client/instructions/initializeReward.ts +0 -50
- package/src/whirlpools-client/instructions/initializeRewardV2.ts +0 -52
- package/src/whirlpools-client/instructions/initializeTickArray.ts +0 -42
- package/src/whirlpools-client/instructions/initializeTokenBadge.ts +0 -38
- package/src/whirlpools-client/instructions/openBundledPosition.ts +0 -66
- package/src/whirlpools-client/instructions/openPosition.ts +0 -70
- package/src/whirlpools-client/instructions/openPositionWithMetadata.ts +0 -80
- package/src/whirlpools-client/instructions/setCollectProtocolFeesAuthority.ts +0 -34
- package/src/whirlpools-client/instructions/setConfigExtensionAuthority.ts +0 -40
- package/src/whirlpools-client/instructions/setDefaultFeeRate.ts +0 -40
- package/src/whirlpools-client/instructions/setDefaultProtocolFeeRate.ts +0 -38
- package/src/whirlpools-client/instructions/setFeeAuthority.ts +0 -26
- package/src/whirlpools-client/instructions/setFeeRate.ts +0 -40
- package/src/whirlpools-client/instructions/setProtocolFeeRate.ts +0 -40
- package/src/whirlpools-client/instructions/setRewardAuthority.ts +0 -40
- package/src/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.ts +0 -46
- package/src/whirlpools-client/instructions/setRewardEmissions.ts +0 -45
- package/src/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.ts +0 -34
- package/src/whirlpools-client/instructions/setRewardEmissionsV2.ts +0 -45
- package/src/whirlpools-client/instructions/setTokenBadgeAuthority.ts +0 -40
- package/src/whirlpools-client/instructions/swap.ts +0 -70
- package/src/whirlpools-client/instructions/swapV2.ts +0 -86
- package/src/whirlpools-client/instructions/twoHopSwap.ts +0 -110
- package/src/whirlpools-client/instructions/twoHopSwapV2.ts +0 -134
- package/src/whirlpools-client/instructions/updateFeesAndRewards.ts +0 -28
- package/src/whirlpools-client/programId.ts +0 -14
- package/src/whirlpools-client/shim/remove-liquidity.ts +0 -128
- package/src/whirlpools-client/types/AccountsType.ts +0 -208
- package/src/whirlpools-client/types/CurrIndex.ts +0 -118
- package/src/whirlpools-client/types/Direction.ts +0 -88
- package/src/whirlpools-client/types/OpenPositionBumps.ts +0 -53
- package/src/whirlpools-client/types/OpenPositionWithMetadataBumps.ts +0 -66
- package/src/whirlpools-client/types/PositionRewardInfo.ts +0 -64
- package/src/whirlpools-client/types/RemainingAccountsInfo.ts +0 -66
- package/src/whirlpools-client/types/RemainingAccountsSlice.ts +0 -64
- package/src/whirlpools-client/types/Tick.ts +0 -107
- package/src/whirlpools-client/types/TickLabel.ts +0 -88
- package/src/whirlpools-client/types/WhirlpoolBumps.ts +0 -53
- package/src/whirlpools-client/types/WhirlpoolRewardInfo.ts +0 -94
- /package/dist/{kamino-client → @codegen/kliquidity}/accounts/index.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/accounts/index.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/errors/anchor.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/errors/anchor.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/errors/custom.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/errors/custom.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/BalanceStatus.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/BalanceStatus.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/BinAddLiquidityStrategy.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/BinAddLiquidityStrategy.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/CollateralTestToken.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/CollateralTestToken.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/CreationStatus.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/CreationStatus.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/DEX.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/DEX.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/DexSpecificPrice.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/DexSpecificPrice.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/DriftDirection.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/DriftDirection.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ExecutiveWithdrawAction.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ExecutiveWithdrawAction.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ExpanderStep.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ExpanderStep.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/GlobalConfigOption.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/GlobalConfigOption.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/LiquidityCalculationMode.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/LiquidityCalculationMode.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/MintingMethod.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/MintingMethod.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/PeriodicRebalanceState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/PositionRewardInfo.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/Price.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAction.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAction.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAutodriftParams.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAutodriftState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAutodriftStep.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAutodriftStep.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceAutodriftWindow.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceDriftParams.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceDriftState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceDriftStep.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceDriftStep.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceEffects.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceEffects.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceExpanderState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceManualState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalancePricePercentageState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalancePricePercentageWithResetState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceRaw.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceTakeProfitState.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceTakeProfitStep.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceTakeProfitStep.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceTakeProfitToken.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceTakeProfitToken.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceType.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RebalanceType.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ReferencePriceType.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ReferencePriceType.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RemoveLiquidityMode.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/RemoveLiquidityMode.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ScopePriceIdTest.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/ScopePriceIdTest.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/SimulationPrice.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/SimulationPrice.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StakingRateSource.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StakingRateSource.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StrategyConfigOption.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StrategyConfigOption.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StrategyStatus.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StrategyStatus.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StrategyType.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/StrategyType.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/SwapLimit.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/SwapLimit.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/UpdateCollateralInfoMode.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/UpdateCollateralInfoMode.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/WithdrawalCapAccumulatorAction.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/WithdrawalCapAccumulatorAction.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/WithdrawalCaps.js +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/index.d.ts +0 -0
- /package/dist/{kamino-client → @codegen/kliquidity}/types/index.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/accounts/index.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/accounts/index.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/errors/anchor.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/errors/anchor.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/errors/custom.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/errors/custom.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/instructions/index.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/instructions/index.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/AddLiquiditySingleSidePreciseParameter.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/Bin.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/BinLiquidityDistribution.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/BinLiquidityDistributionByWeight.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/BinLiquidityReduction.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/CompressedBinDepositAmount.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/FeeInfo.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/FeeParameter.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/InitPermissionPairIx.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/InitPresetParametersIx.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LayoutVersion.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LayoutVersion.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LiquidityOneSideParameter.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LiquidityParameter.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LiquidityParameterByStrategy.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LiquidityParameterByStrategyOneSide.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/LiquidityParameterByWeight.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/Observation.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/PairStatus.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/PairStatus.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/PairType.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/PairType.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/ProtocolFee.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/Rounding.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/Rounding.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/StaticParameters.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/StrategyParameters.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/StrategyType.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/StrategyType.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/UserRewardInfo.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/VariableParameters.js +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/index.d.ts +0 -0
- /package/dist/{meteora_client → @codegen/meteora}/types/index.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/accounts/index.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/accounts/index.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/errors/anchor.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/errors/anchor.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/errors/custom.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/errors/custom.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/instructions/index.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/instructions/index.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/InitializeRewardParam.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/Observation.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/PoolStatusBitFlag.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/PoolStatusBitFlag.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/PoolStatusBitIndex.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/PoolStatusBitIndex.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/PositionRewardInfo.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/RewardState.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/RewardState.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/TickState.js +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/index.d.ts +0 -0
- /package/dist/{raydium_client → @codegen/raydium}/types/index.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/accounts/index.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/accounts/index.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/errors/anchor.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/errors/anchor.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/errors/custom.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/errors/custom.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/instructions/index.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/instructions/index.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/AccountsType.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/AccountsType.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/CurrIndex.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/CurrIndex.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/Direction.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/Direction.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/OpenPositionBumps.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/OpenPositionWithMetadataBumps.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/PositionRewardInfo.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/RemainingAccountsInfo.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/RemainingAccountsSlice.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/Tick.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/TickLabel.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/TickLabel.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/WhirlpoolBumps.js +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/index.d.ts +0 -0
- /package/dist/{whirlpools-client → @codegen/whirlpools}/types/index.js +0 -0
- /package/src/{kamino-client → @codegen/kliquidity}/accounts/index.ts +0 -0
- /package/src/{kamino-client → @codegen/kliquidity}/errors/anchor.ts +0 -0
- /package/src/{kamino-client → @codegen/kliquidity}/errors/custom.ts +0 -0
- /package/src/{kamino-client → @codegen/kliquidity}/types/index.ts +0 -0
- /package/src/{meteora_client → @codegen/meteora}/accounts/index.ts +0 -0
- /package/src/{meteora_client → @codegen/meteora}/errors/anchor.ts +0 -0
- /package/src/{meteora_client → @codegen/meteora}/errors/custom.ts +0 -0
- /package/src/{meteora_client → @codegen/meteora}/instructions/index.ts +0 -0
- /package/src/{meteora_client → @codegen/meteora}/types/index.ts +0 -0
- /package/src/{raydium_client → @codegen/raydium}/accounts/index.ts +0 -0
- /package/src/{raydium_client → @codegen/raydium}/errors/anchor.ts +0 -0
- /package/src/{raydium_client → @codegen/raydium}/errors/custom.ts +0 -0
- /package/src/{raydium_client → @codegen/raydium}/instructions/index.ts +0 -0
- /package/src/{raydium_client → @codegen/raydium}/types/index.ts +0 -0
- /package/src/{whirlpools-client → @codegen/whirlpools}/accounts/index.ts +0 -0
- /package/src/{whirlpools-client → @codegen/whirlpools}/errors/anchor.ts +0 -0
- /package/src/{whirlpools-client → @codegen/whirlpools}/errors/custom.ts +0 -0
- /package/src/{whirlpools-client → @codegen/whirlpools}/instructions/index.ts +0 -0
- /package/src/{whirlpools-client → @codegen/whirlpools}/types/index.ts +0 -0
package/dist/Kamino.js
CHANGED
|
@@ -3,70 +3,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Kamino =
|
|
6
|
+
exports.Kamino = void 0;
|
|
7
7
|
const hubble_config_1 = require("@hubbleprotocol/hubble-config");
|
|
8
|
-
const
|
|
8
|
+
const kit_1 = require("@solana/kit");
|
|
9
9
|
const bs58_1 = __importDefault(require("bs58"));
|
|
10
|
-
const
|
|
11
|
-
const accounts_1 = require("./kamino-client/accounts");
|
|
10
|
+
const accounts_1 = require("./@codegen/kliquidity/accounts");
|
|
12
11
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
13
|
-
const
|
|
12
|
+
const instructions_1 = require("./@codegen/whirlpools/instructions");
|
|
13
|
+
const accounts_2 = require("./@codegen/whirlpools/accounts");
|
|
14
14
|
const whirlpool_sdk_1 = require("@orca-so/whirlpool-sdk");
|
|
15
15
|
const orca_dal_1 = require("@orca-so/whirlpool-sdk/dist/dal/orca-dal");
|
|
16
16
|
const orca_position_1 = require("@orca-so/whirlpool-sdk/dist/position/orca-position");
|
|
17
17
|
const models_1 = require("./models");
|
|
18
|
-
const programId_2 = require("./whirlpools-client/programId");
|
|
19
18
|
const scope_sdk_1 = require("@kamino-finance/scope-sdk");
|
|
20
19
|
const utils_1 = require("./utils");
|
|
21
|
-
const
|
|
22
|
-
const instructions_1 = require("./kamino-client/instructions");
|
|
20
|
+
const instructions_2 = require("./@codegen/kliquidity/instructions");
|
|
23
21
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
24
|
-
const
|
|
25
|
-
const StrategyStatus_1 = require("./kamino-client/types/StrategyStatus");
|
|
22
|
+
const StrategyStatus_1 = require("./@codegen/kliquidity/types/StrategyStatus");
|
|
26
23
|
const constants_1 = require("./constants");
|
|
27
|
-
const types_1 = require("
|
|
28
|
-
const
|
|
29
|
-
const programId_3 = require("./raydium_client/programId");
|
|
30
|
-
const idl_json_1 = __importDefault(require("./kamino-client/idl.json"));
|
|
24
|
+
const types_1 = require("./@codegen/kliquidity/types");
|
|
25
|
+
const accounts_3 = require("./@codegen/raydium/accounts");
|
|
31
26
|
const services_1 = require("./services");
|
|
32
27
|
const add_liquidity_1 = require("@orca-so/whirlpool-sdk/dist/position/quotes/add-liquidity");
|
|
33
|
-
const
|
|
34
|
-
const StrategyConfigOption_1 = require("./kamino-client/types/StrategyConfigOption");
|
|
28
|
+
const StrategyConfigOption_1 = require("./@codegen/kliquidity/types/StrategyConfigOption");
|
|
35
29
|
const DefaultStrategyConfig_1 = require("./constants/DefaultStrategyConfig");
|
|
36
30
|
const pubkeys_1 = require("./constants/pubkeys");
|
|
37
31
|
const CreationParameters_1 = require("./utils/CreationParameters");
|
|
38
32
|
const deposit_method_1 = require("./constants/deposit_method");
|
|
39
33
|
const JupService_1 = require("./services/JupService");
|
|
40
34
|
const PoolSimulationService_1 = require("./services/PoolSimulationService");
|
|
41
|
-
const RebalanceType_1 = require("
|
|
35
|
+
const RebalanceType_1 = require("./@codegen/kliquidity/types/RebalanceType");
|
|
42
36
|
const transactions_1 = require("./utils/transactions");
|
|
43
37
|
const rebalance_methods_1 = require("./rebalance_methods");
|
|
44
|
-
const rebalance_methods_2 = require("./rebalance_methods");
|
|
45
|
-
const rebalance_methods_3 = require("./rebalance_methods");
|
|
46
|
-
const rebalance_methods_4 = require("./rebalance_methods");
|
|
47
|
-
const rebalance_methods_5 = require("./rebalance_methods");
|
|
48
38
|
const priceReferenceTypes_1 = require("./utils/priceReferenceTypes");
|
|
49
39
|
const utils_2 = require("./rebalance_methods/utils");
|
|
50
40
|
const consts_1 = require("./rebalance_methods/consts");
|
|
51
41
|
const autodriftRebalance_1 = require("./rebalance_methods/autodriftRebalance");
|
|
52
|
-
const
|
|
53
|
-
const programId_4 = require("./meteora_client/programId");
|
|
42
|
+
const whirlpools_1 = require("./utils/whirlpools");
|
|
54
43
|
const MeteoraService_1 = require("./services/MeteoraService");
|
|
55
44
|
const meteora_1 = require("./utils/meteora");
|
|
56
|
-
const
|
|
57
|
-
const instructions_3 = require("
|
|
58
|
-
const pubkey_1 = require("./utils/pubkey");
|
|
45
|
+
const accounts_4 = require("./@codegen/meteora/accounts");
|
|
46
|
+
const instructions_3 = require("./@codegen/meteora/instructions");
|
|
59
47
|
const lib_1 = require("@raydium-io/raydium-sdk-v2/lib");
|
|
60
|
-
|
|
48
|
+
const token_2022_1 = require("@solana-program/token-2022");
|
|
49
|
+
const token_1 = require("@solana-program/token");
|
|
50
|
+
const system_1 = require("@solana-program/system");
|
|
51
|
+
const sysvars_1 = require("@solana/sysvars");
|
|
52
|
+
const compat_1 = require("@solana/compat");
|
|
53
|
+
const address_lookup_table_1 = require("@solana-program/address-lookup-table");
|
|
54
|
+
const lookupTable_1 = require("./utils/lookupTable");
|
|
55
|
+
const compat_2 = require("./utils/compat");
|
|
56
|
+
const addressEncoder = (0, kit_1.getAddressEncoder)();
|
|
61
57
|
class Kamino {
|
|
62
58
|
_cluster;
|
|
63
|
-
|
|
59
|
+
_rpc;
|
|
60
|
+
_legacyConnection;
|
|
64
61
|
_config;
|
|
65
62
|
_globalConfig;
|
|
66
63
|
_scope;
|
|
67
|
-
|
|
68
|
-
_kaminoProgram;
|
|
69
|
-
_kaminoProgramId;
|
|
64
|
+
_kliquidityProgramId;
|
|
70
65
|
_orcaService;
|
|
71
66
|
_raydiumService;
|
|
72
67
|
_meteoraService;
|
|
@@ -74,56 +69,45 @@ class Kamino {
|
|
|
74
69
|
/**
|
|
75
70
|
* Create a new instance of the Kamino SDK class.
|
|
76
71
|
* @param cluster Name of the Solana cluster
|
|
77
|
-
* @param
|
|
72
|
+
* @param rpc Connection to the Solana cluster
|
|
73
|
+
* @param legacyConnection Connection to the Solana cluster
|
|
78
74
|
* @param globalConfig override kamino global config
|
|
79
75
|
* @param programId override kamino program id
|
|
80
76
|
* @param whirlpoolProgramId override whirlpool program id
|
|
81
77
|
* @param raydiumProgramId override raydium program id
|
|
78
|
+
* @param meteoraProgramId
|
|
79
|
+
* @param jupBaseAPI
|
|
82
80
|
*/
|
|
83
|
-
constructor(cluster,
|
|
81
|
+
constructor(cluster, rpc, legacyConnection, globalConfig, programId, whirlpoolProgramId, raydiumProgramId, meteoraProgramId, jupBaseAPI) {
|
|
84
82
|
this._cluster = cluster;
|
|
85
|
-
this.
|
|
83
|
+
this._rpc = rpc;
|
|
84
|
+
this._legacyConnection = legacyConnection;
|
|
86
85
|
this._config = (0, hubble_config_1.getConfigByCluster)(cluster);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
if (programId && programId.equals(pubkeys_1.STAGING_KAMINO_PROGRAM_ID)) {
|
|
91
|
-
this._kaminoProgramId = programId;
|
|
86
|
+
if (programId && programId === pubkeys_1.STAGING_KAMINO_PROGRAM_ID) {
|
|
87
|
+
this._kliquidityProgramId = programId;
|
|
92
88
|
this._globalConfig = pubkeys_1.STAGING_GLOBAL_CONFIG;
|
|
93
89
|
}
|
|
94
90
|
else {
|
|
95
|
-
this.
|
|
96
|
-
this._globalConfig = globalConfig ? globalConfig :
|
|
97
|
-
}
|
|
98
|
-
this._kaminoProgram = new anchor_1.Program(exports.KAMINO_IDL, this._kaminoProgramId, this._provider);
|
|
99
|
-
this._scope = new scope_sdk_1.Scope(cluster, connection);
|
|
100
|
-
(0, programId_1.setKaminoProgramId)(this._kaminoProgramId);
|
|
101
|
-
if (whirlpoolProgramId) {
|
|
102
|
-
(0, programId_2.setWhirlpoolsProgramId)(whirlpoolProgramId);
|
|
103
|
-
}
|
|
104
|
-
if (raydiumProgramId) {
|
|
105
|
-
(0, programId_3.setRaydiumProgramId)(raydiumProgramId);
|
|
91
|
+
this._kliquidityProgramId = programId ? programId : (0, compat_1.fromLegacyPublicKey)(this._config.kamino.programId);
|
|
92
|
+
this._globalConfig = globalConfig ? globalConfig : (0, compat_1.fromLegacyPublicKey)(this._config.kamino.globalConfig);
|
|
106
93
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.
|
|
111
|
-
this._raydiumService = new services_1.RaydiumService(connection, raydiumProgramId);
|
|
112
|
-
this._meteoraService = new MeteoraService_1.MeteoraService(connection, meteoraProgramId);
|
|
94
|
+
this._scope = new scope_sdk_1.Scope(cluster, rpc);
|
|
95
|
+
this._orcaService = new services_1.OrcaService(rpc, legacyConnection, cluster, whirlpoolProgramId);
|
|
96
|
+
this._raydiumService = new services_1.RaydiumService(rpc, legacyConnection, raydiumProgramId);
|
|
97
|
+
this._meteoraService = new MeteoraService_1.MeteoraService(rpc, meteoraProgramId);
|
|
113
98
|
if (jupBaseAPI) {
|
|
114
99
|
this._jupBaseAPI = jupBaseAPI;
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
|
-
getConnection = () => this.
|
|
118
|
-
getProgramID = () => this.
|
|
119
|
-
getProgram = () => this._kaminoProgram;
|
|
102
|
+
getConnection = () => this._rpc;
|
|
103
|
+
getProgramID = () => this._kliquidityProgramId;
|
|
120
104
|
setGlobalConfig = (globalConfig) => {
|
|
121
105
|
this._globalConfig = globalConfig;
|
|
122
106
|
};
|
|
123
107
|
getGlobalConfig = () => this._globalConfig;
|
|
124
108
|
getDepositableTokens = async () => {
|
|
125
109
|
const collateralInfos = await this.getCollateralInfos();
|
|
126
|
-
return collateralInfos.filter((x) =>
|
|
110
|
+
return collateralInfos.filter((x) => x.mint !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
127
111
|
};
|
|
128
112
|
getCollateralInfos = async () => {
|
|
129
113
|
const config = await this.getGlobalConfigState(this._globalConfig);
|
|
@@ -134,19 +118,19 @@ class Kamino {
|
|
|
134
118
|
};
|
|
135
119
|
getDisabledTokensPrices = async (collateralInfos) => {
|
|
136
120
|
const collInfos = collateralInfos ? collateralInfos : await this.getCollateralInfos();
|
|
137
|
-
const disabledTokens = collInfos.filter((x) => x.disabled &&
|
|
121
|
+
const disabledTokens = collInfos.filter((x) => x.disabled && x.mint !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
138
122
|
return JupService_1.JupService.getDollarPrices(disabledTokens.map((x) => x.mint), this._jupBaseAPI);
|
|
139
123
|
};
|
|
140
124
|
getSupportedDexes = () => ['ORCA', 'RAYDIUM', 'METEORA'];
|
|
141
125
|
// todo: see if we can read this dynamically
|
|
142
126
|
getFeeTiersForDex = (dex) => {
|
|
143
|
-
if (dex
|
|
127
|
+
if (dex === 'ORCA') {
|
|
144
128
|
return [new decimal_js_1.default(0.0001), new decimal_js_1.default(0.0005), new decimal_js_1.default(0.003), new decimal_js_1.default(0.01)];
|
|
145
129
|
}
|
|
146
|
-
else if (dex
|
|
130
|
+
else if (dex === 'RAYDIUM') {
|
|
147
131
|
return [new decimal_js_1.default(0.0001), new decimal_js_1.default(0.0005), new decimal_js_1.default(0.0025), new decimal_js_1.default(0.01)];
|
|
148
132
|
}
|
|
149
|
-
else if (dex
|
|
133
|
+
else if (dex === 'METEORA') {
|
|
150
134
|
return [new decimal_js_1.default(0.0001), new decimal_js_1.default(0.0005), new decimal_js_1.default(0.0025), new decimal_js_1.default(0.01)];
|
|
151
135
|
}
|
|
152
136
|
else {
|
|
@@ -230,13 +214,13 @@ class Kamino {
|
|
|
230
214
|
getFieldsForManualRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
231
215
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
232
216
|
const defaultFields = (0, rebalance_methods_1.getDefaultManualRebalanceFieldInfos)(price);
|
|
233
|
-
let lowerPrice = defaultFields.find((x) => x.label
|
|
234
|
-
const lowerPriceInput = fieldOverrides.find((x) => x.label
|
|
217
|
+
let lowerPrice = defaultFields.find((x) => x.label === 'rangePriceLower').value;
|
|
218
|
+
const lowerPriceInput = fieldOverrides.find((x) => x.label === 'rangePriceLower');
|
|
235
219
|
if (lowerPriceInput) {
|
|
236
220
|
lowerPrice = lowerPriceInput.value;
|
|
237
221
|
}
|
|
238
|
-
let upperPrice = defaultFields.find((x) => x.label
|
|
239
|
-
const upperPriceInput = fieldOverrides.find((x) => x.label
|
|
222
|
+
let upperPrice = defaultFields.find((x) => x.label === 'rangePriceUpper').value;
|
|
223
|
+
const upperPriceInput = fieldOverrides.find((x) => x.label === 'rangePriceUpper');
|
|
240
224
|
if (upperPriceInput) {
|
|
241
225
|
upperPrice = upperPriceInput.value;
|
|
242
226
|
}
|
|
@@ -244,196 +228,196 @@ class Kamino {
|
|
|
244
228
|
};
|
|
245
229
|
getFieldsForPricePercentageMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
246
230
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
247
|
-
const defaultFields = (0,
|
|
248
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
249
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
231
|
+
const defaultFields = (0, rebalance_methods_1.getDefaultPricePercentageRebalanceFieldInfos)(price);
|
|
232
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label === 'lowerRangeBps').value;
|
|
233
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'lowerRangeBps');
|
|
250
234
|
if (lowerPriceDifferenceBPSInput) {
|
|
251
235
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
252
236
|
}
|
|
253
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
254
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
237
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label === 'upperRangeBps').value;
|
|
238
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'upperRangeBps');
|
|
255
239
|
if (upperPriceDifferenceBPSInput) {
|
|
256
240
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
257
241
|
}
|
|
258
|
-
return (0,
|
|
242
|
+
return (0, rebalance_methods_1.getPricePercentageRebalanceFieldInfos)(price, new decimal_js_1.default(lowerPriceDifferenceBPS), new decimal_js_1.default(upperPriceDifferenceBPS));
|
|
259
243
|
};
|
|
260
244
|
getFieldsForPricePercentageWithResetMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
261
245
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
262
|
-
const defaultFields = (0,
|
|
263
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
264
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
246
|
+
const defaultFields = (0, rebalance_methods_1.getDefaultPricePercentageWithResetRebalanceFieldInfos)(price);
|
|
247
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label === 'lowerRangeBps').value;
|
|
248
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'lowerRangeBps');
|
|
265
249
|
if (lowerPriceDifferenceBPSInput) {
|
|
266
250
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
267
251
|
}
|
|
268
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
269
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
252
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label === 'upperRangeBps').value;
|
|
253
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'upperRangeBps');
|
|
270
254
|
if (upperPriceDifferenceBPSInput) {
|
|
271
255
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
272
256
|
}
|
|
273
|
-
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
274
|
-
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
257
|
+
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label === 'resetLowerRangeBps').value;
|
|
258
|
+
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'resetLowerRangeBps');
|
|
275
259
|
if (lowerResetPriceDifferenceBPSInput) {
|
|
276
260
|
lowerResetPriceDifferenceBPS = lowerResetPriceDifferenceBPSInput.value;
|
|
277
261
|
}
|
|
278
|
-
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
279
|
-
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
262
|
+
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label === 'resetUpperRangeBps').value;
|
|
263
|
+
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'resetUpperRangeBps');
|
|
280
264
|
if (upperResetPriceDifferenceBPSInput) {
|
|
281
265
|
upperResetPriceDifferenceBPS = upperResetPriceDifferenceBPSInput.value;
|
|
282
266
|
}
|
|
283
|
-
return (0,
|
|
267
|
+
return (0, rebalance_methods_1.getPricePercentageWithResetRebalanceFieldInfos)(price, new decimal_js_1.default(lowerPriceDifferenceBPS), new decimal_js_1.default(upperPriceDifferenceBPS), new decimal_js_1.default(lowerResetPriceDifferenceBPS), new decimal_js_1.default(upperResetPriceDifferenceBPS));
|
|
284
268
|
};
|
|
285
269
|
getFieldsForDriftRebalanceMethod = async (dex, fieldOverrides, tickSpacing, tokenAMint, tokenBMint, poolPrice) => {
|
|
286
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
287
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
270
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenAMint);
|
|
271
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenBMint);
|
|
288
272
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
289
|
-
const defaultFields = (0,
|
|
290
|
-
let startMidTick = defaultFields.find((x) => x.label
|
|
291
|
-
const startMidTickInput = fieldOverrides.find((x) => x.label
|
|
273
|
+
const defaultFields = (0, rebalance_methods_1.getDefaultDriftRebalanceFieldInfos)(dex, tickSpacing, price, tokenADecimals, tokenBDecimals);
|
|
274
|
+
let startMidTick = defaultFields.find((x) => x.label === 'startMidTick').value;
|
|
275
|
+
const startMidTickInput = fieldOverrides.find((x) => x.label === 'startMidTick');
|
|
292
276
|
if (startMidTickInput) {
|
|
293
277
|
startMidTick = startMidTickInput.value;
|
|
294
278
|
}
|
|
295
|
-
let ticksBelowMid = defaultFields.find((x) => x.label
|
|
296
|
-
const ticksBelowMidInput = fieldOverrides.find((x) => x.label
|
|
279
|
+
let ticksBelowMid = defaultFields.find((x) => x.label === 'ticksBelowMid').value;
|
|
280
|
+
const ticksBelowMidInput = fieldOverrides.find((x) => x.label === 'ticksBelowMid');
|
|
297
281
|
if (ticksBelowMidInput) {
|
|
298
282
|
ticksBelowMid = ticksBelowMidInput.value;
|
|
299
283
|
}
|
|
300
|
-
let ticksAboveMid = defaultFields.find((x) => x.label
|
|
301
|
-
const ticksAboveMidInput = fieldOverrides.find((x) => x.label
|
|
284
|
+
let ticksAboveMid = defaultFields.find((x) => x.label === 'ticksAboveMid').value;
|
|
285
|
+
const ticksAboveMidInput = fieldOverrides.find((x) => x.label === 'ticksAboveMid');
|
|
302
286
|
if (ticksAboveMidInput) {
|
|
303
287
|
ticksAboveMid = ticksAboveMidInput.value;
|
|
304
288
|
}
|
|
305
|
-
let secondsPerTick = defaultFields.find((x) => x.label
|
|
306
|
-
const secondsPerTickInput = fieldOverrides.find((x) => x.label
|
|
289
|
+
let secondsPerTick = defaultFields.find((x) => x.label === 'secondsPerTick').value;
|
|
290
|
+
const secondsPerTickInput = fieldOverrides.find((x) => x.label === 'secondsPerTick');
|
|
307
291
|
if (secondsPerTickInput) {
|
|
308
292
|
secondsPerTick = secondsPerTickInput.value;
|
|
309
293
|
}
|
|
310
|
-
let direction = defaultFields.find((x) => x.label
|
|
311
|
-
const directionInput = fieldOverrides.find((x) => x.label
|
|
294
|
+
let direction = defaultFields.find((x) => x.label === 'direction').value;
|
|
295
|
+
const directionInput = fieldOverrides.find((x) => x.label === 'direction');
|
|
312
296
|
if (directionInput) {
|
|
313
297
|
direction = directionInput.value;
|
|
314
298
|
}
|
|
315
|
-
const fieldInfos = (0,
|
|
299
|
+
const fieldInfos = (0, rebalance_methods_1.getDriftRebalanceFieldInfos)(dex, tokenADecimals, tokenBDecimals, tickSpacing, new decimal_js_1.default(startMidTick), new decimal_js_1.default(ticksBelowMid), new decimal_js_1.default(ticksAboveMid), new decimal_js_1.default(secondsPerTick), new decimal_js_1.default(direction));
|
|
316
300
|
return fieldInfos;
|
|
317
301
|
};
|
|
318
302
|
getFieldsForTakeProfitRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
319
303
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
320
|
-
const defaultFields = (0,
|
|
321
|
-
let lowerRangePrice = defaultFields.find((x) => x.label
|
|
322
|
-
const lowerRangePriceInput = fieldOverrides.find((x) => x.label
|
|
304
|
+
const defaultFields = (0, rebalance_methods_1.getDefaultTakeProfitRebalanceFieldsInfos)(price);
|
|
305
|
+
let lowerRangePrice = defaultFields.find((x) => x.label === 'rangePriceLower').value;
|
|
306
|
+
const lowerRangePriceInput = fieldOverrides.find((x) => x.label === 'rangePriceLower');
|
|
323
307
|
if (lowerRangePriceInput) {
|
|
324
308
|
lowerRangePrice = lowerRangePriceInput.value;
|
|
325
309
|
}
|
|
326
|
-
let upperRangePrice = defaultFields.find((x) => x.label
|
|
327
|
-
const upperRangePriceInput = fieldOverrides.find((x) => x.label
|
|
310
|
+
let upperRangePrice = defaultFields.find((x) => x.label === 'rangePriceUpper').value;
|
|
311
|
+
const upperRangePriceInput = fieldOverrides.find((x) => x.label === 'rangePriceUpper');
|
|
328
312
|
if (upperRangePriceInput) {
|
|
329
313
|
upperRangePrice = upperRangePriceInput.value;
|
|
330
314
|
}
|
|
331
|
-
let destinationToken = defaultFields.find((x) => x.label
|
|
332
|
-
const destinationTokenInput = fieldOverrides.find((x) => x.label
|
|
315
|
+
let destinationToken = defaultFields.find((x) => x.label === 'destinationToken').value;
|
|
316
|
+
const destinationTokenInput = fieldOverrides.find((x) => x.label === 'destinationToken');
|
|
333
317
|
if (destinationTokenInput) {
|
|
334
318
|
destinationToken = destinationTokenInput.value;
|
|
335
319
|
}
|
|
336
|
-
return (0,
|
|
320
|
+
return (0, rebalance_methods_1.getTakeProfitRebalanceFieldsInfos)(new decimal_js_1.default(lowerRangePrice), new decimal_js_1.default(upperRangePrice), new decimal_js_1.default(destinationToken), true);
|
|
337
321
|
};
|
|
338
322
|
getFieldsForPeriodicRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
339
323
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
340
|
-
const defaultFields = (0,
|
|
341
|
-
let period = new decimal_js_1.default(defaultFields.find((x) => x.label
|
|
342
|
-
const periodInput = fieldOverrides.find((x) => x.label
|
|
324
|
+
const defaultFields = (0, rebalance_methods_1.getDefaultPeriodicRebalanceFieldInfos)(price);
|
|
325
|
+
let period = new decimal_js_1.default(defaultFields.find((x) => x.label === 'period').value);
|
|
326
|
+
const periodInput = fieldOverrides.find((x) => x.label === 'period');
|
|
343
327
|
if (periodInput) {
|
|
344
328
|
period = new decimal_js_1.default(periodInput.value);
|
|
345
329
|
}
|
|
346
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
347
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
330
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label === 'lowerRangeBps').value;
|
|
331
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'lowerRangeBps');
|
|
348
332
|
if (lowerPriceDifferenceBPSInput) {
|
|
349
333
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
350
334
|
}
|
|
351
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
352
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
335
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label === 'upperRangeBps').value;
|
|
336
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'upperRangeBps');
|
|
353
337
|
if (upperPriceDifferenceBPSInput) {
|
|
354
338
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
355
339
|
}
|
|
356
|
-
return (0,
|
|
340
|
+
return (0, rebalance_methods_1.getPeriodicRebalanceRebalanceFieldInfos)(price, period, new decimal_js_1.default(lowerPriceDifferenceBPS), new decimal_js_1.default(upperPriceDifferenceBPS));
|
|
357
341
|
};
|
|
358
342
|
getFieldsForExpanderRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
359
343
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
360
|
-
const defaultFields = (0,
|
|
361
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
362
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
344
|
+
const defaultFields = (0, rebalance_methods_1.getDefaultExpanderRebalanceFieldInfos)(price);
|
|
345
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label === 'lowerRangeBps').value;
|
|
346
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'lowerRangeBps');
|
|
363
347
|
if (lowerPriceDifferenceBPSInput) {
|
|
364
348
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
365
349
|
}
|
|
366
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
367
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
350
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label === 'upperRangeBps').value;
|
|
351
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'upperRangeBps');
|
|
368
352
|
if (upperPriceDifferenceBPSInput) {
|
|
369
353
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
370
354
|
}
|
|
371
|
-
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
372
|
-
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
355
|
+
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label === 'resetLowerRangeBps').value;
|
|
356
|
+
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'resetLowerRangeBps');
|
|
373
357
|
if (lowerResetPriceDifferenceBPSInput) {
|
|
374
358
|
lowerResetPriceDifferenceBPS = lowerResetPriceDifferenceBPSInput.value;
|
|
375
359
|
}
|
|
376
|
-
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
377
|
-
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
360
|
+
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label === 'resetUpperRangeBps').value;
|
|
361
|
+
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label === 'resetUpperRangeBps');
|
|
378
362
|
if (upperResetPriceDifferenceBPSInput) {
|
|
379
363
|
upperResetPriceDifferenceBPS = upperResetPriceDifferenceBPSInput.value;
|
|
380
364
|
}
|
|
381
|
-
let expansionBPS = defaultFields.find((x) => x.label
|
|
382
|
-
const expansionBPSInput = fieldOverrides.find((x) => x.label
|
|
365
|
+
let expansionBPS = defaultFields.find((x) => x.label === 'expansionBps').value;
|
|
366
|
+
const expansionBPSInput = fieldOverrides.find((x) => x.label === 'expansionBps');
|
|
383
367
|
if (expansionBPSInput) {
|
|
384
368
|
expansionBPS = expansionBPSInput.value;
|
|
385
369
|
}
|
|
386
|
-
let maxNumberOfExpansions = defaultFields.find((x) => x.label
|
|
387
|
-
const maxNumberOfExpansionsInput = fieldOverrides.find((x) => x.label
|
|
370
|
+
let maxNumberOfExpansions = defaultFields.find((x) => x.label === 'maxNumberOfExpansions').value;
|
|
371
|
+
const maxNumberOfExpansionsInput = fieldOverrides.find((x) => x.label === 'maxNumberOfExpansions');
|
|
388
372
|
if (maxNumberOfExpansionsInput) {
|
|
389
373
|
maxNumberOfExpansions = maxNumberOfExpansionsInput.value;
|
|
390
374
|
}
|
|
391
|
-
let swapUnevenAllowed = defaultFields.find((x) => x.label
|
|
392
|
-
const swapUnevenAllowedInput = fieldOverrides.find((x) => x.label
|
|
375
|
+
let swapUnevenAllowed = defaultFields.find((x) => x.label === 'swapUnevenAllowed').value;
|
|
376
|
+
const swapUnevenAllowedInput = fieldOverrides.find((x) => x.label === 'swapUnevenAllowed');
|
|
393
377
|
if (swapUnevenAllowedInput) {
|
|
394
378
|
swapUnevenAllowed = swapUnevenAllowedInput.value;
|
|
395
379
|
}
|
|
396
|
-
return (0,
|
|
380
|
+
return (0, rebalance_methods_1.getExpanderRebalanceFieldInfos)(price, new decimal_js_1.default(lowerPriceDifferenceBPS), new decimal_js_1.default(upperPriceDifferenceBPS), new decimal_js_1.default(lowerResetPriceDifferenceBPS), new decimal_js_1.default(upperResetPriceDifferenceBPS), new decimal_js_1.default(expansionBPS), new decimal_js_1.default(maxNumberOfExpansions), new decimal_js_1.default(swapUnevenAllowed));
|
|
397
381
|
};
|
|
398
382
|
getFieldsForAutodriftRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, tickSpacing, poolPrice) => {
|
|
399
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
400
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
383
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenAMint);
|
|
384
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenBMint);
|
|
401
385
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
402
386
|
// TODO: maybe we will need to get real staking price instead of pool price for this to be accurate.
|
|
403
387
|
const defaultFields = (0, autodriftRebalance_1.getDefaultAutodriftRebalanceFieldInfos)(dex, price, tokenADecimals, tokenBDecimals, tickSpacing);
|
|
404
|
-
const lastMidTick = defaultFields.find((x) => x.label
|
|
405
|
-
let initDriftTicksPerEpoch = defaultFields.find((x) => x.label
|
|
406
|
-
const initDriftTicksPerEpochInput = fieldOverrides.find((x) => x.label
|
|
388
|
+
const lastMidTick = defaultFields.find((x) => x.label === 'lastMidTick').value;
|
|
389
|
+
let initDriftTicksPerEpoch = defaultFields.find((x) => x.label === 'initDriftTicksPerEpoch').value;
|
|
390
|
+
const initDriftTicksPerEpochInput = fieldOverrides.find((x) => x.label === 'initDriftTicksPerEpoch');
|
|
407
391
|
if (initDriftTicksPerEpochInput) {
|
|
408
392
|
initDriftTicksPerEpoch = initDriftTicksPerEpochInput.value;
|
|
409
393
|
}
|
|
410
|
-
let ticksBelowMid = defaultFields.find((x) => x.label
|
|
411
|
-
const ticksBelowMidInput = fieldOverrides.find((x) => x.label
|
|
394
|
+
let ticksBelowMid = defaultFields.find((x) => x.label === 'ticksBelowMid').value;
|
|
395
|
+
const ticksBelowMidInput = fieldOverrides.find((x) => x.label === 'ticksBelowMid');
|
|
412
396
|
if (ticksBelowMidInput) {
|
|
413
397
|
ticksBelowMid = ticksBelowMidInput.value;
|
|
414
398
|
}
|
|
415
|
-
let ticksAboveMid = defaultFields.find((x) => x.label
|
|
416
|
-
const ticksAboveMidInput = fieldOverrides.find((x) => x.label
|
|
399
|
+
let ticksAboveMid = defaultFields.find((x) => x.label === 'ticksAboveMid').value;
|
|
400
|
+
const ticksAboveMidInput = fieldOverrides.find((x) => x.label === 'ticksAboveMid');
|
|
417
401
|
if (ticksAboveMidInput) {
|
|
418
402
|
ticksAboveMid = ticksAboveMidInput.value;
|
|
419
403
|
}
|
|
420
|
-
let frontrunMultiplierBps = defaultFields.find((x) => x.label
|
|
421
|
-
const frontrunMultiplierBpsInput = fieldOverrides.find((x) => x.label
|
|
404
|
+
let frontrunMultiplierBps = defaultFields.find((x) => x.label === 'frontrunMultiplierBps').value;
|
|
405
|
+
const frontrunMultiplierBpsInput = fieldOverrides.find((x) => x.label === 'frontrunMultiplierBps');
|
|
422
406
|
if (frontrunMultiplierBpsInput) {
|
|
423
407
|
frontrunMultiplierBps = frontrunMultiplierBpsInput.value;
|
|
424
408
|
}
|
|
425
|
-
let stakingRateASource = defaultFields.find((x) => x.label
|
|
426
|
-
const stakingRateASourceInput = fieldOverrides.find((x) => x.label
|
|
409
|
+
let stakingRateASource = defaultFields.find((x) => x.label === 'stakingRateASource').value;
|
|
410
|
+
const stakingRateASourceInput = fieldOverrides.find((x) => x.label === 'stakingRateASource');
|
|
427
411
|
if (stakingRateASourceInput) {
|
|
428
412
|
stakingRateASource = stakingRateASourceInput.value;
|
|
429
413
|
}
|
|
430
|
-
let stakingRateBSource = defaultFields.find((x) => x.label
|
|
431
|
-
const stakingRateBSourceInput = fieldOverrides.find((x) => x.label
|
|
414
|
+
let stakingRateBSource = defaultFields.find((x) => x.label === 'stakingRateBSource').value;
|
|
415
|
+
const stakingRateBSourceInput = fieldOverrides.find((x) => x.label === 'stakingRateBSource');
|
|
432
416
|
if (stakingRateBSourceInput) {
|
|
433
417
|
stakingRateBSource = stakingRateBSourceInput.value;
|
|
434
418
|
}
|
|
435
|
-
let initialDriftDirection = defaultFields.find((x) => x.label
|
|
436
|
-
const initialDriftDirectionInput = fieldOverrides.find((x) => x.label
|
|
419
|
+
let initialDriftDirection = defaultFields.find((x) => x.label === 'initialDriftDirection').value;
|
|
420
|
+
const initialDriftDirectionInput = fieldOverrides.find((x) => x.label === 'initialDriftDirection');
|
|
437
421
|
if (initialDriftDirectionInput) {
|
|
438
422
|
initialDriftDirection = initialDriftDirectionInput.value;
|
|
439
423
|
}
|
|
@@ -446,27 +430,27 @@ class Kamino {
|
|
|
446
430
|
* @param amountA
|
|
447
431
|
*/
|
|
448
432
|
getPriceForPair = async (dex, poolTokenA, poolTokenB) => {
|
|
449
|
-
if (dex
|
|
433
|
+
if (dex === 'ORCA') {
|
|
450
434
|
const pools = await this.getOrcaPoolsForTokens(poolTokenA, poolTokenB);
|
|
451
|
-
if (pools.length
|
|
435
|
+
if (pools.length === 0) {
|
|
452
436
|
throw new Error(`No pool found for ${poolTokenA.toString()} and ${poolTokenB.toString()}`);
|
|
453
437
|
}
|
|
454
438
|
return pools[0].price;
|
|
455
439
|
}
|
|
456
|
-
else if (dex
|
|
440
|
+
else if (dex === 'RAYDIUM') {
|
|
457
441
|
const pools = await this.getRaydiumPoolsForTokens(poolTokenA, poolTokenB);
|
|
458
|
-
if (pools.length
|
|
442
|
+
if (pools.length === 0) {
|
|
459
443
|
throw new Error(`No pool found for ${poolTokenA.toString()} and ${poolTokenB.toString()}`);
|
|
460
444
|
}
|
|
461
445
|
return pools[0].price;
|
|
462
446
|
}
|
|
463
|
-
else if (dex
|
|
447
|
+
else if (dex === 'METEORA') {
|
|
464
448
|
const pools = await this.getMeteoraPoolsForTokens(poolTokenA, poolTokenB);
|
|
465
|
-
if (pools.length
|
|
449
|
+
if (pools.length === 0) {
|
|
466
450
|
throw new Error(`No pool found for ${poolTokenA.toString()} and ${poolTokenB.toString()}`);
|
|
467
451
|
}
|
|
468
|
-
const decimalsX = await (0, utils_1.getMintDecimals)(this.
|
|
469
|
-
const decimalsY = await (0, utils_1.getMintDecimals)(this.
|
|
452
|
+
const decimalsX = await (0, utils_1.getMintDecimals)(this._rpc, poolTokenA);
|
|
453
|
+
const decimalsY = await (0, utils_1.getMintDecimals)(this._rpc, poolTokenB);
|
|
470
454
|
return (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(pools[0].pool.activeId, pools[0].pool.binStep, decimalsX, decimalsY).toNumber();
|
|
471
455
|
}
|
|
472
456
|
else {
|
|
@@ -475,23 +459,23 @@ class Kamino {
|
|
|
475
459
|
};
|
|
476
460
|
getDefaultRebalanceFields = async (dex, poolTokenA, poolTokenB, tickSpacing, rebalanceMethod) => {
|
|
477
461
|
const price = new decimal_js_1.default(await this.getPriceForPair(dex, poolTokenA, poolTokenB));
|
|
478
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
479
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
462
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, poolTokenA);
|
|
463
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, poolTokenB);
|
|
480
464
|
switch (rebalanceMethod) {
|
|
481
465
|
case CreationParameters_1.ManualRebalanceMethod:
|
|
482
466
|
return (0, rebalance_methods_1.getDefaultManualRebalanceFieldInfos)(price);
|
|
483
467
|
case CreationParameters_1.PricePercentageRebalanceMethod:
|
|
484
|
-
return (0,
|
|
468
|
+
return (0, rebalance_methods_1.getDefaultPricePercentageRebalanceFieldInfos)(price);
|
|
485
469
|
case CreationParameters_1.PricePercentageWithResetRangeRebalanceMethod:
|
|
486
|
-
return (0,
|
|
470
|
+
return (0, rebalance_methods_1.getDefaultPricePercentageWithResetRebalanceFieldInfos)(price);
|
|
487
471
|
case CreationParameters_1.DriftRebalanceMethod:
|
|
488
|
-
return (0,
|
|
472
|
+
return (0, rebalance_methods_1.getDefaultDriftRebalanceFieldInfos)(dex, tickSpacing, price, tokenADecimals, tokenBDecimals);
|
|
489
473
|
case CreationParameters_1.TakeProfitMethod:
|
|
490
|
-
return (0,
|
|
474
|
+
return (0, rebalance_methods_1.getDefaultTakeProfitRebalanceFieldsInfos)(price);
|
|
491
475
|
case CreationParameters_1.PeriodicRebalanceMethod:
|
|
492
|
-
return (0,
|
|
476
|
+
return (0, rebalance_methods_1.getDefaultPeriodicRebalanceFieldInfos)(price);
|
|
493
477
|
case CreationParameters_1.ExpanderMethod:
|
|
494
|
-
return (0,
|
|
478
|
+
return (0, rebalance_methods_1.getDefaultExpanderRebalanceFieldInfos)(price);
|
|
495
479
|
case CreationParameters_1.AutodriftMethod:
|
|
496
480
|
return (0, autodriftRebalance_1.getDefaultAutodriftRebalanceFieldInfos)(dex, price, tokenADecimals, tokenBDecimals, tickSpacing);
|
|
497
481
|
default:
|
|
@@ -502,17 +486,17 @@ class Kamino {
|
|
|
502
486
|
* Return a the pubkey of the pool in a given dex, for given mints and fee tier; if that pool doesn't exist, return default pubkey
|
|
503
487
|
*/
|
|
504
488
|
getPoolInitializedForDexPairTier = async (dex, poolTokenA, poolTokenB, feeBPS) => {
|
|
505
|
-
if (dex
|
|
506
|
-
let pool =
|
|
489
|
+
if (dex === 'ORCA') {
|
|
490
|
+
let pool = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
507
491
|
const orcaPools = await this.getOrcaPoolsForTokens(poolTokenA, poolTokenB);
|
|
508
492
|
orcaPools.forEach((element) => {
|
|
509
|
-
if (element.lpFeeRate * CreationParameters_1.FullBPS
|
|
510
|
-
pool =
|
|
493
|
+
if (element.lpFeeRate * CreationParameters_1.FullBPS === feeBPS.toNumber()) {
|
|
494
|
+
pool = (0, kit_1.address)(element.address);
|
|
511
495
|
}
|
|
512
496
|
});
|
|
513
497
|
return pool;
|
|
514
498
|
}
|
|
515
|
-
else if (dex
|
|
499
|
+
else if (dex === 'RAYDIUM') {
|
|
516
500
|
const pools = [];
|
|
517
501
|
const raydiumPools = await this.getRaydiumPoolsForTokens(poolTokenA, poolTokenB);
|
|
518
502
|
raydiumPools.forEach((element) => {
|
|
@@ -520,26 +504,26 @@ class Kamino {
|
|
|
520
504
|
pools.push(element);
|
|
521
505
|
}
|
|
522
506
|
});
|
|
523
|
-
if (pools.length
|
|
524
|
-
return
|
|
507
|
+
if (pools.length === 0) {
|
|
508
|
+
return pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
525
509
|
}
|
|
526
|
-
let pool =
|
|
510
|
+
let pool = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
527
511
|
let tickSpacing = Number.MAX_VALUE;
|
|
528
512
|
pools.forEach((element) => {
|
|
529
513
|
if (element.ammConfig.tickSpacing < tickSpacing) {
|
|
530
|
-
pool =
|
|
514
|
+
pool = (0, kit_1.address)(element.id);
|
|
531
515
|
tickSpacing = element.ammConfig.tickSpacing;
|
|
532
516
|
}
|
|
533
517
|
});
|
|
534
518
|
return pool;
|
|
535
519
|
}
|
|
536
|
-
else if (dex
|
|
537
|
-
let pool =
|
|
520
|
+
else if (dex === 'METEORA') {
|
|
521
|
+
let pool = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
538
522
|
const pools = await this.getMeteoraPoolsForTokens(poolTokenA, poolTokenB);
|
|
539
523
|
pools.forEach((element) => {
|
|
540
524
|
const feeRateBps = element.pool.parameters.baseFactor * element.pool.binStep;
|
|
541
|
-
if (feeRateBps
|
|
542
|
-
pool =
|
|
525
|
+
if (feeRateBps === feeBPS.toNumber()) {
|
|
526
|
+
pool = (0, kit_1.address)(element.key);
|
|
543
527
|
}
|
|
544
528
|
});
|
|
545
529
|
return pool;
|
|
@@ -552,21 +536,21 @@ class Kamino {
|
|
|
552
536
|
* Return generic information for all pools in a given dex, for given mints and fee tier
|
|
553
537
|
*/
|
|
554
538
|
async getExistentPoolsForPair(dex, tokenMintA, tokenMintB) {
|
|
555
|
-
if (dex
|
|
539
|
+
if (dex === 'ORCA') {
|
|
556
540
|
const pools = await this.getOrcaPoolsForTokens(tokenMintA, tokenMintB);
|
|
557
541
|
const genericPoolInfos = await Promise.all(pools.map(async (pool) => {
|
|
558
|
-
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex,
|
|
542
|
+
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex, (0, kit_1.address)(pool.address)));
|
|
559
543
|
// read price from pool
|
|
560
|
-
const poolData = await this._orcaService.getPool(
|
|
544
|
+
const poolData = await this._orcaService.getPool((0, kit_1.address)(pool.address));
|
|
561
545
|
if (!poolData) {
|
|
562
546
|
throw new Error(`Pool ${pool.address} not found`);
|
|
563
547
|
}
|
|
564
548
|
const poolInfo = {
|
|
565
549
|
dex,
|
|
566
|
-
address:
|
|
567
|
-
price: poolData.
|
|
568
|
-
tokenMintA:
|
|
569
|
-
tokenMintB:
|
|
550
|
+
address: (0, kit_1.address)(pool.address),
|
|
551
|
+
price: (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(poolData.sqrtPrice, pool.tokenA.decimals, pool.tokenB.decimals),
|
|
552
|
+
tokenMintA: (0, kit_1.address)(pool.tokenA.mint),
|
|
553
|
+
tokenMintB: (0, kit_1.address)(pool.tokenB.mint),
|
|
570
554
|
tvl: pool.tvl ? new decimal_js_1.default(pool.tvl) : undefined,
|
|
571
555
|
feeRate: new decimal_js_1.default(pool.lpFeeRate).mul(CreationParameters_1.FullBPS),
|
|
572
556
|
volumeOnLast7d: pool.volume ? new decimal_js_1.default(pool.volume.week) : undefined,
|
|
@@ -577,16 +561,16 @@ class Kamino {
|
|
|
577
561
|
}));
|
|
578
562
|
return genericPoolInfos;
|
|
579
563
|
}
|
|
580
|
-
else if (dex
|
|
564
|
+
else if (dex === 'RAYDIUM') {
|
|
581
565
|
const pools = await this.getRaydiumPoolsForTokens(tokenMintA, tokenMintB);
|
|
582
566
|
const genericPoolInfos = await Promise.all(pools.map(async (pool) => {
|
|
583
|
-
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex,
|
|
567
|
+
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex, (0, kit_1.address)(pool.id)));
|
|
584
568
|
const poolInfo = {
|
|
585
569
|
dex,
|
|
586
|
-
address:
|
|
570
|
+
address: (0, kit_1.address)(pool.id),
|
|
587
571
|
price: new decimal_js_1.default(pool.price),
|
|
588
|
-
tokenMintA:
|
|
589
|
-
tokenMintB:
|
|
572
|
+
tokenMintA: (0, kit_1.address)(pool.mintA),
|
|
573
|
+
tokenMintB: (0, kit_1.address)(pool.mintB),
|
|
590
574
|
tvl: new decimal_js_1.default(pool.tvl),
|
|
591
575
|
feeRate: new decimal_js_1.default(pool.ammConfig.tradeFeeRate).div(new decimal_js_1.default(CreationParameters_1.FullPercentage)),
|
|
592
576
|
volumeOnLast7d: new decimal_js_1.default(pool.week.volume),
|
|
@@ -597,12 +581,12 @@ class Kamino {
|
|
|
597
581
|
}));
|
|
598
582
|
return genericPoolInfos;
|
|
599
583
|
}
|
|
600
|
-
else if (dex
|
|
584
|
+
else if (dex === 'METEORA') {
|
|
601
585
|
const pools = await this.getMeteoraPoolsForTokens(tokenMintA, tokenMintB);
|
|
602
586
|
const genericPoolInfos = await Promise.all(pools.map(async (pool) => {
|
|
603
587
|
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex, pool.key));
|
|
604
|
-
const decimalsX = await (0, utils_1.getMintDecimals)(this.
|
|
605
|
-
const decimalsY = await (0, utils_1.getMintDecimals)(this.
|
|
588
|
+
const decimalsX = await (0, utils_1.getMintDecimals)(this._rpc, pool.pool.tokenXMint);
|
|
589
|
+
const decimalsY = await (0, utils_1.getMintDecimals)(this._rpc, pool.pool.tokenYMint);
|
|
606
590
|
const price = (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(pool.pool.activeId, pool.pool.binStep, decimalsX, decimalsY);
|
|
607
591
|
const poolInfo = {
|
|
608
592
|
dex,
|
|
@@ -630,8 +614,8 @@ class Kamino {
|
|
|
630
614
|
const poolTokenBString = poolTokenB.toString();
|
|
631
615
|
const whirlpools = await this._orcaService.getOrcaWhirlpools();
|
|
632
616
|
whirlpools.whirlpools.forEach((element) => {
|
|
633
|
-
if ((element.tokenA.mint
|
|
634
|
-
(element.tokenA.mint
|
|
617
|
+
if ((element.tokenA.mint === poolTokenAString && element.tokenB.mint === poolTokenBString) ||
|
|
618
|
+
(element.tokenA.mint === poolTokenBString && element.tokenB.mint === poolTokenAString))
|
|
635
619
|
pools.push(element);
|
|
636
620
|
});
|
|
637
621
|
return pools;
|
|
@@ -642,8 +626,8 @@ class Kamino {
|
|
|
642
626
|
const poolTokenBString = poolTokenB.toString();
|
|
643
627
|
const raydiumPools = await this._raydiumService.getRaydiumWhirlpools();
|
|
644
628
|
raydiumPools.data.forEach((element) => {
|
|
645
|
-
if ((element.mintA
|
|
646
|
-
(element.mintA
|
|
629
|
+
if ((element.mintA === poolTokenAString && element.mintB === poolTokenBString) ||
|
|
630
|
+
(element.mintA === poolTokenBString && element.mintB === poolTokenAString)) {
|
|
647
631
|
pools.push(element);
|
|
648
632
|
}
|
|
649
633
|
});
|
|
@@ -653,8 +637,8 @@ class Kamino {
|
|
|
653
637
|
const pools = [];
|
|
654
638
|
const meteoraPools = await this._meteoraService.getMeteoraPools();
|
|
655
639
|
meteoraPools.forEach((element) => {
|
|
656
|
-
if ((element.pool.tokenXMint
|
|
657
|
-
(element.pool.tokenXMint
|
|
640
|
+
if ((element.pool.tokenXMint === poolTokenA && element.pool.tokenYMint === poolTokenB) ||
|
|
641
|
+
(element.pool.tokenXMint === poolTokenB && element.pool.tokenYMint === poolTokenA)) {
|
|
658
642
|
pools.push(element);
|
|
659
643
|
}
|
|
660
644
|
});
|
|
@@ -693,35 +677,39 @@ class Kamino {
|
|
|
693
677
|
getAllStrategiesWithFilters = async (strategyFilters) => {
|
|
694
678
|
const filters = [];
|
|
695
679
|
filters.push({
|
|
696
|
-
dataSize: accounts_1.WhirlpoolStrategy.layout.span + 8,
|
|
680
|
+
dataSize: BigInt(accounts_1.WhirlpoolStrategy.layout.span + 8),
|
|
697
681
|
});
|
|
698
682
|
filters.push({
|
|
699
683
|
memcmp: {
|
|
700
|
-
offset:
|
|
684
|
+
offset: 0n,
|
|
701
685
|
bytes: bs58_1.default.encode(accounts_1.WhirlpoolStrategy.discriminator),
|
|
686
|
+
encoding: 'base58',
|
|
702
687
|
},
|
|
703
688
|
});
|
|
704
689
|
if (strategyFilters.owner) {
|
|
705
690
|
filters.push({
|
|
706
691
|
memcmp: {
|
|
707
|
-
|
|
708
|
-
|
|
692
|
+
offset: 8n,
|
|
693
|
+
bytes: strategyFilters.owner,
|
|
694
|
+
encoding: 'base58',
|
|
709
695
|
},
|
|
710
696
|
});
|
|
711
697
|
}
|
|
712
698
|
if (strategyFilters.strategyCreationStatus) {
|
|
713
699
|
filters.push({
|
|
714
700
|
memcmp: {
|
|
701
|
+
offset: 1625n,
|
|
715
702
|
bytes: (0, utils_1.strategyCreationStatusToBase58)(strategyFilters.strategyCreationStatus),
|
|
716
|
-
|
|
703
|
+
encoding: 'base58',
|
|
717
704
|
},
|
|
718
705
|
});
|
|
719
706
|
}
|
|
720
707
|
if (strategyFilters.strategyType) {
|
|
721
708
|
filters.push({
|
|
722
709
|
memcmp: {
|
|
710
|
+
offset: 1120n,
|
|
723
711
|
bytes: (0, utils_1.strategyTypeToBase58)(strategyFilters.strategyType).toString(),
|
|
724
|
-
|
|
712
|
+
encoding: 'base58',
|
|
725
713
|
},
|
|
726
714
|
});
|
|
727
715
|
}
|
|
@@ -729,16 +717,20 @@ class Kamino {
|
|
|
729
717
|
const value = !strategyFilters.isCommunity ? '1' : '2';
|
|
730
718
|
filters.push({
|
|
731
719
|
memcmp: {
|
|
720
|
+
offset: 1664n,
|
|
732
721
|
bytes: value,
|
|
733
|
-
|
|
722
|
+
encoding: 'base58',
|
|
734
723
|
},
|
|
735
724
|
});
|
|
736
725
|
}
|
|
737
|
-
return (await this.
|
|
726
|
+
return (await this._rpc
|
|
727
|
+
.getProgramAccounts(this.getProgramID(), {
|
|
738
728
|
filters,
|
|
739
|
-
|
|
729
|
+
encoding: 'base64',
|
|
730
|
+
})
|
|
731
|
+
.send()).map((x) => {
|
|
740
732
|
const res = {
|
|
741
|
-
strategy: accounts_1.WhirlpoolStrategy.decode(x.account.data),
|
|
733
|
+
strategy: accounts_1.WhirlpoolStrategy.decode(Buffer.from(x.account.data[0], 'base64')),
|
|
742
734
|
address: x.pubkey,
|
|
743
735
|
};
|
|
744
736
|
return res;
|
|
@@ -754,32 +746,38 @@ class Kamino {
|
|
|
754
746
|
* @param kTokenMint - mint address of the kToken
|
|
755
747
|
*/
|
|
756
748
|
getStrategyByKTokenMint = async (kTokenMint) => {
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
{
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
},
|
|
749
|
+
const filters = [
|
|
750
|
+
{
|
|
751
|
+
dataSize: BigInt(accounts_1.WhirlpoolStrategy.layout.span + 8),
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
memcmp: {
|
|
755
|
+
offset: 0n,
|
|
756
|
+
bytes: bs58_1.default.encode(accounts_1.WhirlpoolStrategy.discriminator),
|
|
757
|
+
encoding: 'base58',
|
|
767
758
|
},
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
memcmp: {
|
|
762
|
+
bytes: kTokenMint,
|
|
763
|
+
offset: 720n,
|
|
764
|
+
encoding: 'base58',
|
|
773
765
|
},
|
|
774
|
-
|
|
775
|
-
|
|
766
|
+
},
|
|
767
|
+
];
|
|
768
|
+
const matchingStrategies = await this._rpc
|
|
769
|
+
.getProgramAccounts(this.getProgramID(), {
|
|
770
|
+
filters,
|
|
771
|
+
encoding: 'base64',
|
|
772
|
+
})
|
|
773
|
+
.send();
|
|
776
774
|
if (matchingStrategies.length === 0) {
|
|
777
775
|
return null;
|
|
778
776
|
}
|
|
779
777
|
if (matchingStrategies.length > 1) {
|
|
780
|
-
throw new Error(`Multiple strategies found for kToken mint: ${kTokenMint
|
|
778
|
+
throw new Error(`Multiple strategies found for kToken mint: ${kTokenMint}. Strategies found: ${matchingStrategies.map((x) => x.pubkey)}`);
|
|
781
779
|
}
|
|
782
|
-
const decodedStrategy = accounts_1.WhirlpoolStrategy.decode(matchingStrategies[0].account.data);
|
|
780
|
+
const decodedStrategy = accounts_1.WhirlpoolStrategy.decode(Buffer.from(matchingStrategies[0].account.data[0], 'base64'));
|
|
783
781
|
return {
|
|
784
782
|
address: matchingStrategies[0].pubkey,
|
|
785
783
|
strategy: decodedStrategy,
|
|
@@ -802,6 +800,19 @@ class Kamino {
|
|
|
802
800
|
return { price: balances.computedHoldings.totalSum.div(sharesIssued).mul(sharesFactor), balance: balances };
|
|
803
801
|
}
|
|
804
802
|
};
|
|
803
|
+
/**
|
|
804
|
+
* Get the token A and B per share for the specified Kamino whirlpool strategy
|
|
805
|
+
* @param strategy
|
|
806
|
+
*/
|
|
807
|
+
getTokenAAndBPerShare = async (strategy) => {
|
|
808
|
+
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
809
|
+
const sharesIssued = new decimal_js_1.default(strategyState.strategy.sharesIssued.toString());
|
|
810
|
+
const balances = await this.getStrategyBalances(strategyState.strategy);
|
|
811
|
+
if (sharesIssued.isZero()) {
|
|
812
|
+
return { a: new decimal_js_1.default(0), b: new decimal_js_1.default(0) };
|
|
813
|
+
}
|
|
814
|
+
return { a: balances.tokenAAmounts.div(sharesIssued), b: balances.tokenBAmounts.div(sharesIssued) };
|
|
815
|
+
};
|
|
805
816
|
/**
|
|
806
817
|
* Batch fetch share data for all or a filtered list of strategies
|
|
807
818
|
* @param strategyFilters strategy filters or a list of strategy public keys
|
|
@@ -817,16 +828,16 @@ class Kamino {
|
|
|
817
828
|
const allScopePrices = strategiesWithAddresses.map((x) => x.strategy.scopePrices);
|
|
818
829
|
const scopePrices = await this._scope.getMultipleOraclePrices(allScopePrices);
|
|
819
830
|
const scopePricesMap = scopePrices.reduce((map, [address, price]) => {
|
|
820
|
-
map[address
|
|
831
|
+
map[address] = price;
|
|
821
832
|
return map;
|
|
822
833
|
}, {});
|
|
823
|
-
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') &&
|
|
834
|
+
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') && x.strategy.position !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
824
835
|
const raydiumPoolsPromise = this.getRaydiumPools(raydiumStrategies.map((x) => x.strategy.pool));
|
|
825
836
|
const raydiumPositionsPromise = this.getRaydiumPositions(raydiumStrategies.map((x) => x.strategy.position));
|
|
826
|
-
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') &&
|
|
837
|
+
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') && x.strategy.position !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
827
838
|
const orcaPoolsPromise = this.getWhirlpools(orcaStrategies.map((x) => x.strategy.pool));
|
|
828
839
|
const orcaPositionsPromise = this.getOrcaPositions(orcaStrategies.map((x) => x.strategy.position));
|
|
829
|
-
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') &&
|
|
840
|
+
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') && x.strategy.position !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
830
841
|
const meteoraPoolsPromise = this.getMeteoraPools(meteoraStrategies.map((x) => x.strategy.pool));
|
|
831
842
|
const meteoraPositionsPromise = this.getMeteoraPositions(meteoraStrategies.map((x) => x.strategy.position));
|
|
832
843
|
const [raydiumPools, raydiumPositions, orcaPools, orcaPositions, meteoraPools, meteoraPositions] = await Promise.all([
|
|
@@ -837,11 +848,11 @@ class Kamino {
|
|
|
837
848
|
meteoraPoolsPromise,
|
|
838
849
|
meteoraPositionsPromise,
|
|
839
850
|
]);
|
|
840
|
-
const inactiveStrategies = strategiesWithAddresses.filter((x) => x.strategy.position.
|
|
851
|
+
const inactiveStrategies = strategiesWithAddresses.filter((x) => x.strategy.position === pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
841
852
|
const collInfos = collateralInfos ? collateralInfos : await this.getCollateralInfos();
|
|
842
853
|
const disabledPrices = disabledTokensPrices ? disabledTokensPrices : await this.getDisabledTokensPrices(collInfos);
|
|
843
854
|
for (const { strategy, address } of inactiveStrategies) {
|
|
844
|
-
const strategyPrices = await this.getStrategyPrices(strategy, collInfos, scopePricesMap[strategy.scopePrices
|
|
855
|
+
const strategyPrices = await this.getStrategyPrices(strategy, collInfos, scopePricesMap[strategy.scopePrices], disabledPrices);
|
|
845
856
|
result.push({
|
|
846
857
|
address,
|
|
847
858
|
strategy,
|
|
@@ -893,7 +904,7 @@ class Kamino {
|
|
|
893
904
|
if (!position) {
|
|
894
905
|
throw new Error(`Position ${strategy.position.toString()} could not be found.`);
|
|
895
906
|
}
|
|
896
|
-
fetchBalances.push(fetchBalance(strategy, pool, position, collateralInfos, prices ? prices[strategy.scopePrices
|
|
907
|
+
fetchBalances.push(fetchBalance(strategy, pool, position, collateralInfos, prices ? prices[strategy.scopePrices] : undefined, disabledTokensPrices).then((balance) => {
|
|
897
908
|
return { balance, strategyWithAddress: { strategy, address } };
|
|
898
909
|
}));
|
|
899
910
|
}
|
|
@@ -916,11 +927,11 @@ class Kamino {
|
|
|
916
927
|
let upperResetPrice = null;
|
|
917
928
|
const dex = (0, utils_1.numberToDex)(strategy.strategyDex.toNumber());
|
|
918
929
|
if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
919
|
-
const state = (0,
|
|
930
|
+
const state = (0, rebalance_methods_1.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
920
931
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
921
932
|
}
|
|
922
933
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
923
|
-
const state = (0,
|
|
934
|
+
const state = (0, rebalance_methods_1.deserializeExpanderRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
924
935
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
925
936
|
}
|
|
926
937
|
const balance = {
|
|
@@ -954,11 +965,11 @@ class Kamino {
|
|
|
954
965
|
let upperResetPrice = null;
|
|
955
966
|
const dex = (0, utils_1.numberToDex)(strategy.strategyDex.toNumber());
|
|
956
967
|
if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
957
|
-
const state = (0,
|
|
968
|
+
const state = (0, rebalance_methods_1.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
958
969
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
959
970
|
}
|
|
960
971
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
961
|
-
const state = (0,
|
|
972
|
+
const state = (0, rebalance_methods_1.deserializeExpanderRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
962
973
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
963
974
|
}
|
|
964
975
|
const balance = {
|
|
@@ -1033,11 +1044,11 @@ class Kamino {
|
|
|
1033
1044
|
let upperResetPrice = null;
|
|
1034
1045
|
const dex = (0, utils_1.numberToDex)(strategy.strategyDex.toNumber());
|
|
1035
1046
|
if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
1036
|
-
const state = (0,
|
|
1047
|
+
const state = (0, rebalance_methods_1.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
1037
1048
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
1038
1049
|
}
|
|
1039
1050
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
1040
|
-
const state = (0,
|
|
1051
|
+
const state = (0, rebalance_methods_1.deserializeExpanderRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
1041
1052
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
1042
1053
|
}
|
|
1043
1054
|
const balance = {
|
|
@@ -1049,7 +1060,7 @@ class Kamino {
|
|
|
1049
1060
|
return balance;
|
|
1050
1061
|
};
|
|
1051
1062
|
getOrcaTokensBalances = (strategy, pool, position, mode = 'WITHDRAW') => {
|
|
1052
|
-
const quote = (0,
|
|
1063
|
+
const quote = (0, whirlpools_1.getRemoveLiquidityQuote)({
|
|
1053
1064
|
positionAddress: strategy.position,
|
|
1054
1065
|
liquidity: position.liquidity,
|
|
1055
1066
|
slippageTolerance: whirlpool_sdk_1.Percentage.fromFraction(0, 1000),
|
|
@@ -1099,7 +1110,7 @@ class Kamino {
|
|
|
1099
1110
|
}
|
|
1100
1111
|
};
|
|
1101
1112
|
getTokenAccountBalance = async (tokenAccount) => {
|
|
1102
|
-
const tokenAccountBalance = await this.
|
|
1113
|
+
const tokenAccountBalance = await this._rpc.getTokenAccountBalance(tokenAccount).send();
|
|
1103
1114
|
if (!tokenAccountBalance.value) {
|
|
1104
1115
|
throw new Error(`Could not get token account balance for ${tokenAccount.toString()}.`);
|
|
1105
1116
|
}
|
|
@@ -1110,7 +1121,7 @@ class Kamino {
|
|
|
1110
1121
|
* @param tokenAccount
|
|
1111
1122
|
*/
|
|
1112
1123
|
getTokenAccountBalanceOrZero = async (tokenAccount) => {
|
|
1113
|
-
const tokenAccountExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
1124
|
+
const tokenAccountExists = await (0, transactions_1.checkIfAccountExists)(this._rpc, tokenAccount);
|
|
1114
1125
|
if (tokenAccountExists) {
|
|
1115
1126
|
return await this.getTokenAccountBalance(tokenAccount);
|
|
1116
1127
|
}
|
|
@@ -1124,13 +1135,13 @@ class Kamino {
|
|
|
1124
1135
|
if (!disabledPrices) {
|
|
1125
1136
|
disabledPrices = await this.getDisabledTokensPrices(collateralInfos);
|
|
1126
1137
|
}
|
|
1127
|
-
if (strategy.strategyDex.toNumber()
|
|
1138
|
+
if (strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
1128
1139
|
return this.getStrategyBalancesOrca(strategy, collateralInfos, scopePrices, disabledPrices);
|
|
1129
1140
|
}
|
|
1130
|
-
else if (strategy.strategyDex.toNumber()
|
|
1141
|
+
else if (strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1131
1142
|
return this.getStrategyBalancesRaydium(strategy, collateralInfos, scopePrices, disabledPrices);
|
|
1132
1143
|
}
|
|
1133
|
-
else if (strategy.strategyDex.toNumber()
|
|
1144
|
+
else if (strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
1134
1145
|
return this.getStrategyBalancesMeteora(strategy, collateralInfos, scopePrices, disabledPrices);
|
|
1135
1146
|
}
|
|
1136
1147
|
else {
|
|
@@ -1138,41 +1149,31 @@ class Kamino {
|
|
|
1138
1149
|
}
|
|
1139
1150
|
};
|
|
1140
1151
|
getStrategyTokensBalances = async (strategy, mode = 'WITHDRAW') => {
|
|
1141
|
-
if (strategy.strategyDex.toNumber()
|
|
1142
|
-
const [whirlpoolAcc, positionAcc] = await this.getConnection().
|
|
1143
|
-
strategy.pool,
|
|
1144
|
-
strategy.position,
|
|
1145
|
-
]);
|
|
1152
|
+
if (strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
1153
|
+
const [whirlpoolAcc, positionAcc] = (await this.getConnection().getMultipleAccounts([strategy.pool, strategy.position]).send()).value;
|
|
1146
1154
|
if (!whirlpoolAcc) {
|
|
1147
1155
|
throw Error(`Could not fetch Orca whirlpool state with pubkey ${strategy.pool.toString()}`);
|
|
1148
1156
|
}
|
|
1149
1157
|
if (!positionAcc) {
|
|
1150
1158
|
throw Error(`Could not fetch Orca whirlpool position state with pubkey ${strategy.position.toString()}`);
|
|
1151
1159
|
}
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1154
|
-
whirlpools_client_1.Position.decode(positionAcc.data),
|
|
1155
|
-
]);
|
|
1160
|
+
const whirlpool = accounts_2.Whirlpool.decode(Buffer.from(whirlpoolAcc.data[0], 'base64'));
|
|
1161
|
+
const position = accounts_2.Position.decode(Buffer.from(positionAcc.data[0], 'base64'));
|
|
1156
1162
|
return this.getOrcaTokensBalances(strategy, whirlpool, position, mode);
|
|
1157
1163
|
}
|
|
1158
|
-
else if (strategy.strategyDex.toNumber()
|
|
1159
|
-
const [poolStateAcc, positionAcc] = await this.getConnection().
|
|
1160
|
-
strategy.pool,
|
|
1161
|
-
strategy.position,
|
|
1162
|
-
]);
|
|
1164
|
+
else if (strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1165
|
+
const [poolStateAcc, positionAcc] = (await this.getConnection().getMultipleAccounts([strategy.pool, strategy.position]).send()).value;
|
|
1163
1166
|
if (!poolStateAcc) {
|
|
1164
1167
|
throw Error(`Could not fetch Raydium pool state with pubkey ${strategy.pool.toString()}`);
|
|
1165
1168
|
}
|
|
1166
1169
|
if (!positionAcc) {
|
|
1167
1170
|
throw Error(`Could not fetch Raydium position state with pubkey ${strategy.position.toString()}`);
|
|
1168
1171
|
}
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
raydium_client_1.PersonalPositionState.decode(positionAcc.data),
|
|
1172
|
-
]);
|
|
1172
|
+
const poolState = accounts_3.PoolState.decode(Buffer.from(poolStateAcc.data[0], 'base64'));
|
|
1173
|
+
const position = accounts_3.PersonalPositionState.decode(Buffer.from(positionAcc.data[0], 'base64'));
|
|
1173
1174
|
return this.getRaydiumTokensBalances(strategy, poolState, position, mode);
|
|
1174
1175
|
}
|
|
1175
|
-
else if (strategy.strategyDex.toNumber()
|
|
1176
|
+
else if (strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
1176
1177
|
return this.getMeteoraTokensBalances(strategy);
|
|
1177
1178
|
}
|
|
1178
1179
|
else {
|
|
@@ -1187,21 +1188,21 @@ class Kamino {
|
|
|
1187
1188
|
const strategies = await this.getStrategiesShareData({ strategyCreationStatus: 'LIVE' });
|
|
1188
1189
|
let totalTokenAmount = new decimal_js_1.default(0);
|
|
1189
1190
|
const vaults = [];
|
|
1190
|
-
for (const { strategy, address, shareData } of strategies) {
|
|
1191
|
+
for (const { strategy, address: ad, shareData } of strategies) {
|
|
1191
1192
|
const aTotal = shareData.balance.computedHoldings.invested.a.plus(shareData.balance.computedHoldings.available.a);
|
|
1192
1193
|
const bTotal = shareData.balance.computedHoldings.invested.b.plus(shareData.balance.computedHoldings.available.b);
|
|
1193
1194
|
let amount = new decimal_js_1.default(0);
|
|
1194
|
-
if (strategy.tokenAMint
|
|
1195
|
+
if (strategy.tokenAMint === (0, kit_1.address)(tokenMint) && aTotal.greaterThan(0)) {
|
|
1195
1196
|
amount = aTotal;
|
|
1196
1197
|
}
|
|
1197
|
-
else if (strategy.tokenBMint
|
|
1198
|
+
else if (strategy.tokenBMint === (0, kit_1.address)(tokenMint) && bTotal.greaterThan(0)) {
|
|
1198
1199
|
amount = bTotal;
|
|
1199
1200
|
}
|
|
1200
1201
|
if (amount.greaterThan(0)) {
|
|
1201
1202
|
totalTokenAmount = totalTokenAmount.plus(amount);
|
|
1202
1203
|
vaults.push({
|
|
1203
|
-
address:
|
|
1204
|
-
frontendUrl: `${constants_1.FRONTEND_KAMINO_STRATEGY_URL}/${
|
|
1204
|
+
address: ad,
|
|
1205
|
+
frontendUrl: `${constants_1.FRONTEND_KAMINO_STRATEGY_URL}/${ad}`,
|
|
1205
1206
|
amount,
|
|
1206
1207
|
});
|
|
1207
1208
|
}
|
|
@@ -1209,66 +1210,53 @@ class Kamino {
|
|
|
1209
1210
|
return { totalTokenAmount, vaults, timestamp: new Date() };
|
|
1210
1211
|
};
|
|
1211
1212
|
getAccountOwner = async (pk) => {
|
|
1212
|
-
const acc = await this.getConnection().getAccountInfo(pk);
|
|
1213
|
-
if (acc
|
|
1214
|
-
throw Error(`Could not fetch mint ${pk
|
|
1213
|
+
const acc = await this.getConnection().getAccountInfo(pk).send();
|
|
1214
|
+
if (acc.value === null) {
|
|
1215
|
+
throw Error(`Could not fetch mint ${pk}`);
|
|
1215
1216
|
}
|
|
1216
|
-
return acc.owner;
|
|
1217
|
+
return acc.value.owner;
|
|
1217
1218
|
};
|
|
1218
1219
|
getStrategyBalancesOrca = async (strategy, collateralInfos, scopePrices, disabledTokensPrices) => {
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
strategy.position,
|
|
1222
|
-
]);
|
|
1220
|
+
const res = await this.getConnection().getMultipleAccounts([strategy.pool, strategy.position]).send();
|
|
1221
|
+
const [whirlpoolAcc, positionAcc] = res.value;
|
|
1223
1222
|
if (!whirlpoolAcc) {
|
|
1224
1223
|
throw Error(`Could not fetch Orca whirlpool state with pubkey ${strategy.pool.toString()}`);
|
|
1225
1224
|
}
|
|
1226
1225
|
if (!positionAcc) {
|
|
1227
1226
|
throw Error(`Could not fetch Orca whirlpool position state with pubkey ${strategy.position.toString()}`);
|
|
1228
1227
|
}
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1231
|
-
whirlpools_client_1.Position.decode(positionAcc.data),
|
|
1232
|
-
]);
|
|
1228
|
+
const whirlpool = accounts_2.Whirlpool.decode(Buffer.from(whirlpoolAcc.data[0], 'base64'));
|
|
1229
|
+
const position = accounts_2.Position.decode(Buffer.from(positionAcc.data[0], 'base64'));
|
|
1233
1230
|
return this.getOrcaBalances(strategy, whirlpool, position, collateralInfos, scopePrices, disabledTokensPrices, undefined);
|
|
1234
1231
|
};
|
|
1235
1232
|
getStrategyBalancesRaydium = async (strategy, collateralInfos, scopePrices, disabledTokensPrices) => {
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
if (!poolStateAcc) {
|
|
1241
|
-
throw Error(`Could not fetch Raydium pool state with pubkey ${strategy.pool.toString()}`);
|
|
1233
|
+
const res = await (0, kit_1.fetchEncodedAccounts)(this.getConnection(), [strategy.pool, strategy.position]);
|
|
1234
|
+
const [poolStateAcc, positionAcc] = res;
|
|
1235
|
+
if (!poolStateAcc.exists) {
|
|
1236
|
+
throw Error(`Could not fetch Raydium pool state with pubkey ${strategy.pool}`);
|
|
1242
1237
|
}
|
|
1243
|
-
if (!positionAcc) {
|
|
1244
|
-
throw Error(`Could not fetch Raydium position state with pubkey ${strategy.position
|
|
1238
|
+
if (!positionAcc.exists) {
|
|
1239
|
+
throw Error(`Could not fetch Raydium position state with pubkey ${strategy.position}`);
|
|
1245
1240
|
}
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1248
|
-
raydium_client_1.PersonalPositionState.decode(positionAcc.data),
|
|
1249
|
-
]);
|
|
1241
|
+
const poolState = accounts_3.PoolState.decode(Buffer.from(poolStateAcc.data));
|
|
1242
|
+
const position = accounts_3.PersonalPositionState.decode(Buffer.from(positionAcc.data));
|
|
1250
1243
|
return this.getRaydiumBalances(strategy, poolState, position, collateralInfos, scopePrices, disabledTokensPrices);
|
|
1251
1244
|
};
|
|
1252
1245
|
getStrategyBalancesMeteora = async (strategy, collateralInfos, scopePrices, disabledTokensPrices) => {
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1255
|
-
strategy.position,
|
|
1256
|
-
]);
|
|
1246
|
+
const res = await this.getConnection().getMultipleAccounts([strategy.pool, strategy.position]).send();
|
|
1247
|
+
const [poolStateAcc, positionAcc] = res.value;
|
|
1257
1248
|
if (!poolStateAcc) {
|
|
1258
|
-
throw Error(`Could not fetch Meteora pool state with pubkey ${strategy.pool
|
|
1249
|
+
throw Error(`Could not fetch Meteora pool state with pubkey ${strategy.pool}`);
|
|
1259
1250
|
}
|
|
1260
1251
|
if (!positionAcc) {
|
|
1261
|
-
throw Error(`Could not fetch Meteora position state with pubkey ${strategy.position
|
|
1252
|
+
throw Error(`Could not fetch Meteora position state with pubkey ${strategy.position}`);
|
|
1262
1253
|
}
|
|
1254
|
+
const poolState = accounts_4.LbPair.decode(Buffer.from(poolStateAcc.data[0], 'base64'));
|
|
1263
1255
|
try {
|
|
1264
|
-
const
|
|
1265
|
-
accounts_2.LbPair.decode(poolStateAcc.data),
|
|
1266
|
-
accounts_2.PositionV2.decode(positionAcc.data),
|
|
1267
|
-
]);
|
|
1256
|
+
const position = accounts_4.PositionV2.decode(Buffer.from(positionAcc.data[0], 'base64'));
|
|
1268
1257
|
return this.getMeteoraBalances(strategy, poolState, position, collateralInfos, scopePrices, disabledTokensPrices);
|
|
1269
1258
|
}
|
|
1270
1259
|
catch (e) {
|
|
1271
|
-
const poolState = accounts_2.LbPair.decode(poolStateAcc.data);
|
|
1272
1260
|
return this.getMeteoraBalances(strategy, poolState, undefined, collateralInfos, scopePrices, disabledTokensPrices);
|
|
1273
1261
|
}
|
|
1274
1262
|
};
|
|
@@ -1325,7 +1313,7 @@ class Kamino {
|
|
|
1325
1313
|
}
|
|
1326
1314
|
}
|
|
1327
1315
|
else {
|
|
1328
|
-
if (collateralInfo.mint.
|
|
1316
|
+
if (collateralInfo.mint === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1329
1317
|
continue;
|
|
1330
1318
|
}
|
|
1331
1319
|
disabledTokens.push(collateralInfo.mint);
|
|
@@ -1336,7 +1324,7 @@ class Kamino {
|
|
|
1336
1324
|
? disabledTokensPrices
|
|
1337
1325
|
: await JupService_1.JupService.getDollarPrices(disabledTokens, this._jupBaseAPI);
|
|
1338
1326
|
for (const [token, price] of tokensPrices) {
|
|
1339
|
-
const collInfo = collateralInfos.find((x) => x.mint
|
|
1327
|
+
const collInfo = collateralInfos.find((x) => x.mint === token);
|
|
1340
1328
|
if (!collInfo) {
|
|
1341
1329
|
console.log(`Could not find collateral info for token ${token.toString()}`);
|
|
1342
1330
|
continue;
|
|
@@ -1384,7 +1372,7 @@ class Kamino {
|
|
|
1384
1372
|
else {
|
|
1385
1373
|
prices = await this._scope.getOraclePrices({ prices: strategy.scopePrices });
|
|
1386
1374
|
}
|
|
1387
|
-
let jupPrices
|
|
1375
|
+
let jupPrices;
|
|
1388
1376
|
if (disabledTokensPrices) {
|
|
1389
1377
|
jupPrices = disabledTokensPrices;
|
|
1390
1378
|
}
|
|
@@ -1441,22 +1429,28 @@ class Kamino {
|
|
|
1441
1429
|
/**
|
|
1442
1430
|
* Get all token accounts for the specified share mint
|
|
1443
1431
|
*/
|
|
1444
|
-
getShareTokenAccounts = (shareMint) => {
|
|
1432
|
+
getShareTokenAccounts = async (shareMint) => {
|
|
1445
1433
|
//how to get all token accounts for specific mint: https://spl.solana.com/token#finding-all-token-accounts-for-a-specific-mint
|
|
1446
1434
|
//get it from the hardcoded token program and create a filter with the actual mint address
|
|
1447
1435
|
//datasize:165 filter selects all token accounts, memcmp filter selects based on the mint address withing each token account
|
|
1448
|
-
return this.
|
|
1449
|
-
|
|
1450
|
-
|
|
1436
|
+
return this._rpc
|
|
1437
|
+
.getProgramAccounts(token_1.TOKEN_PROGRAM_ADDRESS, {
|
|
1438
|
+
filters: [{ dataSize: 165n }, { memcmp: { offset: 0n, bytes: shareMint, encoding: 'base58' } }],
|
|
1439
|
+
encoding: 'jsonParsed',
|
|
1440
|
+
})
|
|
1441
|
+
.send();
|
|
1451
1442
|
};
|
|
1452
1443
|
/**
|
|
1453
1444
|
* Get all token accounts for the specified wallet
|
|
1454
1445
|
*/
|
|
1455
|
-
getAllTokenAccounts = (wallet) => {
|
|
1446
|
+
getAllTokenAccounts = async (wallet) => {
|
|
1456
1447
|
//how to get all token accounts for specific wallet: https://spl.solana.com/token#finding-all-token-accounts-for-a-wallet
|
|
1457
|
-
return this.
|
|
1458
|
-
|
|
1459
|
-
|
|
1448
|
+
return this._rpc
|
|
1449
|
+
.getProgramAccounts(token_1.TOKEN_PROGRAM_ADDRESS, {
|
|
1450
|
+
filters: [{ dataSize: 165n }, { memcmp: { offset: 32n, bytes: wallet, encoding: 'base58' } }],
|
|
1451
|
+
encoding: 'jsonParsed',
|
|
1452
|
+
})
|
|
1453
|
+
.send();
|
|
1460
1454
|
};
|
|
1461
1455
|
/**
|
|
1462
1456
|
* Get all token accounts that are holding a specific Kamino whirlpool strategy
|
|
@@ -1470,13 +1464,13 @@ class Kamino {
|
|
|
1470
1464
|
*/
|
|
1471
1465
|
getStrategyRange = async (strategy) => {
|
|
1472
1466
|
const stratWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
1473
|
-
if (stratWithAddress.strategy.strategyDex.toNumber()
|
|
1467
|
+
if (stratWithAddress.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
1474
1468
|
return this.getStrategyRangeOrca(strategy);
|
|
1475
1469
|
}
|
|
1476
|
-
else if (stratWithAddress.strategy.strategyDex.toNumber()
|
|
1470
|
+
else if (stratWithAddress.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1477
1471
|
return this.getStrategyRangeRaydium(strategy);
|
|
1478
1472
|
}
|
|
1479
|
-
else if (stratWithAddress.strategy.strategyDex.toNumber()
|
|
1473
|
+
else if (stratWithAddress.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
1480
1474
|
return this.getStrategyRangeMeteora(strategy);
|
|
1481
1475
|
}
|
|
1482
1476
|
else {
|
|
@@ -1485,7 +1479,7 @@ class Kamino {
|
|
|
1485
1479
|
};
|
|
1486
1480
|
getStrategyRangeOrca = async (strategy) => {
|
|
1487
1481
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
1488
|
-
if (strategyState.position
|
|
1482
|
+
if (strategyState.position === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1489
1483
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1490
1484
|
}
|
|
1491
1485
|
else {
|
|
@@ -1494,7 +1488,7 @@ class Kamino {
|
|
|
1494
1488
|
};
|
|
1495
1489
|
getStrategyRangeRaydium = async (strategy) => {
|
|
1496
1490
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
1497
|
-
if (strategyState.position
|
|
1491
|
+
if (strategyState.position === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1498
1492
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1499
1493
|
}
|
|
1500
1494
|
else {
|
|
@@ -1503,7 +1497,7 @@ class Kamino {
|
|
|
1503
1497
|
};
|
|
1504
1498
|
getStrategyRangeMeteora = async (strategy) => {
|
|
1505
1499
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
1506
|
-
if (strategyState.position
|
|
1500
|
+
if (strategyState.position === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1507
1501
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1508
1502
|
}
|
|
1509
1503
|
else {
|
|
@@ -1511,13 +1505,13 @@ class Kamino {
|
|
|
1511
1505
|
}
|
|
1512
1506
|
};
|
|
1513
1507
|
getPositionRange = async (dex, position, decimalsA, decimalsB) => {
|
|
1514
|
-
if (dex
|
|
1508
|
+
if (dex === 'ORCA') {
|
|
1515
1509
|
return this.getPositionRangeOrca(position, decimalsA, decimalsB);
|
|
1516
1510
|
}
|
|
1517
|
-
else if (dex
|
|
1511
|
+
else if (dex === 'RAYDIUM') {
|
|
1518
1512
|
return this.getPositionRangeRaydium(position, decimalsA, decimalsB);
|
|
1519
1513
|
}
|
|
1520
|
-
else if (dex
|
|
1514
|
+
else if (dex === 'METEORA') {
|
|
1521
1515
|
return this.getPositionRangeMeteora(position, decimalsA, decimalsB);
|
|
1522
1516
|
}
|
|
1523
1517
|
else {
|
|
@@ -1525,10 +1519,10 @@ class Kamino {
|
|
|
1525
1519
|
}
|
|
1526
1520
|
};
|
|
1527
1521
|
getPositionRangeOrca = async (positionPk, decimalsA, decimalsB) => {
|
|
1528
|
-
if (positionPk.
|
|
1522
|
+
if (positionPk === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1529
1523
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1530
1524
|
}
|
|
1531
|
-
const position = await
|
|
1525
|
+
const position = await accounts_2.Position.fetch(this._rpc, positionPk, this._orcaService.getWhirlpoolProgramId());
|
|
1532
1526
|
if (!position) {
|
|
1533
1527
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1534
1528
|
}
|
|
@@ -1538,10 +1532,10 @@ class Kamino {
|
|
|
1538
1532
|
return positionRange;
|
|
1539
1533
|
};
|
|
1540
1534
|
getPositionRangeRaydium = async (positionPk, decimalsA, decimalsB) => {
|
|
1541
|
-
if (positionPk.
|
|
1535
|
+
if (positionPk === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1542
1536
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1543
1537
|
}
|
|
1544
|
-
const position = await
|
|
1538
|
+
const position = await accounts_3.PersonalPositionState.fetch(this._rpc, positionPk, this._raydiumService.getRaydiumProgramId());
|
|
1545
1539
|
if (!position) {
|
|
1546
1540
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1547
1541
|
}
|
|
@@ -1551,14 +1545,14 @@ class Kamino {
|
|
|
1551
1545
|
return positionRange;
|
|
1552
1546
|
};
|
|
1553
1547
|
getPositionRangeMeteora = async (positionPk, decimalsA, decimalsB) => {
|
|
1554
|
-
if (positionPk.
|
|
1548
|
+
if (positionPk === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
1555
1549
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1556
1550
|
}
|
|
1557
|
-
const position = await
|
|
1551
|
+
const position = await accounts_4.PositionV2.fetch(this._rpc, positionPk, this._meteoraService.getMeteoraProgramId());
|
|
1558
1552
|
if (!position) {
|
|
1559
1553
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1560
1554
|
}
|
|
1561
|
-
const pool = await
|
|
1555
|
+
const pool = await accounts_4.LbPair.fetch(this._rpc, position.lbPair);
|
|
1562
1556
|
if (!pool) {
|
|
1563
1557
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1564
1558
|
}
|
|
@@ -1577,10 +1571,14 @@ class Kamino {
|
|
|
1577
1571
|
const result = [];
|
|
1578
1572
|
for (const tokenAccount of tokenAccounts) {
|
|
1579
1573
|
const accountData = tokenAccount.account.data;
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1574
|
+
if ('parsed' in accountData) {
|
|
1575
|
+
result.push({
|
|
1576
|
+
// @ts-ignore
|
|
1577
|
+
holderPubkey: (0, kit_1.address)(accountData.parsed.info.owner),
|
|
1578
|
+
// @ts-ignore
|
|
1579
|
+
amount: new decimal_js_1.default(accountData.parsed.info.tokenAmount.uiAmountString),
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1584
1582
|
}
|
|
1585
1583
|
return result;
|
|
1586
1584
|
};
|
|
@@ -1590,18 +1588,17 @@ class Kamino {
|
|
|
1590
1588
|
*/
|
|
1591
1589
|
getWhirlpools = async (whirlpools) => {
|
|
1592
1590
|
// todo: make this map have Pubkey as key
|
|
1593
|
-
const whirlpoolMap = new
|
|
1594
|
-
const
|
|
1595
|
-
const uniqueWhirlpools = [...new Set(whirlpoolStrings)].map((value) => new web3_js_1.PublicKey(value));
|
|
1591
|
+
const whirlpoolMap = new Map();
|
|
1592
|
+
const uniqueWhirlpools = [...new Set(whirlpools)];
|
|
1596
1593
|
if (uniqueWhirlpools.length === 1) {
|
|
1597
1594
|
const whirlpool = await this.getWhirlpoolByAddress(whirlpools[0]);
|
|
1598
1595
|
whirlpoolMap.set(whirlpools[0], whirlpool);
|
|
1599
1596
|
return whirlpoolMap;
|
|
1600
1597
|
}
|
|
1601
|
-
const fetched = await (0, utils_1.batchFetch)(uniqueWhirlpools, (chunk) =>
|
|
1598
|
+
const fetched = await (0, utils_1.batchFetch)(uniqueWhirlpools, (chunk) => accounts_2.Whirlpool.fetchMultiple(this._rpc, chunk, this._orcaService.getWhirlpoolProgramId()));
|
|
1602
1599
|
fetched.reduce((map, whirlpool, i) => {
|
|
1603
1600
|
whirlpoolMap.set(uniqueWhirlpools[i], whirlpool);
|
|
1604
|
-
map[uniqueWhirlpools[i]
|
|
1601
|
+
map[uniqueWhirlpools[i]] = whirlpool;
|
|
1605
1602
|
return map;
|
|
1606
1603
|
}, {});
|
|
1607
1604
|
return whirlpoolMap;
|
|
@@ -1611,55 +1608,54 @@ class Kamino {
|
|
|
1611
1608
|
* @param positions
|
|
1612
1609
|
*/
|
|
1613
1610
|
getOrcaPositions = async (positions) => {
|
|
1614
|
-
const nonDefaults = positions.filter((value) => value
|
|
1615
|
-
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) =>
|
|
1611
|
+
const nonDefaults = positions.filter((value) => value !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
1612
|
+
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) => accounts_2.Position.fetchMultiple(this._rpc, chunk, this._orcaService.getWhirlpoolProgramId()));
|
|
1616
1613
|
const fetchedMap = fetched.reduce((map, position, i) => {
|
|
1617
|
-
map[nonDefaults[i]
|
|
1614
|
+
map[nonDefaults[i]] = position;
|
|
1618
1615
|
return map;
|
|
1619
1616
|
}, {});
|
|
1620
|
-
return positions.map((position) => fetchedMap[position
|
|
1617
|
+
return positions.map((position) => fetchedMap[position] || null);
|
|
1621
1618
|
};
|
|
1622
1619
|
/**
|
|
1623
1620
|
* Get a list of Raydium positions from public keys
|
|
1624
1621
|
* @param positions
|
|
1625
1622
|
*/
|
|
1626
1623
|
getRaydiumPositions = async (positions) => {
|
|
1627
|
-
const nonDefaults = positions.filter((value) => value
|
|
1628
|
-
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) =>
|
|
1624
|
+
const nonDefaults = positions.filter((value) => value !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
1625
|
+
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) => accounts_3.PersonalPositionState.fetchMultiple(this._rpc, chunk, this._raydiumService.getRaydiumProgramId()));
|
|
1629
1626
|
const fetchedMap = fetched.reduce((map, position, i) => {
|
|
1630
|
-
map[nonDefaults[i]
|
|
1627
|
+
map[nonDefaults[i]] = position;
|
|
1631
1628
|
return map;
|
|
1632
1629
|
}, {});
|
|
1633
|
-
return positions.map((position) => fetchedMap[position
|
|
1630
|
+
return positions.map((position) => fetchedMap[position] || null);
|
|
1634
1631
|
};
|
|
1635
1632
|
getMeteoraPositions = async (positions) => {
|
|
1636
|
-
const nonDefaults = positions.filter((value) =>
|
|
1637
|
-
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) =>
|
|
1633
|
+
const nonDefaults = positions.filter((value) => value !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
1634
|
+
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) => accounts_4.PositionV2.fetchMultiple(this._rpc, chunk, this._meteoraService.getMeteoraProgramId()));
|
|
1638
1635
|
const fetchedMap = fetched.reduce((map, position, i) => {
|
|
1639
|
-
map[nonDefaults[i]
|
|
1636
|
+
map[nonDefaults[i]] = position;
|
|
1640
1637
|
return map;
|
|
1641
1638
|
}, {});
|
|
1642
|
-
return positions.map((position) => fetchedMap[position
|
|
1639
|
+
return positions.map((position) => fetchedMap[position] || null);
|
|
1643
1640
|
};
|
|
1644
1641
|
/**
|
|
1645
1642
|
* Get whirlpool from public key
|
|
1646
1643
|
* @param whirlpool pubkey of the orca whirlpool
|
|
1647
1644
|
*/
|
|
1648
|
-
getWhirlpoolByAddress = (whirlpool) =>
|
|
1645
|
+
getWhirlpoolByAddress = (whirlpool) => accounts_2.Whirlpool.fetch(this._rpc, whirlpool, this._orcaService.getWhirlpoolProgramId());
|
|
1649
1646
|
/**
|
|
1650
1647
|
* Get a list of Raydium pools from public keys
|
|
1651
1648
|
* @param pools
|
|
1652
1649
|
*/
|
|
1653
1650
|
getRaydiumPools = async (pools) => {
|
|
1654
1651
|
// todo: make this map have Pubkey as key
|
|
1655
|
-
const poolsMap = new
|
|
1656
|
-
const
|
|
1657
|
-
const uniquePools = [...new Set(poolStrings)].map((value) => new web3_js_1.PublicKey(value));
|
|
1652
|
+
const poolsMap = new Map();
|
|
1653
|
+
const uniquePools = [...new Set(pools)];
|
|
1658
1654
|
if (uniquePools.length === 1) {
|
|
1659
1655
|
const pool = await this.getRaydiumPoolByAddress(pools[0]);
|
|
1660
1656
|
poolsMap.set(pools[0], pool);
|
|
1661
1657
|
}
|
|
1662
|
-
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) =>
|
|
1658
|
+
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) => accounts_3.PoolState.fetchMultiple(this._rpc, chunk, this._raydiumService.getRaydiumProgramId()));
|
|
1663
1659
|
fetched.reduce((map, whirlpool, i) => {
|
|
1664
1660
|
poolsMap.set(uniquePools[i], whirlpool);
|
|
1665
1661
|
return map;
|
|
@@ -1668,34 +1664,36 @@ class Kamino {
|
|
|
1668
1664
|
};
|
|
1669
1665
|
getMeteoraPools = async (pools) => {
|
|
1670
1666
|
// todo: make this map have Pubkey as key
|
|
1671
|
-
const poolsMap = new
|
|
1672
|
-
const
|
|
1673
|
-
const uniquePools = [...new Set(poolStrings)].map((value) => new web3_js_1.PublicKey(value));
|
|
1667
|
+
const poolsMap = new Map();
|
|
1668
|
+
const uniquePools = [...new Set(pools)];
|
|
1674
1669
|
if (uniquePools.length === 1) {
|
|
1675
1670
|
const pool = await this.getMeteoraPoolByAddress(pools[0]);
|
|
1676
1671
|
poolsMap.set(pools[0], pool);
|
|
1677
1672
|
}
|
|
1678
|
-
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) =>
|
|
1673
|
+
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) => accounts_4.LbPair.fetchMultiple(this._rpc, chunk, this._meteoraService.getMeteoraProgramId()));
|
|
1679
1674
|
fetched.reduce((map, whirlpool, i) => {
|
|
1680
1675
|
poolsMap.set(uniquePools[i], whirlpool);
|
|
1681
1676
|
return map;
|
|
1682
1677
|
}, {});
|
|
1683
1678
|
return poolsMap;
|
|
1684
1679
|
};
|
|
1685
|
-
getRaydiumAmmConfig = (config) =>
|
|
1680
|
+
getRaydiumAmmConfig = (config) => accounts_3.AmmConfig.fetch(this._rpc, config, this._raydiumService.getRaydiumProgramId());
|
|
1686
1681
|
/**
|
|
1687
1682
|
* Get Raydium pool from public key
|
|
1688
1683
|
* @param pool pubkey of the orca whirlpool
|
|
1689
1684
|
*/
|
|
1690
|
-
getRaydiumPoolByAddress = (pool) =>
|
|
1691
|
-
getMeteoraPoolByAddress = (pool) =>
|
|
1692
|
-
getEventAuthorityPDA = (dex) => {
|
|
1693
|
-
if (dex.toNumber()
|
|
1694
|
-
return
|
|
1695
|
-
}
|
|
1696
|
-
if (dex.toNumber()
|
|
1697
|
-
const [key
|
|
1698
|
-
|
|
1685
|
+
getRaydiumPoolByAddress = (pool) => accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
1686
|
+
getMeteoraPoolByAddress = (pool) => accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
1687
|
+
getEventAuthorityPDA = async (dex) => {
|
|
1688
|
+
if (dex.toNumber() === (0, utils_1.dexToNumber)('ORCA') || dex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1689
|
+
return (0, kit_1.none)();
|
|
1690
|
+
}
|
|
1691
|
+
if (dex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
1692
|
+
const [key] = await (0, kit_1.getProgramDerivedAddress)({
|
|
1693
|
+
seeds: [Buffer.from('__event_authority')],
|
|
1694
|
+
programAddress: this._meteoraService.getMeteoraProgramId(),
|
|
1695
|
+
});
|
|
1696
|
+
return (0, kit_1.some)(key);
|
|
1699
1697
|
}
|
|
1700
1698
|
throw new Error('Invalid dex');
|
|
1701
1699
|
};
|
|
@@ -1711,15 +1709,15 @@ class Kamino {
|
|
|
1711
1709
|
throw Error('Shares amount cant be lower than or equal to 0.');
|
|
1712
1710
|
}
|
|
1713
1711
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1714
|
-
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategy.strategyDex);
|
|
1715
|
-
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault } = this.getTreasuryFeeVaultPDAs(strategyState.strategy.tokenAMint, strategyState.strategy.tokenBMint);
|
|
1712
|
+
const eventAuthority = await this.getEventAuthorityPDA(strategyState.strategy.strategyDex);
|
|
1713
|
+
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault } = await this.getTreasuryFeeVaultPDAs(strategyState.strategy.tokenAMint, strategyState.strategy.tokenBMint);
|
|
1716
1714
|
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
1717
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner),
|
|
1718
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner,
|
|
1719
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner,
|
|
1715
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner.address),
|
|
1716
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
1717
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
1720
1718
|
]);
|
|
1721
1719
|
const sharesAmountInLamports = sharesAmount.mul(new decimal_js_1.default(10).pow(strategyState.strategy.sharesMintDecimals.toString()));
|
|
1722
|
-
const programId =
|
|
1720
|
+
const programId = this.getDexProgramId(strategyState.strategy);
|
|
1723
1721
|
const args = { sharesAmount: new bn_js_1.default(sharesAmountInLamports.floor().toString()) };
|
|
1724
1722
|
const accounts = {
|
|
1725
1723
|
user: owner,
|
|
@@ -1740,25 +1738,25 @@ class Kamino {
|
|
|
1740
1738
|
sharesMint: strategyState.strategy.sharesMint,
|
|
1741
1739
|
treasuryFeeTokenAVault,
|
|
1742
1740
|
treasuryFeeTokenBVault,
|
|
1743
|
-
tokenProgram:
|
|
1744
|
-
tokenProgram2022:
|
|
1741
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
1742
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
1745
1743
|
positionTokenAccount: strategyState.strategy.positionTokenAccount,
|
|
1746
1744
|
poolProgram: programId,
|
|
1747
|
-
instructionSysvarAccount:
|
|
1745
|
+
instructionSysvarAccount: sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
1748
1746
|
tokenAMint: strategyState.strategy.tokenAMint,
|
|
1749
1747
|
tokenBMint: strategyState.strategy.tokenBMint,
|
|
1750
1748
|
eventAuthority,
|
|
1751
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
1752
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
1749
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
1750
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
1753
1751
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
1754
1752
|
};
|
|
1755
|
-
|
|
1753
|
+
let withdrawIx = (0, instructions_2.withdraw)(args, accounts, this.getProgramID());
|
|
1756
1754
|
let collectFeesAndRewardsIxns = [];
|
|
1757
1755
|
// for Raydium strats we need to collect fees and rewards before withdrawal
|
|
1758
1756
|
// add rewards vaults accounts to withdraw
|
|
1759
|
-
const isRaydium = strategyState.strategy.strategyDex.toNumber()
|
|
1757
|
+
const isRaydium = strategyState.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM');
|
|
1760
1758
|
if (isRaydium) {
|
|
1761
|
-
const raydiumPosition = await
|
|
1759
|
+
const raydiumPosition = await accounts_3.PersonalPositionState.fetch(this._rpc, strategyState.strategy.position, this._raydiumService.getRaydiumProgramId());
|
|
1762
1760
|
if (!raydiumPosition) {
|
|
1763
1761
|
throw new Error('Position is not found');
|
|
1764
1762
|
}
|
|
@@ -1769,39 +1767,94 @@ class Kamino {
|
|
|
1769
1767
|
if (!poolState) {
|
|
1770
1768
|
throw new Error('Pool is not found');
|
|
1771
1769
|
}
|
|
1772
|
-
withdrawIx
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1770
|
+
withdrawIx = {
|
|
1771
|
+
...withdrawIx,
|
|
1772
|
+
accounts: withdrawIx.accounts?.concat([
|
|
1773
|
+
{
|
|
1774
|
+
address: strategyState.strategy.raydiumPoolConfigOrBaseVaultAuthority,
|
|
1775
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1776
|
+
},
|
|
1777
|
+
]),
|
|
1778
|
+
};
|
|
1777
1779
|
if (strategyState.strategy.reward0Decimals.toNumber() > 0) {
|
|
1778
|
-
withdrawIx
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1780
|
+
withdrawIx = {
|
|
1781
|
+
...withdrawIx,
|
|
1782
|
+
accounts: withdrawIx.accounts?.concat([
|
|
1783
|
+
{
|
|
1784
|
+
address: poolState.rewardInfos[0].tokenVault,
|
|
1785
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
address: strategyState.strategy.reward0Vault,
|
|
1789
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
address: poolState.rewardInfos[0].tokenMint,
|
|
1793
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1794
|
+
},
|
|
1795
|
+
]),
|
|
1796
|
+
};
|
|
1783
1797
|
}
|
|
1784
1798
|
if (strategyState.strategy.reward1Decimals.toNumber() > 0) {
|
|
1785
|
-
withdrawIx
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1799
|
+
withdrawIx = {
|
|
1800
|
+
...withdrawIx,
|
|
1801
|
+
accounts: withdrawIx.accounts?.concat([
|
|
1802
|
+
{
|
|
1803
|
+
address: poolState.rewardInfos[1].tokenVault,
|
|
1804
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
address: strategyState.strategy.reward1Vault,
|
|
1808
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
address: poolState.rewardInfos[1].tokenMint,
|
|
1812
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1813
|
+
},
|
|
1814
|
+
]),
|
|
1815
|
+
};
|
|
1790
1816
|
}
|
|
1791
1817
|
if (strategyState.strategy.reward2Decimals.toNumber() > 0) {
|
|
1792
|
-
withdrawIx
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1818
|
+
withdrawIx = {
|
|
1819
|
+
...withdrawIx,
|
|
1820
|
+
accounts: withdrawIx.accounts?.concat([
|
|
1821
|
+
{
|
|
1822
|
+
address: poolState.rewardInfos[2].tokenVault,
|
|
1823
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
address: strategyState.strategy.reward2Vault,
|
|
1827
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
address: poolState.rewardInfos[2].tokenMint,
|
|
1831
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1832
|
+
},
|
|
1833
|
+
]),
|
|
1834
|
+
};
|
|
1797
1835
|
}
|
|
1798
|
-
const [poolTickArrayBitmap, _poolTickArrayBitmapBump] =
|
|
1799
|
-
|
|
1836
|
+
const [poolTickArrayBitmap, _poolTickArrayBitmapBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
1837
|
+
seeds: [Buffer.from('pool_tick_array_bitmap_extension'), addressEncoder.encode(strategyState.strategy.pool)],
|
|
1838
|
+
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
1839
|
+
});
|
|
1840
|
+
withdrawIx = {
|
|
1841
|
+
...withdrawIx,
|
|
1842
|
+
accounts: withdrawIx.accounts?.concat([
|
|
1843
|
+
{
|
|
1844
|
+
address: poolTickArrayBitmap,
|
|
1845
|
+
role: kit_1.AccountRole.WRITABLE,
|
|
1846
|
+
},
|
|
1847
|
+
]),
|
|
1848
|
+
};
|
|
1800
1849
|
}
|
|
1801
1850
|
const res = { prerequisiteIxs: collectFeesAndRewardsIxns, withdrawIx };
|
|
1802
1851
|
// if we withdraw everything also close the shares ATA
|
|
1803
1852
|
if (sharesAtaBalance && sharesAtaBalance.lte(sharesAmount)) {
|
|
1804
|
-
res.closeSharesAtaIx = (0,
|
|
1853
|
+
res.closeSharesAtaIx = (0, token_2022_1.getCloseAccountInstruction)({
|
|
1854
|
+
owner,
|
|
1855
|
+
account: sharesAta,
|
|
1856
|
+
destination: owner.address,
|
|
1857
|
+
}, { programAddress: token_1.TOKEN_PROGRAM_ADDRESS });
|
|
1805
1858
|
}
|
|
1806
1859
|
return res;
|
|
1807
1860
|
};
|
|
@@ -1820,31 +1873,31 @@ class Kamino {
|
|
|
1820
1873
|
getCreateAssociatedTokenAccountInstructionsIfNotExist = async (owner, strategyState, tokenAData, tokenAAta, tokenBData, tokenBAta, sharesMintData, sharesAta) => {
|
|
1821
1874
|
const instructions = [];
|
|
1822
1875
|
if (!tokenAData) {
|
|
1823
|
-
const tokenProgramA = strategyState.strategy.tokenATokenProgram
|
|
1824
|
-
?
|
|
1876
|
+
const tokenProgramA = strategyState.strategy.tokenATokenProgram === pubkeys_1.DEFAULT_PUBLIC_KEY
|
|
1877
|
+
? token_1.TOKEN_PROGRAM_ADDRESS
|
|
1825
1878
|
: strategyState.strategy.tokenATokenProgram;
|
|
1826
|
-
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenAAta, owner, strategyState.strategy.tokenAMint, tokenProgramA));
|
|
1879
|
+
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenAAta, owner.address, strategyState.strategy.tokenAMint, tokenProgramA));
|
|
1827
1880
|
}
|
|
1828
1881
|
if (!tokenBData) {
|
|
1829
|
-
const tokenProgramB = strategyState.strategy.tokenBTokenProgram
|
|
1830
|
-
?
|
|
1882
|
+
const tokenProgramB = strategyState.strategy.tokenBTokenProgram === pubkeys_1.DEFAULT_PUBLIC_KEY
|
|
1883
|
+
? token_1.TOKEN_PROGRAM_ADDRESS
|
|
1831
1884
|
: strategyState.strategy.tokenBTokenProgram;
|
|
1832
|
-
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenBAta, owner, strategyState.strategy.tokenBMint, tokenProgramB));
|
|
1885
|
+
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenBAta, owner.address, strategyState.strategy.tokenBMint, tokenProgramB));
|
|
1833
1886
|
}
|
|
1834
1887
|
if (!sharesMintData) {
|
|
1835
|
-
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, sharesAta, owner, strategyState.strategy.sharesMint));
|
|
1888
|
+
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, sharesAta, owner.address, strategyState.strategy.sharesMint));
|
|
1836
1889
|
}
|
|
1837
1890
|
return instructions;
|
|
1838
1891
|
};
|
|
1839
1892
|
/**
|
|
1840
1893
|
* Check if strategy has already been fetched (is StrategyWithAddress type) and return that,
|
|
1841
|
-
* otherwise fetch it first from
|
|
1894
|
+
* otherwise fetch it first from Address and return it
|
|
1842
1895
|
* @param strategy
|
|
1843
1896
|
* @private
|
|
1844
1897
|
*/
|
|
1845
1898
|
getStrategyStateIfNotFetched = async (strategy) => {
|
|
1846
1899
|
const hasStrategyBeenFetched = (object) => {
|
|
1847
|
-
return '
|
|
1900
|
+
return !(typeof object === 'string' && (0, kit_1.isAddress)(object));
|
|
1848
1901
|
};
|
|
1849
1902
|
if (hasStrategyBeenFetched(strategy)) {
|
|
1850
1903
|
return strategy;
|
|
@@ -1893,10 +1946,21 @@ class Kamino {
|
|
|
1893
1946
|
* @param tokenBMint
|
|
1894
1947
|
* @private
|
|
1895
1948
|
*/
|
|
1896
|
-
getTreasuryFeeVaultPDAs = (tokenAMint, tokenBMint) => {
|
|
1897
|
-
const [treasuryFeeTokenAVault,
|
|
1898
|
-
|
|
1899
|
-
|
|
1949
|
+
getTreasuryFeeVaultPDAs = async (tokenAMint, tokenBMint) => {
|
|
1950
|
+
const [[treasuryFeeTokenAVault], [treasuryFeeTokenBVault], [treasuryFeeVaultAuthority]] = await Promise.all([
|
|
1951
|
+
(0, kit_1.getProgramDerivedAddress)({
|
|
1952
|
+
seeds: [Buffer.from('treasury_fee_vault'), addressEncoder.encode(tokenAMint)],
|
|
1953
|
+
programAddress: this.getProgramID(),
|
|
1954
|
+
}),
|
|
1955
|
+
(0, kit_1.getProgramDerivedAddress)({
|
|
1956
|
+
seeds: [Buffer.from('treasury_fee_vault'), addressEncoder.encode(tokenBMint)],
|
|
1957
|
+
programAddress: this.getProgramID(),
|
|
1958
|
+
}),
|
|
1959
|
+
(0, kit_1.getProgramDerivedAddress)({
|
|
1960
|
+
seeds: [Buffer.from('treasury_fee_vault_authority')],
|
|
1961
|
+
programAddress: this.getProgramID(),
|
|
1962
|
+
}),
|
|
1963
|
+
]);
|
|
1900
1964
|
return { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority };
|
|
1901
1965
|
};
|
|
1902
1966
|
/**
|
|
@@ -1907,15 +1971,12 @@ class Kamino {
|
|
|
1907
1971
|
*/
|
|
1908
1972
|
withdrawAllShares = async (strategy, owner) => {
|
|
1909
1973
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1910
|
-
const [
|
|
1911
|
-
if (!sharesData) {
|
|
1974
|
+
const [, sharesData] = await (0, utils_1.getAssociatedTokenAddressAndAccount)(this._rpc, strategyState.strategy.sharesMint, owner.address);
|
|
1975
|
+
if (!sharesData || sharesData.data.amount === 0n) {
|
|
1912
1976
|
return null;
|
|
1913
1977
|
}
|
|
1914
|
-
const
|
|
1915
|
-
|
|
1916
|
-
return null;
|
|
1917
|
-
}
|
|
1918
|
-
return this.withdrawShares(strategyState, balance, owner);
|
|
1978
|
+
const amount = new decimal_js_1.default(sharesData.data.amount.toString()).div(new decimal_js_1.default(10).pow(strategyState.strategy.sharesMintDecimals.toString()));
|
|
1979
|
+
return this.withdrawShares(strategyState, amount, owner);
|
|
1919
1980
|
};
|
|
1920
1981
|
/**
|
|
1921
1982
|
* Get all the accounts needed by the deposit tx, without the swap.
|
|
@@ -1925,14 +1986,14 @@ class Kamino {
|
|
|
1925
1986
|
*/
|
|
1926
1987
|
getAllDepositAccounts = async (strategy, owner) => {
|
|
1927
1988
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1928
|
-
const globalConfig = await accounts_1.GlobalConfig.fetch(this.
|
|
1989
|
+
const globalConfig = await accounts_1.GlobalConfig.fetch(this._rpc, strategyState.strategy.globalConfig, this.getProgramID());
|
|
1929
1990
|
if (!globalConfig) {
|
|
1930
1991
|
throw Error(`Could not fetch global config with pubkey ${strategyState.strategy.globalConfig.toString()}`);
|
|
1931
1992
|
}
|
|
1932
1993
|
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
1933
1994
|
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner),
|
|
1934
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner,
|
|
1935
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner,
|
|
1995
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
1996
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
1936
1997
|
]);
|
|
1937
1998
|
const accounts = [
|
|
1938
1999
|
owner,
|
|
@@ -1952,10 +2013,10 @@ class Kamino {
|
|
|
1952
2013
|
strategyState.strategy.sharesMintAuthority,
|
|
1953
2014
|
strategyState.strategy.scopePrices,
|
|
1954
2015
|
globalConfig.tokenInfos,
|
|
1955
|
-
|
|
1956
|
-
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
1957
|
-
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
1958
|
-
|
|
2016
|
+
token_1.TOKEN_PROGRAM_ADDRESS,
|
|
2017
|
+
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2018
|
+
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2019
|
+
sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
1959
2020
|
strategyState.strategy.tickArrayLower,
|
|
1960
2021
|
strategyState.strategy.tickArrayUpper,
|
|
1961
2022
|
];
|
|
@@ -1978,9 +2039,11 @@ class Kamino {
|
|
|
1978
2039
|
if (!globalConfig) {
|
|
1979
2040
|
throw Error(`Could not fetch global config with pubkey ${strategyState.strategy.globalConfig.toString()}`);
|
|
1980
2041
|
}
|
|
1981
|
-
const [sharesAta] = await
|
|
1982
|
-
|
|
1983
|
-
|
|
2042
|
+
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
2043
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner.address),
|
|
2044
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2045
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2046
|
+
]);
|
|
1984
2047
|
const lamportsA = amountA.mul(new decimal_js_1.default(10).pow(strategyState.strategy.tokenAMintDecimals.toString()));
|
|
1985
2048
|
const lamportsB = amountB.mul(new decimal_js_1.default(10).pow(strategyState.strategy.tokenBMintDecimals.toString()));
|
|
1986
2049
|
const depositArgs = {
|
|
@@ -2005,29 +2068,29 @@ class Kamino {
|
|
|
2005
2068
|
sharesMintAuthority: strategyState.strategy.sharesMintAuthority,
|
|
2006
2069
|
scopePrices: strategyState.strategy.scopePrices,
|
|
2007
2070
|
tokenInfos: globalConfig.tokenInfos,
|
|
2008
|
-
tokenProgram:
|
|
2009
|
-
instructionSysvarAccount:
|
|
2071
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
2072
|
+
instructionSysvarAccount: sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
2010
2073
|
tickArrayLower: strategyState.strategy.tickArrayLower,
|
|
2011
2074
|
tickArrayUpper: strategyState.strategy.tickArrayUpper,
|
|
2012
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
2013
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
2075
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2076
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2014
2077
|
};
|
|
2015
|
-
return (0,
|
|
2078
|
+
return (0, instructions_2.deposit)(depositArgs, depositAccounts, this.getProgramID());
|
|
2016
2079
|
};
|
|
2017
2080
|
singleSidedDepositTokenA = async (strategy, amountToDeposit, owner, slippageBps, profiler = utils_1.noopProfiledFunctionExecution, swapIxsBuilder, initialUserTokenAtaBalances, priceAInB, includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
2018
2081
|
onlyDirectRoutes) => {
|
|
2019
2082
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
2020
|
-
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner, strategyWithAddress.strategy.tokenAMint, strategyWithAddress.strategy.tokenBMint, initialUserTokenAtaBalances), 'A-getInitialUserTokenBalances', []);
|
|
2083
|
+
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner.address, strategyWithAddress.strategy.tokenAMint, strategyWithAddress.strategy.tokenBMint, initialUserTokenAtaBalances), 'A-getInitialUserTokenBalances', []);
|
|
2021
2084
|
const userTokenBalancesWithoutSolBalanace = {
|
|
2022
2085
|
a: userTokenBalances.a,
|
|
2023
2086
|
b: userTokenBalances.b,
|
|
2024
2087
|
};
|
|
2025
2088
|
// if any of the tokens is SOL, we need to read how much SOL the user has, not how much wSOL which is what getInitialUserTokenBalances returns
|
|
2026
2089
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenAMint)) {
|
|
2027
|
-
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this.
|
|
2090
|
+
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default((await this._rpc.getBalance(owner.address).send()).value.toString()), utils_1.DECIMALS_SOL));
|
|
2028
2091
|
}
|
|
2029
2092
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenBMint)) {
|
|
2030
|
-
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this.
|
|
2093
|
+
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default((await this._rpc.getBalance(owner.address).send()).value.toString()), utils_1.DECIMALS_SOL));
|
|
2031
2094
|
}
|
|
2032
2095
|
if (!userTokenBalances.a || !userTokenBalances.b) {
|
|
2033
2096
|
throw Error('Error reading user token balances');
|
|
@@ -2035,7 +2098,7 @@ class Kamino {
|
|
|
2035
2098
|
const tokenAMinPostDepositBalance = userTokenBalances.a?.sub(amountToDeposit);
|
|
2036
2099
|
const swapper = swapIxsBuilder
|
|
2037
2100
|
? swapIxsBuilder
|
|
2038
|
-
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user, slippageBps, false, allAccounts, profiler, onlyDirectRoutes);
|
|
2101
|
+
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user.address, slippageBps, false, allAccounts, profiler, onlyDirectRoutes);
|
|
2039
2102
|
console.log('single sided deposit tokenA tokenAMinPostDepositBalance', tokenAMinPostDepositBalance);
|
|
2040
2103
|
console.log('single sided deposit tokenA userTokenBalances.b', userTokenBalances.b);
|
|
2041
2104
|
return await profiler(this.getSingleSidedDepositIxs(strategyWithAddress, (0, utils_1.collToLamportsDecimal)(tokenAMinPostDepositBalance, strategyWithAddress.strategy.tokenAMintDecimals.toNumber()), (0, utils_1.collToLamportsDecimal)(userTokenBalances.b, strategyWithAddress.strategy.tokenBMintDecimals.toNumber()), owner, slippageBps, swapper, profiler, userTokenBalancesWithoutSolBalanace, priceAInB, includeAtaIxns), 'A-getSingleSidedDepositIxs', []);
|
|
@@ -2043,17 +2106,17 @@ class Kamino {
|
|
|
2043
2106
|
singleSidedDepositTokenB = async (strategy, amountToDeposit, owner, slippageBps, profiler = utils_1.noopProfiledFunctionExecution, swapIxsBuilder, initialUserTokenAtaBalances, priceAInB, includeAtaIxns = true, // if true it includes create and close wsol and token atas,
|
|
2044
2107
|
onlyDirectRoutes) => {
|
|
2045
2108
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
2046
|
-
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner, strategyWithAddress.strategy.tokenAMint, strategyWithAddress.strategy.tokenBMint, initialUserTokenAtaBalances), 'A-getInitialUserTokenBalances', []);
|
|
2109
|
+
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner.address, strategyWithAddress.strategy.tokenAMint, strategyWithAddress.strategy.tokenBMint, initialUserTokenAtaBalances), 'A-getInitialUserTokenBalances', []);
|
|
2047
2110
|
const userTokenBalancesWithoutSolBalanace = {
|
|
2048
2111
|
a: userTokenBalances.a,
|
|
2049
2112
|
b: userTokenBalances.b,
|
|
2050
2113
|
};
|
|
2051
2114
|
// if any of the tokens is SOL, we need to read how much SOL the user has, not how much wSOL which is what getInitialUserTokenBalances returns
|
|
2052
2115
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenAMint)) {
|
|
2053
|
-
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this.
|
|
2116
|
+
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default((await this._rpc.getBalance(owner.address).send()).value.toString()), utils_1.DECIMALS_SOL));
|
|
2054
2117
|
}
|
|
2055
2118
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenBMint)) {
|
|
2056
|
-
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this.
|
|
2119
|
+
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default((await this._rpc.getBalance(owner.address).send()).value.toString()), utils_1.DECIMALS_SOL));
|
|
2057
2120
|
}
|
|
2058
2121
|
if (!userTokenBalances.a || !userTokenBalances.b) {
|
|
2059
2122
|
throw Error('Error reading user token balances');
|
|
@@ -2061,7 +2124,7 @@ class Kamino {
|
|
|
2061
2124
|
const tokenBMinPostDepositBalance = userTokenBalances.b.sub(amountToDeposit);
|
|
2062
2125
|
const swapper = swapIxsBuilder
|
|
2063
2126
|
? swapIxsBuilder
|
|
2064
|
-
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user, slippageBps, false, allAccounts, profiler, onlyDirectRoutes);
|
|
2127
|
+
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user.address, slippageBps, false, allAccounts, profiler, onlyDirectRoutes);
|
|
2065
2128
|
return await profiler(this.getSingleSidedDepositIxs(strategyWithAddress, (0, utils_1.collToLamportsDecimal)(userTokenBalances.a, strategyWithAddress.strategy.tokenAMintDecimals.toNumber()), (0, utils_1.collToLamportsDecimal)(tokenBMinPostDepositBalance, strategyWithAddress.strategy.tokenBMintDecimals.toNumber()), owner, slippageBps, swapper, profiler, userTokenBalancesWithoutSolBalanace, priceAInB, includeAtaIxns), 'A-getSingleSidedDepositIxs', []);
|
|
2066
2129
|
};
|
|
2067
2130
|
getInitialUserTokenBalances = async (owner, tokenAMint, tokenBMint, initialUserTokenBalances) => {
|
|
@@ -2072,8 +2135,8 @@ class Kamino {
|
|
|
2072
2135
|
}
|
|
2073
2136
|
else {
|
|
2074
2137
|
const tokenATokenProgram = await this.getAccountOwner(tokenAMint);
|
|
2075
|
-
const
|
|
2076
|
-
const ataExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2138
|
+
const tokenAAta = await (0, utils_1.getAssociatedTokenAddress)(tokenAMint, owner, (0, utils_1.keyOrDefault)(tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS));
|
|
2139
|
+
const ataExists = await (0, transactions_1.checkIfAccountExists)(this._rpc, tokenAAta);
|
|
2077
2140
|
if (!ataExists) {
|
|
2078
2141
|
initialUserTokenABalance = new decimal_js_1.default(0);
|
|
2079
2142
|
}
|
|
@@ -2086,8 +2149,8 @@ class Kamino {
|
|
|
2086
2149
|
}
|
|
2087
2150
|
else {
|
|
2088
2151
|
const tokenBTokenProgram = await this.getAccountOwner(tokenBMint);
|
|
2089
|
-
const
|
|
2090
|
-
const ataExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2152
|
+
const tokenBAta = await (0, utils_1.getAssociatedTokenAddress)(tokenBMint, owner, (0, utils_1.keyOrDefault)(tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS));
|
|
2153
|
+
const ataExists = await (0, transactions_1.checkIfAccountExists)(this._rpc, tokenBAta);
|
|
2091
2154
|
if (!ataExists) {
|
|
2092
2155
|
initialUserTokenBBalance = new decimal_js_1.default(0);
|
|
2093
2156
|
}
|
|
@@ -2109,9 +2172,9 @@ class Kamino {
|
|
|
2109
2172
|
throw Error('Token A or B post deposit amount cant be lower than 0.');
|
|
2110
2173
|
}
|
|
2111
2174
|
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
2112
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.sharesMint, owner),
|
|
2113
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, owner,
|
|
2114
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, owner,
|
|
2175
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.sharesMint, owner.address),
|
|
2176
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2177
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2115
2178
|
]);
|
|
2116
2179
|
let tokenAAtaBalance = initialUserTokenAtaBalances.a;
|
|
2117
2180
|
let tokenBAtaBalance = initialUserTokenAtaBalances.b;
|
|
@@ -2121,7 +2184,7 @@ class Kamino {
|
|
|
2121
2184
|
const createWsolAtasIxns = [];
|
|
2122
2185
|
if ((0, utils_1.isSOLMint)(strategyState.tokenAMint)) {
|
|
2123
2186
|
// read how much SOL the user has and calculate the amount to deposit and balance based on it
|
|
2124
|
-
const solBalance = new decimal_js_1.default(await this.
|
|
2187
|
+
const solBalance = new decimal_js_1.default((await this._rpc.getBalance(owner.address).send()).value.toString());
|
|
2125
2188
|
const tokenAAtaBalanceLamports = (0, utils_1.collToLamportsDecimal)(tokenAAtaBalance, strategyState.tokenAMintDecimals.toNumber());
|
|
2126
2189
|
const availableSol = solBalance.add(tokenAAtaBalanceLamports);
|
|
2127
2190
|
const solToDeposit = availableSol.sub(tokenAMinPostDepositBalanceLamports);
|
|
@@ -2131,9 +2194,9 @@ class Kamino {
|
|
|
2131
2194
|
tokenAAtaBalance = (0, utils_1.lamportsToNumberDecimal)(aToDeposit, utils_1.DECIMALS_SOL);
|
|
2132
2195
|
}
|
|
2133
2196
|
}
|
|
2134
|
-
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this.
|
|
2197
|
+
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this._rpc, new decimal_js_1.default((0, utils_1.lamportsToNumberDecimal)(solToDeposit, utils_1.DECIMALS_SOL)), owner);
|
|
2135
2198
|
// if the wSOL ata is not created, expect to have 0 remaining after the deposit
|
|
2136
|
-
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2199
|
+
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this._rpc, createWSolAtaIxns.ata);
|
|
2137
2200
|
if (!wSolAtaExists) {
|
|
2138
2201
|
realTokenAMinPostDepositBalanceLamports = new decimal_js_1.default(0);
|
|
2139
2202
|
}
|
|
@@ -2151,7 +2214,7 @@ class Kamino {
|
|
|
2151
2214
|
}
|
|
2152
2215
|
}
|
|
2153
2216
|
if ((0, utils_1.isSOLMint)(strategyState.tokenBMint)) {
|
|
2154
|
-
const solBalance = new decimal_js_1.default(await this.
|
|
2217
|
+
const solBalance = new decimal_js_1.default((await this._rpc.getBalance(owner.address).send()).value.toString());
|
|
2155
2218
|
const tokenBAtaBalanceLamports = (0, utils_1.collToLamportsDecimal)(tokenBAtaBalance, strategyState.tokenBMintDecimals.toNumber());
|
|
2156
2219
|
const availableSol = solBalance.add(tokenBAtaBalanceLamports);
|
|
2157
2220
|
const solToDeposit = availableSol.sub(tokenBMinPostDepositBalanceLamports);
|
|
@@ -2162,8 +2225,8 @@ class Kamino {
|
|
|
2162
2225
|
tokenBAtaBalance = (0, utils_1.lamportsToNumberDecimal)(bToDeposit, utils_1.DECIMALS_SOL);
|
|
2163
2226
|
}
|
|
2164
2227
|
}
|
|
2165
|
-
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this.
|
|
2166
|
-
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2228
|
+
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this._rpc, new decimal_js_1.default((0, utils_1.lamportsToNumberDecimal)(solToDeposit, utils_1.DECIMALS_SOL)), owner);
|
|
2229
|
+
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this._rpc, createWSolAtaIxns.ata);
|
|
2167
2230
|
if (!wSolAtaExists) {
|
|
2168
2231
|
realTokenBMinPostDepositBalanceLamports = new decimal_js_1.default(0);
|
|
2169
2232
|
}
|
|
@@ -2184,14 +2247,20 @@ class Kamino {
|
|
|
2184
2247
|
if (aToDeposit.lessThan(0) || bToDeposit.lessThan(0)) {
|
|
2185
2248
|
throw Error(`Token A or B to deposit amount cannot be lower than 0; aToDeposit=${aToDeposit.toString()} bToDeposit=${bToDeposit.toString()}`);
|
|
2186
2249
|
}
|
|
2187
|
-
const createAtaList = [[strategyState.sharesMint,
|
|
2250
|
+
const createAtaList = [[strategyState.sharesMint, token_1.TOKEN_PROGRAM_ADDRESS]];
|
|
2188
2251
|
if (!tokenAAtaBalance.greaterThan(0)) {
|
|
2189
|
-
createAtaList.push([
|
|
2252
|
+
createAtaList.push([
|
|
2253
|
+
strategyState.tokenAMint,
|
|
2254
|
+
(0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2255
|
+
]);
|
|
2190
2256
|
}
|
|
2191
2257
|
if (!tokenBAtaBalance.greaterThan(0)) {
|
|
2192
|
-
createAtaList.push([
|
|
2258
|
+
createAtaList.push([
|
|
2259
|
+
strategyState.tokenBMint,
|
|
2260
|
+
(0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2261
|
+
]);
|
|
2193
2262
|
}
|
|
2194
|
-
const createAtasIxnsPromise = (0, transactions_1.getAtasWithCreateIxnsIfMissing)(this.
|
|
2263
|
+
const createAtasIxnsPromise = (0, transactions_1.getAtasWithCreateIxnsIfMissing)(this._rpc, createAtaList.filter(([mint, _tokenProgram]) => !(0, utils_1.isSOLMint)(mint)), owner);
|
|
2195
2264
|
const getGlobalConfigPromise = this.getGlobalConfigState(strategyState.globalConfig);
|
|
2196
2265
|
const [createAtasIxns, amountsToDepositWithSwap, globalConfig] = await Promise.all([
|
|
2197
2266
|
createAtasIxnsPromise,
|
|
@@ -2224,20 +2293,20 @@ class Kamino {
|
|
|
2224
2293
|
sharesMintAuthority: strategyState.sharesMintAuthority,
|
|
2225
2294
|
scopePrices: strategyState.scopePrices,
|
|
2226
2295
|
tokenInfos: globalConfig.tokenInfos,
|
|
2227
|
-
tokenProgram:
|
|
2228
|
-
instructionSysvarAccount:
|
|
2296
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
2297
|
+
instructionSysvarAccount: sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
2229
2298
|
tickArrayLower: strategyWithAddress.strategy.tickArrayLower,
|
|
2230
2299
|
tickArrayUpper: strategyWithAddress.strategy.tickArrayUpper,
|
|
2231
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenATokenProgram,
|
|
2232
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenBTokenProgram,
|
|
2300
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2301
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2233
2302
|
};
|
|
2234
|
-
const singleSidedDepositIx = (0,
|
|
2303
|
+
const singleSidedDepositIx = (0, instructions_2.singleTokenDepositWithMin)(args, accounts, this.getProgramID());
|
|
2235
2304
|
let result = [];
|
|
2236
2305
|
if (includeAtaIxns) {
|
|
2237
2306
|
result.push(...createAtasIxns, ...createWsolAtasIxns);
|
|
2238
2307
|
}
|
|
2239
2308
|
// get all unique accounts in the tx so we can use the remaining space (MAX_ACCOUNTS_PER_TRANSACTION - accounts_used) for the swap
|
|
2240
|
-
const extractKeys = (ixs) => ixs.flatMap((ix) => ix.
|
|
2309
|
+
const extractKeys = (ixs) => ixs.flatMap((ix) => ix.accounts?.map((key) => key.address) || []);
|
|
2241
2310
|
const allKeys = [
|
|
2242
2311
|
...extractKeys(result),
|
|
2243
2312
|
...extractKeys([checkExpectedVaultsBalancesIx]),
|
|
@@ -2276,15 +2345,15 @@ class Kamino {
|
|
|
2276
2345
|
* @param amountLamports Amount of SOL to deposit into topup vault
|
|
2277
2346
|
* @returns transaction instruction for adding SOL to topup vault
|
|
2278
2347
|
*/
|
|
2279
|
-
upkeepTopupVault = (owner, amountLamports) => {
|
|
2348
|
+
upkeepTopupVault = async (owner, amountLamports) => {
|
|
2280
2349
|
if (amountLamports.lessThanOrEqualTo(0)) {
|
|
2281
2350
|
throw Error('Must deposit a positive amount of SOL.');
|
|
2282
2351
|
}
|
|
2283
|
-
const topupVault = this.getUserTopupVault(owner);
|
|
2284
|
-
const ix =
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2352
|
+
const topupVault = await this.getUserTopupVault(owner.address);
|
|
2353
|
+
const ix = (0, system_1.getTransferSolInstruction)({
|
|
2354
|
+
source: owner,
|
|
2355
|
+
destination: topupVault,
|
|
2356
|
+
amount: BigInt(amountLamports.floor().toString()),
|
|
2288
2357
|
});
|
|
2289
2358
|
return ix;
|
|
2290
2359
|
};
|
|
@@ -2294,8 +2363,8 @@ class Kamino {
|
|
|
2294
2363
|
* @returns SOL amount in topup vault
|
|
2295
2364
|
*/
|
|
2296
2365
|
topupVaultBalance = async (owner) => {
|
|
2297
|
-
const topupVault = this.getUserTopupVault(owner);
|
|
2298
|
-
return (0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this.
|
|
2366
|
+
const topupVault = await this.getUserTopupVault(owner);
|
|
2367
|
+
return (0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default((await this._rpc.getBalance(topupVault).send()).value.toString()), utils_1.DECIMALS_SOL);
|
|
2299
2368
|
};
|
|
2300
2369
|
/**
|
|
2301
2370
|
* Get transaction instruction to withdraw SOL from the topup vault.
|
|
@@ -2307,10 +2376,10 @@ class Kamino {
|
|
|
2307
2376
|
if (amount.lessThanOrEqualTo(0)) {
|
|
2308
2377
|
throw Error('Must withdraw a positive amount of SOL.');
|
|
2309
2378
|
}
|
|
2310
|
-
const topupVault = this.getUserTopupVault(owner);
|
|
2379
|
+
const topupVault = await this.getUserTopupVault(owner.address);
|
|
2311
2380
|
let solToWithdraw;
|
|
2312
2381
|
if (amount.eq(new decimal_js_1.default(constants_1.U64_MAX))) {
|
|
2313
|
-
solToWithdraw = new decimal_js_1.default(await this.
|
|
2382
|
+
solToWithdraw = new decimal_js_1.default((await this._rpc.getBalance(topupVault).send()).value.toString());
|
|
2314
2383
|
}
|
|
2315
2384
|
else {
|
|
2316
2385
|
solToWithdraw = (0, utils_1.collToLamportsDecimal)(amount, utils_1.DECIMALS_SOL);
|
|
@@ -2321,25 +2390,29 @@ class Kamino {
|
|
|
2321
2390
|
const accounts = {
|
|
2322
2391
|
adminAuthority: owner,
|
|
2323
2392
|
topupVault,
|
|
2324
|
-
system:
|
|
2393
|
+
system: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
2325
2394
|
};
|
|
2326
|
-
const withdrawIxn = (0,
|
|
2395
|
+
const withdrawIxn = (0, instructions_2.withdrawFromTopup)(args, accounts, this.getProgramID());
|
|
2327
2396
|
return withdrawIxn;
|
|
2328
2397
|
};
|
|
2329
2398
|
getJupSwapIxsWithMaxAccounts = async (input, tokenAMint, tokenBMint, owner, slippageBps, useOnlyLegacyTransaction, existingAccounts, maxAccounts, profiler = utils_1.noopProfiledFunctionExecution, onlyDirectRoutes) => {
|
|
2330
2399
|
const jupiterQuote = input.tokenAToSwapAmount.lt(utils_1.ZERO)
|
|
2331
2400
|
? await profiler(JupService_1.JupService.getBestRouteV6(owner, input.tokenAToSwapAmount.abs(), tokenAMint, tokenBMint, slippageBps.toNumber(), useOnlyLegacyTransaction, maxAccounts, onlyDirectRoutes), 'C-getBestRouteV6', [])
|
|
2332
2401
|
: await profiler(JupService_1.JupService.getBestRouteV6(owner, input.tokenBToSwapAmount.abs(), tokenBMint, tokenAMint, slippageBps.toNumber(), useOnlyLegacyTransaction, maxAccounts, onlyDirectRoutes), 'C-getBestRouteV6', []);
|
|
2333
|
-
const
|
|
2334
|
-
|
|
2335
|
-
|
|
2402
|
+
const allJupIxs = [
|
|
2403
|
+
...(jupiterQuote.tokenLedgerInstruction ? [jupiterQuote.tokenLedgerInstruction] : []),
|
|
2404
|
+
...(0, transactions_1.removeBudgetAndAtaIxns)(jupiterQuote.setupInstructions, [tokenAMint, tokenBMint]),
|
|
2405
|
+
jupiterQuote.swapInstruction,
|
|
2406
|
+
...(jupiterQuote.cleanupInstruction ? [jupiterQuote.cleanupInstruction] : []),
|
|
2407
|
+
];
|
|
2408
|
+
const allJupAccounts = allJupIxs.flatMap((ix) => ix.accounts?.map((key) => key.address) || []);
|
|
2336
2409
|
const allAccounts = new Set([...existingAccounts, ...allJupAccounts]);
|
|
2337
2410
|
const prefix = 'getSingleSidedJupRoute:';
|
|
2338
2411
|
console.log(`${prefix} All distinct existing accounts number ${new Set(existingAccounts).size}`);
|
|
2339
2412
|
console.log(`${prefix} All distinct Jup accounts number ${new Set(allJupAccounts).size}`);
|
|
2340
2413
|
console.log(`${prefix} All accounts number ${allAccounts.size}`);
|
|
2341
2414
|
if (allAccounts.size < transactions_1.MAX_ACCOUNTS_PER_TRANSACTION) {
|
|
2342
|
-
return [allJupIxs,
|
|
2415
|
+
return [allJupIxs, jupiterQuote.addressLookupTableAddresses];
|
|
2343
2416
|
}
|
|
2344
2417
|
// if none of the swap TXs returned by Jup have less than max allowed accounts throw error as the tx will fail because we lock too many accounts
|
|
2345
2418
|
throw new Error('All Jupiter swap routes have too many accounts in the instructions');
|
|
@@ -2399,7 +2472,7 @@ class Kamino {
|
|
|
2399
2472
|
tokenAAta,
|
|
2400
2473
|
tokenBAta,
|
|
2401
2474
|
};
|
|
2402
|
-
return (0,
|
|
2475
|
+
return (0, instructions_2.checkExpectedVaultsBalances)(args, accounts, this.getProgramID());
|
|
2403
2476
|
};
|
|
2404
2477
|
/**
|
|
2405
2478
|
* Get transaction instruction to create a new Kamino strategy.
|
|
@@ -2413,26 +2486,26 @@ class Kamino {
|
|
|
2413
2486
|
* @returns transaction instruction for Kamino strategy creation
|
|
2414
2487
|
*/
|
|
2415
2488
|
createStrategy = async (strategy, pool, owner, dex) => {
|
|
2416
|
-
let tokenAMint =
|
|
2417
|
-
let tokenBMint =
|
|
2418
|
-
if (dex
|
|
2419
|
-
const whirlpoolState = await
|
|
2489
|
+
let tokenAMint = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2490
|
+
let tokenBMint = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2491
|
+
if (dex === 'ORCA') {
|
|
2492
|
+
const whirlpoolState = await accounts_2.Whirlpool.fetch(this._rpc, pool, this._orcaService.getWhirlpoolProgramId());
|
|
2420
2493
|
if (!whirlpoolState) {
|
|
2421
2494
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
2422
2495
|
}
|
|
2423
2496
|
tokenAMint = whirlpoolState.tokenMintA;
|
|
2424
2497
|
tokenBMint = whirlpoolState.tokenMintB;
|
|
2425
2498
|
}
|
|
2426
|
-
else if (dex
|
|
2427
|
-
const raydiumPoolState = await
|
|
2499
|
+
else if (dex === 'RAYDIUM') {
|
|
2500
|
+
const raydiumPoolState = await accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
2428
2501
|
if (!raydiumPoolState) {
|
|
2429
2502
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
2430
2503
|
}
|
|
2431
2504
|
tokenAMint = raydiumPoolState.tokenMint0;
|
|
2432
2505
|
tokenBMint = raydiumPoolState.tokenMint1;
|
|
2433
2506
|
}
|
|
2434
|
-
else if (dex
|
|
2435
|
-
const meteoraPoolState = await
|
|
2507
|
+
else if (dex === 'METEORA') {
|
|
2508
|
+
const meteoraPoolState = await accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
2436
2509
|
if (!meteoraPoolState) {
|
|
2437
2510
|
throw Error(`Could not fetch Meteora pool state with pubkey ${pool.toString()}`);
|
|
2438
2511
|
}
|
|
@@ -2446,11 +2519,11 @@ class Kamino {
|
|
|
2446
2519
|
throw Error(`Could not fetch globalConfig with pubkey ${this.getGlobalConfig().toString()}`);
|
|
2447
2520
|
}
|
|
2448
2521
|
const collateralInfos = await this.getCollateralInfo(config.tokenInfos);
|
|
2449
|
-
const tokenACollateralId = collateralInfos.findIndex((x) => x.mint
|
|
2522
|
+
const tokenACollateralId = collateralInfos.findIndex((x) => x.mint === tokenAMint);
|
|
2450
2523
|
if (tokenACollateralId === -1) {
|
|
2451
2524
|
throw Error(`Could not find token A (mint ${tokenAMint}) in collateral infos`);
|
|
2452
2525
|
}
|
|
2453
|
-
const tokenBCollateralId = collateralInfos.findIndex((x) => x.mint
|
|
2526
|
+
const tokenBCollateralId = collateralInfos.findIndex((x) => x.mint === tokenBMint);
|
|
2454
2527
|
if (tokenBCollateralId === -1) {
|
|
2455
2528
|
throw Error(`Could not find token A (mint ${tokenBMint}) in collateral infos`);
|
|
2456
2529
|
}
|
|
@@ -2473,30 +2546,36 @@ class Kamino {
|
|
|
2473
2546
|
sharesMint: programAddresses.sharesMint,
|
|
2474
2547
|
sharesMintAuthority: programAddresses.sharesMintAuthority,
|
|
2475
2548
|
tokenInfos: config.tokenInfos,
|
|
2476
|
-
systemProgram:
|
|
2477
|
-
rent:
|
|
2478
|
-
tokenProgram:
|
|
2549
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
2550
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
2551
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
2479
2552
|
tokenATokenProgram,
|
|
2480
2553
|
tokenBTokenProgram,
|
|
2481
2554
|
};
|
|
2482
|
-
|
|
2483
|
-
ix
|
|
2484
|
-
|
|
2555
|
+
let ix = (0, instructions_2.initializeStrategy)(strategyArgs, strategyAccounts, this.getProgramID());
|
|
2556
|
+
ix = {
|
|
2557
|
+
...ix,
|
|
2558
|
+
accounts: ix.accounts?.concat([
|
|
2559
|
+
{ address: config.scopePriceId, role: kit_1.AccountRole.READONLY },
|
|
2560
|
+
{ address: config.scopeProgramId, role: kit_1.AccountRole.READONLY },
|
|
2561
|
+
]),
|
|
2562
|
+
};
|
|
2485
2563
|
return ix;
|
|
2486
2564
|
};
|
|
2487
2565
|
/**
|
|
2488
2566
|
* Get transaction instruction to close Kamino strategy, including its position if there is any
|
|
2489
2567
|
* and strategy token accounts.
|
|
2490
2568
|
* @param strategy public key of the strategy
|
|
2569
|
+
* @param admin signer to close the strategy
|
|
2491
2570
|
* @returns instruction to close the strategy
|
|
2492
2571
|
*/
|
|
2493
|
-
withdrawAllAndCloseStrategy = async (strategy) => {
|
|
2572
|
+
withdrawAllAndCloseStrategy = async (admin, strategy) => {
|
|
2494
2573
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
2495
|
-
const withdrawIxns = await this.withdrawAllShares(strategyWithAddress,
|
|
2496
|
-
if (withdrawIxns
|
|
2574
|
+
const withdrawIxns = await this.withdrawAllShares(strategyWithAddress, admin);
|
|
2575
|
+
if (withdrawIxns === null) {
|
|
2497
2576
|
return null;
|
|
2498
2577
|
}
|
|
2499
|
-
const closeIxn = await this.closeStrategy(strategyWithAddress);
|
|
2578
|
+
const closeIxn = await this.closeStrategy(admin, strategyWithAddress);
|
|
2500
2579
|
return {
|
|
2501
2580
|
withdrawIxns: [...withdrawIxns.prerequisiteIxs, withdrawIxns.withdrawIx],
|
|
2502
2581
|
closeIxn,
|
|
@@ -2505,20 +2584,21 @@ class Kamino {
|
|
|
2505
2584
|
/**
|
|
2506
2585
|
* Get transaction instruction to close Kamino strategy, including its position if there is any
|
|
2507
2586
|
* and strategy token accounts.
|
|
2587
|
+
* @param admin signer to close the strategy
|
|
2508
2588
|
* @param strategy public key of the strategy
|
|
2509
2589
|
* @returns instruction to close the strategy
|
|
2510
2590
|
*/
|
|
2511
|
-
closeStrategy = async (strategy) => {
|
|
2591
|
+
closeStrategy = async (admin, strategy) => {
|
|
2512
2592
|
const { address: strategyPubkey, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
2513
2593
|
const collInfos = await this.getCollateralInfos();
|
|
2514
|
-
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2515
|
-
const poolProgram =
|
|
2594
|
+
const eventAuthority = await this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2595
|
+
const poolProgram = this.getDexProgramId(strategyState);
|
|
2516
2596
|
let oldPositionOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2517
2597
|
let oldPositionMintOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2518
2598
|
let oldPositionTokenAccountOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2519
2599
|
let oldTickArrayLowerOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2520
2600
|
let oldTickArrayUpperOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2521
|
-
if (
|
|
2601
|
+
if (strategyState.position !== pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
2522
2602
|
oldPositionOrBaseVaultAuthority = strategyState.position;
|
|
2523
2603
|
oldPositionMintOrBaseVaultAuthority = strategyState.positionMint;
|
|
2524
2604
|
oldPositionTokenAccountOrBaseVaultAuthority = strategyState.positionTokenAccount;
|
|
@@ -2526,18 +2606,18 @@ class Kamino {
|
|
|
2526
2606
|
oldTickArrayUpperOrBaseVaultAuthority = strategyState.tickArrayUpper;
|
|
2527
2607
|
}
|
|
2528
2608
|
const [userTokenAAta, userTokenBAta] = await Promise.all([
|
|
2529
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, strategyState.adminAuthority,
|
|
2530
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, strategyState.adminAuthority,
|
|
2609
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, strategyState.adminAuthority, (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2610
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, strategyState.adminAuthority, (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2531
2611
|
]);
|
|
2532
2612
|
const rewardMints = Array(6).fill(strategyState.pool);
|
|
2533
|
-
const rewardTokenPrograms = Array(6).fill(
|
|
2613
|
+
const rewardTokenPrograms = Array(6).fill(token_1.TOKEN_PROGRAM_ADDRESS);
|
|
2534
2614
|
let reward0Vault = strategyState.baseVaultAuthority;
|
|
2535
2615
|
let userReward0Ata = strategyState.baseVaultAuthority;
|
|
2536
2616
|
if ((0, utils_1.isVaultInitialized)(strategyState.reward0Vault, strategyState.reward0Decimals)) {
|
|
2537
2617
|
reward0Vault = strategyState.reward0Vault;
|
|
2538
2618
|
rewardMints[0] = collInfos[strategyState.reward0CollateralId.toNumber()].mint;
|
|
2539
2619
|
rewardTokenPrograms[0] = await this.getAccountOwner(rewardMints[0]);
|
|
2540
|
-
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[0], strategyState.adminAuthority,
|
|
2620
|
+
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[0], strategyState.adminAuthority, rewardTokenPrograms[0]);
|
|
2541
2621
|
}
|
|
2542
2622
|
let reward1Vault = strategyState.baseVaultAuthority;
|
|
2543
2623
|
let userReward1Ata = strategyState.baseVaultAuthority;
|
|
@@ -2545,7 +2625,7 @@ class Kamino {
|
|
|
2545
2625
|
reward1Vault = strategyState.reward1Vault;
|
|
2546
2626
|
rewardMints[1] = collInfos[strategyState.reward1CollateralId.toNumber()].mint;
|
|
2547
2627
|
rewardTokenPrograms[1] = await this.getAccountOwner(rewardMints[1]);
|
|
2548
|
-
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[1], strategyState.adminAuthority,
|
|
2628
|
+
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[1], strategyState.adminAuthority, rewardTokenPrograms[1]);
|
|
2549
2629
|
}
|
|
2550
2630
|
let reward2Vault = strategyState.baseVaultAuthority;
|
|
2551
2631
|
let userReward2Ata = strategyState.baseVaultAuthority;
|
|
@@ -2553,7 +2633,7 @@ class Kamino {
|
|
|
2553
2633
|
reward2Vault = strategyState.reward2Vault;
|
|
2554
2634
|
rewardMints[2] = collInfos[strategyState.reward2CollateralId.toNumber()].mint;
|
|
2555
2635
|
rewardTokenPrograms[2] = await this.getAccountOwner(rewardMints[2]);
|
|
2556
|
-
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[2], strategyState.adminAuthority,
|
|
2636
|
+
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[2], strategyState.adminAuthority, rewardTokenPrograms[2]);
|
|
2557
2637
|
}
|
|
2558
2638
|
let kaminoReward0Vault = strategyState.baseVaultAuthority;
|
|
2559
2639
|
const userKaminoReward0Ata = strategyState.baseVaultAuthority;
|
|
@@ -2561,7 +2641,7 @@ class Kamino {
|
|
|
2561
2641
|
kaminoReward0Vault = strategyState.kaminoRewards[0].rewardVault;
|
|
2562
2642
|
rewardMints[3] = strategyState.kaminoRewards[0].rewardVault;
|
|
2563
2643
|
rewardTokenPrograms[3] = await this.getAccountOwner(rewardMints[3]);
|
|
2564
|
-
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[3], strategyState.adminAuthority,
|
|
2644
|
+
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[3], strategyState.adminAuthority, rewardTokenPrograms[3]);
|
|
2565
2645
|
}
|
|
2566
2646
|
let kaminoReward1Vault = strategyState.baseVaultAuthority;
|
|
2567
2647
|
const userKaminoReward1Ata = strategyState.baseVaultAuthority;
|
|
@@ -2569,7 +2649,7 @@ class Kamino {
|
|
|
2569
2649
|
kaminoReward1Vault = strategyState.kaminoRewards[1].rewardVault;
|
|
2570
2650
|
rewardMints[4] = strategyState.kaminoRewards[1].rewardVault;
|
|
2571
2651
|
rewardTokenPrograms[4] = await this.getAccountOwner(rewardMints[4]);
|
|
2572
|
-
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[4], strategyState.adminAuthority,
|
|
2652
|
+
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[4], strategyState.adminAuthority, rewardTokenPrograms[4]);
|
|
2573
2653
|
}
|
|
2574
2654
|
let kaminoReward2Vault = strategyState.baseVaultAuthority;
|
|
2575
2655
|
const userKaminoReward2Ata = strategyState.baseVaultAuthority;
|
|
@@ -2577,10 +2657,10 @@ class Kamino {
|
|
|
2577
2657
|
kaminoReward2Vault = strategyState.kaminoRewards[2].rewardVault;
|
|
2578
2658
|
rewardMints[5] = strategyState.kaminoRewards[2].rewardVault;
|
|
2579
2659
|
rewardTokenPrograms[5] = await this.getAccountOwner(rewardMints[5]);
|
|
2580
|
-
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[5],
|
|
2660
|
+
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[5], admin.address, rewardTokenPrograms[5]);
|
|
2581
2661
|
}
|
|
2582
2662
|
const strategyAccounts = {
|
|
2583
|
-
adminAuthority:
|
|
2663
|
+
adminAuthority: admin,
|
|
2584
2664
|
strategy: strategyPubkey,
|
|
2585
2665
|
oldPositionOrBaseVaultAuthority,
|
|
2586
2666
|
oldPositionMintOrBaseVaultAuthority,
|
|
@@ -2588,8 +2668,8 @@ class Kamino {
|
|
|
2588
2668
|
tokenAVault: strategyState.tokenAVault,
|
|
2589
2669
|
tokenBVault: strategyState.tokenBVault,
|
|
2590
2670
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
2591
|
-
system:
|
|
2592
|
-
tokenProgram:
|
|
2671
|
+
system: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
2672
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
2593
2673
|
poolProgram: poolProgram,
|
|
2594
2674
|
userTokenAAta,
|
|
2595
2675
|
userTokenBAta,
|
|
@@ -2609,20 +2689,28 @@ class Kamino {
|
|
|
2609
2689
|
oldTickArrayUpperOrBaseVaultAuthority,
|
|
2610
2690
|
pool: strategyState.pool,
|
|
2611
2691
|
eventAuthority,
|
|
2612
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
2613
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
2692
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2693
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2614
2694
|
tokenAMint: strategyState.tokenAMint,
|
|
2615
2695
|
tokenBMint: strategyState.tokenBMint,
|
|
2616
2696
|
};
|
|
2617
|
-
|
|
2697
|
+
let ix = (0, instructions_2.closeStrategy)(strategyAccounts, this.getProgramID());
|
|
2618
2698
|
for (let i = 0; i < 6; i++) {
|
|
2619
|
-
ix
|
|
2620
|
-
|
|
2699
|
+
ix = {
|
|
2700
|
+
...ix,
|
|
2701
|
+
accounts: ix.accounts?.concat([
|
|
2702
|
+
{ address: rewardMints[i], role: kit_1.AccountRole.READONLY },
|
|
2703
|
+
{ address: rewardTokenPrograms[i], role: kit_1.AccountRole.READONLY },
|
|
2704
|
+
]),
|
|
2705
|
+
};
|
|
2621
2706
|
}
|
|
2622
2707
|
return ix;
|
|
2623
2708
|
};
|
|
2624
|
-
getUserTopupVault = (user) => {
|
|
2625
|
-
const [topupVault
|
|
2709
|
+
getUserTopupVault = async (user) => {
|
|
2710
|
+
const [topupVault] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2711
|
+
seeds: [Buffer.from('topup_vault'), addressEncoder.encode(user)],
|
|
2712
|
+
programAddress: this.getProgramID(),
|
|
2713
|
+
});
|
|
2626
2714
|
return topupVault;
|
|
2627
2715
|
};
|
|
2628
2716
|
/**
|
|
@@ -2634,11 +2722,31 @@ class Kamino {
|
|
|
2634
2722
|
* @returns object with program addresses for kamino strategy creation
|
|
2635
2723
|
*/
|
|
2636
2724
|
getStrategyProgramAddresses = async (strategy, tokenMintA, tokenMintB) => {
|
|
2637
|
-
const [tokenAVault, tokenABump] =
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
const [
|
|
2725
|
+
const [tokenAVault, tokenABump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2726
|
+
seeds: [Buffer.from('svault_a'), addressEncoder.encode(strategy)],
|
|
2727
|
+
programAddress: this.getProgramID(),
|
|
2728
|
+
});
|
|
2729
|
+
const [tokenBVault, tokenBBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2730
|
+
seeds: [Buffer.from('svault_b'), addressEncoder.encode(strategy)],
|
|
2731
|
+
programAddress: this.getProgramID(),
|
|
2732
|
+
});
|
|
2733
|
+
const [baseVaultAuthority, baseVaultAuthorityBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2734
|
+
seeds: [Buffer.from('authority'), addressEncoder.encode(tokenAVault), addressEncoder.encode(tokenBVault)],
|
|
2735
|
+
programAddress: this.getProgramID(),
|
|
2736
|
+
});
|
|
2737
|
+
const [sharesMint, sharesMintBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2738
|
+
seeds: [
|
|
2739
|
+
Buffer.from('shares'),
|
|
2740
|
+
addressEncoder.encode(strategy),
|
|
2741
|
+
addressEncoder.encode(tokenMintA),
|
|
2742
|
+
addressEncoder.encode(tokenMintB),
|
|
2743
|
+
],
|
|
2744
|
+
programAddress: this.getProgramID(),
|
|
2745
|
+
});
|
|
2746
|
+
const [sharesMintAuthority, sharesMintAuthorityBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2747
|
+
seeds: [Buffer.from('authority'), addressEncoder.encode(sharesMint)],
|
|
2748
|
+
programAddress: this.getProgramID(),
|
|
2749
|
+
});
|
|
2642
2750
|
return {
|
|
2643
2751
|
sharesMintAuthority,
|
|
2644
2752
|
tokenAVault,
|
|
@@ -2659,17 +2767,17 @@ class Kamino {
|
|
|
2659
2767
|
* @returns transaction instruction to create the account
|
|
2660
2768
|
*/
|
|
2661
2769
|
createStrategyAccount = async (payer, newStrategy) => {
|
|
2662
|
-
const accountSize =
|
|
2770
|
+
const accountSize = BigInt(accounts_1.WhirlpoolStrategy.layout.span + 8);
|
|
2663
2771
|
return this.createAccountRentExempt(payer, newStrategy, accountSize);
|
|
2664
2772
|
};
|
|
2665
|
-
createAccountRentExempt = async (payer,
|
|
2666
|
-
const lamports = await this.
|
|
2667
|
-
return
|
|
2668
|
-
|
|
2669
|
-
fromPubkey: payer,
|
|
2670
|
-
newAccountPubkey,
|
|
2773
|
+
createAccountRentExempt = async (payer, newAccount, size) => {
|
|
2774
|
+
const lamports = await this._rpc.getMinimumBalanceForRentExemption(size).send();
|
|
2775
|
+
return (0, system_1.getCreateAccountInstruction)({
|
|
2776
|
+
newAccount,
|
|
2671
2777
|
space: size,
|
|
2672
2778
|
lamports,
|
|
2779
|
+
payer,
|
|
2780
|
+
programAddress: this.getProgramID(),
|
|
2673
2781
|
});
|
|
2674
2782
|
};
|
|
2675
2783
|
/**
|
|
@@ -2681,17 +2789,17 @@ class Kamino {
|
|
|
2681
2789
|
*/
|
|
2682
2790
|
collectFeesAndRewards = async (strategy, owner) => {
|
|
2683
2791
|
const { address: strategyPubkey, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
2684
|
-
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2685
|
-
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } = this.getTreasuryFeeVaultPDAs(strategyState.tokenAMint, strategyState.tokenBMint);
|
|
2792
|
+
const eventAuthority = await this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2793
|
+
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } = await this.getTreasuryFeeVaultPDAs(strategyState.tokenAMint, strategyState.tokenBMint);
|
|
2686
2794
|
let programId = this._orcaService.getWhirlpoolProgramId();
|
|
2687
|
-
let poolRewardVault0 =
|
|
2688
|
-
let poolRewardVault1 =
|
|
2689
|
-
let poolRewardVault2 =
|
|
2690
|
-
let rewardMint0 =
|
|
2691
|
-
let rewardMint1 =
|
|
2692
|
-
let rewardMint2 =
|
|
2795
|
+
let poolRewardVault0 = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2796
|
+
let poolRewardVault1 = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2797
|
+
let poolRewardVault2 = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2798
|
+
let rewardMint0 = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2799
|
+
let rewardMint1 = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2800
|
+
let rewardMint2 = pubkeys_1.DEFAULT_PUBLIC_KEY;
|
|
2693
2801
|
if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
2694
|
-
const whirlpool = await
|
|
2802
|
+
const whirlpool = await accounts_2.Whirlpool.fetch(this._rpc, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
2695
2803
|
if (!whirlpool) {
|
|
2696
2804
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
2697
2805
|
}
|
|
@@ -2704,7 +2812,7 @@ class Kamino {
|
|
|
2704
2812
|
}
|
|
2705
2813
|
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
2706
2814
|
programId = this._raydiumService.getRaydiumProgramId();
|
|
2707
|
-
const poolState = await
|
|
2815
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
2708
2816
|
if (!poolState) {
|
|
2709
2817
|
throw Error(`Could not fetch Raydium pool state with pubkey ${strategyState.pool.toString()}`);
|
|
2710
2818
|
}
|
|
@@ -2715,9 +2823,9 @@ class Kamino {
|
|
|
2715
2823
|
rewardMint1 = poolState.rewardInfos[1].tokenMint;
|
|
2716
2824
|
rewardMint2 = poolState.rewardInfos[2].tokenMint;
|
|
2717
2825
|
}
|
|
2718
|
-
else if (strategyState.strategyDex.toNumber()
|
|
2826
|
+
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
2719
2827
|
programId = this._meteoraService.getMeteoraProgramId();
|
|
2720
|
-
const poolState = await
|
|
2828
|
+
const poolState = await accounts_4.LbPair.fetch(this._rpc, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
2721
2829
|
if (!poolState) {
|
|
2722
2830
|
throw Error(`Could not fetch Meteora pool state with pubkey ${strategyState.pool.toString()}`);
|
|
2723
2831
|
}
|
|
@@ -2726,7 +2834,7 @@ class Kamino {
|
|
|
2726
2834
|
poolRewardVault2 = strategyPubkey;
|
|
2727
2835
|
rewardMint0 = poolState.rewardInfos[0].mint;
|
|
2728
2836
|
rewardMint1 = poolState.rewardInfos[1].mint;
|
|
2729
|
-
rewardMint2 = this.
|
|
2837
|
+
rewardMint2 = this.getProgramID();
|
|
2730
2838
|
}
|
|
2731
2839
|
const accounts = {
|
|
2732
2840
|
user: owner || strategyState.adminAuthority,
|
|
@@ -2755,15 +2863,15 @@ class Kamino {
|
|
|
2755
2863
|
tickArrayUpper: strategyState.tickArrayUpper,
|
|
2756
2864
|
raydiumProtocolPositionOrBaseVaultAuthority: strategyState.raydiumProtocolPositionOrBaseVaultAuthority,
|
|
2757
2865
|
poolProgram: programId,
|
|
2758
|
-
instructionSysvarAccount:
|
|
2866
|
+
instructionSysvarAccount: sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
2759
2867
|
eventAuthority,
|
|
2760
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
2761
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
2868
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2869
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2762
2870
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
2763
|
-
tokenProgram:
|
|
2764
|
-
tokenProgram2022:
|
|
2871
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
2872
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
2765
2873
|
};
|
|
2766
|
-
|
|
2874
|
+
let ix = (0, instructions_2.collectFeesAndRewards)(accounts, this.getProgramID());
|
|
2767
2875
|
const pairs = [
|
|
2768
2876
|
[strategyState.reward0Decimals.toNumber(), rewardMint0],
|
|
2769
2877
|
[strategyState.reward1Decimals.toNumber(), rewardMint1],
|
|
@@ -2771,24 +2879,41 @@ class Kamino {
|
|
|
2771
2879
|
];
|
|
2772
2880
|
for (const [decimals, mint] of pairs) {
|
|
2773
2881
|
if (decimals > 0) {
|
|
2774
|
-
ixn.keys.push({ pubkey: mint, isSigner: false, isWritable: false });
|
|
2775
2882
|
const tokenProgram = await this.getAccountOwner(mint);
|
|
2776
|
-
|
|
2883
|
+
ix = {
|
|
2884
|
+
...ix,
|
|
2885
|
+
accounts: ix.accounts?.concat([
|
|
2886
|
+
{ address: mint, role: kit_1.AccountRole.READONLY },
|
|
2887
|
+
{ address: tokenProgram, role: kit_1.AccountRole.READONLY },
|
|
2888
|
+
]),
|
|
2889
|
+
};
|
|
2777
2890
|
}
|
|
2778
2891
|
}
|
|
2779
|
-
if (strategyState.strategyDex.toNumber()
|
|
2780
|
-
const [poolTickArrayBitmap
|
|
2781
|
-
|
|
2892
|
+
if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
2893
|
+
const [poolTickArrayBitmap] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2894
|
+
seeds: [Buffer.from('pool_tick_array_bitmap_extension'), addressEncoder.encode(strategyState.pool)],
|
|
2895
|
+
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
2896
|
+
});
|
|
2897
|
+
ix = {
|
|
2898
|
+
...ix,
|
|
2899
|
+
accounts: ix.accounts?.concat([{ address: poolTickArrayBitmap, role: kit_1.AccountRole.READONLY }]),
|
|
2900
|
+
};
|
|
2782
2901
|
}
|
|
2783
|
-
return
|
|
2902
|
+
return ix;
|
|
2784
2903
|
};
|
|
2785
2904
|
/**
|
|
2786
2905
|
* Get orca position metadata program addresses
|
|
2787
2906
|
* @param positionMint mint account of the position
|
|
2788
2907
|
*/
|
|
2789
|
-
getMetadataProgramAddressesOrca = (positionMint) => {
|
|
2790
|
-
const [position, positionBump] =
|
|
2791
|
-
|
|
2908
|
+
getMetadataProgramAddressesOrca = async (positionMint) => {
|
|
2909
|
+
const [position, positionBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2910
|
+
seeds: [Buffer.from('position'), addressEncoder.encode(positionMint)],
|
|
2911
|
+
programAddress: this._orcaService.getWhirlpoolProgramId(),
|
|
2912
|
+
});
|
|
2913
|
+
const [positionMetadata, positionMetadataBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2914
|
+
seeds: [Buffer.from('metadata'), addressEncoder.encode(constants_1.METADATA_PROGRAM_ID), addressEncoder.encode(positionMint)],
|
|
2915
|
+
programAddress: constants_1.METADATA_PROGRAM_ID,
|
|
2916
|
+
});
|
|
2792
2917
|
return {
|
|
2793
2918
|
position,
|
|
2794
2919
|
positionBump,
|
|
@@ -2796,24 +2921,36 @@ class Kamino {
|
|
|
2796
2921
|
positionMetadataBump,
|
|
2797
2922
|
};
|
|
2798
2923
|
};
|
|
2799
|
-
getMetadataProgramAddressesRaydium = (positionMint, pool, tickLowerIndex, tickUpperIndex) => {
|
|
2800
|
-
const { publicKey: protocolPosition, nonce: protocolPositionBump } = (0, lib_1.getPdaProtocolPositionAddress)(this._raydiumService.getRaydiumProgramId(), pool, tickLowerIndex, tickUpperIndex);
|
|
2801
|
-
const [position, positionBump] =
|
|
2802
|
-
|
|
2924
|
+
getMetadataProgramAddressesRaydium = async (positionMint, pool, tickLowerIndex, tickUpperIndex) => {
|
|
2925
|
+
const { publicKey: protocolPosition, nonce: protocolPositionBump } = (0, lib_1.getPdaProtocolPositionAddress)((0, compat_2.toLegacyPublicKey)(this._raydiumService.getRaydiumProgramId()), (0, compat_2.toLegacyPublicKey)(pool), tickLowerIndex, tickUpperIndex);
|
|
2926
|
+
const [position, positionBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2927
|
+
seeds: [Buffer.from('position'), addressEncoder.encode(positionMint)],
|
|
2928
|
+
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
2929
|
+
});
|
|
2930
|
+
const [positionMetadata, positionMetadataBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2931
|
+
seeds: [Buffer.from('metadata'), addressEncoder.encode(constants_1.METADATA_PROGRAM_ID), addressEncoder.encode(positionMint)],
|
|
2932
|
+
programAddress: constants_1.METADATA_PROGRAM_ID,
|
|
2933
|
+
});
|
|
2803
2934
|
return {
|
|
2804
2935
|
position,
|
|
2805
2936
|
positionBump,
|
|
2806
|
-
protocolPosition,
|
|
2937
|
+
protocolPosition: (0, compat_1.fromLegacyPublicKey)(protocolPosition),
|
|
2807
2938
|
protocolPositionBump,
|
|
2808
2939
|
positionMetadata,
|
|
2809
2940
|
positionMetadataBump,
|
|
2810
2941
|
};
|
|
2811
2942
|
};
|
|
2812
|
-
getStartEndTicketIndexProgramAddressesOrca = (whirlpool, whirlpoolState, tickLowerIndex, tickUpperIndex) => {
|
|
2943
|
+
getStartEndTicketIndexProgramAddressesOrca = async (whirlpool, whirlpoolState, tickLowerIndex, tickUpperIndex) => {
|
|
2813
2944
|
const startTickIndex = (0, whirlpool_sdk_1.getStartTickIndex)(tickLowerIndex, whirlpoolState.tickSpacing, 0);
|
|
2814
2945
|
const endTickIndex = (0, whirlpool_sdk_1.getStartTickIndex)(tickUpperIndex, whirlpoolState.tickSpacing, 0);
|
|
2815
|
-
const [lowerTickPubkey, lowerTickBump] =
|
|
2816
|
-
|
|
2946
|
+
const [lowerTickPubkey, lowerTickBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2947
|
+
seeds: [Buffer.from('tick_array'), addressEncoder.encode(whirlpool), Buffer.from(startTickIndex.toString())],
|
|
2948
|
+
programAddress: this._orcaService.getWhirlpoolProgramId(),
|
|
2949
|
+
});
|
|
2950
|
+
const [upperTickPubkey, upperTickBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2951
|
+
seeds: [Buffer.from('tick_array'), addressEncoder.encode(whirlpool), Buffer.from(endTickIndex.toString())],
|
|
2952
|
+
programAddress: this._orcaService.getWhirlpoolProgramId(),
|
|
2953
|
+
});
|
|
2817
2954
|
return {
|
|
2818
2955
|
lowerTick: lowerTickPubkey,
|
|
2819
2956
|
lowerTickBump,
|
|
@@ -2821,11 +2958,17 @@ class Kamino {
|
|
|
2821
2958
|
upperTickBump,
|
|
2822
2959
|
};
|
|
2823
2960
|
};
|
|
2824
|
-
getStartEndTicketIndexProgramAddressesRaydium = (pool, poolState, tickLowerIndex, tickUpperIndex) => {
|
|
2961
|
+
getStartEndTicketIndexProgramAddressesRaydium = async (pool, poolState, tickLowerIndex, tickUpperIndex) => {
|
|
2825
2962
|
const startTickIndex = lib_1.TickUtils.getTickArrayStartIndexByTick(tickLowerIndex, poolState.tickSpacing);
|
|
2826
2963
|
const endTickIndex = lib_1.TickUtils.getTickArrayStartIndexByTick(tickUpperIndex, poolState.tickSpacing);
|
|
2827
|
-
const [lowerTickPubkey, lowerTickBump] =
|
|
2828
|
-
|
|
2964
|
+
const [lowerTickPubkey, lowerTickBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2965
|
+
seeds: [Buffer.from('tick_array'), addressEncoder.encode(pool), (0, lib_1.i32ToBytes)(startTickIndex)],
|
|
2966
|
+
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
2967
|
+
});
|
|
2968
|
+
const [upperTickPubkey, upperTickBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
2969
|
+
seeds: [Buffer.from('tick_array'), addressEncoder.encode(pool), (0, lib_1.i32ToBytes)(endTickIndex)],
|
|
2970
|
+
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
2971
|
+
});
|
|
2829
2972
|
return {
|
|
2830
2973
|
lowerTick: lowerTickPubkey,
|
|
2831
2974
|
lowerTickBump,
|
|
@@ -2834,21 +2977,21 @@ class Kamino {
|
|
|
2834
2977
|
};
|
|
2835
2978
|
};
|
|
2836
2979
|
readMeteoraPosition = async (poolPk, positionPk) => {
|
|
2837
|
-
const pool = await
|
|
2838
|
-
const position = await
|
|
2980
|
+
const pool = await accounts_4.LbPair.fetch(this._rpc, poolPk, this._meteoraService.getMeteoraProgramId());
|
|
2981
|
+
const position = await accounts_4.PositionV2.fetch(this._rpc, positionPk, this._meteoraService.getMeteoraProgramId());
|
|
2839
2982
|
if (!pool || !position) {
|
|
2840
2983
|
return {
|
|
2841
|
-
|
|
2984
|
+
Address: positionPk,
|
|
2842
2985
|
amountX: new decimal_js_1.default(0),
|
|
2843
2986
|
amountY: new decimal_js_1.default(0),
|
|
2844
2987
|
};
|
|
2845
2988
|
}
|
|
2846
|
-
const { lowerTick: lowerTickPk, upperTick: upperTickPk } = this.getStartEndTicketIndexProgramAddressesMeteora(poolPk, position.lowerBinId);
|
|
2847
|
-
const lowerBinArray = await
|
|
2848
|
-
const upperBinArray = await
|
|
2989
|
+
const { lowerTick: lowerTickPk, upperTick: upperTickPk } = await this.getStartEndTicketIndexProgramAddressesMeteora(poolPk, position.lowerBinId);
|
|
2990
|
+
const lowerBinArray = await accounts_4.BinArray.fetch(this._rpc, lowerTickPk, this._meteoraService.getMeteoraProgramId());
|
|
2991
|
+
const upperBinArray = await accounts_4.BinArray.fetch(this._rpc, upperTickPk, this._meteoraService.getMeteoraProgramId());
|
|
2849
2992
|
if (!lowerBinArray || !upperBinArray) {
|
|
2850
2993
|
return {
|
|
2851
|
-
|
|
2994
|
+
Address: positionPk,
|
|
2852
2995
|
amountX: new decimal_js_1.default(0),
|
|
2853
2996
|
amountY: new decimal_js_1.default(0),
|
|
2854
2997
|
};
|
|
@@ -2873,17 +3016,17 @@ class Kamino {
|
|
|
2873
3016
|
}
|
|
2874
3017
|
}
|
|
2875
3018
|
return {
|
|
2876
|
-
|
|
3019
|
+
Address: positionPk,
|
|
2877
3020
|
amountX: totalAmountX,
|
|
2878
3021
|
amountY: totalAmountY,
|
|
2879
3022
|
};
|
|
2880
3023
|
};
|
|
2881
|
-
getStartEndTicketIndexProgramAddressesMeteora = (pool, tickLowerIndex) => {
|
|
3024
|
+
getStartEndTicketIndexProgramAddressesMeteora = async (pool, tickLowerIndex) => {
|
|
2882
3025
|
const meteoraProgramId = this._meteoraService.getMeteoraProgramId();
|
|
2883
3026
|
const lowerBinArrayIndex = (0, meteora_1.binIdToBinArrayIndex)(new bn_js_1.default(tickLowerIndex));
|
|
2884
|
-
const [lowerTick, lowerTickBump] = (0, meteora_1.deriveBinArray)(pool, lowerBinArrayIndex, meteoraProgramId);
|
|
3027
|
+
const [lowerTick, lowerTickBump] = await (0, meteora_1.deriveBinArray)(pool, lowerBinArrayIndex, meteoraProgramId);
|
|
2885
3028
|
const upperBinArrayIndex = lowerBinArrayIndex.add(new bn_js_1.default(1));
|
|
2886
|
-
const [upperTick, upperTickBump] = (0, meteora_1.deriveBinArray)(pool, upperBinArrayIndex, meteoraProgramId);
|
|
3029
|
+
const [upperTick, upperTickBump] = await (0, meteora_1.deriveBinArray)(pool, upperBinArrayIndex, meteoraProgramId);
|
|
2887
3030
|
return {
|
|
2888
3031
|
lowerTick,
|
|
2889
3032
|
lowerTickBump,
|
|
@@ -2893,22 +3036,23 @@ class Kamino {
|
|
|
2893
3036
|
};
|
|
2894
3037
|
/**
|
|
2895
3038
|
* Get a transaction to open liquidity position for a Kamino strategy
|
|
3039
|
+
* @param admin strategy admin authority
|
|
2896
3040
|
* @param strategy strategy you want to open liquidity position for
|
|
2897
|
-
* @param positionMint position mint
|
|
3041
|
+
* @param positionMint position mint keypair
|
|
2898
3042
|
* @param priceLower new position's lower price of the range
|
|
2899
3043
|
* @param priceUpper new position's upper price of the range
|
|
2900
3044
|
* @param status strategy status
|
|
2901
3045
|
*/
|
|
2902
|
-
openPosition = async (strategy, positionMint, priceLower, priceUpper, status = new StrategyStatus_1.Uninitialized()) => {
|
|
3046
|
+
openPosition = async (admin, strategy, positionMint, priceLower, priceUpper, status = new StrategyStatus_1.Uninitialized()) => {
|
|
2903
3047
|
const { strategy: strategyState, address: strategyAddress } = await this.getStrategyStateIfNotFetched(strategy);
|
|
2904
3048
|
if (!strategyState) {
|
|
2905
3049
|
throw Error(`Could not fetch strategy state with pubkey ${strategy.toString()}`);
|
|
2906
3050
|
}
|
|
2907
|
-
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2908
|
-
if (strategyState.strategyDex.toNumber()
|
|
2909
|
-
return this.openPositionOrca(
|
|
3051
|
+
const eventAuthority = await this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3052
|
+
if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
3053
|
+
return this.openPositionOrca(admin, strategyAddress, strategyState.baseVaultAuthority, strategyState.pool, positionMint, priceLower, priceUpper, strategyState.tokenAVault, strategyState.tokenBVault, strategyState.tokenAMint, strategyState.tokenBMint, strategyState.tokenATokenProgram, strategyState.tokenBTokenProgram, strategyState.position, strategyState.positionMint, strategyState.positionTokenAccount, strategyState.tickArrayLower, strategyState.tickArrayUpper, status);
|
|
2910
3054
|
}
|
|
2911
|
-
else if (strategyState.strategyDex.toNumber()
|
|
3055
|
+
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
2912
3056
|
let reward0Vault = undefined;
|
|
2913
3057
|
let reward1Vault = undefined;
|
|
2914
3058
|
let reward2Vault = undefined;
|
|
@@ -2921,10 +3065,10 @@ class Kamino {
|
|
|
2921
3065
|
if (strategyState.reward2Decimals.toNumber() > 0) {
|
|
2922
3066
|
reward2Vault = strategyState.reward2Vault;
|
|
2923
3067
|
}
|
|
2924
|
-
return this.openPositionRaydium(
|
|
3068
|
+
return this.openPositionRaydium(admin, strategyAddress, strategyState.baseVaultAuthority, strategyState.pool, positionMint, priceLower, priceUpper, strategyState.tokenAVault, strategyState.tokenBVault, strategyState.tokenAMint, strategyState.tokenBMint, strategyState.tokenATokenProgram, strategyState.tokenBTokenProgram, strategyState.tickArrayLower, strategyState.tickArrayUpper, strategyState.position, strategyState.positionMint, strategyState.positionTokenAccount, strategyState.raydiumProtocolPositionOrBaseVaultAuthority, eventAuthority, status, reward0Vault, reward1Vault, reward2Vault);
|
|
2925
3069
|
}
|
|
2926
|
-
else if (strategyState.strategyDex.toNumber()
|
|
2927
|
-
return this.openPositionMeteora(
|
|
3070
|
+
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
3071
|
+
return this.openPositionMeteora(admin, strategyAddress, strategyState.baseVaultAuthority, strategyState.pool, positionMint, priceLower, priceUpper, strategyState.tokenAVault, strategyState.tokenBVault, strategyState.tokenAMint, strategyState.tokenBMint, strategyState.tokenATokenProgram, strategyState.tokenBTokenProgram, strategyState.position, strategyState.positionMint, strategyState.positionTokenAccount, strategyState.tickArrayLower, strategyState.tickArrayUpper, eventAuthority, status);
|
|
2928
3072
|
}
|
|
2929
3073
|
else {
|
|
2930
3074
|
throw new Error(`Invalid dex ${strategyState.strategyDex.toString()}`);
|
|
@@ -2938,24 +3082,24 @@ class Kamino {
|
|
|
2938
3082
|
* @param priceUpper new position's upper price of the range
|
|
2939
3083
|
* @param status strategy status
|
|
2940
3084
|
*/
|
|
2941
|
-
openPositionOrca = async (adminAuthority, strategy, baseVaultAuthority, pool, positionMint, priceLower, priceUpper, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, oldPositionOrBaseVaultAuthority, oldPositionMintOrBaseVaultAuthority, oldPositionTokenAccountOrBaseVaultAuthority, oldTickArrayLowerOrBaseVaultAuthority, oldTickArrayUpperOrBaseVaultAuthority,
|
|
2942
|
-
const whirlpool = await
|
|
3085
|
+
openPositionOrca = async (adminAuthority, strategy, baseVaultAuthority, pool, positionMint, priceLower, priceUpper, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, oldPositionOrBaseVaultAuthority, oldPositionMintOrBaseVaultAuthority, oldPositionTokenAccountOrBaseVaultAuthority, oldTickArrayLowerOrBaseVaultAuthority, oldTickArrayUpperOrBaseVaultAuthority, status = new StrategyStatus_1.Uninitialized()) => {
|
|
3086
|
+
const whirlpool = await accounts_2.Whirlpool.fetch(this._rpc, pool, this._orcaService.getWhirlpoolProgramId());
|
|
2943
3087
|
if (!whirlpool) {
|
|
2944
3088
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
2945
3089
|
}
|
|
2946
3090
|
const isRebalancing = status.discriminator === StrategyStatus_1.Rebalancing.discriminator;
|
|
2947
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
2948
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
3091
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, whirlpool.tokenMintA);
|
|
3092
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, whirlpool.tokenMintB);
|
|
2949
3093
|
const tickLowerIndex = (0, whirlpool_sdk_1.getNextValidTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(priceLower, decimalsA, decimalsB), whirlpool.tickSpacing);
|
|
2950
3094
|
const tickUpperIndex = (0, whirlpool_sdk_1.getNextValidTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(priceUpper, decimalsA, decimalsB), whirlpool.tickSpacing);
|
|
2951
|
-
const { position, positionBump, positionMetadata } = this.getMetadataProgramAddressesOrca(positionMint);
|
|
2952
|
-
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint, baseVaultAuthority);
|
|
3095
|
+
const { position, positionBump, positionMetadata } = await this.getMetadataProgramAddressesOrca(positionMint.address);
|
|
3096
|
+
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint.address, baseVaultAuthority);
|
|
2953
3097
|
const args = {
|
|
2954
3098
|
tickLowerIndex: new bn_js_1.default(tickLowerIndex),
|
|
2955
3099
|
tickUpperIndex: new bn_js_1.default(tickUpperIndex),
|
|
2956
3100
|
bump: positionBump,
|
|
2957
3101
|
};
|
|
2958
|
-
const { lowerTick: startTickIndex, upperTick: endTickIndex } = this.getStartEndTicketIndexProgramAddressesOrca(pool, whirlpool, tickLowerIndex, tickUpperIndex);
|
|
3102
|
+
const { lowerTick: startTickIndex, upperTick: endTickIndex } = await this.getStartEndTicketIndexProgramAddressesOrca(pool, whirlpool, tickLowerIndex, tickUpperIndex);
|
|
2959
3103
|
const globalConfig = await this.getGlobalConfigState(this._globalConfig);
|
|
2960
3104
|
if (!globalConfig) {
|
|
2961
3105
|
throw Error(`Could not fetch global config with pubkey ${this._globalConfig.toString()}`);
|
|
@@ -2968,17 +3112,17 @@ class Kamino {
|
|
|
2968
3112
|
tickArrayUpper: endTickIndex,
|
|
2969
3113
|
baseVaultAuthority: baseVaultAuthority,
|
|
2970
3114
|
position,
|
|
2971
|
-
positionMint,
|
|
3115
|
+
positionMint: positionMint.address,
|
|
2972
3116
|
positionMetadataAccount: positionMetadata,
|
|
2973
3117
|
positionTokenAccount,
|
|
2974
|
-
rent:
|
|
2975
|
-
system:
|
|
2976
|
-
tokenProgram:
|
|
2977
|
-
tokenProgram2022:
|
|
2978
|
-
associatedTokenProgram:
|
|
3118
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
3119
|
+
system: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
3120
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
3121
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
3122
|
+
associatedTokenProgram: token_2022_1.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
2979
3123
|
poolProgram: this._orcaService.getWhirlpoolProgramId(),
|
|
2980
3124
|
oldPositionOrBaseVaultAuthority: isRebalancing ? oldPositionOrBaseVaultAuthority : baseVaultAuthority,
|
|
2981
|
-
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint,
|
|
3125
|
+
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint.address,
|
|
2982
3126
|
oldPositionTokenAccountOrBaseVaultAuthority: isRebalancing
|
|
2983
3127
|
? oldPositionTokenAccountOrBaseVaultAuthority
|
|
2984
3128
|
: positionTokenAccount,
|
|
@@ -2993,16 +3137,27 @@ class Kamino {
|
|
|
2993
3137
|
tokenInfos: globalConfig.tokenInfos,
|
|
2994
3138
|
tokenAMint,
|
|
2995
3139
|
tokenBMint,
|
|
2996
|
-
eventAuthority,
|
|
3140
|
+
eventAuthority: (0, kit_1.none)(),
|
|
2997
3141
|
consensusAccount: pubkeys_1.CONSENSUS_ID,
|
|
2998
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram,
|
|
2999
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram,
|
|
3142
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3143
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3000
3144
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3001
3145
|
};
|
|
3002
|
-
const
|
|
3003
|
-
const
|
|
3004
|
-
|
|
3005
|
-
|
|
3146
|
+
const ix = (0, instructions_2.openLiquidityPosition)(args, accounts, this.getProgramID());
|
|
3147
|
+
const accs = [...(ix.accounts || [])];
|
|
3148
|
+
const accountIndex = accs.findIndex((acc) => acc.address === positionMint.address);
|
|
3149
|
+
if (accountIndex >= 0) {
|
|
3150
|
+
accs[accountIndex] = {
|
|
3151
|
+
...accs[accountIndex],
|
|
3152
|
+
role: kit_1.AccountRole.WRITABLE_SIGNER,
|
|
3153
|
+
// @ts-ignore
|
|
3154
|
+
signer: positionMint,
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
return {
|
|
3158
|
+
...ix,
|
|
3159
|
+
accounts: accs,
|
|
3160
|
+
};
|
|
3006
3161
|
};
|
|
3007
3162
|
/**
|
|
3008
3163
|
* Get a transaction to open liquidity position for a Kamino strategy
|
|
@@ -3013,23 +3168,23 @@ class Kamino {
|
|
|
3013
3168
|
* @param status strategy status
|
|
3014
3169
|
*/
|
|
3015
3170
|
openPositionRaydium = async (adminAuthority, strategy, baseVaultAuthority, pool, positionMint, priceLower, priceUpper, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, oldTickArrayLowerOrBaseVaultAuthority, oldTickArrayUpperOrBaseVaultAuthority, oldPositionOrBaseVaultAuthority, oldPositionMintOrBaseVaultAuthority, oldPositionTokenAccountOrBaseVaultAuthority, oldProtocolPositionOrBaseVaultAuthority, eventAuthority, status = new StrategyStatus_1.Uninitialized(), strategyRewardOVault, strategyReward1Vault, strategyReward2Vault) => {
|
|
3016
|
-
const poolState = await
|
|
3171
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
3017
3172
|
if (!poolState) {
|
|
3018
3173
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
3019
3174
|
}
|
|
3020
3175
|
const isRebalancing = status.discriminator === StrategyStatus_1.Rebalancing.discriminator;
|
|
3021
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
3022
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
3176
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, poolState.tokenMint0);
|
|
3177
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, poolState.tokenMint1);
|
|
3023
3178
|
const tickLowerIndex = lib_1.TickMath.getTickWithPriceAndTickspacing(lib_1.TickMath.roundPriceWithTickspacing(priceLower, poolState.tickSpacing, decimalsA, decimalsB), poolState.tickSpacing, decimalsA, decimalsB);
|
|
3024
3179
|
const tickUpperIndex = lib_1.TickMath.getTickWithPriceAndTickspacing(lib_1.TickMath.roundPriceWithTickspacing(priceUpper, poolState.tickSpacing, decimalsA, decimalsB), poolState.tickSpacing, decimalsA, decimalsB);
|
|
3025
|
-
const { position, positionBump, protocolPosition, positionMetadata } = this.getMetadataProgramAddressesRaydium(positionMint, pool, tickLowerIndex, tickUpperIndex);
|
|
3026
|
-
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint, baseVaultAuthority);
|
|
3180
|
+
const { position, positionBump, protocolPosition, positionMetadata } = await this.getMetadataProgramAddressesRaydium(positionMint.address, pool, tickLowerIndex, tickUpperIndex);
|
|
3181
|
+
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint.address, baseVaultAuthority);
|
|
3027
3182
|
const args = {
|
|
3028
3183
|
tickLowerIndex: new bn_js_1.default(tickLowerIndex),
|
|
3029
3184
|
tickUpperIndex: new bn_js_1.default(tickUpperIndex),
|
|
3030
3185
|
bump: positionBump,
|
|
3031
3186
|
};
|
|
3032
|
-
const { lowerTick: startTickIndex, upperTick: endTickIndex } = this.getStartEndTicketIndexProgramAddressesRaydium(pool, poolState, tickLowerIndex, tickUpperIndex);
|
|
3187
|
+
const { lowerTick: startTickIndex, upperTick: endTickIndex } = await this.getStartEndTicketIndexProgramAddressesRaydium(pool, poolState, tickLowerIndex, tickUpperIndex);
|
|
3033
3188
|
const globalConfig = await this.getGlobalConfigState(this._globalConfig);
|
|
3034
3189
|
if (!globalConfig) {
|
|
3035
3190
|
throw Error(`Could not fetch global config with pubkey ${this._globalConfig.toString()}`);
|
|
@@ -3042,17 +3197,17 @@ class Kamino {
|
|
|
3042
3197
|
tickArrayUpper: endTickIndex,
|
|
3043
3198
|
baseVaultAuthority: baseVaultAuthority,
|
|
3044
3199
|
position,
|
|
3045
|
-
positionMint,
|
|
3200
|
+
positionMint: positionMint.address,
|
|
3046
3201
|
positionMetadataAccount: positionMetadata,
|
|
3047
3202
|
positionTokenAccount,
|
|
3048
|
-
rent:
|
|
3049
|
-
system:
|
|
3050
|
-
tokenProgram:
|
|
3051
|
-
tokenProgram2022:
|
|
3052
|
-
associatedTokenProgram:
|
|
3203
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
3204
|
+
system: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
3205
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
3206
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
3207
|
+
associatedTokenProgram: token_2022_1.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
3053
3208
|
poolProgram: this._raydiumService.getRaydiumProgramId(),
|
|
3054
3209
|
oldPositionOrBaseVaultAuthority: isRebalancing ? oldPositionOrBaseVaultAuthority : baseVaultAuthority,
|
|
3055
|
-
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint,
|
|
3210
|
+
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint.address,
|
|
3056
3211
|
oldPositionTokenAccountOrBaseVaultAuthority: isRebalancing
|
|
3057
3212
|
? oldPositionTokenAccountOrBaseVaultAuthority
|
|
3058
3213
|
: positionTokenAccount,
|
|
@@ -3069,42 +3224,68 @@ class Kamino {
|
|
|
3069
3224
|
tokenBMint,
|
|
3070
3225
|
eventAuthority,
|
|
3071
3226
|
consensusAccount: pubkeys_1.CONSENSUS_ID,
|
|
3072
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram,
|
|
3073
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram,
|
|
3227
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3228
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3074
3229
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3075
3230
|
};
|
|
3076
|
-
const [poolTickArrayBitmap
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3231
|
+
const [poolTickArrayBitmap] = await (0, kit_1.getProgramDerivedAddress)({
|
|
3232
|
+
seeds: [Buffer.from('pool_tick_array_bitmap_extension'), addressEncoder.encode(pool)],
|
|
3233
|
+
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
3234
|
+
});
|
|
3235
|
+
let ix = (0, instructions_2.openLiquidityPosition)(args, accounts, this.getProgramID());
|
|
3236
|
+
ix = {
|
|
3237
|
+
...ix,
|
|
3238
|
+
accounts: ix.accounts?.concat([
|
|
3239
|
+
{ address: protocolPosition, role: kit_1.AccountRole.WRITABLE },
|
|
3240
|
+
{ address: oldProtocolPositionOrBaseVaultAuthority, role: kit_1.AccountRole.WRITABLE },
|
|
3241
|
+
{ address: constants_1.METADATA_PROGRAM_ID, role: kit_1.AccountRole.READONLY },
|
|
3242
|
+
{ address: poolTickArrayBitmap, role: kit_1.AccountRole.WRITABLE },
|
|
3243
|
+
]),
|
|
3244
|
+
};
|
|
3084
3245
|
if (strategyRewardOVault) {
|
|
3085
|
-
ix
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3246
|
+
ix = {
|
|
3247
|
+
...ix,
|
|
3248
|
+
accounts: ix.accounts?.concat([
|
|
3249
|
+
{ address: poolState.rewardInfos[0].tokenVault, role: kit_1.AccountRole.WRITABLE },
|
|
3250
|
+
{ address: strategyRewardOVault, role: kit_1.AccountRole.WRITABLE },
|
|
3251
|
+
{ address: poolState.rewardInfos[0].tokenMint, role: kit_1.AccountRole.READONLY },
|
|
3252
|
+
]),
|
|
3253
|
+
};
|
|
3090
3254
|
}
|
|
3091
3255
|
if (strategyReward1Vault) {
|
|
3092
|
-
ix
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3256
|
+
ix = {
|
|
3257
|
+
...ix,
|
|
3258
|
+
accounts: ix.accounts?.concat([
|
|
3259
|
+
{ address: poolState.rewardInfos[1].tokenVault, role: kit_1.AccountRole.WRITABLE },
|
|
3260
|
+
{ address: strategyReward1Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3261
|
+
{ address: poolState.rewardInfos[1].tokenMint, role: kit_1.AccountRole.READONLY },
|
|
3262
|
+
]),
|
|
3263
|
+
};
|
|
3097
3264
|
}
|
|
3098
3265
|
if (strategyReward2Vault) {
|
|
3099
|
-
ix
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3266
|
+
ix = {
|
|
3267
|
+
...ix,
|
|
3268
|
+
accounts: ix.accounts?.concat([
|
|
3269
|
+
{ address: poolState.rewardInfos[2].tokenVault, role: kit_1.AccountRole.WRITABLE },
|
|
3270
|
+
{ address: strategyReward2Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3271
|
+
{ address: poolState.rewardInfos[2].tokenMint, role: kit_1.AccountRole.READONLY },
|
|
3272
|
+
]),
|
|
3273
|
+
};
|
|
3104
3274
|
}
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3107
|
-
|
|
3275
|
+
const accs = [...(ix.accounts || [])];
|
|
3276
|
+
const accountIndex = accs.findIndex((acc) => acc.address === positionMint.address);
|
|
3277
|
+
if (accountIndex >= 0) {
|
|
3278
|
+
accs[accountIndex] = {
|
|
3279
|
+
...accs[accountIndex],
|
|
3280
|
+
role: kit_1.AccountRole.WRITABLE_SIGNER,
|
|
3281
|
+
// @ts-ignore
|
|
3282
|
+
signer: positionMint,
|
|
3283
|
+
};
|
|
3284
|
+
}
|
|
3285
|
+
return {
|
|
3286
|
+
...ix,
|
|
3287
|
+
accounts: accs,
|
|
3288
|
+
};
|
|
3108
3289
|
};
|
|
3109
3290
|
/**
|
|
3110
3291
|
* Get a transaction to open liquidity position for a Kamino strategy
|
|
@@ -3115,23 +3296,23 @@ class Kamino {
|
|
|
3115
3296
|
* @param status strategy status
|
|
3116
3297
|
*/
|
|
3117
3298
|
openPositionMeteora = async (adminAuthority, strategy, baseVaultAuthority, pool, position, priceLower, priceUpper, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, oldPositionOrBaseVaultAuthority, oldPositionMintOrBaseVaultAuthority, oldPositionTokenAccountOrBaseVaultAuthority, oldTickArrayLowerOrBaseVaultAuthority, oldTickArrayUpperOrBaseVaultAuthority, eventAuthority, status = new StrategyStatus_1.Uninitialized()) => {
|
|
3118
|
-
const lbPair = await
|
|
3299
|
+
const lbPair = await accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
3119
3300
|
if (!lbPair) {
|
|
3120
3301
|
throw Error(`Could not fetch meteora lbpair state with pubkey ${pool.toString()}`);
|
|
3121
3302
|
}
|
|
3122
3303
|
const isRebalancing = status.discriminator === StrategyStatus_1.Rebalancing.discriminator;
|
|
3123
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
3124
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
3304
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, lbPair.tokenXMint);
|
|
3305
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, lbPair.tokenYMint);
|
|
3125
3306
|
const tickLowerIndex = (0, meteora_1.getBinIdFromPriceWithDecimals)(priceLower, lbPair.binStep, true, decimalsA, decimalsB);
|
|
3126
3307
|
const tickUpperIndex = (0, meteora_1.getBinIdFromPriceWithDecimals)(priceUpper, lbPair.binStep, true, decimalsA, decimalsB);
|
|
3127
|
-
const { position: positionMint, positionBump, positionMetadata } = this.getMetadataProgramAddressesOrca(position);
|
|
3128
|
-
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(position, baseVaultAuthority);
|
|
3308
|
+
const { position: positionMint, positionBump, positionMetadata, } = await this.getMetadataProgramAddressesOrca(position.address);
|
|
3309
|
+
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(position.address, baseVaultAuthority);
|
|
3129
3310
|
const args = {
|
|
3130
3311
|
tickLowerIndex: new bn_js_1.default(tickLowerIndex),
|
|
3131
3312
|
tickUpperIndex: new bn_js_1.default(tickUpperIndex),
|
|
3132
3313
|
bump: positionBump,
|
|
3133
3314
|
};
|
|
3134
|
-
const { lowerTick: startTickIndex, upperTick: endTickIndex } = this.getStartEndTicketIndexProgramAddressesMeteora(pool, tickLowerIndex);
|
|
3315
|
+
const { lowerTick: startTickIndex, upperTick: endTickIndex } = await this.getStartEndTicketIndexProgramAddressesMeteora(pool, tickLowerIndex);
|
|
3135
3316
|
const globalConfig = await this.getGlobalConfigState(this._globalConfig);
|
|
3136
3317
|
if (!globalConfig) {
|
|
3137
3318
|
throw Error(`Could not fetch global config with pubkey ${this._globalConfig.toString()}`);
|
|
@@ -3143,16 +3324,16 @@ class Kamino {
|
|
|
3143
3324
|
tickArrayLower: startTickIndex,
|
|
3144
3325
|
tickArrayUpper: endTickIndex,
|
|
3145
3326
|
baseVaultAuthority: baseVaultAuthority,
|
|
3146
|
-
position,
|
|
3327
|
+
position: position.address,
|
|
3147
3328
|
positionMint,
|
|
3148
3329
|
positionMetadataAccount: positionMetadata,
|
|
3149
3330
|
positionTokenAccount,
|
|
3150
|
-
rent:
|
|
3151
|
-
system:
|
|
3152
|
-
tokenProgram:
|
|
3153
|
-
tokenProgram2022:
|
|
3154
|
-
associatedTokenProgram:
|
|
3155
|
-
poolProgram: this.
|
|
3331
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
3332
|
+
system: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
3333
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
3334
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
3335
|
+
associatedTokenProgram: token_2022_1.ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
3336
|
+
poolProgram: this._meteoraService.getMeteoraProgramId(),
|
|
3156
3337
|
oldPositionOrBaseVaultAuthority: isRebalancing ? oldPositionOrBaseVaultAuthority : baseVaultAuthority,
|
|
3157
3338
|
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint,
|
|
3158
3339
|
oldPositionTokenAccountOrBaseVaultAuthority: isRebalancing
|
|
@@ -3171,14 +3352,25 @@ class Kamino {
|
|
|
3171
3352
|
tokenBMint,
|
|
3172
3353
|
eventAuthority,
|
|
3173
3354
|
consensusAccount: pubkeys_1.CONSENSUS_ID,
|
|
3174
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram,
|
|
3175
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram,
|
|
3355
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3356
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3176
3357
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3177
3358
|
};
|
|
3178
|
-
const
|
|
3179
|
-
const
|
|
3180
|
-
|
|
3181
|
-
|
|
3359
|
+
const ix = (0, instructions_2.openLiquidityPosition)(args, accounts, this.getProgramID());
|
|
3360
|
+
const accs = [...(ix.accounts || [])];
|
|
3361
|
+
const accountIndex = accs.findIndex((acc) => acc.address === position.address);
|
|
3362
|
+
if (accountIndex >= 0) {
|
|
3363
|
+
accs[accountIndex] = {
|
|
3364
|
+
...accs[accountIndex],
|
|
3365
|
+
role: kit_1.AccountRole.WRITABLE_SIGNER,
|
|
3366
|
+
// @ts-ignore
|
|
3367
|
+
signer: position,
|
|
3368
|
+
};
|
|
3369
|
+
}
|
|
3370
|
+
return {
|
|
3371
|
+
...ix,
|
|
3372
|
+
accounts: accs,
|
|
3373
|
+
};
|
|
3182
3374
|
};
|
|
3183
3375
|
/**
|
|
3184
3376
|
* Get a transaction for executive withdrawal from a Kamino strategy.
|
|
@@ -3186,19 +3378,19 @@ class Kamino {
|
|
|
3186
3378
|
* @param action withdrawal action
|
|
3187
3379
|
* @returns transaction for executive withdrawal
|
|
3188
3380
|
*/
|
|
3189
|
-
executiveWithdraw = async (strategy, action) => {
|
|
3381
|
+
executiveWithdraw = async (admin, strategy, action) => {
|
|
3190
3382
|
const { address: strategyPubkey, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3191
|
-
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3383
|
+
const eventAuthority = await this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3192
3384
|
const globalConfig = await this.getGlobalConfigState(strategyState.globalConfig);
|
|
3193
|
-
if (globalConfig
|
|
3385
|
+
if (globalConfig === null) {
|
|
3194
3386
|
throw new Error(`Unable to fetch GlobalConfig with Pubkey ${strategyState.globalConfig}`);
|
|
3195
3387
|
}
|
|
3196
3388
|
const args = {
|
|
3197
3389
|
action: action.discriminator,
|
|
3198
3390
|
};
|
|
3199
|
-
const programId =
|
|
3391
|
+
const programId = this.getDexProgramId(strategyState);
|
|
3200
3392
|
const accounts = {
|
|
3201
|
-
adminAuthority:
|
|
3393
|
+
adminAuthority: admin,
|
|
3202
3394
|
strategy: strategyPubkey,
|
|
3203
3395
|
globalConfig: strategyState.globalConfig,
|
|
3204
3396
|
pool: strategyState.pool,
|
|
@@ -3218,50 +3410,60 @@ class Kamino {
|
|
|
3218
3410
|
poolProgram: programId,
|
|
3219
3411
|
tokenInfos: globalConfig.tokenInfos,
|
|
3220
3412
|
eventAuthority,
|
|
3221
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
3222
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
3413
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3414
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3223
3415
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3224
|
-
tokenProgram:
|
|
3225
|
-
tokenProgram2022:
|
|
3416
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
3417
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
3226
3418
|
};
|
|
3227
|
-
|
|
3419
|
+
let executiveWithdrawIx = (0, instructions_2.executiveWithdraw)(args, accounts, this.getProgramID());
|
|
3228
3420
|
// for Raydium strats we need to collect fees and rewards before withdrawal
|
|
3229
3421
|
// add rewards vaults accounts to withdraw
|
|
3230
|
-
const isRaydium = strategyState.strategyDex.toNumber()
|
|
3422
|
+
const isRaydium = strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM');
|
|
3231
3423
|
if (isRaydium) {
|
|
3232
3424
|
const poolState = await this.getRaydiumPoolByAddress(strategyState.pool);
|
|
3233
3425
|
if (!poolState) {
|
|
3234
3426
|
throw new Error('Pool is not found');
|
|
3235
3427
|
}
|
|
3236
3428
|
if (strategyState.reward0Decimals.toNumber() > 0) {
|
|
3237
|
-
executiveWithdrawIx
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3429
|
+
executiveWithdrawIx = {
|
|
3430
|
+
...executiveWithdrawIx,
|
|
3431
|
+
accounts: executiveWithdrawIx.accounts?.concat([
|
|
3432
|
+
{ address: poolState.rewardInfos[0].tokenVault, role: kit_1.AccountRole.WRITABLE },
|
|
3433
|
+
{ address: strategyState.reward0Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3434
|
+
]),
|
|
3435
|
+
};
|
|
3241
3436
|
}
|
|
3242
3437
|
if (strategyState.reward1Decimals.toNumber() > 0) {
|
|
3243
|
-
executiveWithdrawIx
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3438
|
+
executiveWithdrawIx = {
|
|
3439
|
+
...executiveWithdrawIx,
|
|
3440
|
+
accounts: executiveWithdrawIx.accounts?.concat([
|
|
3441
|
+
{ address: poolState.rewardInfos[1].tokenVault, role: kit_1.AccountRole.WRITABLE },
|
|
3442
|
+
{ address: strategyState.reward1Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3443
|
+
]),
|
|
3444
|
+
};
|
|
3247
3445
|
}
|
|
3248
3446
|
if (strategyState.reward2Decimals.toNumber() > 0) {
|
|
3249
|
-
executiveWithdrawIx
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3447
|
+
executiveWithdrawIx = {
|
|
3448
|
+
...executiveWithdrawIx,
|
|
3449
|
+
accounts: executiveWithdrawIx.accounts?.concat([
|
|
3450
|
+
{ address: poolState.rewardInfos[2].tokenVault, role: kit_1.AccountRole.WRITABLE },
|
|
3451
|
+
{ address: strategyState.reward2Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3452
|
+
]),
|
|
3453
|
+
};
|
|
3253
3454
|
}
|
|
3254
3455
|
}
|
|
3255
3456
|
return executiveWithdrawIx;
|
|
3256
3457
|
};
|
|
3257
3458
|
/**
|
|
3258
3459
|
* Get a an instruction to update the reference price type of a strategy
|
|
3460
|
+
* @param admin transaction signer
|
|
3259
3461
|
* @param strategy strategy pubkey or object
|
|
3260
3462
|
* @param referencePriceType new reference price type
|
|
3261
3463
|
*/
|
|
3262
|
-
getUpdateReferencePriceTypeIx = async (strategy, referencePriceType) => {
|
|
3263
|
-
const { address
|
|
3264
|
-
return (0, utils_1.getUpdateStrategyConfigIx)(
|
|
3464
|
+
getUpdateReferencePriceTypeIx = async (admin, strategy, referencePriceType) => {
|
|
3465
|
+
const { address } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3466
|
+
return (0, utils_1.getUpdateStrategyConfigIx)(admin, this._globalConfig, address, new StrategyConfigOption_1.UpdateReferencePriceType(), new decimal_js_1.default(referencePriceType.discriminator), this.getProgramID());
|
|
3265
3467
|
};
|
|
3266
3468
|
/**
|
|
3267
3469
|
* Get a transaction to invest funds from the Kamino vaults and put them into the DEX pool as liquidity.
|
|
@@ -3278,8 +3480,8 @@ class Kamino {
|
|
|
3278
3480
|
if (!globalConfig) {
|
|
3279
3481
|
throw Error(`Could not fetch global config with pubkey ${strategyState.globalConfig.toString()}`);
|
|
3280
3482
|
}
|
|
3281
|
-
const programId =
|
|
3282
|
-
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3483
|
+
const programId = this.getDexProgramId(strategyState);
|
|
3484
|
+
const eventAuthority = await this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3283
3485
|
const accounts = {
|
|
3284
3486
|
position: strategyState.position,
|
|
3285
3487
|
positionTokenAccount: strategyState.positionTokenAccount,
|
|
@@ -3298,17 +3500,17 @@ class Kamino {
|
|
|
3298
3500
|
raydiumProtocolPositionOrBaseVaultAuthority: strategyState.raydiumProtocolPositionOrBaseVaultAuthority,
|
|
3299
3501
|
tokenInfos: globalConfig.tokenInfos,
|
|
3300
3502
|
poolProgram: programId,
|
|
3301
|
-
instructionSysvarAccount:
|
|
3503
|
+
instructionSysvarAccount: sysvars_1.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
3302
3504
|
tokenAMint: strategyState.tokenAMint,
|
|
3303
3505
|
tokenBMint: strategyState.tokenBMint,
|
|
3304
3506
|
eventAuthority,
|
|
3305
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
3306
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
3507
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3508
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
3307
3509
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3308
|
-
tokenProgram:
|
|
3309
|
-
tokenProgram2022:
|
|
3510
|
+
tokenProgram: token_1.TOKEN_PROGRAM_ADDRESS,
|
|
3511
|
+
tokenProgram2022: token_2022_1.TOKEN_2022_PROGRAM_ADDRESS,
|
|
3310
3512
|
};
|
|
3311
|
-
return (0,
|
|
3513
|
+
return (0, instructions_2.invest)(accounts, this.getProgramID());
|
|
3312
3514
|
};
|
|
3313
3515
|
/**
|
|
3314
3516
|
* Get a list of instructions to collect the pending fees and invest them into the Kamino strategy's position.
|
|
@@ -3331,11 +3533,11 @@ class Kamino {
|
|
|
3331
3533
|
*/
|
|
3332
3534
|
getPendingFees = async (strategies) => {
|
|
3333
3535
|
const strategiesWithAddresses = await this.getStrategiesWithAddresses(strategies);
|
|
3334
|
-
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') &&
|
|
3536
|
+
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') && x.strategy.position !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
3335
3537
|
const raydiumPositionsPromise = this.getRaydiumPositions(raydiumStrategies.map((x) => x.strategy.position));
|
|
3336
|
-
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') &&
|
|
3538
|
+
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') && x.strategy.position !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
3337
3539
|
const orcaPositionsPromise = this.getOrcaPositions(orcaStrategies.map((x) => x.strategy.position));
|
|
3338
|
-
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') &&
|
|
3540
|
+
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') && x.strategy.position !== pubkeys_1.DEFAULT_PUBLIC_KEY);
|
|
3339
3541
|
const meteoraPositionsPromise = this.getMeteoraPositions(meteoraStrategies.map((x) => x.strategy.position));
|
|
3340
3542
|
const [raydiumPositions, orcaPositions, meteoraPositions] = await Promise.all([
|
|
3341
3543
|
raydiumPositionsPromise,
|
|
@@ -3400,20 +3602,20 @@ class Kamino {
|
|
|
3400
3602
|
const rebalanceParams = rebalanceFieldInfos
|
|
3401
3603
|
.filter((x) => x.label != consts_1.RebalanceTypeLabelName && x.enabled)
|
|
3402
3604
|
.map((f) => new decimal_js_1.default(f.value));
|
|
3403
|
-
return this.
|
|
3605
|
+
return this.getUpdateRebalancingParamsIxns(strategyAdmin, strategyWithAddress.address, rebalanceParams, rebalanceType, strategyWithAddress.strategy.tokenAMintDecimals.toNumber(), strategyWithAddress.strategy.tokenBMintDecimals.toNumber());
|
|
3404
3606
|
};
|
|
3405
3607
|
processRebalanceParams = async (dex, pool, rebalanceType, rebalanceParams) => {
|
|
3406
3608
|
const processedRebalanceParams = [...rebalanceParams];
|
|
3407
3609
|
const rebalanceTypeKind = (0, utils_1.numberToRebalanceType)(rebalanceType.toNumber());
|
|
3408
|
-
if (dex
|
|
3610
|
+
if (dex === 'ORCA') {
|
|
3409
3611
|
const { whirlpool: whilrpoolState } = await this.getWhirlpoolStateIfNotFetched(pool);
|
|
3410
|
-
if (rebalanceTypeKind.kind
|
|
3612
|
+
if (rebalanceTypeKind.kind === types_1.RebalanceType.Drift.kind) {
|
|
3411
3613
|
processedRebalanceParams[0] = new decimal_js_1.default((0, whirlpool_sdk_1.getNearestValidTickIndexFromTickIndex)(rebalanceParams[0].toNumber(), whilrpoolState.tickSpacing));
|
|
3412
3614
|
}
|
|
3413
3615
|
}
|
|
3414
3616
|
return processedRebalanceParams;
|
|
3415
3617
|
};
|
|
3416
|
-
|
|
3618
|
+
getUpdateRebalancingParamsIxns = async (strategyAdmin, strategy, rebalanceParams, rebalanceType, tokenADecimals, tokenBDecimals) => {
|
|
3417
3619
|
const { address: strategyAddress, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3418
3620
|
if (!rebalanceType) {
|
|
3419
3621
|
rebalanceType = (0, utils_1.numberToRebalanceType)(strategyState.rebalanceType);
|
|
@@ -3428,12 +3630,12 @@ class Kamino {
|
|
|
3428
3630
|
};
|
|
3429
3631
|
const accounts = {
|
|
3430
3632
|
adminAuthority: strategyAdmin,
|
|
3431
|
-
newAccount:
|
|
3633
|
+
newAccount: pubkeys_1.DEFAULT_PUBLIC_KEY, // not used
|
|
3432
3634
|
globalConfig: this._globalConfig,
|
|
3433
3635
|
strategy: strategyAddress,
|
|
3434
|
-
systemProgram:
|
|
3636
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
3435
3637
|
};
|
|
3436
|
-
return (0,
|
|
3638
|
+
return (0, instructions_2.updateStrategyConfig)(args, accounts, this.getProgramID());
|
|
3437
3639
|
};
|
|
3438
3640
|
getUpdateRebalancingParamsForUninitializedStratIx = async (strategyAdmin, strategy, rebalanceParams, rebalanceType, tokenADecimals, tokenBDecimals) => {
|
|
3439
3641
|
const value = (0, utils_1.buildStrategyRebalanceParams)(rebalanceParams, rebalanceType, tokenADecimals, tokenBDecimals);
|
|
@@ -3443,12 +3645,12 @@ class Kamino {
|
|
|
3443
3645
|
};
|
|
3444
3646
|
const accounts = {
|
|
3445
3647
|
adminAuthority: strategyAdmin,
|
|
3446
|
-
newAccount:
|
|
3648
|
+
newAccount: pubkeys_1.DEFAULT_PUBLIC_KEY, // not used
|
|
3447
3649
|
globalConfig: this._globalConfig,
|
|
3448
3650
|
strategy,
|
|
3449
|
-
systemProgram:
|
|
3651
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
3450
3652
|
};
|
|
3451
|
-
return (0,
|
|
3653
|
+
return (0, instructions_2.updateStrategyConfig)(args, accounts, this.getProgramID());
|
|
3452
3654
|
};
|
|
3453
3655
|
buildStrategyRebalanceParams = async (strategy) => {
|
|
3454
3656
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
@@ -3476,7 +3678,7 @@ class Kamino {
|
|
|
3476
3678
|
throw Error(`Token mint ${tokenAMint.toString()} is not supported`);
|
|
3477
3679
|
}
|
|
3478
3680
|
const pool = await this.getPoolInitializedForDexPairTier(dex, tokenAMint, tokenBMint, feeTier.mul(CreationParameters_1.FullBPS));
|
|
3479
|
-
if (pool
|
|
3681
|
+
if (pool === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
3480
3682
|
throw Error(`Pool for tokens ${tokenAMint.toString()} and ${tokenBMint.toString()} for feeTier ${feeTier.toString()} does not exist`);
|
|
3481
3683
|
}
|
|
3482
3684
|
const processedRebalanceParams = await this.processRebalanceParams(dex, pool, rebalanceType, rebalanceParams);
|
|
@@ -3484,8 +3686,8 @@ class Kamino {
|
|
|
3484
3686
|
let tokenMintA;
|
|
3485
3687
|
let tokenMintB;
|
|
3486
3688
|
let tickSpacing;
|
|
3487
|
-
if (dex
|
|
3488
|
-
const whirlpoolState = await
|
|
3689
|
+
if (dex === 'ORCA') {
|
|
3690
|
+
const whirlpoolState = await accounts_2.Whirlpool.fetch(this._rpc, pool, this._orcaService.getWhirlpoolProgramId());
|
|
3489
3691
|
if (!whirlpoolState) {
|
|
3490
3692
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3491
3693
|
}
|
|
@@ -3493,8 +3695,8 @@ class Kamino {
|
|
|
3493
3695
|
tokenMintB = whirlpoolState.tokenMintB;
|
|
3494
3696
|
tickSpacing = whirlpoolState.tickSpacing;
|
|
3495
3697
|
}
|
|
3496
|
-
else if (dex
|
|
3497
|
-
const raydiumPoolState = await
|
|
3698
|
+
else if (dex === 'RAYDIUM') {
|
|
3699
|
+
const raydiumPoolState = await accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
3498
3700
|
if (!raydiumPoolState) {
|
|
3499
3701
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
3500
3702
|
}
|
|
@@ -3502,8 +3704,8 @@ class Kamino {
|
|
|
3502
3704
|
tokenMintB = raydiumPoolState.tokenMint1;
|
|
3503
3705
|
tickSpacing = raydiumPoolState.tickSpacing;
|
|
3504
3706
|
}
|
|
3505
|
-
else if (dex
|
|
3506
|
-
const meteoraPoolState = await
|
|
3707
|
+
else if (dex === 'METEORA') {
|
|
3708
|
+
const meteoraPoolState = await accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
3507
3709
|
if (!meteoraPoolState) {
|
|
3508
3710
|
throw Error(`Could not fetch Meteora pool state with pubkey ${pool.toString()}`);
|
|
3509
3711
|
}
|
|
@@ -3517,8 +3719,8 @@ class Kamino {
|
|
|
3517
3719
|
const tokenATokenProgram = await this.getAccountOwner(tokenAMint);
|
|
3518
3720
|
const tokenBTokenProgram = await this.getAccountOwner(tokenBMint);
|
|
3519
3721
|
const initStrategyIx = await this.createStrategy(strategy, pool, strategyAdmin, dex);
|
|
3520
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3521
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3722
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenMintA);
|
|
3723
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenMintB);
|
|
3522
3724
|
const rebalanceKind = (0, utils_1.numberToRebalanceType)(rebalanceType.toNumber());
|
|
3523
3725
|
const updateRebalanceParamsIx = await this.getUpdateRebalancingParamsForUninitializedStratIx(strategyAdmin, strategy, processedRebalanceParams, rebalanceKind, tokenADecimals, tokenBDecimals);
|
|
3524
3726
|
const updateStrategyParamsIxs = await this.getUpdateStrategyParamsIxs(strategyAdmin, strategy, rebalanceType, withdrawFeeBps, performanceFeeBps);
|
|
@@ -3528,15 +3730,15 @@ class Kamino {
|
|
|
3528
3730
|
const tokenBVault = programAddresses.tokenBVault;
|
|
3529
3731
|
const { lowerPrice, upperPrice } = await this.getRebalancePositionRange(dex, price, tokenAMint, tokenBMint, tickSpacing, rebalanceKind, rebalanceParams);
|
|
3530
3732
|
const openPositionIxs = [];
|
|
3531
|
-
const eventAuthority = this.getEventAuthorityPDA(new bn_js_1.default((0, utils_1.dexToNumber)(dex)));
|
|
3532
|
-
if (dex
|
|
3733
|
+
const eventAuthority = await this.getEventAuthorityPDA(new bn_js_1.default((0, utils_1.dexToNumber)(dex)));
|
|
3734
|
+
if (dex === 'ORCA') {
|
|
3533
3735
|
const whirlpoolWithAddress = await this.getWhirlpoolStateIfNotFetched(pool);
|
|
3534
3736
|
if (!whirlpoolWithAddress) {
|
|
3535
3737
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3536
3738
|
}
|
|
3537
3739
|
const initLowerTickIfNeeded = await this.initializeTickForOrcaPool(strategyAdmin, pool, lowerPrice);
|
|
3538
3740
|
const initUpperTickIfNeeded = await this.initializeTickForOrcaPool(strategyAdmin, pool, upperPrice);
|
|
3539
|
-
const openPositionIx = await this.openPositionOrca(strategyAdmin, strategy, baseVaultAuthority, pool, positionMint, lowerPrice, upperPrice, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority
|
|
3741
|
+
const openPositionIx = await this.openPositionOrca(strategyAdmin, strategy, baseVaultAuthority, pool, positionMint, lowerPrice, upperPrice, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority);
|
|
3540
3742
|
if (initLowerTickIfNeeded.initTickIx) {
|
|
3541
3743
|
openPositionIxs.push(initLowerTickIfNeeded.initTickIx);
|
|
3542
3744
|
}
|
|
@@ -3545,11 +3747,11 @@ class Kamino {
|
|
|
3545
3747
|
}
|
|
3546
3748
|
openPositionIxs.push(openPositionIx);
|
|
3547
3749
|
}
|
|
3548
|
-
else if (dex
|
|
3750
|
+
else if (dex === 'RAYDIUM') {
|
|
3549
3751
|
const openPositionIx = await this.openPositionRaydium(strategyAdmin, strategy, baseVaultAuthority, pool, positionMint, lowerPrice, upperPrice, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, eventAuthority);
|
|
3550
3752
|
openPositionIxs.push(openPositionIx);
|
|
3551
3753
|
}
|
|
3552
|
-
else if (dex
|
|
3754
|
+
else if (dex === 'METEORA') {
|
|
3553
3755
|
const lbPair = await this.getMeteoraStateIfNotFetched(pool);
|
|
3554
3756
|
if (!lbPair) {
|
|
3555
3757
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
@@ -3585,23 +3787,23 @@ class Kamino {
|
|
|
3585
3787
|
return this.getRebalancePositionRange(dex, price, tokenAMint, tokenBMint, tickSpacing, rebalanceKind, rebalanceParams);
|
|
3586
3788
|
}
|
|
3587
3789
|
async getRebalancePositionRange(dex, price, tokenAMint, tokenBMint, tickSpacing, rebalanceKind, rebalanceParams) {
|
|
3588
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3589
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3790
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenAMint);
|
|
3791
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, tokenBMint);
|
|
3590
3792
|
switch (rebalanceKind.kind) {
|
|
3591
3793
|
case types_1.RebalanceType.Manual.kind:
|
|
3592
3794
|
return { lowerPrice: rebalanceParams[0], upperPrice: rebalanceParams[1] };
|
|
3593
3795
|
case types_1.RebalanceType.TakeProfit.kind:
|
|
3594
3796
|
return { lowerPrice: rebalanceParams[0], upperPrice: rebalanceParams[1] };
|
|
3595
3797
|
case types_1.RebalanceType.PricePercentage.kind:
|
|
3596
|
-
return (0,
|
|
3798
|
+
return (0, rebalance_methods_1.getPositionRangeFromPercentageRebalanceParams)(price, rebalanceParams[0], rebalanceParams[1]);
|
|
3597
3799
|
case types_1.RebalanceType.PricePercentageWithReset.kind:
|
|
3598
|
-
return (0,
|
|
3800
|
+
return (0, rebalance_methods_1.getPositionRangeFromPricePercentageWithResetParams)(price, rebalanceParams[0], rebalanceParams[1]);
|
|
3599
3801
|
case types_1.RebalanceType.Drift.kind:
|
|
3600
|
-
return (0,
|
|
3802
|
+
return (0, rebalance_methods_1.getPositionRangeFromDriftParams)(dex, tickSpacing, tokenADecimals, tokenBDecimals, rebalanceParams[0], rebalanceParams[1], rebalanceParams[2]);
|
|
3601
3803
|
case types_1.RebalanceType.PeriodicRebalance.kind:
|
|
3602
|
-
return (0,
|
|
3804
|
+
return (0, rebalance_methods_1.getPositionRangeFromPeriodicRebalanceParams)(price, rebalanceParams[1], rebalanceParams[2]);
|
|
3603
3805
|
case types_1.RebalanceType.Expander.kind:
|
|
3604
|
-
return (0,
|
|
3806
|
+
return (0, rebalance_methods_1.getPositionRangeFromExpanderParams)(price, rebalanceParams[0], rebalanceParams[1]);
|
|
3605
3807
|
case types_1.RebalanceType.Autodrift.kind:
|
|
3606
3808
|
const currentTickIndex = (0, whirlpool_sdk_1.priceToTickIndex)(price, tokenADecimals, tokenBDecimals);
|
|
3607
3809
|
const startMidTick = new decimal_js_1.default(currentTickIndex);
|
|
@@ -3617,13 +3819,13 @@ class Kamino {
|
|
|
3617
3819
|
return this.getCurrentPriceFromPool(dex, pool);
|
|
3618
3820
|
}
|
|
3619
3821
|
async getCurrentPriceFromPool(dex, pool) {
|
|
3620
|
-
if (dex
|
|
3822
|
+
if (dex === 'ORCA') {
|
|
3621
3823
|
return this.getOrcaPoolPrice(pool);
|
|
3622
3824
|
}
|
|
3623
|
-
else if (dex
|
|
3825
|
+
else if (dex === 'RAYDIUM') {
|
|
3624
3826
|
return this.getRaydiumPoolPrice(pool);
|
|
3625
3827
|
}
|
|
3626
|
-
else if (dex
|
|
3828
|
+
else if (dex === 'METEORA') {
|
|
3627
3829
|
return this.getMeteoraPoolPrice(pool);
|
|
3628
3830
|
}
|
|
3629
3831
|
else {
|
|
@@ -3631,22 +3833,22 @@ class Kamino {
|
|
|
3631
3833
|
}
|
|
3632
3834
|
}
|
|
3633
3835
|
async getPoolTickSpacing(dex, pool) {
|
|
3634
|
-
if (dex
|
|
3635
|
-
const whirlpoolState = await
|
|
3836
|
+
if (dex === 'ORCA') {
|
|
3837
|
+
const whirlpoolState = await accounts_2.Whirlpool.fetch(this._rpc, pool, this._orcaService.getWhirlpoolProgramId());
|
|
3636
3838
|
if (!whirlpoolState) {
|
|
3637
3839
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3638
3840
|
}
|
|
3639
3841
|
return whirlpoolState.tickSpacing;
|
|
3640
3842
|
}
|
|
3641
|
-
else if (dex
|
|
3642
|
-
const raydiumPoolState = await
|
|
3843
|
+
else if (dex === 'RAYDIUM') {
|
|
3844
|
+
const raydiumPoolState = await accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
3643
3845
|
if (!raydiumPoolState) {
|
|
3644
3846
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
3645
3847
|
}
|
|
3646
3848
|
return raydiumPoolState.tickSpacing;
|
|
3647
3849
|
}
|
|
3648
|
-
else if (dex
|
|
3649
|
-
const meteoraPoolState = await
|
|
3850
|
+
else if (dex === 'METEORA') {
|
|
3851
|
+
const meteoraPoolState = await accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
3650
3852
|
if (!meteoraPoolState) {
|
|
3651
3853
|
throw Error(`Could not fetch Meteora pool state with pubkey ${pool.toString()}`);
|
|
3652
3854
|
}
|
|
@@ -3658,13 +3860,13 @@ class Kamino {
|
|
|
3658
3860
|
}
|
|
3659
3861
|
async getPriceRangePercentageBasedFromPool(dex, pool, lowerPriceBpsDifference, upperPriceBpsDifference) {
|
|
3660
3862
|
let poolPrice;
|
|
3661
|
-
if (dex
|
|
3863
|
+
if (dex === 'ORCA') {
|
|
3662
3864
|
poolPrice = await this.getOrcaPoolPrice(pool);
|
|
3663
3865
|
}
|
|
3664
|
-
else if (dex
|
|
3866
|
+
else if (dex === 'RAYDIUM') {
|
|
3665
3867
|
poolPrice = await this.getRaydiumPoolPrice(pool);
|
|
3666
3868
|
}
|
|
3667
|
-
else if (dex
|
|
3869
|
+
else if (dex === 'METEORA') {
|
|
3668
3870
|
poolPrice = await this.getMeteoraPoolPrice(pool);
|
|
3669
3871
|
}
|
|
3670
3872
|
else {
|
|
@@ -3683,24 +3885,24 @@ class Kamino {
|
|
|
3683
3885
|
rebalanceFields = [];
|
|
3684
3886
|
}
|
|
3685
3887
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
3686
|
-
rebalanceFields = (0,
|
|
3888
|
+
rebalanceFields = (0, rebalance_methods_1.readPricePercentageRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3687
3889
|
}
|
|
3688
3890
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
3689
|
-
rebalanceFields = (0,
|
|
3891
|
+
rebalanceFields = (0, rebalance_methods_1.readPricePercentageWithResetRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3690
3892
|
}
|
|
3691
3893
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
3692
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3894
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readDriftRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3693
3895
|
}
|
|
3694
3896
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
3695
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3696
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3697
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3897
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
3898
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
3899
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readTakeProfitRebalanceParamsFromStrategy)(tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw));
|
|
3698
3900
|
}
|
|
3699
3901
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
3700
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3902
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readPeriodicRebalanceRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3701
3903
|
}
|
|
3702
3904
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
3703
|
-
rebalanceFields = (0,
|
|
3905
|
+
rebalanceFields = (0, rebalance_methods_1.readExpanderRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3704
3906
|
}
|
|
3705
3907
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
3706
3908
|
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, autodriftRebalance_1.readAutodriftRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
@@ -3721,22 +3923,22 @@ class Kamino {
|
|
|
3721
3923
|
rebalanceFields = [];
|
|
3722
3924
|
}
|
|
3723
3925
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
3724
|
-
rebalanceFields = (0,
|
|
3926
|
+
rebalanceFields = (0, rebalance_methods_1.readRawPricePercentageRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3725
3927
|
}
|
|
3726
3928
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
3727
|
-
rebalanceFields = (0,
|
|
3929
|
+
rebalanceFields = (0, rebalance_methods_1.readRawPricePercentageWithResetRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3728
3930
|
}
|
|
3729
3931
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
3730
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3932
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readRawDriftRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3731
3933
|
}
|
|
3732
3934
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
3733
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3935
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readTakeProfitRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3734
3936
|
}
|
|
3735
3937
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
3736
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3938
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readPeriodicRebalanceRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3737
3939
|
}
|
|
3738
3940
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
3739
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3941
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_1.readRawExpanderRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3740
3942
|
}
|
|
3741
3943
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
3742
3944
|
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, autodriftRebalance_1.readRawAutodriftRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
@@ -3746,6 +3948,46 @@ class Kamino {
|
|
|
3746
3948
|
}
|
|
3747
3949
|
return rebalanceFields;
|
|
3748
3950
|
}
|
|
3951
|
+
/**
|
|
3952
|
+
* Get the current withdrawal caps for a strategy
|
|
3953
|
+
*/
|
|
3954
|
+
async getStrategyCurrentWithdrawalCaps(strategy) {
|
|
3955
|
+
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
3956
|
+
const tokenAWithdrawalCap = strategyWithAddress.strategy.withdrawalCapA;
|
|
3957
|
+
const tokenBWithdrawalCap = strategyWithAddress.strategy.withdrawalCapB;
|
|
3958
|
+
let tokenAWithdrawalCapTokens = decimal_js_1.default.max(new decimal_js_1.default(tokenAWithdrawalCap.configCapacity.toString()).sub(tokenAWithdrawalCap.currentTotal.toString()), utils_1.ZERO);
|
|
3959
|
+
let tokenBWithdrawalCapTokens = decimal_js_1.default.max(new decimal_js_1.default(tokenBWithdrawalCap.configCapacity.toString()).sub(tokenBWithdrawalCap.currentTotal.toString()), utils_1.ZERO);
|
|
3960
|
+
if (tokenAWithdrawalCap.configIntervalLengthSeconds.toNumber() == 0) {
|
|
3961
|
+
tokenAWithdrawalCapTokens = new decimal_js_1.default(Number.MAX_VALUE);
|
|
3962
|
+
}
|
|
3963
|
+
if (tokenBWithdrawalCap.configIntervalLengthSeconds.toNumber() == 0) {
|
|
3964
|
+
tokenBWithdrawalCapTokens = new decimal_js_1.default(Number.MAX_VALUE);
|
|
3965
|
+
}
|
|
3966
|
+
return {
|
|
3967
|
+
a: (0, utils_1.lamportsToNumberDecimal)(tokenAWithdrawalCapTokens, strategyWithAddress.strategy.tokenAMintDecimals.toNumber()),
|
|
3968
|
+
b: (0, utils_1.lamportsToNumberDecimal)(tokenBWithdrawalCapTokens, strategyWithAddress.strategy.tokenBMintDecimals.toNumber()),
|
|
3969
|
+
};
|
|
3970
|
+
}
|
|
3971
|
+
/**
|
|
3972
|
+
* Get the max USD value that can be deposited per ix for a strategy
|
|
3973
|
+
*/
|
|
3974
|
+
async getStrategyDepositCapInUSDPerIx(strategy) {
|
|
3975
|
+
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
3976
|
+
return (0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(strategyWithAddress.strategy.depositCapUsdPerIxn.toString()), 6);
|
|
3977
|
+
}
|
|
3978
|
+
async getStrategyMaxDepositInUSD(strategy) {
|
|
3979
|
+
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
3980
|
+
const depositCapInUSDPerIx = await this.getStrategyDepositCapInUSDPerIx(strategy);
|
|
3981
|
+
// return the min between deposit cap per ix and the cap left in the deposit
|
|
3982
|
+
const depositCapInTokens = (0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(strategyWithAddress.strategy.depositCapUsd.toString()), 6);
|
|
3983
|
+
// read the tvl from API
|
|
3984
|
+
const url = `https://api.hubbleprotocol.io/strategies/${strategyWithAddress.address.toString()}/metrics?env=mainnet-beta`;
|
|
3985
|
+
const response = await fetch(url);
|
|
3986
|
+
const data = (await response.json());
|
|
3987
|
+
const tvl = new decimal_js_1.default(data.totalValueLocked);
|
|
3988
|
+
const spaceLeftInDeposit = decimal_js_1.default.max(depositCapInTokens.sub(tvl), utils_1.ZERO);
|
|
3989
|
+
return decimal_js_1.default.min(depositCapInUSDPerIx, spaceLeftInDeposit);
|
|
3990
|
+
}
|
|
3749
3991
|
/**
|
|
3750
3992
|
* Get the prices for rebalancing params (range and reset range, if strategy involves a reset range)
|
|
3751
3993
|
*/
|
|
@@ -3758,36 +4000,36 @@ class Kamino {
|
|
|
3758
4000
|
}
|
|
3759
4001
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
3760
4002
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3761
|
-
return (0,
|
|
4003
|
+
return (0, rebalance_methods_1.deserializePricePercentageRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3762
4004
|
}
|
|
3763
4005
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
3764
4006
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3765
|
-
return (0,
|
|
4007
|
+
return (0, rebalance_methods_1.deserializePricePercentageWithResetRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3766
4008
|
}
|
|
3767
4009
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
3768
4010
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
3769
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3770
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4011
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
4012
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
3771
4013
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
3772
|
-
return (0,
|
|
4014
|
+
return (0, rebalance_methods_1.deserializeDriftRebalanceFromOnchainParams)(dex, tickSpacing, tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
3773
4015
|
}
|
|
3774
4016
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
3775
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3776
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3777
|
-
return (0,
|
|
4017
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
4018
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
4019
|
+
return (0, rebalance_methods_1.deserializeTakeProfitRebalanceFromOnchainParams)(tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
3778
4020
|
}
|
|
3779
4021
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
3780
4022
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3781
|
-
return (0,
|
|
4023
|
+
return (0, rebalance_methods_1.deserializePeriodicRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3782
4024
|
}
|
|
3783
4025
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
3784
4026
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3785
|
-
return (0,
|
|
4027
|
+
return (0, rebalance_methods_1.readExpanderRebalanceFieldInfosFromStrategy)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3786
4028
|
}
|
|
3787
4029
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
3788
4030
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
3789
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3790
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4031
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
4032
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
3791
4033
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
3792
4034
|
return (0, autodriftRebalance_1.deserializeAutodriftRebalanceFromOnchainParams)(dex, tokenADecimals, tokenBDecimals, tickSpacing, strategyWithAddress.strategy.rebalanceRaw);
|
|
3793
4035
|
}
|
|
@@ -3810,36 +4052,36 @@ class Kamino {
|
|
|
3810
4052
|
}
|
|
3811
4053
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
3812
4054
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3813
|
-
return (0,
|
|
4055
|
+
return (0, rebalance_methods_1.deserializePricePercentageRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3814
4056
|
}
|
|
3815
4057
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
3816
4058
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3817
|
-
return (0,
|
|
4059
|
+
return (0, rebalance_methods_1.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3818
4060
|
}
|
|
3819
4061
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
3820
4062
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
3821
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3822
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4063
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
4064
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
3823
4065
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
3824
|
-
return (0,
|
|
4066
|
+
return (0, rebalance_methods_1.deserializeDriftRebalanceWithStateOverride)(dex, tickSpacing, tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
3825
4067
|
}
|
|
3826
4068
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
3827
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3828
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3829
|
-
return (0,
|
|
4069
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
4070
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
4071
|
+
return (0, rebalance_methods_1.deserializeTakeProfitRebalanceFromOnchainParams)(tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
3830
4072
|
}
|
|
3831
4073
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
3832
4074
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3833
|
-
return (0,
|
|
4075
|
+
return (0, rebalance_methods_1.deserializePeriodicRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3834
4076
|
}
|
|
3835
4077
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
3836
4078
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
3837
|
-
return (0,
|
|
4079
|
+
return (0, rebalance_methods_1.deserializeExpanderRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, price, strategyWithAddress.strategy.rebalanceRaw);
|
|
3838
4080
|
}
|
|
3839
4081
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
3840
4082
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
3841
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3842
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4083
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenAMint);
|
|
4084
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._rpc, strategyWithAddress.strategy.tokenBMint);
|
|
3843
4085
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
3844
4086
|
return (0, autodriftRebalance_1.deserializeAutodriftRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, tickSpacing, strategyWithAddress.strategy.rebalanceRaw);
|
|
3845
4087
|
}
|
|
@@ -3855,7 +4097,7 @@ class Kamino {
|
|
|
3855
4097
|
*/
|
|
3856
4098
|
getUpdatedRebalanceFieldInfos(initialRebalanceFieldInfos, updatedFields) {
|
|
3857
4099
|
const newRebalanceFieldInfos = initialRebalanceFieldInfos.map((f) => {
|
|
3858
|
-
const updatedField = updatedFields.find((x) => x.label
|
|
4100
|
+
const updatedField = updatedFields.find((x) => x.label === f.label);
|
|
3859
4101
|
if (updatedField) {
|
|
3860
4102
|
return { ...f, value: updatedField.value };
|
|
3861
4103
|
}
|
|
@@ -3875,13 +4117,13 @@ class Kamino {
|
|
|
3875
4117
|
* Read the pool price for a specific dex and pool
|
|
3876
4118
|
*/
|
|
3877
4119
|
async getPoolPrice(dex, pool) {
|
|
3878
|
-
if (dex
|
|
4120
|
+
if (dex === 'ORCA') {
|
|
3879
4121
|
return this.getOrcaPoolPrice(pool);
|
|
3880
4122
|
}
|
|
3881
|
-
else if (dex
|
|
4123
|
+
else if (dex === 'RAYDIUM') {
|
|
3882
4124
|
return this.getRaydiumPoolPrice(pool);
|
|
3883
4125
|
}
|
|
3884
|
-
else if (dex
|
|
4126
|
+
else if (dex === 'METEORA') {
|
|
3885
4127
|
return this.getMeteoraPoolPrice(pool);
|
|
3886
4128
|
}
|
|
3887
4129
|
else {
|
|
@@ -3889,18 +4131,14 @@ class Kamino {
|
|
|
3889
4131
|
}
|
|
3890
4132
|
}
|
|
3891
4133
|
async getOrcaPoolPrice(pool) {
|
|
3892
|
-
const
|
|
3893
|
-
connection: this._connection,
|
|
3894
|
-
network: this._cluster === 'mainnet-beta' ? whirlpool_sdk_1.OrcaNetwork.MAINNET : whirlpool_sdk_1.OrcaNetwork.DEVNET,
|
|
3895
|
-
});
|
|
3896
|
-
const poolData = await orca.getPool(pool);
|
|
4134
|
+
const poolData = await this._orcaService.getPool(pool);
|
|
3897
4135
|
if (!poolData) {
|
|
3898
4136
|
throw Error(`Could not fetch Whirlpool data for ${pool.toString()}`);
|
|
3899
4137
|
}
|
|
3900
4138
|
return poolData.price;
|
|
3901
4139
|
}
|
|
3902
4140
|
async getRaydiumPoolPrice(pool) {
|
|
3903
|
-
const poolState = await
|
|
4141
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
3904
4142
|
if (!poolState) {
|
|
3905
4143
|
throw new Error(`Raydium poolState ${pool.toString()} is not found`);
|
|
3906
4144
|
}
|
|
@@ -3908,23 +4146,23 @@ class Kamino {
|
|
|
3908
4146
|
return price;
|
|
3909
4147
|
}
|
|
3910
4148
|
async getMeteoraPoolPrice(pool) {
|
|
3911
|
-
const poolState = await
|
|
4149
|
+
const poolState = await accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
3912
4150
|
if (!poolState) {
|
|
3913
4151
|
throw new Error(`Meteora poolState ${pool.toString()} is not found`);
|
|
3914
4152
|
}
|
|
3915
|
-
const decimalsX = await (0, utils_1.getMintDecimals)(this.
|
|
3916
|
-
const decimalsY = await (0, utils_1.getMintDecimals)(this.
|
|
4153
|
+
const decimalsX = await (0, utils_1.getMintDecimals)(this._rpc, poolState.tokenXMint);
|
|
4154
|
+
const decimalsY = await (0, utils_1.getMintDecimals)(this._rpc, poolState.tokenYMint);
|
|
3917
4155
|
return (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(poolState.activeId, poolState.binStep, decimalsX, decimalsY);
|
|
3918
4156
|
}
|
|
3919
4157
|
async getGenericPoolInfo(dex, pool) {
|
|
3920
4158
|
let poolInfo;
|
|
3921
|
-
if (dex
|
|
4159
|
+
if (dex === 'ORCA') {
|
|
3922
4160
|
poolInfo = await this._orcaService.getGenericPoolInfo(pool);
|
|
3923
4161
|
}
|
|
3924
|
-
else if (dex
|
|
4162
|
+
else if (dex === 'RAYDIUM') {
|
|
3925
4163
|
poolInfo = await this._raydiumService.getGenericPoolInfo(pool);
|
|
3926
4164
|
}
|
|
3927
|
-
else if (dex
|
|
4165
|
+
else if (dex === 'METEORA') {
|
|
3928
4166
|
poolInfo = await this._meteoraService.getGenericPoolInfo(pool);
|
|
3929
4167
|
}
|
|
3930
4168
|
else {
|
|
@@ -3935,74 +4173,75 @@ class Kamino {
|
|
|
3935
4173
|
mintIsSupported = (collateralInfos, tokenMint) => {
|
|
3936
4174
|
let found = false;
|
|
3937
4175
|
collateralInfos.forEach((element) => {
|
|
3938
|
-
if (element.mint
|
|
4176
|
+
if (element.mint === tokenMint) {
|
|
3939
4177
|
found = true;
|
|
3940
4178
|
}
|
|
3941
4179
|
});
|
|
3942
4180
|
return found;
|
|
3943
4181
|
};
|
|
3944
4182
|
getCollateralInfoFromMint = (mint, collateralInfos) => {
|
|
3945
|
-
const collInfosForMint = collateralInfos.filter((x) => x.mint
|
|
3946
|
-
if (collInfosForMint.length
|
|
4183
|
+
const collInfosForMint = collateralInfos.filter((x) => x.mint === mint);
|
|
4184
|
+
if (collInfosForMint.length === 0) {
|
|
3947
4185
|
return undefined;
|
|
3948
4186
|
}
|
|
3949
4187
|
return collInfosForMint[0];
|
|
3950
4188
|
};
|
|
3951
4189
|
getCollateralIdFromMint = (mint, collateralInfos) => {
|
|
3952
4190
|
for (let i = 0; i < collateralInfos.length; i++) {
|
|
3953
|
-
if (collateralInfos[i].mint
|
|
4191
|
+
if (collateralInfos[i].mint === mint) {
|
|
3954
4192
|
return i;
|
|
3955
4193
|
}
|
|
3956
4194
|
}
|
|
3957
4195
|
return -1;
|
|
3958
4196
|
};
|
|
3959
4197
|
getMainLookupTablePks = async () => {
|
|
3960
|
-
if (this.
|
|
3961
|
-
this._cluster
|
|
3962
|
-
this._cluster
|
|
3963
|
-
return await this.
|
|
3964
|
-
.getProgramAccounts(
|
|
3965
|
-
filters: [{ memcmp: { offset:
|
|
4198
|
+
if (this.getProgramID() === pubkeys_1.STAGING_KAMINO_PROGRAM_ID ||
|
|
4199
|
+
this._cluster === 'mainnet-beta' ||
|
|
4200
|
+
this._cluster === 'devnet') {
|
|
4201
|
+
return await this._rpc
|
|
4202
|
+
.getProgramAccounts(address_lookup_table_1.ADDRESS_LOOKUP_TABLE_PROGRAM_ADDRESS, {
|
|
4203
|
+
filters: [{ memcmp: { offset: 22n, bytes: pubkeys_1.LUT_OWNER_KEY, encoding: 'base58' } }],
|
|
3966
4204
|
dataSlice: { length: 0, offset: 0 },
|
|
3967
4205
|
})
|
|
4206
|
+
.send()
|
|
3968
4207
|
.then((res) => res.map((raw) => raw.pubkey));
|
|
3969
4208
|
}
|
|
3970
4209
|
return [];
|
|
3971
4210
|
};
|
|
3972
4211
|
getMainLookupTable = async () => {
|
|
3973
4212
|
const pks = await this.getMainLookupTablePks();
|
|
3974
|
-
if (this.
|
|
3975
|
-
this._cluster
|
|
3976
|
-
this._cluster
|
|
3977
|
-
return
|
|
3978
|
-
return new web3_js_1.AddressLookupTableAccount({
|
|
3979
|
-
key: pks[i],
|
|
3980
|
-
state: web3_js_1.AddressLookupTableAccount.deserialize(raw.data),
|
|
3981
|
-
});
|
|
3982
|
-
}));
|
|
4213
|
+
if (this.getProgramID() === pubkeys_1.STAGING_KAMINO_PROGRAM_ID ||
|
|
4214
|
+
this._cluster === 'mainnet-beta' ||
|
|
4215
|
+
this._cluster === 'devnet') {
|
|
4216
|
+
return (0, lookupTable_1.fetchMultipleLookupTableAccounts)(this._rpc, pks);
|
|
3983
4217
|
}
|
|
3984
4218
|
else {
|
|
3985
4219
|
return undefined;
|
|
3986
4220
|
}
|
|
3987
4221
|
};
|
|
3988
4222
|
getInitLookupTableIx = async (authority, slot) => {
|
|
3989
|
-
let recentSlot
|
|
3990
|
-
if (
|
|
3991
|
-
recentSlot =
|
|
4223
|
+
let recentSlot;
|
|
4224
|
+
if (slot) {
|
|
4225
|
+
recentSlot = slot;
|
|
4226
|
+
}
|
|
4227
|
+
else {
|
|
4228
|
+
recentSlot = await this._rpc.getSlot({ commitment: 'finalized' }).send();
|
|
3992
4229
|
}
|
|
3993
|
-
const
|
|
3994
|
-
|
|
3995
|
-
authority,
|
|
4230
|
+
const pda = await (0, address_lookup_table_1.findAddressLookupTablePda)({ authority: authority.address, recentSlot });
|
|
4231
|
+
const createLookupTableIx = (0, address_lookup_table_1.getCreateLookupTableInstruction)({
|
|
4232
|
+
authority: authority,
|
|
3996
4233
|
payer: authority,
|
|
3997
|
-
|
|
4234
|
+
address: pda,
|
|
4235
|
+
recentSlot: recentSlot,
|
|
3998
4236
|
});
|
|
4237
|
+
return [createLookupTableIx, pda[0]];
|
|
3999
4238
|
};
|
|
4000
4239
|
getPopulateLookupTableIxs = async (authority, lookupTable, strategy) => {
|
|
4001
4240
|
const { strategy: strategyState, address } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4002
4241
|
if (!strategyState) {
|
|
4003
4242
|
throw Error(`Could not fetch strategy state with pubkey ${strategy.toString()}`);
|
|
4004
4243
|
}
|
|
4005
|
-
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } = this.getTreasuryFeeVaultPDAs(strategyState.tokenAMint, strategyState.tokenBMint);
|
|
4244
|
+
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } = await this.getTreasuryFeeVaultPDAs(strategyState.tokenAMint, strategyState.tokenBMint);
|
|
4006
4245
|
const accountsToBeInserted = [
|
|
4007
4246
|
address,
|
|
4008
4247
|
strategyState.adminAuthority,
|
|
@@ -4029,87 +4268,48 @@ class Kamino {
|
|
|
4029
4268
|
const txs = [];
|
|
4030
4269
|
for (let i = 0; i < entries.length; i += chunkSize) {
|
|
4031
4270
|
const chunk = entries.slice(i, i + chunkSize);
|
|
4032
|
-
txs.push(
|
|
4033
|
-
payer: authority,
|
|
4271
|
+
txs.push((0, address_lookup_table_1.getExtendLookupTableInstruction)({
|
|
4034
4272
|
authority,
|
|
4035
|
-
|
|
4273
|
+
payer: authority,
|
|
4274
|
+
address: lookupTable,
|
|
4036
4275
|
addresses: chunk,
|
|
4037
4276
|
}));
|
|
4038
4277
|
}
|
|
4039
4278
|
return txs;
|
|
4040
4279
|
};
|
|
4041
4280
|
getLookupTable = async (tablePk) => {
|
|
4042
|
-
const
|
|
4043
|
-
if (!
|
|
4044
|
-
throw new Error(`Could not get lookup table ${tablePk
|
|
4281
|
+
const lut = await (0, address_lookup_table_1.fetchMaybeAddressLookupTable)(this._rpc, tablePk);
|
|
4282
|
+
if (!lut.exists) {
|
|
4283
|
+
throw new Error(`Could not get lookup table ${tablePk}`);
|
|
4045
4284
|
}
|
|
4046
|
-
return
|
|
4285
|
+
return lut;
|
|
4047
4286
|
};
|
|
4048
4287
|
setupStrategyLookupTable = async (authority, strategy, slot) => {
|
|
4049
|
-
const [createLookupTableIx, lookupTable] = await this.getInitLookupTableIx(authority
|
|
4050
|
-
const
|
|
4051
|
-
const strategyPk = '
|
|
4052
|
-
const
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
}
|
|
4059
|
-
const updateStrategyLookupTableTx = new web3_js_1.Transaction().add(getUpdateStrategyLookupTableIx);
|
|
4060
|
-
const sig = await (0, utils_1.sendTransactionWithLogs)(this._connection, updateStrategyLookupTableTx, authority.publicKey, [
|
|
4061
|
-
authority,
|
|
4062
|
-
]);
|
|
4063
|
-
console.log('Updated strategy', strategyPk, 'lookup table', sig);
|
|
4064
|
-
return lookupTable;
|
|
4065
|
-
};
|
|
4066
|
-
// the optional param is a list of pubkeys of lookup tables and they will be read from chain and used in the tx
|
|
4067
|
-
getTransactionV2Message = async (payer, instructions, lookupTables) => {
|
|
4068
|
-
const lookupTable = await this.getMainLookupTable();
|
|
4069
|
-
let allLookupTables = [];
|
|
4070
|
-
if (lookupTable) {
|
|
4071
|
-
allLookupTables = allLookupTables.concat(lookupTable);
|
|
4072
|
-
}
|
|
4073
|
-
if (lookupTables) {
|
|
4074
|
-
for (const table of lookupTables) {
|
|
4075
|
-
const lookupTableData = await this.getLookupTable(table);
|
|
4076
|
-
allLookupTables.push(lookupTableData);
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
return await this.getTransactionV2MessageWithFetchedLookupTables(payer, instructions, allLookupTables);
|
|
4080
|
-
};
|
|
4081
|
-
// the optional param is the lookup table list of the tables that are already feteched from chain
|
|
4082
|
-
getTransactionV2MessageWithFetchedLookupTables = async (payer, instructions, lookupTables) => {
|
|
4083
|
-
const lookupTable = await this.getMainLookupTable();
|
|
4084
|
-
const blockhash = await this._connection.getLatestBlockhash();
|
|
4085
|
-
let allLookupTables = [];
|
|
4086
|
-
if (lookupTables) {
|
|
4087
|
-
allLookupTables.push(...lookupTables);
|
|
4088
|
-
}
|
|
4089
|
-
if (lookupTable) {
|
|
4090
|
-
allLookupTables = allLookupTables.concat(lookupTable);
|
|
4091
|
-
}
|
|
4092
|
-
const v2Tx = new web3_js_1.TransactionMessage({
|
|
4093
|
-
payerKey: payer,
|
|
4094
|
-
recentBlockhash: blockhash.blockhash,
|
|
4095
|
-
instructions: instructions,
|
|
4096
|
-
}).compileToV0Message(allLookupTables);
|
|
4097
|
-
return v2Tx;
|
|
4288
|
+
const [createLookupTableIx, lookupTable] = await this.getInitLookupTableIx(authority, slot);
|
|
4289
|
+
const populateLookupTableIxs = await this.getPopulateLookupTableIxs(authority, lookupTable, strategy);
|
|
4290
|
+
const strategyPk = typeof strategy === 'string' && (0, kit_1.isAddress)(strategy) ? strategy : strategy.address;
|
|
4291
|
+
const updateStrategyLookupTableIx = await (0, utils_1.getUpdateStrategyConfigIx)(authority, this._globalConfig, strategyPk, new StrategyConfigOption_1.UpdateLookupTable(), new decimal_js_1.default(0), this.getProgramID(), lookupTable);
|
|
4292
|
+
return {
|
|
4293
|
+
lookupTable,
|
|
4294
|
+
createLookupTableIx,
|
|
4295
|
+
populateLookupTableIxs,
|
|
4296
|
+
updateStrategyLookupTableIx,
|
|
4297
|
+
};
|
|
4098
4298
|
};
|
|
4099
4299
|
// todo(silviu): implement this
|
|
4100
4300
|
// getEstimatedApyAndVolumeOnRange = async (
|
|
4101
4301
|
// dex: Dex,
|
|
4102
|
-
// pool:
|
|
4302
|
+
// pool: Address,
|
|
4103
4303
|
// lowerPrice: Decimal,
|
|
4104
4304
|
// upperPrice: Decimal,
|
|
4105
4305
|
// _startDate: Date,
|
|
4106
4306
|
// _endDate: Date
|
|
4107
4307
|
// ): Promise<GenericPositionRangeInfo> => {
|
|
4108
|
-
// if (dex
|
|
4308
|
+
// if (dex === 'ORCA') {
|
|
4109
4309
|
// return this.getEstimatedApyAndVolumeOnRangeOrca();
|
|
4110
|
-
// } else if (dex
|
|
4310
|
+
// } else if (dex === 'RAYDIUM') {
|
|
4111
4311
|
// return this.getEstimatedApyAndVolumeOnRangeRaydium();
|
|
4112
|
-
// } else if (dex
|
|
4312
|
+
// } else if (dex === 'METEORA') {
|
|
4113
4313
|
// return this.getEstimatedApyAndVolumeOnRangeMeteora();
|
|
4114
4314
|
// } else {
|
|
4115
4315
|
// throw new Error(`Dex ${dex} is not supported`);
|
|
@@ -4146,24 +4346,25 @@ class Kamino {
|
|
|
4146
4346
|
};
|
|
4147
4347
|
/**
|
|
4148
4348
|
* Get a list of transactions to rebalance a Kamino strategy.
|
|
4349
|
+
* @param admin pool admin
|
|
4149
4350
|
* @param strategy strategy pubkey or object
|
|
4150
4351
|
* @param newPosition new liquidity position account pubkey
|
|
4151
4352
|
* @param priceLower new position's lower price of the range
|
|
4152
4353
|
* @param priceUpper new position's upper price of the range
|
|
4153
4354
|
* @returns list of transactions to rebalance (executive withdraw, collect fees/rewards, open new position, invest)
|
|
4154
4355
|
*/
|
|
4155
|
-
rebalance = async (strategy, newPosition, priceLower, priceUpper) => {
|
|
4356
|
+
rebalance = async (admin, strategy, newPosition, priceLower, priceUpper) => {
|
|
4156
4357
|
// todo: refactor this to return an object, not a list
|
|
4157
4358
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
4158
4359
|
const ixs = [];
|
|
4159
4360
|
// if there are no invested tokens we don't need to collect fees and rewards
|
|
4160
4361
|
const stratTokenBalances = await this.getStrategyTokensBalances(strategyWithAddress.strategy);
|
|
4161
|
-
if (strategyWithAddress.strategy.strategyDex.toNumber()
|
|
4362
|
+
if (strategyWithAddress.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') ||
|
|
4162
4363
|
stratTokenBalances.invested.a.greaterThan(utils_1.ZERO) ||
|
|
4163
4364
|
stratTokenBalances.invested.b.greaterThan(utils_1.ZERO)) {
|
|
4164
|
-
ixs.push(await this.collectFeesAndRewards(strategyWithAddress));
|
|
4365
|
+
ixs.push(await this.collectFeesAndRewards(strategyWithAddress, admin));
|
|
4165
4366
|
}
|
|
4166
|
-
ixs.push(await this.openPosition(strategyWithAddress, newPosition, priceLower, priceUpper, new StrategyStatus_1.Rebalancing()));
|
|
4367
|
+
ixs.push(await this.openPosition(admin, strategyWithAddress, newPosition, priceLower, priceUpper, new StrategyStatus_1.Rebalancing()));
|
|
4167
4368
|
return ixs;
|
|
4168
4369
|
};
|
|
4169
4370
|
/**
|
|
@@ -4178,14 +4379,18 @@ class Kamino {
|
|
|
4178
4379
|
const positions = [];
|
|
4179
4380
|
for (const tokenAccount of userTokenAccounts) {
|
|
4180
4381
|
const accountData = tokenAccount.account.data;
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4382
|
+
if ('parsed' in accountData) {
|
|
4383
|
+
// @ts-ignore
|
|
4384
|
+
const strategy = liveStrategies.find((x) => x.strategy.sharesMint === accountData.parsed.info.mint);
|
|
4385
|
+
if (strategy) {
|
|
4386
|
+
positions.push({
|
|
4387
|
+
shareMint: strategy.strategy.sharesMint,
|
|
4388
|
+
strategy: strategy.address,
|
|
4389
|
+
// @ts-ignore
|
|
4390
|
+
sharesAmount: new decimal_js_1.default(accountData.parsed.info.tokenAmount.uiAmountString),
|
|
4391
|
+
strategyDex: (0, utils_1.numberToDex)(strategy.strategy.strategyDex.toNumber()),
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4189
4394
|
}
|
|
4190
4395
|
}
|
|
4191
4396
|
return positions;
|
|
@@ -4193,53 +4398,57 @@ class Kamino {
|
|
|
4193
4398
|
/**
|
|
4194
4399
|
* Get a list of user's Kamino strategy positions
|
|
4195
4400
|
* @param wallet user wallet address
|
|
4401
|
+
* @param strategiesWithShareMintsMap
|
|
4402
|
+
* @param strategiesWithAddressMap
|
|
4196
4403
|
* @returns list of kamino strategy positions
|
|
4197
4404
|
*/
|
|
4198
4405
|
getUserPositionsByStrategiesMap = async (wallet, strategiesWithShareMintsMap, strategiesWithAddressMap) => {
|
|
4199
|
-
const tokenAccounts = await this.
|
|
4200
|
-
programId:
|
|
4201
|
-
|
|
4406
|
+
const tokenAccounts = await this._rpc
|
|
4407
|
+
.getTokenAccountsByOwner(wallet, { programId: token_1.TOKEN_PROGRAM_ADDRESS }, { encoding: 'jsonParsed' })
|
|
4408
|
+
.send();
|
|
4202
4409
|
const mints = tokenAccounts.value.map((accountInfo) => {
|
|
4203
|
-
return
|
|
4410
|
+
return accountInfo.account.data.parsed.info.mint;
|
|
4204
4411
|
});
|
|
4205
|
-
const mintInfos = await (0, utils_1.batchFetch)(mints, (chunk) => this.getConnection()
|
|
4206
|
-
const
|
|
4412
|
+
const mintInfos = await (0, utils_1.batchFetch)(mints, async (chunk) => await (0, token_2022_1.fetchAllMint)(this.getConnection(), chunk));
|
|
4413
|
+
const kaminoStrategyAddresses = [];
|
|
4207
4414
|
const kaminoAccountInfos = [];
|
|
4208
|
-
for (
|
|
4209
|
-
const mint = mints[
|
|
4210
|
-
const mintInfo = mintInfos[
|
|
4211
|
-
const accountInfo = tokenAccounts.value[
|
|
4415
|
+
for (let i = 0; i < mints.length; i++) {
|
|
4416
|
+
const mint = mints[i];
|
|
4417
|
+
const mintInfo = mintInfos[i];
|
|
4418
|
+
const accountInfo = tokenAccounts.value[i];
|
|
4212
4419
|
if (!mint || !mintInfo || !accountInfo)
|
|
4213
4420
|
continue;
|
|
4214
|
-
const [expectedMintAuthority] =
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4421
|
+
const [expectedMintAuthority] = await (0, kit_1.getProgramDerivedAddress)({
|
|
4422
|
+
seeds: [Buffer.from('authority'), addressEncoder.encode(mint)],
|
|
4423
|
+
programAddress: this.getProgramID(),
|
|
4424
|
+
});
|
|
4425
|
+
if ((0, kit_1.isSome)(mintInfo.data.mintAuthority) && mintInfo.data.mintAuthority.value === expectedMintAuthority) {
|
|
4426
|
+
const shareMintAddress = tokenAccounts.value[i].account.data.parsed.info.mint;
|
|
4427
|
+
const addr = strategiesWithShareMintsMap.get(shareMintAddress)?.address;
|
|
4428
|
+
if (!addr)
|
|
4220
4429
|
continue;
|
|
4221
|
-
|
|
4222
|
-
kaminoAccountInfos.push(accountInfo.account);
|
|
4430
|
+
kaminoStrategyAddresses.push(addr);
|
|
4431
|
+
kaminoAccountInfos.push(accountInfo.account.data.parsed.info);
|
|
4223
4432
|
}
|
|
4224
4433
|
}
|
|
4225
4434
|
let strategies = strategiesWithAddressMap
|
|
4226
4435
|
? Array.from(strategiesWithAddressMap.values())
|
|
4227
4436
|
: [];
|
|
4228
|
-
const missingStrategies =
|
|
4437
|
+
const missingStrategies = kaminoStrategyAddresses.filter((x) => !strategiesWithAddressMap || !strategiesWithAddressMap.has(x));
|
|
4229
4438
|
const missingStrategiesState = await (0, utils_1.batchFetch)(missingStrategies, (chunk) => this.getStrategies(chunk));
|
|
4230
4439
|
strategies = strategies.concat(missingStrategiesState);
|
|
4231
4440
|
const positions = [];
|
|
4232
4441
|
for (const index of strategies.keys()) {
|
|
4233
4442
|
const strategy = strategies[index];
|
|
4234
4443
|
const accountData = kaminoAccountInfos[index];
|
|
4235
|
-
const address =
|
|
4444
|
+
const address = kaminoStrategyAddresses[index];
|
|
4236
4445
|
if (!strategy || !accountData) {
|
|
4237
4446
|
continue;
|
|
4238
4447
|
}
|
|
4239
4448
|
positions.push({
|
|
4240
4449
|
shareMint: strategy.sharesMint,
|
|
4241
4450
|
strategy: address,
|
|
4242
|
-
sharesAmount: new decimal_js_1.default(accountData.
|
|
4451
|
+
sharesAmount: new decimal_js_1.default(accountData.tokenAmount.uiAmountString),
|
|
4243
4452
|
strategyDex: (0, utils_1.numberToDex)(strategy.strategyDex.toNumber()),
|
|
4244
4453
|
});
|
|
4245
4454
|
}
|
|
@@ -4257,7 +4466,7 @@ class Kamino {
|
|
|
4257
4466
|
const isOrca = (0, utils_1.dexToNumber)('ORCA') === dex;
|
|
4258
4467
|
const isRaydium = (0, utils_1.dexToNumber)('RAYDIUM') === dex;
|
|
4259
4468
|
const isMeteora = (0, utils_1.dexToNumber)('METEORA') === dex;
|
|
4260
|
-
if (strategyState.position.
|
|
4469
|
+
if (strategyState.position === pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
4261
4470
|
return {
|
|
4262
4471
|
totalApr: utils_1.ZERO,
|
|
4263
4472
|
feeApr: utils_1.ZERO,
|
|
@@ -4287,7 +4496,7 @@ class Kamino {
|
|
|
4287
4496
|
getStrategyPerformanceFees = async (strategy, globalConfig) => {
|
|
4288
4497
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4289
4498
|
const globalConfigState = globalConfig || (await this.getGlobalConfigState(strategyState.globalConfig));
|
|
4290
|
-
if (globalConfigState
|
|
4499
|
+
if (globalConfigState === null) {
|
|
4291
4500
|
throw new Error(`Unable to fetch GlobalConfig with Pubkey ${strategyState.globalConfig}`);
|
|
4292
4501
|
}
|
|
4293
4502
|
const globalConfigMinPerformanceFee = new decimal_js_1.default(globalConfigState.minPerformanceFeeBps.toString());
|
|
@@ -4312,13 +4521,13 @@ class Kamino {
|
|
|
4312
4521
|
return this._orcaService.getWhirlpoolLiquidityDistribution(pool, keepOrder, lowestTick, highestTick);
|
|
4313
4522
|
};
|
|
4314
4523
|
getLiquidityDistribution = async (dex, pool, keepOrder = true, lowestTick, highestTick) => {
|
|
4315
|
-
if (dex
|
|
4524
|
+
if (dex === 'ORCA') {
|
|
4316
4525
|
return this.getLiquidityDistributionOrcaWhirlpool(pool, keepOrder, lowestTick, highestTick);
|
|
4317
4526
|
}
|
|
4318
|
-
else if (dex
|
|
4527
|
+
else if (dex === 'RAYDIUM') {
|
|
4319
4528
|
return this.getLiquidityDistributionRaydiumPool(pool, keepOrder, lowestTick, highestTick);
|
|
4320
4529
|
}
|
|
4321
|
-
else if (dex
|
|
4530
|
+
else if (dex === 'METEORA') {
|
|
4322
4531
|
return this.getLiquidityDistributionMeteoraPool(pool, keepOrder, lowestTick, highestTick);
|
|
4323
4532
|
}
|
|
4324
4533
|
else {
|
|
@@ -4326,13 +4535,13 @@ class Kamino {
|
|
|
4326
4535
|
}
|
|
4327
4536
|
};
|
|
4328
4537
|
getPositionsCountForPool = async (dex, pool) => {
|
|
4329
|
-
if (dex
|
|
4538
|
+
if (dex === 'ORCA') {
|
|
4330
4539
|
return this._orcaService.getPositionsCountByPool(pool);
|
|
4331
4540
|
}
|
|
4332
|
-
else if (dex
|
|
4541
|
+
else if (dex === 'RAYDIUM') {
|
|
4333
4542
|
return this._raydiumService.getPositionsCountByPool(pool);
|
|
4334
4543
|
}
|
|
4335
|
-
else if (dex
|
|
4544
|
+
else if (dex === 'METEORA') {
|
|
4336
4545
|
return this._meteoraService.getPositionsCountByPool(pool);
|
|
4337
4546
|
}
|
|
4338
4547
|
else {
|
|
@@ -4428,8 +4637,8 @@ class Kamino {
|
|
|
4428
4637
|
*/
|
|
4429
4638
|
calculateAmountsDistributionWithPriceRange = async (dex, pool, lowerPrice, upperPrice) => {
|
|
4430
4639
|
const tokenAAmountToDeposit = new decimal_js_1.default(100.0);
|
|
4431
|
-
if (dex
|
|
4432
|
-
const poolState = await
|
|
4640
|
+
if (dex === 'RAYDIUM') {
|
|
4641
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, pool, this._raydiumService.getRaydiumProgramId());
|
|
4433
4642
|
if (!poolState) {
|
|
4434
4643
|
throw new Error(`Raydium poolState ${pool.toString()} is not found`);
|
|
4435
4644
|
}
|
|
@@ -4440,23 +4649,23 @@ class Kamino {
|
|
|
4440
4649
|
const amountBDecimal = new decimal_js_1.default(amountB.toString());
|
|
4441
4650
|
return [(0, utils_1.lamportsToNumberDecimal)(amountADecimal, decimalsA), (0, utils_1.lamportsToNumberDecimal)(amountBDecimal, decimalsB)];
|
|
4442
4651
|
}
|
|
4443
|
-
else if (dex
|
|
4444
|
-
const whirlpoolState = await
|
|
4652
|
+
else if (dex === 'ORCA') {
|
|
4653
|
+
const whirlpoolState = await accounts_2.Whirlpool.fetch(this._rpc, pool, this._orcaService.getWhirlpoolProgramId());
|
|
4445
4654
|
if (!whirlpoolState) {
|
|
4446
4655
|
throw new Error(`Raydium poolState ${pool.toString()} is not found`);
|
|
4447
4656
|
}
|
|
4448
4657
|
const tokenMintA = whirlpoolState.tokenMintA;
|
|
4449
4658
|
const tokenMintB = whirlpoolState.tokenMintB;
|
|
4450
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
4451
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
4659
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, tokenMintA);
|
|
4660
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, tokenMintB);
|
|
4452
4661
|
const tickLowerIndex = (0, whirlpool_sdk_1.getNearestValidTickIndexFromTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(lowerPrice, decimalsA, decimalsB), whirlpoolState.tickSpacing);
|
|
4453
4662
|
const tickUpperIndex = (0, whirlpool_sdk_1.getNearestValidTickIndexFromTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(upperPrice, decimalsA, decimalsB), whirlpoolState.tickSpacing);
|
|
4454
4663
|
const params = {
|
|
4455
|
-
tokenMintA,
|
|
4456
|
-
tokenMintB,
|
|
4664
|
+
tokenMintA: (0, compat_2.toLegacyPublicKey)(tokenMintA),
|
|
4665
|
+
tokenMintB: (0, compat_2.toLegacyPublicKey)(tokenMintB),
|
|
4457
4666
|
tickCurrentIndex: whirlpoolState.tickCurrentIndex,
|
|
4458
4667
|
sqrtPrice: whirlpoolState.sqrtPrice,
|
|
4459
|
-
inputTokenMint: tokenMintA,
|
|
4668
|
+
inputTokenMint: (0, compat_2.toLegacyPublicKey)(tokenMintA),
|
|
4460
4669
|
inputTokenAmount: new bn_js_1.default((0, utils_1.collToLamportsDecimal)(tokenAAmountToDeposit, decimalsA).toString()),
|
|
4461
4670
|
tickLowerIndex,
|
|
4462
4671
|
tickUpperIndex,
|
|
@@ -4468,8 +4677,8 @@ class Kamino {
|
|
|
4468
4677
|
(0, utils_1.lamportsToNumberDecimal)(addLiqResult.estTokenB.toNumber(), decimalsB),
|
|
4469
4678
|
];
|
|
4470
4679
|
}
|
|
4471
|
-
else if (dex
|
|
4472
|
-
const poolState = await
|
|
4680
|
+
else if (dex === 'METEORA') {
|
|
4681
|
+
const poolState = await accounts_4.LbPair.fetch(this._rpc, pool, this._meteoraService.getMeteoraProgramId());
|
|
4473
4682
|
if (!poolState) {
|
|
4474
4683
|
throw new Error(`Meteora poolState ${pool.toString()} is not found`);
|
|
4475
4684
|
}
|
|
@@ -4485,7 +4694,7 @@ class Kamino {
|
|
|
4485
4694
|
};
|
|
4486
4695
|
calculateAmountsToBeDeposited = async (strategy, tokenAAmount, tokenBAmount, profiledFunctionExecution = utils_1.noopProfiledFunctionExecution) => {
|
|
4487
4696
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4488
|
-
if (strategyState.shareCalculationMethod === deposit_method_1.
|
|
4697
|
+
if (strategyState.shareCalculationMethod === deposit_method_1.DOLLAR_BASED) {
|
|
4489
4698
|
return this.calculateDepostAmountsDollarBased(strategy, tokenAAmount, tokenBAmount);
|
|
4490
4699
|
}
|
|
4491
4700
|
else if (strategyState.shareCalculationMethod === deposit_method_1.PROPORTION_BASED) {
|
|
@@ -4498,7 +4707,7 @@ class Kamino {
|
|
|
4498
4707
|
/// Returns an amount of tokenA and an amount of tokenB that define the ratio of the amounts that can be deposited
|
|
4499
4708
|
calculateAmountsRatioToBeDeposited = async (strategy, holdings, profiler = utils_1.noopProfiledFunctionExecution) => {
|
|
4500
4709
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4501
|
-
if (strategyState.shareCalculationMethod === deposit_method_1.
|
|
4710
|
+
if (strategyState.shareCalculationMethod === deposit_method_1.DOLLAR_BASED) {
|
|
4502
4711
|
return this.calculateDepostAmountsDollarBased(strategy, new decimal_js_1.default(100), undefined);
|
|
4503
4712
|
}
|
|
4504
4713
|
else if (strategyState.shareCalculationMethod === deposit_method_1.PROPORTION_BASED) {
|
|
@@ -4557,7 +4766,7 @@ class Kamino {
|
|
|
4557
4766
|
const isRaydium = (0, utils_1.dexToNumber)('RAYDIUM') === dex;
|
|
4558
4767
|
const isMeteora = (0, utils_1.dexToNumber)('METEORA') === dex;
|
|
4559
4768
|
if (isOrca) {
|
|
4560
|
-
const whirlpool = await
|
|
4769
|
+
const whirlpool = await accounts_2.Whirlpool.fetch(this._rpc, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
4561
4770
|
if (!whirlpool) {
|
|
4562
4771
|
throw new Error(`Unable to get Orca whirlpool for pubkey ${strategyState.pool}`);
|
|
4563
4772
|
}
|
|
@@ -4585,7 +4794,7 @@ class Kamino {
|
|
|
4585
4794
|
return [new decimal_js_1.default(0), new decimal_js_1.default(0)];
|
|
4586
4795
|
}
|
|
4587
4796
|
// Given A in ATA, calc how much A and B
|
|
4588
|
-
const accessor = new orca_dal_1.OrcaDAL(whirlpoolConfig, this._orcaService.getWhirlpoolProgramId(), this.
|
|
4797
|
+
const accessor = new orca_dal_1.OrcaDAL(whirlpoolConfig, this._orcaService.getWhirlpoolProgramId(), this._legacyConnection);
|
|
4589
4798
|
const orcaPosition = new orca_position_1.OrcaPosition(accessor);
|
|
4590
4799
|
const defaultSlippagePercentage = whirlpool_sdk_1.Percentage.fromFraction(1, 1000); // 0.1%
|
|
4591
4800
|
const primaryTokenAmount = tokenAAmount || tokenBAmount;
|
|
@@ -4625,8 +4834,8 @@ class Kamino {
|
|
|
4625
4834
|
if (!tokenAAmount && !tokenBAmount) {
|
|
4626
4835
|
return [new decimal_js_1.default(0), new decimal_js_1.default(0)];
|
|
4627
4836
|
}
|
|
4628
|
-
const poolState = await
|
|
4629
|
-
const position = await
|
|
4837
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
4838
|
+
const position = await accounts_3.PersonalPositionState.fetch(this._rpc, strategyState.position, this._raydiumService.getRaydiumProgramId());
|
|
4630
4839
|
if (!position) {
|
|
4631
4840
|
throw new Error(`position ${strategyState.position.toString()} is not found`);
|
|
4632
4841
|
}
|
|
@@ -4662,7 +4871,7 @@ class Kamino {
|
|
|
4662
4871
|
if (!tokenAAmount && !tokenBAmount) {
|
|
4663
4872
|
return [new decimal_js_1.default(0), new decimal_js_1.default(0)];
|
|
4664
4873
|
}
|
|
4665
|
-
const poolState = await
|
|
4874
|
+
const poolState = await accounts_4.LbPair.fetch(this._rpc, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
4666
4875
|
if (!poolState) {
|
|
4667
4876
|
throw new Error(`poolState ${strategyState.pool.toString()} is not found`);
|
|
4668
4877
|
}
|
|
@@ -4673,8 +4882,8 @@ class Kamino {
|
|
|
4673
4882
|
}
|
|
4674
4883
|
else {
|
|
4675
4884
|
const binArrayIndex = (0, meteora_1.binIdToBinArrayIndex)(new bn_js_1.default(poolState.activeId));
|
|
4676
|
-
const [binArrayPk] = (0, meteora_1.deriveBinArray)(strategyState.pool, binArrayIndex, this._meteoraService.getMeteoraProgramId());
|
|
4677
|
-
const binArray = await
|
|
4885
|
+
const [binArrayPk] = await (0, meteora_1.deriveBinArray)(strategyState.pool, binArrayIndex, this._meteoraService.getMeteoraProgramId());
|
|
4886
|
+
const binArray = await accounts_4.BinArray.fetch(this._rpc, binArrayPk, this._meteoraService.getMeteoraProgramId());
|
|
4678
4887
|
if (!binArray) {
|
|
4679
4888
|
throw new Error(`bin array ${binArrayPk.toString()} is not found`);
|
|
4680
4889
|
}
|
|
@@ -4693,8 +4902,8 @@ class Kamino {
|
|
|
4693
4902
|
throw new Error(`bin ${poolState.activeId.toString()} is not found`);
|
|
4694
4903
|
}
|
|
4695
4904
|
if (amountADecimal.eq(utils_1.ZERO) && amountBDecimal.eq(utils_1.ZERO)) {
|
|
4696
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
4697
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
4905
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, strategyState.tokenAMint);
|
|
4906
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, strategyState.tokenBMint);
|
|
4698
4907
|
const poolPrice = (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(poolState.activeId, poolState.binStep, decimalsA, decimalsB);
|
|
4699
4908
|
return [tokenAAmount || tokenBAmount.div(poolPrice), tokenBAmount || tokenAAmount.mul(poolPrice)];
|
|
4700
4909
|
}
|
|
@@ -4762,9 +4971,12 @@ class Kamino {
|
|
|
4762
4971
|
* @param owner
|
|
4763
4972
|
*/
|
|
4764
4973
|
async getUserTermsSignatureState(owner) {
|
|
4765
|
-
const pdaSeed = [Buffer.from('signature'),
|
|
4766
|
-
const [signatureStateKey, _signatureStateBump] =
|
|
4767
|
-
|
|
4974
|
+
const pdaSeed = [Buffer.from('signature'), addressEncoder.encode(owner)];
|
|
4975
|
+
const [signatureStateKey, _signatureStateBump] = await (0, kit_1.getProgramDerivedAddress)({
|
|
4976
|
+
seeds: pdaSeed,
|
|
4977
|
+
programAddress: this.getProgramID(),
|
|
4978
|
+
});
|
|
4979
|
+
return await accounts_1.TermsSignature.fetch(this._rpc, signatureStateKey, this.getProgramID());
|
|
4768
4980
|
}
|
|
4769
4981
|
/**
|
|
4770
4982
|
* Get the instruction to store the on chain owner signature of terms&conditions
|
|
@@ -4772,35 +4984,35 @@ class Kamino {
|
|
|
4772
4984
|
* @param signature
|
|
4773
4985
|
*/
|
|
4774
4986
|
async getUserTermsSignatureIx(owner, signature) {
|
|
4775
|
-
const pdaSeed = [Buffer.from('signature'), owner.
|
|
4776
|
-
const [signatureStateKey
|
|
4987
|
+
const pdaSeed = [Buffer.from('signature'), addressEncoder.encode(owner.address)];
|
|
4988
|
+
const [signatureStateKey] = await (0, kit_1.getProgramDerivedAddress)({ seeds: pdaSeed, programAddress: this.getProgramID() });
|
|
4777
4989
|
const args = {
|
|
4778
4990
|
signature: Array.from(signature),
|
|
4779
4991
|
};
|
|
4780
4992
|
const accounts = {
|
|
4781
4993
|
owner: owner,
|
|
4782
4994
|
ownerSignatureState: signatureStateKey,
|
|
4783
|
-
systemProgram:
|
|
4784
|
-
rent:
|
|
4995
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
4996
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
4785
4997
|
};
|
|
4786
|
-
return (0, instructions_2.signTerms)(args, accounts);
|
|
4998
|
+
return (0, instructions_2.signTerms)(args, accounts, this.getProgramID());
|
|
4787
4999
|
}
|
|
4788
5000
|
async getDepositRatioFromAOrca(strategy, amountA) {
|
|
4789
5001
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4790
|
-
const whirlpool = await
|
|
5002
|
+
const whirlpool = await accounts_2.Whirlpool.fetch(this._rpc, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
4791
5003
|
if (!whirlpool) {
|
|
4792
5004
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
4793
5005
|
}
|
|
4794
|
-
const position = await
|
|
5006
|
+
const position = await accounts_2.Position.fetch(this._rpc, strategyState.position, this._orcaService.getWhirlpoolProgramId());
|
|
4795
5007
|
if (!position) {
|
|
4796
5008
|
throw new Error(`Whirlpool position ${strategyState.position} does not exist`);
|
|
4797
5009
|
}
|
|
4798
5010
|
const params = {
|
|
4799
|
-
tokenMintA: strategyState.tokenAMint,
|
|
4800
|
-
tokenMintB: strategyState.tokenBMint,
|
|
5011
|
+
tokenMintA: (0, compat_2.toLegacyPublicKey)(strategyState.tokenAMint),
|
|
5012
|
+
tokenMintB: (0, compat_2.toLegacyPublicKey)(strategyState.tokenBMint),
|
|
4801
5013
|
tickCurrentIndex: whirlpool.tickCurrentIndex,
|
|
4802
5014
|
sqrtPrice: whirlpool.sqrtPrice,
|
|
4803
|
-
inputTokenMint: strategyState.tokenAMint,
|
|
5015
|
+
inputTokenMint: (0, compat_2.toLegacyPublicKey)(strategyState.tokenAMint),
|
|
4804
5016
|
inputTokenAmount: amountA,
|
|
4805
5017
|
tickLowerIndex: position.tickLowerIndex,
|
|
4806
5018
|
tickUpperIndex: position.tickUpperIndex,
|
|
@@ -4811,8 +5023,8 @@ class Kamino {
|
|
|
4811
5023
|
}
|
|
4812
5024
|
async getDepositRatioFromAMeteora(strategy) {
|
|
4813
5025
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4814
|
-
const poolStatePromise =
|
|
4815
|
-
const positionPromise =
|
|
5026
|
+
const poolStatePromise = accounts_4.LbPair.fetch(this._rpc, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
5027
|
+
const positionPromise = accounts_4.PositionV2.fetch(this._rpc, strategyState.position, this._meteoraService.getMeteoraProgramId());
|
|
4816
5028
|
const [poolState, _position] = await Promise.all([poolStatePromise, positionPromise]);
|
|
4817
5029
|
if (!poolState) {
|
|
4818
5030
|
throw Error(`Could not fetch lb pair state with pubkey ${strategyState.pool.toString()}`);
|
|
@@ -4822,8 +5034,8 @@ class Kamino {
|
|
|
4822
5034
|
async getDepositRatioFromBMeteora(strategy) {
|
|
4823
5035
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4824
5036
|
const [poolState, _position] = await Promise.all([
|
|
4825
|
-
|
|
4826
|
-
|
|
5037
|
+
accounts_4.LbPair.fetch(this._rpc, strategyState.pool, this._meteoraService.getMeteoraProgramId()),
|
|
5038
|
+
accounts_4.PositionV2.fetch(this._rpc, strategyState.position, this._meteoraService.getMeteoraProgramId()),
|
|
4827
5039
|
]);
|
|
4828
5040
|
if (!poolState) {
|
|
4829
5041
|
throw Error(`Could not fetch lb pair state with pubkey ${strategyState.pool.toString()}`);
|
|
@@ -4832,20 +5044,20 @@ class Kamino {
|
|
|
4832
5044
|
}
|
|
4833
5045
|
getDepositRatioFromBOrca = async (strategy, amountB) => {
|
|
4834
5046
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4835
|
-
const whirlpool = await
|
|
5047
|
+
const whirlpool = await accounts_2.Whirlpool.fetch(this._rpc, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
4836
5048
|
if (!whirlpool) {
|
|
4837
5049
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
4838
5050
|
}
|
|
4839
|
-
const position = await
|
|
5051
|
+
const position = await accounts_2.Position.fetch(this._rpc, strategyState.position, this._orcaService.getWhirlpoolProgramId());
|
|
4840
5052
|
if (!position) {
|
|
4841
5053
|
throw new Error(`Whirlpool position ${strategyState.position} does not exist`);
|
|
4842
5054
|
}
|
|
4843
5055
|
const params = {
|
|
4844
|
-
tokenMintA: strategyState.tokenAMint,
|
|
4845
|
-
tokenMintB: strategyState.tokenBMint,
|
|
5056
|
+
tokenMintA: (0, compat_2.toLegacyPublicKey)(strategyState.tokenAMint),
|
|
5057
|
+
tokenMintB: (0, compat_2.toLegacyPublicKey)(strategyState.tokenBMint),
|
|
4846
5058
|
tickCurrentIndex: whirlpool.tickCurrentIndex,
|
|
4847
5059
|
sqrtPrice: whirlpool.sqrtPrice,
|
|
4848
|
-
inputTokenMint: strategyState.tokenBMint,
|
|
5060
|
+
inputTokenMint: (0, compat_2.toLegacyPublicKey)(strategyState.tokenBMint),
|
|
4849
5061
|
inputTokenAmount: amountB,
|
|
4850
5062
|
tickLowerIndex: position.tickLowerIndex,
|
|
4851
5063
|
tickUpperIndex: position.tickUpperIndex,
|
|
@@ -4856,8 +5068,8 @@ class Kamino {
|
|
|
4856
5068
|
};
|
|
4857
5069
|
getDepositRatioFromARaydium = async (strategy, amountA) => {
|
|
4858
5070
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4859
|
-
const poolState = await
|
|
4860
|
-
const positionState = await
|
|
5071
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
5072
|
+
const positionState = await accounts_3.PersonalPositionState.fetch(this._rpc, strategyState.position, this._raydiumService.getRaydiumProgramId());
|
|
4861
5073
|
if (!positionState) {
|
|
4862
5074
|
throw new Error(`Raydium position ${strategyState.position.toString()} could not be found.`);
|
|
4863
5075
|
}
|
|
@@ -4872,8 +5084,8 @@ class Kamino {
|
|
|
4872
5084
|
};
|
|
4873
5085
|
getDepositRatioFromBRaydium = async (strategy, amountB) => {
|
|
4874
5086
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4875
|
-
const poolState = await
|
|
4876
|
-
const positionState = await
|
|
5087
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
5088
|
+
const positionState = await accounts_3.PersonalPositionState.fetch(this._rpc, strategyState.position, this._raydiumService.getRaydiumProgramId());
|
|
4877
5089
|
if (!positionState) {
|
|
4878
5090
|
throw new Error(`Raydium position ${strategyState.position.toString()} could not be found.`);
|
|
4879
5091
|
}
|
|
@@ -4887,20 +5099,20 @@ class Kamino {
|
|
|
4887
5099
|
return amountsSlippage;
|
|
4888
5100
|
};
|
|
4889
5101
|
getCollateralInfo = async (address) => {
|
|
4890
|
-
const collateralInfos = await accounts_1.CollateralInfos.fetch(this.
|
|
5102
|
+
const collateralInfos = await accounts_1.CollateralInfos.fetch(this._rpc, address, this.getProgramID());
|
|
4891
5103
|
if (collateralInfos === null) {
|
|
4892
5104
|
throw new Error('Could not fetch CollateralInfos');
|
|
4893
5105
|
}
|
|
4894
5106
|
return collateralInfos.infos;
|
|
4895
5107
|
};
|
|
4896
5108
|
getGlobalConfigState = async (address) => {
|
|
4897
|
-
return await accounts_1.GlobalConfig.fetch(this.
|
|
5109
|
+
return await accounts_1.GlobalConfig.fetch(this._rpc, address, this.getProgramID());
|
|
4898
5110
|
};
|
|
4899
5111
|
getWhirlpoolStrategy = async (address) => {
|
|
4900
|
-
return await accounts_1.WhirlpoolStrategy.fetch(this.
|
|
5112
|
+
return await accounts_1.WhirlpoolStrategy.fetch(this._rpc, address, this.getProgramID());
|
|
4901
5113
|
};
|
|
4902
5114
|
getWhirlpoolStrategies = async (addresses) => {
|
|
4903
|
-
return await accounts_1.WhirlpoolStrategy.fetchMultiple(this.
|
|
5115
|
+
return await accounts_1.WhirlpoolStrategy.fetchMultiple(this._rpc, addresses, this.getProgramID());
|
|
4904
5116
|
};
|
|
4905
5117
|
getStrategyVaultBalances = async (strategy) => {
|
|
4906
5118
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
@@ -4913,18 +5125,18 @@ class Kamino {
|
|
|
4913
5125
|
return { aVault, bVault };
|
|
4914
5126
|
};
|
|
4915
5127
|
getUpdateStrategyParamsIxs = async (strategyAdmin, strategy, rebalanceType, withdrawFeeBps, performanceFeeBps) => {
|
|
4916
|
-
const updateRebalanceTypeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateRebalanceType(), rebalanceType);
|
|
5128
|
+
const updateRebalanceTypeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateRebalanceType(), rebalanceType, this.getProgramID());
|
|
4917
5129
|
let updateWithdrawalFeeIx = null;
|
|
4918
5130
|
if (withdrawFeeBps) {
|
|
4919
|
-
updateWithdrawalFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateWithdrawFee(), withdrawFeeBps);
|
|
5131
|
+
updateWithdrawalFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateWithdrawFee(), withdrawFeeBps, this.getProgramID());
|
|
4920
5132
|
}
|
|
4921
5133
|
if (!performanceFeeBps) {
|
|
4922
5134
|
performanceFeeBps = DefaultStrategyConfig_1.DefaultPerformanceFeeBps;
|
|
4923
5135
|
}
|
|
4924
|
-
const updateFeesFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateCollectFeesFee(), performanceFeeBps);
|
|
4925
|
-
const updateRewards0FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward0Fee(), performanceFeeBps);
|
|
4926
|
-
const updateRewards1FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward1Fee(), performanceFeeBps);
|
|
4927
|
-
const updateRewards2FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward2Fee(), performanceFeeBps);
|
|
5136
|
+
const updateFeesFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateCollectFeesFee(), performanceFeeBps, this.getProgramID());
|
|
5137
|
+
const updateRewards0FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward0Fee(), performanceFeeBps, this.getProgramID());
|
|
5138
|
+
const updateRewards1FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward1Fee(), performanceFeeBps, this.getProgramID());
|
|
5139
|
+
const updateRewards2FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward2Fee(), performanceFeeBps, this.getProgramID());
|
|
4928
5140
|
const ixs = [updateRebalanceTypeIx, updateFeesFeeIx, updateRewards0FeeIx, updateRewards1FeeIx, updateRewards2FeeIx];
|
|
4929
5141
|
if (updateWithdrawalFeeIx) {
|
|
4930
5142
|
ixs.push(updateWithdrawalFeeIx);
|
|
@@ -4943,18 +5155,18 @@ class Kamino {
|
|
|
4943
5155
|
}
|
|
4944
5156
|
const collateralInfos = await this.getCollateralInfo(globalConfig.tokenInfos);
|
|
4945
5157
|
const result = [];
|
|
4946
|
-
if (strategyState.strategyDex.toNumber()
|
|
4947
|
-
const whirlpool = await
|
|
5158
|
+
if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
5159
|
+
const whirlpool = await accounts_2.Whirlpool.fetch(this._rpc, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
4948
5160
|
if (!whirlpool) {
|
|
4949
5161
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
4950
5162
|
}
|
|
4951
5163
|
for (let i = 0; i < 3; i++) {
|
|
4952
|
-
if (
|
|
5164
|
+
if (whirlpool.rewardInfos[i].mint !== pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
4953
5165
|
const collateralId = this.getCollateralIdFromMint(whirlpool.rewardInfos[i].mint, collateralInfos);
|
|
4954
|
-
if (collateralId
|
|
5166
|
+
if (collateralId === -1) {
|
|
4955
5167
|
throw Error(`Could not find collateral id for mint ${whirlpool.rewardInfos[i].mint.toString()}`);
|
|
4956
5168
|
}
|
|
4957
|
-
const rewardVault =
|
|
5169
|
+
const rewardVault = await (0, kit_1.generateKeyPairSigner)();
|
|
4958
5170
|
const args = {
|
|
4959
5171
|
rewardIndex: i,
|
|
4960
5172
|
collateralToken: collateralId,
|
|
@@ -4966,31 +5178,31 @@ class Kamino {
|
|
|
4966
5178
|
strategy: strategyWithAddress.address,
|
|
4967
5179
|
pool: strategyState.pool,
|
|
4968
5180
|
rewardMint: whirlpool.rewardInfos[i].mint,
|
|
4969
|
-
rewardVault: rewardVault
|
|
5181
|
+
rewardVault: rewardVault,
|
|
4970
5182
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
4971
|
-
systemProgram:
|
|
4972
|
-
rent:
|
|
5183
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
5184
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
4973
5185
|
tokenProgram,
|
|
4974
5186
|
tokenInfos: globalConfig.tokenInfos,
|
|
4975
5187
|
};
|
|
4976
|
-
const ix = (0,
|
|
5188
|
+
const ix = (0, instructions_2.updateRewardMapping)(args, accounts, this.getProgramID());
|
|
4977
5189
|
result.push([ix, rewardVault]);
|
|
4978
5190
|
}
|
|
4979
5191
|
}
|
|
4980
5192
|
return result;
|
|
4981
5193
|
}
|
|
4982
|
-
else if (strategyState.strategyDex.toNumber()
|
|
4983
|
-
const poolState = await
|
|
5194
|
+
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
5195
|
+
const poolState = await accounts_3.PoolState.fetch(this._rpc, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
4984
5196
|
if (!poolState) {
|
|
4985
5197
|
throw new Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
4986
5198
|
}
|
|
4987
5199
|
for (let i = 0; i < 3; i++) {
|
|
4988
|
-
if (
|
|
5200
|
+
if (poolState.rewardInfos[i].tokenMint !== pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
4989
5201
|
const collateralId = this.getCollateralIdFromMint(poolState.rewardInfos[i].tokenMint, collateralInfos);
|
|
4990
|
-
if (collateralId
|
|
5202
|
+
if (collateralId === -1) {
|
|
4991
5203
|
throw Error(`Could not find collateral id for mint ${poolState.rewardInfos[i].tokenMint.toString()}`);
|
|
4992
5204
|
}
|
|
4993
|
-
const rewardVault =
|
|
5205
|
+
const rewardVault = await (0, kit_1.generateKeyPairSigner)();
|
|
4994
5206
|
const args = {
|
|
4995
5207
|
rewardIndex: i,
|
|
4996
5208
|
collateralToken: collateralId,
|
|
@@ -5002,31 +5214,31 @@ class Kamino {
|
|
|
5002
5214
|
strategy: strategyWithAddress.address,
|
|
5003
5215
|
pool: strategyState.pool,
|
|
5004
5216
|
rewardMint: poolState.rewardInfos[i].tokenMint,
|
|
5005
|
-
rewardVault: rewardVault
|
|
5217
|
+
rewardVault: rewardVault,
|
|
5006
5218
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
5007
|
-
systemProgram:
|
|
5008
|
-
rent:
|
|
5219
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
5220
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
5009
5221
|
tokenProgram,
|
|
5010
5222
|
tokenInfos: globalConfig.tokenInfos,
|
|
5011
5223
|
};
|
|
5012
|
-
const ix = (0,
|
|
5224
|
+
const ix = (0, instructions_2.updateRewardMapping)(args, accounts, this.getProgramID());
|
|
5013
5225
|
result.push([ix, rewardVault]);
|
|
5014
5226
|
}
|
|
5015
5227
|
}
|
|
5016
5228
|
return result;
|
|
5017
5229
|
}
|
|
5018
|
-
else if (strategyState.strategyDex.toNumber()
|
|
5019
|
-
const poolState = await
|
|
5230
|
+
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA')) {
|
|
5231
|
+
const poolState = await accounts_4.LbPair.fetch(this._rpc, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
5020
5232
|
if (!poolState) {
|
|
5021
5233
|
throw new Error(`Could not fetch meteora state with pubkey ${strategyState.pool.toString()}`);
|
|
5022
5234
|
}
|
|
5023
5235
|
for (let i = 0; i < 2; i++) {
|
|
5024
|
-
if (
|
|
5236
|
+
if (poolState.rewardInfos[i].mint !== pubkeys_1.DEFAULT_PUBLIC_KEY) {
|
|
5025
5237
|
const collateralId = this.getCollateralIdFromMint(poolState.rewardInfos[i].mint, collateralInfos);
|
|
5026
|
-
if (collateralId
|
|
5238
|
+
if (collateralId === -1) {
|
|
5027
5239
|
throw Error(`Could not find collateral id for mint ${poolState.rewardInfos[i].mint.toString()}`);
|
|
5028
5240
|
}
|
|
5029
|
-
const rewardVault =
|
|
5241
|
+
const rewardVault = await (0, kit_1.generateKeyPairSigner)();
|
|
5030
5242
|
const args = {
|
|
5031
5243
|
rewardIndex: i,
|
|
5032
5244
|
collateralToken: collateralId,
|
|
@@ -5038,14 +5250,14 @@ class Kamino {
|
|
|
5038
5250
|
strategy: strategyWithAddress.address,
|
|
5039
5251
|
pool: strategyState.pool,
|
|
5040
5252
|
rewardMint: poolState.rewardInfos[i].mint,
|
|
5041
|
-
rewardVault: rewardVault
|
|
5253
|
+
rewardVault: rewardVault,
|
|
5042
5254
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
5043
|
-
systemProgram:
|
|
5044
|
-
rent:
|
|
5255
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
5256
|
+
rent: sysvars_1.SYSVAR_RENT_ADDRESS,
|
|
5045
5257
|
tokenProgram,
|
|
5046
5258
|
tokenInfos: globalConfig.tokenInfos,
|
|
5047
5259
|
};
|
|
5048
|
-
const ix = (0,
|
|
5260
|
+
const ix = (0, instructions_2.updateRewardMapping)(args, accounts, this.getProgramID());
|
|
5049
5261
|
result.push([ix, rewardVault]);
|
|
5050
5262
|
}
|
|
5051
5263
|
}
|
|
@@ -5064,12 +5276,12 @@ class Kamino {
|
|
|
5064
5276
|
*/
|
|
5065
5277
|
initializeTickForOrcaPool = async (payer, pool, price) => {
|
|
5066
5278
|
const { address: poolAddress, whirlpool: whilrpoolState } = await this.getWhirlpoolStateIfNotFetched(pool);
|
|
5067
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
5068
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
5279
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, whilrpoolState.tokenMintA);
|
|
5280
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, whilrpoolState.tokenMintB);
|
|
5069
5281
|
const tickIndex = (0, whirlpool_sdk_1.getNextValidTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(price, decimalsA, decimalsB), whilrpoolState.tickSpacing);
|
|
5070
5282
|
const startTickIndex = (0, whirlpool_sdk_1.getStartTickIndex)(tickIndex, whilrpoolState.tickSpacing);
|
|
5071
|
-
const [startTickIndexPk, _startTickIndexBump] = (0, utils_1.getTickArray)(this._orcaService.getWhirlpoolProgramId(), poolAddress, startTickIndex);
|
|
5072
|
-
const tick = await
|
|
5283
|
+
const [startTickIndexPk, _startTickIndexBump] = await (0, utils_1.getTickArray)(this._orcaService.getWhirlpoolProgramId(), poolAddress, startTickIndex);
|
|
5284
|
+
const tick = await accounts_2.TickArray.fetch(this._rpc, startTickIndexPk, this._orcaService.getWhirlpoolProgramId());
|
|
5073
5285
|
// initialize tick if it doesn't exist
|
|
5074
5286
|
if (!tick) {
|
|
5075
5287
|
const initTickArrayArgs = {
|
|
@@ -5079,11 +5291,11 @@ class Kamino {
|
|
|
5079
5291
|
whirlpool: poolAddress,
|
|
5080
5292
|
funder: payer,
|
|
5081
5293
|
tickArray: startTickIndexPk,
|
|
5082
|
-
systemProgram:
|
|
5294
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
5083
5295
|
};
|
|
5084
5296
|
return {
|
|
5085
5297
|
tick: startTickIndexPk,
|
|
5086
|
-
initTickIx: (0,
|
|
5298
|
+
initTickIx: (0, instructions_1.initializeTickArray)(initTickArrayArgs, initTickArrayAccounts),
|
|
5087
5299
|
};
|
|
5088
5300
|
}
|
|
5089
5301
|
return {
|
|
@@ -5093,12 +5305,12 @@ class Kamino {
|
|
|
5093
5305
|
};
|
|
5094
5306
|
initializeTickForMeteoraPool = async (payer, pool, price) => {
|
|
5095
5307
|
const { address: poolAddress, pool: poolState } = await this.getMeteoraStateIfNotFetched(pool);
|
|
5096
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
5097
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
5308
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._rpc, poolState.tokenXMint);
|
|
5309
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._rpc, poolState.tokenYMint);
|
|
5098
5310
|
const binArray = (0, meteora_1.getBinIdFromPriceWithDecimals)(price, poolState.binStep, true, decimalsA, decimalsB);
|
|
5099
5311
|
const binArrayIndex = (0, meteora_1.binIdToBinArrayIndex)(new bn_js_1.default(binArray));
|
|
5100
|
-
const [startTickIndexPk
|
|
5101
|
-
const tick = await
|
|
5312
|
+
const [startTickIndexPk] = await (0, meteora_1.deriveBinArray)(poolAddress, binArrayIndex, this._meteoraService.getMeteoraProgramId());
|
|
5313
|
+
const tick = await accounts_2.TickArray.fetch(this._rpc, startTickIndexPk, this._meteoraService.getMeteoraProgramId());
|
|
5102
5314
|
// initialize tick if it doesn't exist
|
|
5103
5315
|
if (!tick) {
|
|
5104
5316
|
const initTickArrayArgs = {
|
|
@@ -5107,7 +5319,7 @@ class Kamino {
|
|
|
5107
5319
|
const initTickArrayAccounts = {
|
|
5108
5320
|
funder: payer,
|
|
5109
5321
|
binArray: startTickIndexPk,
|
|
5110
|
-
systemProgram:
|
|
5322
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
5111
5323
|
lbPair: poolAddress,
|
|
5112
5324
|
};
|
|
5113
5325
|
return {
|
|
@@ -5120,6 +5332,20 @@ class Kamino {
|
|
|
5120
5332
|
initTickIx: undefined,
|
|
5121
5333
|
};
|
|
5122
5334
|
};
|
|
5335
|
+
getDexProgramId(strategyState) {
|
|
5336
|
+
if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA')) {
|
|
5337
|
+
return this._orcaService.getWhirlpoolProgramId();
|
|
5338
|
+
}
|
|
5339
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
5340
|
+
return this._raydiumService.getRaydiumProgramId();
|
|
5341
|
+
}
|
|
5342
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
5343
|
+
return this._meteoraService.getMeteoraProgramId();
|
|
5344
|
+
}
|
|
5345
|
+
else {
|
|
5346
|
+
throw Error(`Invalid DEX ${strategyState.strategyDex.toString()}`);
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5123
5349
|
}
|
|
5124
5350
|
exports.Kamino = Kamino;
|
|
5125
5351
|
exports.default = Kamino;
|