@kamino-finance/kliquidity-sdk 8.1.0 → 8.1.3
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/Kamino.d.ts +478 -223
- package/dist/Kamino.d.ts.map +1 -1
- package/dist/Kamino.js +1044 -1270
- 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/kamino-client/accounts/CollateralInfos.d.ts +20 -0
- package/dist/kamino-client/accounts/CollateralInfos.d.ts.map +1 -0
- package/dist/kamino-client/accounts/CollateralInfos.js +94 -0
- package/dist/kamino-client/accounts/CollateralInfos.js.map +1 -0
- package/dist/kamino-client/accounts/GlobalConfig.d.ts +89 -0
- package/dist/kamino-client/accounts/GlobalConfig.d.ts.map +1 -0
- package/dist/kamino-client/accounts/GlobalConfig.js +239 -0
- package/dist/kamino-client/accounts/GlobalConfig.js.map +1 -0
- package/dist/kamino-client/accounts/PersonalPositionState.d.ts +84 -0
- package/dist/kamino-client/accounts/PersonalPositionState.d.ts.map +1 -0
- package/dist/kamino-client/accounts/PersonalPositionState.js +175 -0
- package/dist/kamino-client/accounts/PersonalPositionState.js.map +1 -0
- package/dist/kamino-client/accounts/PoolState.d.ts +213 -0
- package/dist/kamino-client/accounts/PoolState.d.ts.map +1 -0
- package/dist/kamino-client/accounts/PoolState.js +343 -0
- package/dist/kamino-client/accounts/PoolState.js.map +1 -0
- package/dist/kamino-client/accounts/Position.d.ts +48 -0
- package/dist/kamino-client/accounts/Position.d.ts.map +1 -0
- package/dist/kamino-client/accounts/Position.js +153 -0
- package/dist/kamino-client/accounts/Position.js.map +1 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.d.ts +80 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.d.ts.map +1 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.js +168 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.js.map +1 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.d.ts +19 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.d.ts.map +1 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.js +93 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.js.map +1 -0
- package/dist/kamino-client/accounts/TermsSignature.d.ts +19 -0
- package/dist/kamino-client/accounts/TermsSignature.d.ts.map +1 -0
- package/dist/kamino-client/accounts/TermsSignature.js +93 -0
- package/dist/kamino-client/accounts/TermsSignature.js.map +1 -0
- package/dist/kamino-client/accounts/Whirlpool.d.ts +76 -0
- package/dist/kamino-client/accounts/Whirlpool.d.ts.map +1 -0
- package/dist/kamino-client/accounts/Whirlpool.js +208 -0
- package/dist/kamino-client/accounts/Whirlpool.js.map +1 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.d.ts +321 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.d.ts.map +1 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.js +703 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.js.map +1 -0
- package/dist/kamino-client/accounts/index.d.ts.map +1 -0
- package/dist/kamino-client/accounts/index.js.map +1 -0
- package/dist/kamino-client/errors/anchor.d.ts.map +1 -0
- package/dist/kamino-client/errors/anchor.js.map +1 -0
- package/dist/kamino-client/errors/custom.d.ts.map +1 -0
- package/dist/kamino-client/errors/custom.js.map +1 -0
- package/dist/kamino-client/errors/index.d.ts +6 -0
- package/dist/kamino-client/errors/index.d.ts.map +1 -0
- package/dist/kamino-client/errors/index.js +80 -0
- package/dist/kamino-client/errors/index.js.map +1 -0
- package/dist/kamino-client/idl.json +7038 -0
- package/dist/kamino-client/instructions/addKaminoRewards.d.ts +18 -0
- package/dist/kamino-client/instructions/addKaminoRewards.d.ts.map +1 -0
- package/dist/kamino-client/instructions/addKaminoRewards.js +65 -0
- package/dist/kamino-client/instructions/addKaminoRewards.js.map +1 -0
- package/dist/kamino-client/instructions/changePool.d.ts +13 -0
- package/dist/kamino-client/instructions/changePool.d.ts.map +1 -0
- package/dist/kamino-client/instructions/changePool.js +34 -0
- package/dist/kamino-client/instructions/changePool.js.map +1 -0
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.d.ts +14 -0
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.d.ts.map +1 -0
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.js +61 -0
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.js.map +1 -0
- package/dist/kamino-client/instructions/closeProgramAccount.d.ts +10 -0
- package/dist/kamino-client/instructions/closeProgramAccount.d.ts.map +1 -0
- package/dist/kamino-client/instructions/closeProgramAccount.js +19 -0
- package/dist/kamino-client/instructions/closeProgramAccount.js.map +1 -0
- package/dist/kamino-client/instructions/closeStrategy.d.ts +50 -0
- package/dist/kamino-client/instructions/closeStrategy.d.ts.map +1 -0
- package/dist/kamino-client/instructions/closeStrategy.js +79 -0
- package/dist/kamino-client/instructions/closeStrategy.js.map +1 -0
- package/dist/kamino-client/instructions/collectFeesAndRewards.d.ts +44 -0
- package/dist/kamino-client/instructions/collectFeesAndRewards.d.ts.map +1 -0
- package/dist/kamino-client/instructions/collectFeesAndRewards.js +71 -0
- package/dist/kamino-client/instructions/collectFeesAndRewards.js.map +1 -0
- package/dist/kamino-client/instructions/deposit.d.ts +34 -0
- package/dist/kamino-client/instructions/deposit.d.ts.map +1 -0
- package/dist/kamino-client/instructions/deposit.js +89 -0
- package/dist/kamino-client/instructions/deposit.js.map +1 -0
- package/dist/kamino-client/instructions/depositAndInvest.d.ts +43 -0
- package/dist/kamino-client/instructions/depositAndInvest.d.ts.map +1 -0
- package/dist/kamino-client/instructions/depositAndInvest.js +105 -0
- package/dist/kamino-client/instructions/depositAndInvest.js.map +1 -0
- package/dist/kamino-client/instructions/emergencySwap.d.ts +36 -0
- package/dist/kamino-client/instructions/emergencySwap.d.ts.map +1 -0
- package/dist/kamino-client/instructions/emergencySwap.js +80 -0
- package/dist/kamino-client/instructions/emergencySwap.js.map +1 -0
- package/dist/kamino-client/instructions/executiveWithdraw.d.ts +34 -0
- package/dist/kamino-client/instructions/executiveWithdraw.d.ts.map +1 -0
- package/dist/kamino-client/instructions/executiveWithdraw.js +87 -0
- package/dist/kamino-client/instructions/executiveWithdraw.js.map +1 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.d.ts +41 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.d.ts.map +1 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.js +93 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.js.map +1 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.d.ts +42 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.d.ts.map +1 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.js +90 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.js.map +1 -0
- package/dist/kamino-client/instructions/index.d.ts +75 -0
- package/dist/kamino-client/instructions/index.d.ts.map +1 -0
- package/dist/kamino-client/instructions/index.js +78 -0
- package/dist/kamino-client/instructions/index.js.map +1 -0
- package/dist/kamino-client/instructions/initializeCollateralInfo.d.ts +9 -0
- package/dist/kamino-client/instructions/initializeCollateralInfo.d.ts.map +1 -0
- package/dist/kamino-client/instructions/initializeCollateralInfo.js +18 -0
- package/dist/kamino-client/instructions/initializeCollateralInfo.js.map +1 -0
- package/dist/kamino-client/instructions/initializeGlobalConfig.d.ts +8 -0
- package/dist/kamino-client/instructions/initializeGlobalConfig.d.ts.map +1 -0
- package/dist/kamino-client/instructions/initializeGlobalConfig.js +17 -0
- package/dist/kamino-client/instructions/initializeGlobalConfig.js.map +1 -0
- package/dist/kamino-client/instructions/initializeKaminoReward.d.ts +21 -0
- package/dist/kamino-client/instructions/initializeKaminoReward.d.ts.map +1 -0
- package/dist/kamino-client/instructions/initializeKaminoReward.js +68 -0
- package/dist/kamino-client/instructions/initializeKaminoReward.js.map +1 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.d.ts +20 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.d.ts.map +1 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.js +73 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.js.map +1 -0
- package/dist/kamino-client/instructions/initializeStrategy.d.ts +30 -0
- package/dist/kamino-client/instructions/initializeStrategy.d.ts.map +1 -0
- package/dist/kamino-client/instructions/initializeStrategy.js +77 -0
- package/dist/kamino-client/instructions/initializeStrategy.js.map +1 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.d.ts +15 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.d.ts.map +1 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.js +62 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.js.map +1 -0
- package/dist/kamino-client/instructions/invest.d.ts +31 -0
- package/dist/kamino-client/instructions/invest.d.ts.map +1 -0
- package/dist/kamino-client/instructions/invest.js +52 -0
- package/dist/kamino-client/instructions/invest.js.map +1 -0
- package/dist/kamino-client/instructions/openLiquidityPosition.d.ts +47 -0
- package/dist/kamino-client/instructions/openLiquidityPosition.d.ts.map +1 -0
- package/dist/kamino-client/instructions/openLiquidityPosition.js +127 -0
- package/dist/kamino-client/instructions/openLiquidityPosition.js.map +1 -0
- package/dist/kamino-client/instructions/orcaSwap.d.ts +31 -0
- package/dist/kamino-client/instructions/orcaSwap.d.ts.map +1 -0
- package/dist/kamino-client/instructions/orcaSwap.js +81 -0
- package/dist/kamino-client/instructions/orcaSwap.js.map +1 -0
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.d.ts +12 -0
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.d.ts.map +1 -0
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.js +25 -0
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.js.map +1 -0
- package/dist/kamino-client/instructions/signTerms.d.ts +13 -0
- package/dist/kamino-client/instructions/signTerms.d.ts.map +1 -0
- package/dist/kamino-client/instructions/signTerms.js +58 -0
- package/dist/kamino-client/instructions/signTerms.js.map +1 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.d.ts +43 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.d.ts.map +1 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.js +105 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.js.map +1 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.d.ts +34 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.d.ts.map +1 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.js +89 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.js.map +1 -0
- package/dist/kamino-client/instructions/swapRewards.d.ts +38 -0
- package/dist/kamino-client/instructions/swapRewards.d.ts.map +1 -0
- package/dist/kamino-client/instructions/swapRewards.js +108 -0
- package/dist/kamino-client/instructions/swapRewards.js.map +1 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.d.ts +43 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.d.ts.map +1 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.js +92 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.js.map +1 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.d.ts +15 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.js +63 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.js.map +1 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.d.ts +14 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.js +63 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.js.map +1 -0
- package/dist/kamino-client/instructions/updateRewardMapping.d.ts +21 -0
- package/dist/kamino-client/instructions/updateRewardMapping.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateRewardMapping.js +69 -0
- package/dist/kamino-client/instructions/updateRewardMapping.js.map +1 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.d.ts +18 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.js +71 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.js.map +1 -0
- package/dist/kamino-client/instructions/updateStrategyAdmin.d.ts +7 -0
- package/dist/kamino-client/instructions/updateStrategyAdmin.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateStrategyAdmin.js +16 -0
- package/dist/kamino-client/instructions/updateStrategyAdmin.js.map +1 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.d.ts +15 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.js +63 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.js.map +1 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.d.ts +18 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.d.ts.map +1 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.js +67 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.js.map +1 -0
- package/dist/kamino-client/instructions/withdraw.d.ts +39 -0
- package/dist/kamino-client/instructions/withdraw.d.ts.map +1 -0
- package/dist/kamino-client/instructions/withdraw.js +99 -0
- package/dist/kamino-client/instructions/withdraw.js.map +1 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.d.ts +13 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.d.ts.map +1 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.js +57 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.js.map +1 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.d.ts +19 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.d.ts.map +1 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.js +67 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.js.map +1 -0
- package/dist/kamino-client/programId.d.ts +5 -0
- package/dist/kamino-client/programId.d.ts.map +1 -0
- package/dist/kamino-client/programId.js +13 -0
- package/dist/kamino-client/programId.js.map +1 -0
- package/dist/kamino-client/types/BalanceStatus.d.ts.map +1 -0
- package/dist/kamino-client/types/BalanceStatus.js.map +1 -0
- package/dist/kamino-client/types/BinAddLiquidityStrategy.d.ts.map +1 -0
- package/dist/kamino-client/types/BinAddLiquidityStrategy.js.map +1 -0
- package/dist/kamino-client/types/CollateralInfo.d.ts +94 -0
- package/dist/kamino-client/types/CollateralInfo.d.ts.map +1 -0
- package/dist/kamino-client/types/CollateralInfo.js +177 -0
- package/dist/kamino-client/types/CollateralInfo.js.map +1 -0
- package/dist/kamino-client/types/CollateralInfoParams.d.ts +84 -0
- package/dist/kamino-client/types/CollateralInfoParams.d.ts.map +1 -0
- package/dist/kamino-client/types/CollateralInfoParams.js +163 -0
- package/dist/kamino-client/types/CollateralInfoParams.js.map +1 -0
- package/dist/kamino-client/types/CollateralTestToken.d.ts.map +1 -0
- package/dist/kamino-client/types/CollateralTestToken.js.map +1 -0
- package/dist/kamino-client/types/CreationStatus.d.ts.map +1 -0
- package/dist/kamino-client/types/CreationStatus.js.map +1 -0
- package/dist/kamino-client/types/DEX.d.ts.map +1 -0
- package/dist/kamino-client/types/DEX.js.map +1 -0
- package/dist/kamino-client/types/DexSpecificPrice.d.ts.map +1 -0
- package/dist/kamino-client/types/DexSpecificPrice.js.map +1 -0
- package/dist/kamino-client/types/DriftDirection.d.ts.map +1 -0
- package/dist/kamino-client/types/DriftDirection.js.map +1 -0
- package/dist/kamino-client/types/ExecutiveWithdrawAction.d.ts.map +1 -0
- package/dist/kamino-client/types/ExecutiveWithdrawAction.js.map +1 -0
- package/dist/kamino-client/types/ExpanderStep.d.ts.map +1 -0
- package/dist/kamino-client/types/ExpanderStep.js.map +1 -0
- package/dist/kamino-client/types/GlobalConfigOption.d.ts.map +1 -0
- package/dist/kamino-client/types/GlobalConfigOption.js.map +1 -0
- package/dist/kamino-client/types/KaminoRewardInfo.d.ts +64 -0
- package/dist/kamino-client/types/KaminoRewardInfo.d.ts.map +1 -0
- package/dist/kamino-client/types/KaminoRewardInfo.js +135 -0
- package/dist/kamino-client/types/KaminoRewardInfo.js.map +1 -0
- package/dist/kamino-client/types/LiquidityCalculationMode.d.ts.map +1 -0
- package/dist/kamino-client/types/LiquidityCalculationMode.js.map +1 -0
- package/dist/kamino-client/types/MintingMethod.d.ts.map +1 -0
- package/dist/kamino-client/types/MintingMethod.js.map +1 -0
- package/dist/kamino-client/types/PeriodicRebalanceState.d.ts +23 -0
- package/dist/kamino-client/types/PeriodicRebalanceState.d.ts.map +1 -0
- package/dist/kamino-client/types/PeriodicRebalanceState.js.map +1 -0
- package/dist/kamino-client/types/PositionRewardInfo.d.ts +28 -0
- package/dist/kamino-client/types/PositionRewardInfo.d.ts.map +1 -0
- package/dist/kamino-client/types/PositionRewardInfo.js.map +1 -0
- package/dist/kamino-client/types/Price.d.ts +28 -0
- package/dist/kamino-client/types/Price.d.ts.map +1 -0
- package/dist/kamino-client/types/Price.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAction.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceAction.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftParams.d.ts +76 -0
- package/dist/kamino-client/types/RebalanceAutodriftParams.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftParams.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftState.d.ts +89 -0
- package/dist/kamino-client/types/RebalanceAutodriftState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftStep.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftStep.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftWindow.d.ts +55 -0
- package/dist/kamino-client/types/RebalanceAutodriftWindow.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftWindow.js.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftParams.d.ts +51 -0
- package/dist/kamino-client/types/RebalanceDriftParams.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftParams.js.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftState.d.ts +41 -0
- package/dist/kamino-client/types/RebalanceDriftState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftStep.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftStep.js.map +1 -0
- package/dist/kamino-client/types/RebalanceEffects.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceEffects.js.map +1 -0
- package/dist/kamino-client/types/RebalanceExpanderState.d.ts +28 -0
- package/dist/kamino-client/types/RebalanceExpanderState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceExpanderState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceManualState.d.ts +15 -0
- package/dist/kamino-client/types/RebalanceManualState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceManualState.js.map +1 -0
- package/dist/kamino-client/types/RebalancePricePercentageState.d.ts +28 -0
- package/dist/kamino-client/types/RebalancePricePercentageState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalancePricePercentageState.js.map +1 -0
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.d.ts +28 -0
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceRaw.d.ts +32 -0
- package/dist/kamino-client/types/RebalanceRaw.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceRaw.js.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitState.d.ts +34 -0
- package/dist/kamino-client/types/RebalanceTakeProfitState.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitStep.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitStep.js.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitToken.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitToken.js.map +1 -0
- package/dist/kamino-client/types/RebalanceType.d.ts.map +1 -0
- package/dist/kamino-client/types/RebalanceType.js.map +1 -0
- package/dist/kamino-client/types/ReferencePriceType.d.ts.map +1 -0
- package/dist/kamino-client/types/ReferencePriceType.js.map +1 -0
- package/dist/kamino-client/types/RemoveLiquidityMode.d.ts.map +1 -0
- package/dist/kamino-client/types/RemoveLiquidityMode.js.map +1 -0
- package/dist/kamino-client/types/RewardInfo.d.ts +116 -0
- package/dist/kamino-client/types/RewardInfo.d.ts.map +1 -0
- package/dist/kamino-client/types/RewardInfo.js +163 -0
- package/dist/kamino-client/types/RewardInfo.js.map +1 -0
- package/dist/kamino-client/types/ScopeConversionChain.d.ts +1 -0
- package/dist/kamino-client/types/ScopeConversionChain.d.ts.map +1 -0
- package/dist/kamino-client/types/ScopeConversionChain.js +2 -0
- package/dist/kamino-client/types/ScopeConversionChain.js.map +1 -0
- package/dist/kamino-client/types/ScopePriceIdTest.d.ts.map +1 -0
- package/dist/kamino-client/types/ScopePriceIdTest.js.map +1 -0
- package/dist/kamino-client/types/SimulationPrice.d.ts.map +1 -0
- package/dist/kamino-client/types/SimulationPrice.js.map +1 -0
- package/dist/kamino-client/types/StakingRateSource.d.ts.map +1 -0
- package/dist/kamino-client/types/StakingRateSource.js.map +1 -0
- package/dist/kamino-client/types/StrategyConfigOption.d.ts.map +1 -0
- package/dist/kamino-client/types/StrategyConfigOption.js.map +1 -0
- package/dist/kamino-client/types/StrategyStatus.d.ts.map +1 -0
- package/dist/kamino-client/types/StrategyStatus.js.map +1 -0
- package/dist/kamino-client/types/StrategyType.d.ts.map +1 -0
- package/dist/kamino-client/types/StrategyType.js.map +1 -0
- package/dist/kamino-client/types/SwapLimit.d.ts.map +1 -0
- package/dist/kamino-client/types/SwapLimit.js.map +1 -0
- package/dist/kamino-client/types/UpdateCollateralInfoMode.d.ts.map +1 -0
- package/dist/kamino-client/types/UpdateCollateralInfoMode.js.map +1 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.d.ts +68 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.d.ts.map +1 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.js +115 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.js.map +1 -0
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.d.ts.map +1 -0
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.js.map +1 -0
- package/dist/kamino-client/types/WithdrawalCaps.d.ts +38 -0
- package/dist/kamino-client/types/WithdrawalCaps.d.ts.map +1 -0
- package/dist/kamino-client/types/WithdrawalCaps.js.map +1 -0
- package/dist/kamino-client/types/index.d.ts.map +1 -0
- package/dist/kamino-client/types/index.js.map +1 -0
- package/dist/meteora_client/accounts/BinArray.d.ts +42 -0
- package/dist/meteora_client/accounts/BinArray.d.ts.map +1 -0
- package/dist/meteora_client/accounts/BinArray.js +130 -0
- package/dist/meteora_client/accounts/BinArray.js.map +1 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.d.ts +32 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.d.ts.map +1 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.js +112 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.js.map +1 -0
- package/dist/meteora_client/accounts/LbPair.d.ts +180 -0
- package/dist/meteora_client/accounts/LbPair.d.ts.map +1 -0
- package/dist/meteora_client/accounts/LbPair.js +297 -0
- package/dist/meteora_client/accounts/LbPair.js.map +1 -0
- package/dist/meteora_client/accounts/Oracle.d.ts +35 -0
- package/dist/meteora_client/accounts/Oracle.d.ts.map +1 -0
- package/dist/meteora_client/accounts/Oracle.js +112 -0
- package/dist/meteora_client/accounts/Oracle.js.map +1 -0
- package/dist/meteora_client/accounts/Position.d.ts +90 -0
- package/dist/meteora_client/accounts/Position.d.ts.map +1 -0
- package/dist/meteora_client/accounts/Position.js +177 -0
- package/dist/meteora_client/accounts/Position.js.map +1 -0
- package/dist/meteora_client/accounts/PositionV2.d.ts +114 -0
- package/dist/meteora_client/accounts/PositionV2.d.ts.map +1 -0
- package/dist/meteora_client/accounts/PositionV2.js +206 -0
- package/dist/meteora_client/accounts/PositionV2.js.map +1 -0
- package/dist/meteora_client/accounts/PresetParameter.d.ts +76 -0
- package/dist/meteora_client/accounts/PresetParameter.d.ts.map +1 -0
- package/dist/meteora_client/accounts/PresetParameter.js +157 -0
- package/dist/meteora_client/accounts/PresetParameter.js.map +1 -0
- package/dist/meteora_client/accounts/index.d.ts.map +1 -0
- package/dist/meteora_client/accounts/index.js.map +1 -0
- package/dist/meteora_client/errors/anchor.d.ts.map +1 -0
- package/dist/meteora_client/errors/anchor.js.map +1 -0
- package/dist/meteora_client/errors/custom.d.ts.map +1 -0
- package/dist/meteora_client/errors/custom.js.map +1 -0
- package/dist/meteora_client/errors/index.d.ts +6 -0
- package/dist/meteora_client/errors/index.d.ts.map +1 -0
- package/dist/meteora_client/errors/index.js +80 -0
- package/dist/meteora_client/errors/index.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidity.d.ts +26 -0
- package/dist/meteora_client/instructions/addLiquidity.d.ts.map +1 -0
- package/dist/meteora_client/instructions/addLiquidity.js +77 -0
- package/dist/meteora_client/instructions/addLiquidity.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.d.ts +26 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.d.ts.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.js +77 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.d.ts +22 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.d.ts.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.js +73 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.d.ts +26 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.d.ts.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.js +77 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.d.ts +22 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.d.ts.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.js +73 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.d.ts +22 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.d.ts.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.js +73 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.js.map +1 -0
- package/dist/meteora_client/instructions/claimFee.d.ts +19 -0
- package/dist/meteora_client/instructions/claimFee.d.ts.map +1 -0
- package/dist/meteora_client/instructions/claimFee.js +28 -0
- package/dist/meteora_client/instructions/claimFee.js.map +1 -0
- package/dist/meteora_client/instructions/claimReward.d.ts +21 -0
- package/dist/meteora_client/instructions/claimReward.d.ts.map +1 -0
- package/dist/meteora_client/instructions/claimReward.js +65 -0
- package/dist/meteora_client/instructions/claimReward.js.map +1 -0
- package/dist/meteora_client/instructions/closePosition.d.ts +13 -0
- package/dist/meteora_client/instructions/closePosition.d.ts.map +1 -0
- package/dist/meteora_client/instructions/closePosition.js +22 -0
- package/dist/meteora_client/instructions/closePosition.js.map +1 -0
- package/dist/meteora_client/instructions/closePresetParameter.d.ts +8 -0
- package/dist/meteora_client/instructions/closePresetParameter.d.ts.map +1 -0
- package/dist/meteora_client/instructions/closePresetParameter.js +17 -0
- package/dist/meteora_client/instructions/closePresetParameter.js.map +1 -0
- package/dist/meteora_client/instructions/fundReward.d.ts +21 -0
- package/dist/meteora_client/instructions/fundReward.d.ts.map +1 -0
- package/dist/meteora_client/instructions/fundReward.js +69 -0
- package/dist/meteora_client/instructions/fundReward.js.map +1 -0
- package/dist/meteora_client/instructions/goToABin.d.ts +15 -0
- package/dist/meteora_client/instructions/goToABin.d.ts.map +1 -0
- package/dist/meteora_client/instructions/goToABin.js +64 -0
- package/dist/meteora_client/instructions/goToABin.js.map +1 -0
- package/dist/meteora_client/instructions/increaseOracleLength.d.ts +15 -0
- package/dist/meteora_client/instructions/increaseOracleLength.d.ts.map +1 -0
- package/dist/meteora_client/instructions/increaseOracleLength.js +59 -0
- package/dist/meteora_client/instructions/increaseOracleLength.js.map +1 -0
- package/dist/meteora_client/instructions/index.d.ts.map +1 -0
- package/dist/meteora_client/instructions/index.js.map +1 -0
- package/dist/meteora_client/instructions/initializeBinArray.d.ts +14 -0
- package/dist/meteora_client/instructions/initializeBinArray.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializeBinArray.js +58 -0
- package/dist/meteora_client/instructions/initializeBinArray.js.map +1 -0
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.d.ts +11 -0
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.js +23 -0
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.js.map +1 -0
- package/dist/meteora_client/instructions/initializeLbPair.d.ts +24 -0
- package/dist/meteora_client/instructions/initializeLbPair.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializeLbPair.js +76 -0
- package/dist/meteora_client/instructions/initializeLbPair.js.map +1 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.d.ts +24 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.js +75 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.js.map +1 -0
- package/dist/meteora_client/instructions/initializePosition.d.ts +18 -0
- package/dist/meteora_client/instructions/initializePosition.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializePosition.js +66 -0
- package/dist/meteora_client/instructions/initializePosition.js.map +1 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.d.ts +22 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.js +71 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.js.map +1 -0
- package/dist/meteora_client/instructions/initializePositionPda.d.ts +20 -0
- package/dist/meteora_client/instructions/initializePositionPda.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializePositionPda.js +67 -0
- package/dist/meteora_client/instructions/initializePositionPda.js.map +1 -0
- package/dist/meteora_client/instructions/initializePresetParameter.d.ts +14 -0
- package/dist/meteora_client/instructions/initializePresetParameter.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializePresetParameter.js +59 -0
- package/dist/meteora_client/instructions/initializePresetParameter.js.map +1 -0
- package/dist/meteora_client/instructions/initializeReward.d.ts +21 -0
- package/dist/meteora_client/instructions/initializeReward.d.ts.map +1 -0
- package/dist/meteora_client/instructions/initializeReward.js +69 -0
- package/dist/meteora_client/instructions/initializeReward.js.map +1 -0
- package/dist/meteora_client/instructions/migrateBinArray.d.ts +6 -0
- package/dist/meteora_client/instructions/migrateBinArray.d.ts.map +1 -0
- package/dist/meteora_client/instructions/migrateBinArray.js +15 -0
- package/dist/meteora_client/instructions/migrateBinArray.js.map +1 -0
- package/dist/meteora_client/instructions/migratePosition.d.ts +15 -0
- package/dist/meteora_client/instructions/migratePosition.d.ts.map +1 -0
- package/dist/meteora_client/instructions/migratePosition.js +24 -0
- package/dist/meteora_client/instructions/migratePosition.js.map +1 -0
- package/dist/meteora_client/instructions/removeAllLiquidity.d.ts +21 -0
- package/dist/meteora_client/instructions/removeAllLiquidity.d.ts.map +1 -0
- package/dist/meteora_client/instructions/removeAllLiquidity.js +34 -0
- package/dist/meteora_client/instructions/removeAllLiquidity.js.map +1 -0
- package/dist/meteora_client/instructions/removeLiquidity.d.ts +26 -0
- package/dist/meteora_client/instructions/removeLiquidity.d.ts.map +1 -0
- package/dist/meteora_client/instructions/removeLiquidity.js +77 -0
- package/dist/meteora_client/instructions/removeLiquidity.js.map +1 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.d.ts +27 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.d.ts.map +1 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.js +80 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.js.map +1 -0
- package/dist/meteora_client/instructions/setActivationSlot.d.ts +12 -0
- package/dist/meteora_client/instructions/setActivationSlot.d.ts.map +1 -0
- package/dist/meteora_client/instructions/setActivationSlot.js +56 -0
- package/dist/meteora_client/instructions/setActivationSlot.js.map +1 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.d.ts +15 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.d.ts.map +1 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.js +59 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.js.map +1 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.d.ts +11 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.d.ts.map +1 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.js +56 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.js.map +1 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.d.ts +11 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.d.ts.map +1 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.js +58 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.js.map +1 -0
- package/dist/meteora_client/instructions/swap.d.ts +26 -0
- package/dist/meteora_client/instructions/swap.d.ts.map +1 -0
- package/dist/meteora_client/instructions/swap.js +77 -0
- package/dist/meteora_client/instructions/swap.js.map +1 -0
- package/dist/meteora_client/instructions/togglePairStatus.d.ts +7 -0
- package/dist/meteora_client/instructions/togglePairStatus.d.ts.map +1 -0
- package/dist/meteora_client/instructions/togglePairStatus.js +16 -0
- package/dist/meteora_client/instructions/togglePairStatus.js.map +1 -0
- package/dist/meteora_client/instructions/updateFeeOwner.d.ts +8 -0
- package/dist/meteora_client/instructions/updateFeeOwner.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updateFeeOwner.js +17 -0
- package/dist/meteora_client/instructions/updateFeeOwner.js.map +1 -0
- package/dist/meteora_client/instructions/updateFeeParameters.d.ts +14 -0
- package/dist/meteora_client/instructions/updateFeeParameters.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updateFeeParameters.js +59 -0
- package/dist/meteora_client/instructions/updateFeeParameters.js.map +1 -0
- package/dist/meteora_client/instructions/updateFeesAndRewards.d.ts +10 -0
- package/dist/meteora_client/instructions/updateFeesAndRewards.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updateFeesAndRewards.js +19 -0
- package/dist/meteora_client/instructions/updateFeesAndRewards.js.map +1 -0
- package/dist/meteora_client/instructions/updatePositionOperator.d.ts +13 -0
- package/dist/meteora_client/instructions/updatePositionOperator.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updatePositionOperator.js +58 -0
- package/dist/meteora_client/instructions/updatePositionOperator.js.map +1 -0
- package/dist/meteora_client/instructions/updateRewardDuration.d.ts +16 -0
- package/dist/meteora_client/instructions/updateRewardDuration.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updateRewardDuration.js +63 -0
- package/dist/meteora_client/instructions/updateRewardDuration.js.map +1 -0
- package/dist/meteora_client/instructions/updateRewardFunder.d.ts +15 -0
- package/dist/meteora_client/instructions/updateRewardFunder.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updateRewardFunder.js +62 -0
- package/dist/meteora_client/instructions/updateRewardFunder.js.map +1 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.d.ts +11 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.d.ts.map +1 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.js +56 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.js.map +1 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.d.ts +19 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.d.ts.map +1 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.js +63 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.js.map +1 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.d.ts +20 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.d.ts.map +1 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.js +64 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.js.map +1 -0
- package/dist/meteora_client/programId.d.ts +6 -0
- package/dist/meteora_client/programId.d.ts.map +1 -0
- package/dist/meteora_client/programId.js +15 -0
- package/dist/meteora_client/programId.js.map +1 -0
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.d.ts +34 -0
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.d.ts.map +1 -0
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.js.map +1 -0
- package/dist/meteora_client/types/Bin.d.ts +90 -0
- package/dist/meteora_client/types/Bin.d.ts.map +1 -0
- package/dist/meteora_client/types/Bin.js.map +1 -0
- package/dist/meteora_client/types/BinLiquidityDistribution.d.ts +41 -0
- package/dist/meteora_client/types/BinLiquidityDistribution.d.ts.map +1 -0
- package/dist/meteora_client/types/BinLiquidityDistribution.js.map +1 -0
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.d.ts +33 -0
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.d.ts.map +1 -0
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.js.map +1 -0
- package/dist/meteora_client/types/BinLiquidityReduction.d.ts +27 -0
- package/dist/meteora_client/types/BinLiquidityReduction.d.ts.map +1 -0
- package/dist/meteora_client/types/BinLiquidityReduction.js.map +1 -0
- package/dist/meteora_client/types/CompressedBinDepositAmount.d.ts +27 -0
- package/dist/meteora_client/types/CompressedBinDepositAmount.d.ts.map +1 -0
- package/dist/meteora_client/types/CompressedBinDepositAmount.js.map +1 -0
- package/dist/meteora_client/types/FeeInfo.d.ts +38 -0
- package/dist/meteora_client/types/FeeInfo.d.ts.map +1 -0
- package/dist/meteora_client/types/FeeInfo.js.map +1 -0
- package/dist/meteora_client/types/FeeParameter.d.ts +33 -0
- package/dist/meteora_client/types/FeeParameter.d.ts.map +1 -0
- package/dist/meteora_client/types/FeeParameter.js.map +1 -0
- package/dist/meteora_client/types/InitPermissionPairIx.d.ts +48 -0
- package/dist/meteora_client/types/InitPermissionPairIx.d.ts.map +1 -0
- package/dist/meteora_client/types/InitPermissionPairIx.js.map +1 -0
- package/dist/meteora_client/types/InitPresetParametersIx.d.ts +97 -0
- package/dist/meteora_client/types/InitPresetParametersIx.d.ts.map +1 -0
- package/dist/meteora_client/types/InitPresetParametersIx.js.map +1 -0
- package/dist/meteora_client/types/LayoutVersion.d.ts.map +1 -0
- package/dist/meteora_client/types/LayoutVersion.js.map +1 -0
- package/dist/meteora_client/types/LiquidityOneSideParameter.d.ts +56 -0
- package/dist/meteora_client/types/LiquidityOneSideParameter.d.ts.map +1 -0
- package/dist/meteora_client/types/LiquidityOneSideParameter.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameter.d.ts +50 -0
- package/dist/meteora_client/types/LiquidityParameter.d.ts.map +1 -0
- package/dist/meteora_client/types/LiquidityParameter.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategy.d.ts +104 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategy.d.ts.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategy.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.d.ts +96 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.d.ts.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByWeight.d.ts +64 -0
- package/dist/meteora_client/types/LiquidityParameterByWeight.d.ts.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByWeight.js.map +1 -0
- package/dist/meteora_client/types/Observation.d.ts +42 -0
- package/dist/meteora_client/types/Observation.d.ts.map +1 -0
- package/dist/meteora_client/types/Observation.js.map +1 -0
- package/dist/meteora_client/types/PairStatus.d.ts.map +1 -0
- package/dist/meteora_client/types/PairStatus.js.map +1 -0
- package/dist/meteora_client/types/PairType.d.ts.map +1 -0
- package/dist/meteora_client/types/PairType.js.map +1 -0
- package/dist/meteora_client/types/ProtocolFee.d.ts +28 -0
- package/dist/meteora_client/types/ProtocolFee.d.ts.map +1 -0
- package/dist/meteora_client/types/ProtocolFee.js.map +1 -0
- package/dist/meteora_client/types/RewardInfo.d.ts +84 -0
- package/dist/meteora_client/types/RewardInfo.d.ts.map +1 -0
- package/dist/meteora_client/types/RewardInfo.js +138 -0
- package/dist/meteora_client/types/RewardInfo.js.map +1 -0
- package/dist/meteora_client/types/Rounding.d.ts.map +1 -0
- package/dist/meteora_client/types/Rounding.js.map +1 -0
- package/dist/meteora_client/types/StaticParameters.d.ts +98 -0
- package/dist/meteora_client/types/StaticParameters.d.ts.map +1 -0
- package/dist/meteora_client/types/StaticParameters.js.map +1 -0
- package/dist/meteora_client/types/StrategyParameters.d.ts +85 -0
- package/dist/meteora_client/types/StrategyParameters.d.ts.map +1 -0
- package/dist/meteora_client/types/StrategyParameters.js.map +1 -0
- package/dist/meteora_client/types/StrategyType.d.ts.map +1 -0
- package/dist/meteora_client/types/StrategyType.js.map +1 -0
- package/dist/meteora_client/types/UserRewardInfo.d.ts +28 -0
- package/dist/meteora_client/types/UserRewardInfo.d.ts.map +1 -0
- package/dist/meteora_client/types/UserRewardInfo.js.map +1 -0
- package/dist/meteora_client/types/VariableParameters.d.ts +76 -0
- package/dist/meteora_client/types/VariableParameters.d.ts.map +1 -0
- package/dist/meteora_client/types/VariableParameters.js.map +1 -0
- package/dist/meteora_client/types/index.d.ts.map +1 -0
- package/dist/meteora_client/types/index.js.map +1 -0
- 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 +4 -5
- 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/raydium_client/accounts/AmmConfig.d.ts +47 -0
- package/dist/raydium_client/accounts/AmmConfig.d.ts.map +1 -0
- package/dist/raydium_client/accounts/AmmConfig.js +152 -0
- package/dist/raydium_client/accounts/AmmConfig.js.map +1 -0
- package/dist/raydium_client/accounts/ObservationState.d.ts +30 -0
- package/dist/raydium_client/accounts/ObservationState.d.ts.map +1 -0
- package/dist/raydium_client/accounts/ObservationState.js +117 -0
- package/dist/raydium_client/accounts/ObservationState.js.map +1 -0
- package/dist/raydium_client/accounts/OperationState.d.ts +25 -0
- package/dist/raydium_client/accounts/OperationState.d.ts.map +1 -0
- package/dist/raydium_client/accounts/OperationState.js +106 -0
- package/dist/raydium_client/accounts/OperationState.js.map +1 -0
- package/dist/raydium_client/accounts/PersonalPositionState.d.ts +54 -0
- package/dist/raydium_client/accounts/PersonalPositionState.d.ts.map +1 -0
- package/dist/raydium_client/accounts/PersonalPositionState.js +165 -0
- package/dist/raydium_client/accounts/PersonalPositionState.js.map +1 -0
- package/dist/raydium_client/accounts/PoolState.d.ts +129 -0
- package/dist/raydium_client/accounts/PoolState.d.ts.map +1 -0
- package/dist/raydium_client/accounts/PoolState.js +315 -0
- package/dist/raydium_client/accounts/PoolState.js.map +1 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.d.ts +50 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.d.ts.map +1 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.js +158 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.js.map +1 -0
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.d.ts +26 -0
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.d.ts.map +1 -0
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.js +110 -0
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.js.map +1 -0
- package/dist/raydium_client/accounts/TickArrayState.d.ts +32 -0
- package/dist/raydium_client/accounts/TickArrayState.d.ts.map +1 -0
- package/dist/raydium_client/accounts/TickArrayState.js +119 -0
- package/dist/raydium_client/accounts/TickArrayState.js.map +1 -0
- package/dist/raydium_client/accounts/index.d.ts.map +1 -0
- package/dist/raydium_client/accounts/index.js.map +1 -0
- package/dist/raydium_client/errors/anchor.d.ts.map +1 -0
- package/dist/raydium_client/errors/anchor.js.map +1 -0
- package/dist/raydium_client/errors/custom.d.ts.map +1 -0
- package/dist/raydium_client/errors/custom.js.map +1 -0
- package/dist/raydium_client/errors/index.d.ts +6 -0
- package/dist/raydium_client/errors/index.d.ts.map +1 -0
- package/dist/raydium_client/errors/index.js +80 -0
- package/dist/raydium_client/errors/index.js.map +1 -0
- package/dist/raydium_client/index.d.ts +5 -0
- package/dist/raydium_client/index.d.ts.map +1 -0
- package/dist/raydium_client/index.js +21 -0
- package/dist/raydium_client/index.js.map +1 -0
- package/dist/raydium_client/instructions/closePosition.d.ts +11 -0
- package/dist/raydium_client/instructions/closePosition.d.ts.map +1 -0
- package/dist/raydium_client/instructions/closePosition.js +20 -0
- package/dist/raydium_client/instructions/closePosition.js.map +1 -0
- package/dist/raydium_client/instructions/collectFundFee.d.ts +22 -0
- package/dist/raydium_client/instructions/collectFundFee.d.ts.map +1 -0
- package/dist/raydium_client/instructions/collectFundFee.js +77 -0
- package/dist/raydium_client/instructions/collectFundFee.js.map +1 -0
- package/dist/raydium_client/instructions/collectProtocolFee.d.ts +22 -0
- package/dist/raydium_client/instructions/collectProtocolFee.d.ts.map +1 -0
- package/dist/raydium_client/instructions/collectProtocolFee.js +77 -0
- package/dist/raydium_client/instructions/collectProtocolFee.js.map +1 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.d.ts +17 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.d.ts.map +1 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.js +62 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.js.map +1 -0
- package/dist/raydium_client/instructions/createAmmConfig.d.ts +16 -0
- package/dist/raydium_client/instructions/createAmmConfig.d.ts.map +1 -0
- package/dist/raydium_client/instructions/createAmmConfig.js +67 -0
- package/dist/raydium_client/instructions/createAmmConfig.js.map +1 -0
- package/dist/raydium_client/instructions/createOperationAccount.d.ts +8 -0
- package/dist/raydium_client/instructions/createOperationAccount.d.ts.map +1 -0
- package/dist/raydium_client/instructions/createOperationAccount.js +17 -0
- package/dist/raydium_client/instructions/createOperationAccount.js.map +1 -0
- package/dist/raydium_client/instructions/createPool.d.ts +24 -0
- package/dist/raydium_client/instructions/createPool.d.ts.map +1 -0
- package/dist/raydium_client/instructions/createPool.js +71 -0
- package/dist/raydium_client/instructions/createPool.js.map +1 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.d.ts +24 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.d.ts.map +1 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.js +80 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.js.map +1 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.d.ts +28 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.d.ts.map +1 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.js +84 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.js.map +1 -0
- package/dist/raydium_client/instructions/increaseLiquidity.d.ts +24 -0
- package/dist/raydium_client/instructions/increaseLiquidity.d.ts.map +1 -0
- package/dist/raydium_client/instructions/increaseLiquidity.js +72 -0
- package/dist/raydium_client/instructions/increaseLiquidity.js.map +1 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.d.ts +28 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.d.ts.map +1 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.js +77 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.js.map +1 -0
- package/dist/raydium_client/instructions/index.d.ts.map +1 -0
- package/dist/raydium_client/instructions/index.js.map +1 -0
- package/dist/raydium_client/instructions/initializeReward.d.ts +20 -0
- package/dist/raydium_client/instructions/initializeReward.d.ts.map +1 -0
- package/dist/raydium_client/instructions/initializeReward.js +67 -0
- package/dist/raydium_client/instructions/initializeReward.js.map +1 -0
- package/dist/raydium_client/instructions/openPosition.d.ts +35 -0
- package/dist/raydium_client/instructions/openPosition.d.ts.map +1 -0
- package/dist/raydium_client/instructions/openPosition.js +91 -0
- package/dist/raydium_client/instructions/openPosition.js.map +1 -0
- package/dist/raydium_client/instructions/openPositionV2.d.ts +40 -0
- package/dist/raydium_client/instructions/openPositionV2.d.ts.map +1 -0
- package/dist/raydium_client/instructions/openPositionV2.js +98 -0
- package/dist/raydium_client/instructions/openPositionV2.js.map +1 -0
- package/dist/raydium_client/instructions/setRewardParams.d.ts +19 -0
- package/dist/raydium_client/instructions/setRewardParams.d.ts.map +1 -0
- package/dist/raydium_client/instructions/setRewardParams.js +68 -0
- package/dist/raydium_client/instructions/setRewardParams.js.map +1 -0
- package/dist/raydium_client/instructions/swap.d.ts +23 -0
- package/dist/raydium_client/instructions/swap.d.ts.map +1 -0
- package/dist/raydium_client/instructions/swap.js +72 -0
- package/dist/raydium_client/instructions/swap.js.map +1 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.d.ts +17 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.d.ts.map +1 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.js +64 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.js.map +1 -0
- package/dist/raydium_client/instructions/swapV2.d.ts +26 -0
- package/dist/raydium_client/instructions/swapV2.d.ts.map +1 -0
- package/dist/raydium_client/instructions/swapV2.js +75 -0
- package/dist/raydium_client/instructions/swapV2.js.map +1 -0
- package/dist/raydium_client/instructions/transferRewardOwner.d.ts +11 -0
- package/dist/raydium_client/instructions/transferRewardOwner.d.ts.map +1 -0
- package/dist/raydium_client/instructions/transferRewardOwner.js +56 -0
- package/dist/raydium_client/instructions/transferRewardOwner.js.map +1 -0
- package/dist/raydium_client/instructions/updateAmmConfig.d.ts +12 -0
- package/dist/raydium_client/instructions/updateAmmConfig.d.ts.map +1 -0
- package/dist/raydium_client/instructions/updateAmmConfig.js +57 -0
- package/dist/raydium_client/instructions/updateAmmConfig.js.map +1 -0
- package/dist/raydium_client/instructions/updateOperationAccount.d.ts +13 -0
- package/dist/raydium_client/instructions/updateOperationAccount.d.ts.map +1 -0
- package/dist/raydium_client/instructions/updateOperationAccount.js +61 -0
- package/dist/raydium_client/instructions/updateOperationAccount.js.map +1 -0
- package/dist/raydium_client/instructions/updatePoolStatus.d.ts +11 -0
- package/dist/raydium_client/instructions/updatePoolStatus.d.ts.map +1 -0
- package/dist/raydium_client/instructions/updatePoolStatus.js +56 -0
- package/dist/raydium_client/instructions/updatePoolStatus.js.map +1 -0
- package/dist/raydium_client/instructions/updateRewardInfos.d.ts +6 -0
- package/dist/raydium_client/instructions/updateRewardInfos.d.ts.map +1 -0
- package/dist/raydium_client/instructions/updateRewardInfos.js +15 -0
- package/dist/raydium_client/instructions/updateRewardInfos.js.map +1 -0
- package/dist/raydium_client/programId.d.ts +6 -0
- package/dist/raydium_client/programId.d.ts.map +1 -0
- package/dist/raydium_client/programId.js +15 -0
- package/dist/raydium_client/programId.js.map +1 -0
- package/dist/raydium_client/types/InitializeRewardParam.d.ts +33 -0
- package/dist/raydium_client/types/InitializeRewardParam.d.ts.map +1 -0
- package/dist/raydium_client/types/InitializeRewardParam.js.map +1 -0
- package/dist/raydium_client/types/Observation.d.ts +38 -0
- package/dist/raydium_client/types/Observation.d.ts.map +1 -0
- package/dist/raydium_client/types/Observation.js.map +1 -0
- package/dist/raydium_client/types/PoolStatusBitFlag.d.ts.map +1 -0
- package/dist/raydium_client/types/PoolStatusBitFlag.js.map +1 -0
- package/dist/raydium_client/types/PoolStatusBitIndex.d.ts.map +1 -0
- package/dist/raydium_client/types/PoolStatusBitIndex.js.map +1 -0
- package/dist/raydium_client/types/PositionRewardInfo.d.ts +28 -0
- package/dist/raydium_client/types/PositionRewardInfo.d.ts.map +1 -0
- package/dist/raydium_client/types/PositionRewardInfo.js.map +1 -0
- package/dist/raydium_client/types/RewardInfo.d.ts +74 -0
- package/dist/raydium_client/types/RewardInfo.d.ts.map +1 -0
- package/dist/raydium_client/types/RewardInfo.js +149 -0
- package/dist/raydium_client/types/RewardInfo.js.map +1 -0
- package/dist/raydium_client/types/RewardState.d.ts.map +1 -0
- package/dist/raydium_client/types/RewardState.js.map +1 -0
- package/dist/raydium_client/types/TickArryBitmap.d.ts +1 -0
- package/dist/raydium_client/types/TickArryBitmap.d.ts.map +1 -0
- package/dist/raydium_client/types/TickArryBitmap.js +2 -0
- package/dist/raydium_client/types/TickArryBitmap.js.map +1 -0
- package/dist/raydium_client/types/TickState.d.ts +53 -0
- package/dist/raydium_client/types/TickState.d.ts.map +1 -0
- package/dist/raydium_client/types/TickState.js.map +1 -0
- package/dist/raydium_client/types/index.d.ts.map +1 -0
- package/dist/raydium_client/types/index.js.map +1 -0
- 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 +19 -24
- package/dist/services/JupService.d.ts.map +1 -1
- package/dist/services/JupService.js +59 -58
- 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 +25 -30
- package/dist/services/MeteoraService.js.map +1 -1
- package/dist/services/OrcaService.d.ts +12 -14
- package/dist/services/OrcaService.d.ts.map +1 -1
- package/dist/services/OrcaService.js +24 -28
- 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 +10 -12
- package/dist/services/RaydiumService.d.ts.map +1 -1
- package/dist/services/RaydiumService.js +17 -20
- 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/anchorUtils.d.ts +6 -0
- package/dist/utils/anchorUtils.d.ts.map +1 -0
- package/dist/utils/anchorUtils.js +18 -0
- package/dist/utils/anchorUtils.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/instructions.d.ts +7 -0
- package/dist/utils/instructions.d.ts.map +1 -0
- package/dist/utils/instructions.js +40 -0
- package/dist/utils/instructions.js.map +1 -0
- package/dist/utils/lookupTable.d.ts +3 -5
- package/dist/utils/lookupTable.d.ts.map +1 -1
- package/dist/utils/lookupTable.js +28 -55
- package/dist/utils/lookupTable.js.map +1 -1
- package/dist/utils/meteora.d.ts +5 -6
- package/dist/utils/meteora.d.ts.map +1 -1
- package/dist/utils/meteora.js +3 -8
- package/dist/utils/meteora.js.map +1 -1
- package/dist/utils/orca.d.ts +2 -3
- package/dist/utils/orca.d.ts.map +1 -1
- package/dist/utils/orca.js +3 -7
- package/dist/utils/orca.js.map +1 -1
- package/dist/utils/pubkey.d.ts +66 -0
- package/dist/utils/pubkey.d.ts.map +1 -0
- package/dist/utils/pubkey.js +216 -0
- package/dist/utils/pubkey.js.map +1 -0
- package/dist/utils/tokenUtils.d.ts +16 -11
- package/dist/utils/tokenUtils.d.ts.map +1 -1
- package/dist/utils/tokenUtils.js +87 -38
- package/dist/utils/tokenUtils.js.map +1 -1
- package/dist/utils/transactions.d.ts +9 -8
- package/dist/utils/transactions.d.ts.map +1 -1
- package/dist/utils/transactions.js +47 -36
- 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 +8 -6
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +28 -11
- package/dist/utils/utils.js.map +1 -1
- package/dist/whirlpools-client/accounts/FeeTier.d.ts +25 -0
- package/dist/whirlpools-client/accounts/FeeTier.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/FeeTier.js +106 -0
- package/dist/whirlpools-client/accounts/FeeTier.js.map +1 -0
- package/dist/whirlpools-client/accounts/Position.d.ts +48 -0
- package/dist/whirlpools-client/accounts/Position.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/Position.js +153 -0
- package/dist/whirlpools-client/accounts/Position.js.map +1 -0
- package/dist/whirlpools-client/accounts/PositionBundle.d.ts +22 -0
- package/dist/whirlpools-client/accounts/PositionBundle.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/PositionBundle.js +100 -0
- package/dist/whirlpools-client/accounts/PositionBundle.js.map +1 -0
- package/dist/whirlpools-client/accounts/TickArray.d.ts +26 -0
- package/dist/whirlpools-client/accounts/TickArray.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/TickArray.js +107 -0
- package/dist/whirlpools-client/accounts/TickArray.js.map +1 -0
- package/dist/whirlpools-client/accounts/TokenBadge.d.ts +22 -0
- package/dist/whirlpools-client/accounts/TokenBadge.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/TokenBadge.js +100 -0
- package/dist/whirlpools-client/accounts/TokenBadge.js.map +1 -0
- package/dist/whirlpools-client/accounts/Whirlpool.d.ts +75 -0
- package/dist/whirlpools-client/accounts/Whirlpool.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/Whirlpool.js +207 -0
- package/dist/whirlpools-client/accounts/Whirlpool.js.map +1 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.d.ts +28 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.js +112 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.js.map +1 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.d.ts +25 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.js +106 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.js.map +1 -0
- package/dist/whirlpools-client/accounts/index.d.ts.map +1 -0
- package/dist/whirlpools-client/accounts/index.js.map +1 -0
- package/dist/whirlpools-client/errors/anchor.d.ts.map +1 -0
- package/dist/whirlpools-client/errors/anchor.js.map +1 -0
- package/dist/whirlpools-client/errors/custom.d.ts.map +1 -0
- package/dist/whirlpools-client/errors/custom.js.map +1 -0
- package/dist/whirlpools-client/errors/index.d.ts +6 -0
- package/dist/whirlpools-client/errors/index.d.ts.map +1 -0
- package/dist/whirlpools-client/errors/index.js +80 -0
- package/dist/whirlpools-client/errors/index.js.map +1 -0
- package/dist/whirlpools-client/index.d.ts +5 -0
- package/dist/whirlpools-client/index.d.ts.map +1 -0
- package/dist/whirlpools-client/index.js +21 -0
- package/dist/whirlpools-client/index.js.map +1 -0
- package/dist/whirlpools-client/instructions/closeBundledPosition.d.ts +14 -0
- package/dist/whirlpools-client/instructions/closeBundledPosition.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/closeBundledPosition.js +67 -0
- package/dist/whirlpools-client/instructions/closeBundledPosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/closePosition.d.ts +11 -0
- package/dist/whirlpools-client/instructions/closePosition.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/closePosition.js +24 -0
- package/dist/whirlpools-client/instructions/closePosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectFees.d.ts +14 -0
- package/dist/whirlpools-client/instructions/collectFees.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/collectFees.js +27 -0
- package/dist/whirlpools-client/instructions/collectFees.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectFeesV2.d.ts +23 -0
- package/dist/whirlpools-client/instructions/collectFeesV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/collectFeesV2.js +76 -0
- package/dist/whirlpools-client/instructions/collectFeesV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectProtocolFees.d.ts +13 -0
- package/dist/whirlpools-client/instructions/collectProtocolFees.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/collectProtocolFees.js +26 -0
- package/dist/whirlpools-client/instructions/collectProtocolFees.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.d.ts +22 -0
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.js +75 -0
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectReward.d.ts +16 -0
- package/dist/whirlpools-client/instructions/collectReward.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/collectReward.js +65 -0
- package/dist/whirlpools-client/instructions/collectReward.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.d.ts +20 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.js +74 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.d.ts +23 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.js +75 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.js.map +1 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.d.ts +29 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.js +84 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/deletePositionBundle.d.ts +11 -0
- package/dist/whirlpools-client/instructions/deletePositionBundle.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/deletePositionBundle.js +24 -0
- package/dist/whirlpools-client/instructions/deletePositionBundle.js.map +1 -0
- package/dist/whirlpools-client/instructions/deleteTokenBadge.d.ts +11 -0
- package/dist/whirlpools-client/instructions/deleteTokenBadge.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/deleteTokenBadge.js +24 -0
- package/dist/whirlpools-client/instructions/deleteTokenBadge.js.map +1 -0
- package/dist/whirlpools-client/instructions/increaseLiquidity.d.ts +23 -0
- package/dist/whirlpools-client/instructions/increaseLiquidity.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/increaseLiquidity.js +75 -0
- package/dist/whirlpools-client/instructions/increaseLiquidity.js.map +1 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.d.ts +29 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.js +84 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/index.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/index.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeConfig.d.ts +15 -0
- package/dist/whirlpools-client/instructions/initializeConfig.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeConfig.js +65 -0
- package/dist/whirlpools-client/instructions/initializeConfig.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeConfigExtension.d.ts +10 -0
- package/dist/whirlpools-client/instructions/initializeConfigExtension.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeConfigExtension.js +19 -0
- package/dist/whirlpools-client/instructions/initializeConfigExtension.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeFeeTier.d.ts +15 -0
- package/dist/whirlpools-client/instructions/initializeFeeTier.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeFeeTier.js +63 -0
- package/dist/whirlpools-client/instructions/initializeFeeTier.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePool.d.ts +24 -0
- package/dist/whirlpools-client/instructions/initializePool.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializePool.js +72 -0
- package/dist/whirlpools-client/instructions/initializePool.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.d.ts +25 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.js +72 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePositionBundle.d.ts +14 -0
- package/dist/whirlpools-client/instructions/initializePositionBundle.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializePositionBundle.js +35 -0
- package/dist/whirlpools-client/instructions/initializePositionBundle.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.d.ts +17 -0
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.js +42 -0
- package/dist/whirlpools-client/instructions/initializePositionBundleWithMetadata.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeReward.d.ts +17 -0
- package/dist/whirlpools-client/instructions/initializeReward.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeReward.js +62 -0
- package/dist/whirlpools-client/instructions/initializeReward.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.d.ts +18 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.js +63 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.d.ts +13 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.js +58 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeTokenBadge.d.ts +12 -0
- package/dist/whirlpools-client/instructions/initializeTokenBadge.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/initializeTokenBadge.js +25 -0
- package/dist/whirlpools-client/instructions/initializeTokenBadge.js.map +1 -0
- package/dist/whirlpools-client/instructions/openBundledPosition.d.ts +19 -0
- package/dist/whirlpools-client/instructions/openBundledPosition.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/openBundledPosition.js +76 -0
- package/dist/whirlpools-client/instructions/openBundledPosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/openPosition.d.ts +22 -0
- package/dist/whirlpools-client/instructions/openPosition.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/openPosition.js +79 -0
- package/dist/whirlpools-client/instructions/openPosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.d.ts +25 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.js +86 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.js.map +1 -0
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.d.ts +8 -0
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.js +25 -0
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.d.ts +9 -0
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.js +30 -0
- package/dist/whirlpools-client/instructions/setConfigExtensionAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.d.ts +12 -0
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.js +57 -0
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.d.ts +11 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.js +56 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setFeeAuthority.d.ts +8 -0
- package/dist/whirlpools-client/instructions/setFeeAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setFeeAuthority.js +17 -0
- package/dist/whirlpools-client/instructions/setFeeAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setFeeRate.d.ts +12 -0
- package/dist/whirlpools-client/instructions/setFeeRate.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setFeeRate.js +57 -0
- package/dist/whirlpools-client/instructions/setFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.d.ts +12 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.js +57 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.d.ts +12 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.js +57 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.d.ts +13 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.js +62 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.d.ts +14 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.js +61 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.d.ts +8 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.js +25 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.d.ts +14 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.js +61 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.d.ts +9 -0
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.js +30 -0
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/swap.d.ts +25 -0
- package/dist/whirlpools-client/instructions/swap.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/swap.js +75 -0
- package/dist/whirlpools-client/instructions/swap.js.map +1 -0
- package/dist/whirlpools-client/instructions/swapV2.d.ts +31 -0
- package/dist/whirlpools-client/instructions/swapV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/swapV2.js +84 -0
- package/dist/whirlpools-client/instructions/swapV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.d.ts +36 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.js +104 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.js.map +1 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.d.ts +42 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.js +121 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.d.ts +9 -0
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.d.ts.map +1 -0
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.js +18 -0
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.js.map +1 -0
- package/dist/whirlpools-client/programId.d.ts +6 -0
- package/dist/whirlpools-client/programId.d.ts.map +1 -0
- package/dist/whirlpools-client/programId.js +15 -0
- package/dist/whirlpools-client/programId.js.map +1 -0
- package/dist/whirlpools-client/shim/remove-liquidity.d.ts +14 -0
- package/dist/whirlpools-client/shim/remove-liquidity.d.ts.map +1 -0
- package/dist/whirlpools-client/shim/remove-liquidity.js +72 -0
- package/dist/whirlpools-client/shim/remove-liquidity.js.map +1 -0
- package/dist/whirlpools-client/types/AccountsType.d.ts.map +1 -0
- package/dist/whirlpools-client/types/AccountsType.js.map +1 -0
- package/dist/whirlpools-client/types/CurrIndex.d.ts.map +1 -0
- package/dist/whirlpools-client/types/CurrIndex.js.map +1 -0
- package/dist/whirlpools-client/types/Direction.d.ts.map +1 -0
- package/dist/whirlpools-client/types/Direction.js.map +1 -0
- package/dist/whirlpools-client/types/OpenPositionBumps.d.ts +22 -0
- package/dist/whirlpools-client/types/OpenPositionBumps.d.ts.map +1 -0
- package/dist/whirlpools-client/types/OpenPositionBumps.js.map +1 -0
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.d.ts +27 -0
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.d.ts.map +1 -0
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.js.map +1 -0
- package/dist/whirlpools-client/types/PositionRewardInfo.d.ts +28 -0
- package/dist/whirlpools-client/types/PositionRewardInfo.d.ts.map +1 -0
- package/dist/whirlpools-client/types/PositionRewardInfo.js.map +1 -0
- package/dist/whirlpools-client/types/RemainingAccountsInfo.d.ts +52 -0
- package/dist/whirlpools-client/types/RemainingAccountsInfo.d.ts.map +1 -0
- package/dist/whirlpools-client/types/RemainingAccountsInfo.js.map +1 -0
- package/dist/whirlpools-client/types/RemainingAccountsSlice.d.ts +51 -0
- package/dist/whirlpools-client/types/RemainingAccountsSlice.d.ts.map +1 -0
- package/dist/whirlpools-client/types/RemainingAccountsSlice.js.map +1 -0
- package/dist/whirlpools-client/types/Tick.d.ts +48 -0
- package/dist/whirlpools-client/types/Tick.d.ts.map +1 -0
- package/dist/whirlpools-client/types/Tick.js.map +1 -0
- package/dist/whirlpools-client/types/TickLabel.d.ts.map +1 -0
- package/dist/whirlpools-client/types/TickLabel.js.map +1 -0
- package/dist/whirlpools-client/types/WhirlpoolBumps.d.ts +22 -0
- package/dist/whirlpools-client/types/WhirlpoolBumps.d.ts.map +1 -0
- package/dist/whirlpools-client/types/WhirlpoolBumps.js.map +1 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.d.ts +44 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.d.ts.map +1 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.js +107 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.js.map +1 -0
- package/dist/whirlpools-client/types/index.d.ts.map +1 -0
- package/dist/whirlpools-client/types/index.js.map +1 -0
- package/package.json +16 -25
- package/src/Kamino.ts +1714 -1791
- package/src/constants/deposit_method.ts +1 -1
- package/src/constants/metadata.ts +3 -3
- package/src/constants/pubkeys.ts +10 -10
- package/src/kamino-client/accounts/CollateralInfos.ts +95 -0
- package/src/kamino-client/accounts/GlobalConfig.ts +292 -0
- package/src/kamino-client/accounts/PersonalPositionState.ts +215 -0
- package/src/kamino-client/accounts/PoolState.ts +469 -0
- package/src/kamino-client/accounts/Position.ts +169 -0
- package/src/kamino-client/accounts/ProtocolPositionState.ts +201 -0
- package/src/kamino-client/accounts/ScopeChainAccount.ts +89 -0
- package/src/kamino-client/accounts/TermsSignature.ts +89 -0
- package/src/kamino-client/accounts/Whirlpool.ts +242 -0
- package/src/kamino-client/accounts/WhirlpoolStrategy.ts +918 -0
- package/src/kamino-client/errors/index.ts +62 -0
- package/src/kamino-client/instructions/addKaminoRewards.ts +53 -0
- package/src/kamino-client/instructions/changePool.ts +48 -0
- package/src/kamino-client/instructions/checkExpectedVaultsBalances.ts +45 -0
- package/src/kamino-client/instructions/closeProgramAccount.ts +30 -0
- package/src/kamino-client/instructions/closeStrategy.ts +130 -0
- package/src/kamino-client/instructions/collectFeesAndRewards.ts +116 -0
- package/src/kamino-client/instructions/deposit.ts +93 -0
- package/src/kamino-client/instructions/depositAndInvest.ts +118 -0
- package/src/kamino-client/instructions/emergencySwap.ts +86 -0
- package/src/kamino-client/instructions/executiveWithdraw.ts +92 -0
- package/src/kamino-client/instructions/flashSwapUnevenVaultsEnd.ts +95 -0
- package/src/kamino-client/instructions/flashSwapUnevenVaultsStart.ts +91 -0
- package/src/kamino-client/instructions/index.ts +140 -0
- package/src/kamino-client/instructions/initializeCollateralInfo.ts +28 -0
- package/src/kamino-client/instructions/initializeGlobalConfig.ts +26 -0
- package/src/kamino-client/instructions/initializeKaminoReward.ts +59 -0
- package/src/kamino-client/instructions/initializeSharesMetadata.ts +64 -0
- package/src/kamino-client/instructions/initializeStrategy.ts +77 -0
- package/src/kamino-client/instructions/insertCollateralInfo.ts +45 -0
- package/src/kamino-client/instructions/invest.ts +84 -0
- package/src/kamino-client/instructions/openLiquidityPosition.ts +144 -0
- package/src/kamino-client/instructions/orcaSwap.ts +82 -0
- package/src/kamino-client/instructions/permisionlessWithdrawFromTreasury.ts +38 -0
- package/src/kamino-client/instructions/signTerms.ts +42 -0
- package/src/kamino-client/instructions/singleTokenDepositAndInvestWithMin.ts +118 -0
- package/src/kamino-client/instructions/singleTokenDepositWithMin.ts +93 -0
- package/src/kamino-client/instructions/swapRewards.ts +116 -0
- package/src/kamino-client/instructions/swapUnevenVaults.ts +105 -0
- package/src/kamino-client/instructions/updateCollateralInfo.ts +48 -0
- package/src/kamino-client/instructions/updateGlobalConfig.ts +48 -0
- package/src/kamino-client/instructions/updateRewardMapping.ts +61 -0
- package/src/kamino-client/instructions/updateSharesMetadata.ts +60 -0
- package/src/kamino-client/instructions/updateStrategyAdmin.ts +24 -0
- package/src/kamino-client/instructions/updateStrategyConfig.ts +49 -0
- package/src/kamino-client/instructions/updateTreasuryFeeVault.ts +56 -0
- package/src/kamino-client/instructions/withdraw.ts +108 -0
- package/src/kamino-client/instructions/withdrawFromTopup.ts +40 -0
- package/src/kamino-client/instructions/withdrawFromTreasury.ts +56 -0
- package/src/kamino-client/programId.ts +13 -0
- package/src/kamino-client/types/BalanceStatus.ts +90 -0
- package/src/kamino-client/types/BinAddLiquidityStrategy.ts +189 -0
- package/src/kamino-client/types/CollateralInfo.ts +184 -0
- package/src/kamino-client/types/CollateralInfoParams.ts +166 -0
- package/src/kamino-client/types/CollateralTestToken.ts +870 -0
- package/src/kamino-client/types/CreationStatus.ts +180 -0
- package/src/kamino-client/types/DEX.ts +118 -0
- package/src/kamino-client/types/DexSpecificPrice.ts +116 -0
- package/src/kamino-client/types/DriftDirection.ts +90 -0
- package/src/kamino-client/types/ExecutiveWithdrawAction.ts +120 -0
- package/src/kamino-client/types/ExpanderStep.ts +101 -0
- package/src/kamino-client/types/GlobalConfigOption.ts +720 -0
- package/src/kamino-client/types/KaminoRewardInfo.ts +130 -0
- package/src/kamino-client/types/LiquidityCalculationMode.ts +90 -0
- package/src/kamino-client/types/MintingMethod.ts +90 -0
- package/src/kamino-client/types/PeriodicRebalanceState.ts +53 -0
- package/src/kamino-client/types/PositionRewardInfo.ts +64 -0
- package/src/kamino-client/types/Price.ts +61 -0
- package/src/kamino-client/types/RebalanceAction.ts +166 -0
- package/src/kamino-client/types/RebalanceAutodriftParams.ts +122 -0
- package/src/kamino-client/types/RebalanceAutodriftState.ts +84 -0
- package/src/kamino-client/types/RebalanceAutodriftStep.ts +90 -0
- package/src/kamino-client/types/RebalanceAutodriftWindow.ts +106 -0
- package/src/kamino-client/types/RebalanceDriftParams.ts +94 -0
- package/src/kamino-client/types/RebalanceDriftState.ts +76 -0
- package/src/kamino-client/types/RebalanceDriftStep.ts +90 -0
- package/src/kamino-client/types/RebalanceEffects.ts +104 -0
- package/src/kamino-client/types/RebalanceExpanderState.ts +64 -0
- package/src/kamino-client/types/RebalanceManualState.ts +37 -0
- package/src/kamino-client/types/RebalancePricePercentageState.ts +69 -0
- package/src/kamino-client/types/RebalancePricePercentageWithResetState.ts +77 -0
- package/src/kamino-client/types/RebalanceRaw.ts +76 -0
- package/src/kamino-client/types/RebalanceTakeProfitState.ts +56 -0
- package/src/kamino-client/types/RebalanceTakeProfitStep.ts +120 -0
- package/src/kamino-client/types/RebalanceTakeProfitToken.ts +87 -0
- package/src/kamino-client/types/RebalanceType.ts +270 -0
- package/src/kamino-client/types/ReferencePriceType.ts +90 -0
- package/src/kamino-client/types/RemoveLiquidityMode.ts +146 -0
- package/src/kamino-client/types/RewardInfo.ts +190 -0
- package/src/kamino-client/types/ScopeConversionChain.ts +0 -0
- package/src/kamino-client/types/ScopePriceIdTest.ts +2130 -0
- package/src/kamino-client/types/SimulationPrice.ts +146 -0
- package/src/kamino-client/types/StakingRateSource.ts +90 -0
- package/src/kamino-client/types/StrategyConfigOption.ts +1590 -0
- package/src/kamino-client/types/StrategyStatus.ts +180 -0
- package/src/kamino-client/types/StrategyType.ts +118 -0
- package/src/kamino-client/types/SwapLimit.ts +157 -0
- package/src/kamino-client/types/UpdateCollateralInfoMode.ts +420 -0
- package/src/kamino-client/types/WhirlpoolRewardInfo.ts +118 -0
- package/src/kamino-client/types/WithdrawalCapAccumulatorAction.ts +92 -0
- package/src/kamino-client/types/WithdrawalCaps.ts +85 -0
- package/src/meteora_client/accounts/BinArray.ts +134 -0
- package/src/meteora_client/accounts/BinArrayBitmapExtension.ts +119 -0
- package/src/meteora_client/accounts/LbPair.ts +401 -0
- package/src/meteora_client/accounts/Oracle.ts +114 -0
- package/src/meteora_client/accounts/Position.ts +229 -0
- package/src/meteora_client/accounts/PositionV2.ts +277 -0
- package/src/meteora_client/accounts/PresetParameter.ts +191 -0
- package/src/meteora_client/errors/index.ts +62 -0
- package/src/meteora_client/instructions/addLiquidity.ts +74 -0
- package/src/meteora_client/instructions/addLiquidityByStrategy.ts +74 -0
- package/src/meteora_client/instructions/addLiquidityByStrategyOneSide.ts +66 -0
- package/src/meteora_client/instructions/addLiquidityByWeight.ts +74 -0
- package/src/meteora_client/instructions/addLiquidityOneSide.ts +66 -0
- package/src/meteora_client/instructions/addLiquidityOneSidePrecise.ts +66 -0
- package/src/meteora_client/instructions/claimFee.ts +48 -0
- package/src/meteora_client/instructions/claimReward.ts +56 -0
- package/src/meteora_client/instructions/closePosition.ts +36 -0
- package/src/meteora_client/instructions/closePresetParameter.ts +26 -0
- package/src/meteora_client/instructions/fundReward.ts +60 -0
- package/src/meteora_client/instructions/goToABin.ts +50 -0
- package/src/meteora_client/instructions/increaseOracleLength.ts +44 -0
- package/src/meteora_client/instructions/initializeBinArray.ts +42 -0
- package/src/meteora_client/instructions/initializeBinArrayBitmapExtension.ts +35 -0
- package/src/meteora_client/instructions/initializeLbPair.ts +71 -0
- package/src/meteora_client/instructions/initializePermissionLbPair.ts +68 -0
- package/src/meteora_client/instructions/initializePosition.ts +55 -0
- package/src/meteora_client/instructions/initializePositionByOperator.ts +64 -0
- package/src/meteora_client/instructions/initializePositionPda.ts +58 -0
- package/src/meteora_client/instructions/initializePresetParameter.ts +42 -0
- package/src/meteora_client/instructions/initializeReward.ts +60 -0
- package/src/meteora_client/instructions/migrateBinArray.ts +22 -0
- package/src/meteora_client/instructions/migratePosition.ts +40 -0
- package/src/meteora_client/instructions/removeAllLiquidity.ts +56 -0
- package/src/meteora_client/instructions/removeLiquidity.ts +74 -0
- package/src/meteora_client/instructions/removeLiquidityByRange.ts +78 -0
- package/src/meteora_client/instructions/setActivationSlot.ts +38 -0
- package/src/meteora_client/instructions/setLockReleaseSlot.ts +44 -0
- package/src/meteora_client/instructions/setPreActivationSlotDuration.ts +38 -0
- package/src/meteora_client/instructions/setPreActivationSwapAddress.ts +40 -0
- package/src/meteora_client/instructions/swap.ts +73 -0
- package/src/meteora_client/instructions/togglePairStatus.ts +24 -0
- package/src/meteora_client/instructions/updateFeeOwner.ts +26 -0
- package/src/meteora_client/instructions/updateFeeParameters.ts +42 -0
- package/src/meteora_client/instructions/updateFeesAndRewards.ts +30 -0
- package/src/meteora_client/instructions/updatePositionOperator.ts +42 -0
- package/src/meteora_client/instructions/updateRewardDuration.ts +49 -0
- package/src/meteora_client/instructions/updateRewardFunder.ts +47 -0
- package/src/meteora_client/instructions/updateWhitelistedWallet.ts +38 -0
- package/src/meteora_client/instructions/withdrawIneligibleReward.ts +52 -0
- package/src/meteora_client/instructions/withdrawProtocolFee.ts +54 -0
- package/src/meteora_client/programId.ts +14 -0
- package/src/meteora_client/types/AddLiquiditySingleSidePreciseParameter.ts +79 -0
- package/src/meteora_client/types/Bin.ts +161 -0
- package/src/meteora_client/types/BinLiquidityDistribution.ts +85 -0
- package/src/meteora_client/types/BinLiquidityDistributionByWeight.ts +69 -0
- package/src/meteora_client/types/BinLiquidityReduction.ts +64 -0
- package/src/meteora_client/types/CompressedBinDepositAmount.ts +63 -0
- package/src/meteora_client/types/FeeInfo.ts +85 -0
- package/src/meteora_client/types/FeeParameter.ts +70 -0
- package/src/meteora_client/types/InitPermissionPairIx.ts +103 -0
- package/src/meteora_client/types/InitPresetParametersIx.ts +169 -0
- package/src/meteora_client/types/LayoutVersion.ts +87 -0
- package/src/meteora_client/types/LiquidityOneSideParameter.ts +112 -0
- package/src/meteora_client/types/LiquidityParameter.ts +95 -0
- package/src/meteora_client/types/LiquidityParameterByStrategy.ts +119 -0
- package/src/meteora_client/types/LiquidityParameterByStrategyOneSide.ts +107 -0
- package/src/meteora_client/types/LiquidityParameterByWeight.ts +124 -0
- package/src/meteora_client/types/Observation.ts +85 -0
- package/src/meteora_client/types/PairStatus.ts +88 -0
- package/src/meteora_client/types/PairType.ts +88 -0
- package/src/meteora_client/types/ProtocolFee.ts +61 -0
- package/src/meteora_client/types/RewardInfo.ts +152 -0
- package/src/meteora_client/types/Rounding.ts +85 -0
- package/src/meteora_client/types/StaticParameters.ts +170 -0
- package/src/meteora_client/types/StrategyParameters.ts +97 -0
- package/src/meteora_client/types/StrategyType.ts +298 -0
- package/src/meteora_client/types/UserRewardInfo.ts +71 -0
- package/src/meteora_client/types/VariableParameters.ts +131 -0
- package/src/models/EnrichedScopePrice.ts +2 -2
- package/src/models/KaminoPosition.ts +3 -3
- package/src/models/KaminoStrategyWithShareMint.ts +4 -6
- 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/raydium_client/accounts/AmmConfig.ts +161 -0
- package/src/raydium_client/accounts/ObservationState.ts +121 -0
- package/src/raydium_client/accounts/OperationState.ts +105 -0
- package/src/raydium_client/accounts/PersonalPositionState.ts +185 -0
- package/src/raydium_client/accounts/PoolState.ts +385 -0
- package/src/raydium_client/accounts/ProtocolPositionState.ts +171 -0
- package/src/raydium_client/accounts/TickArrayBitmapExtension.ts +113 -0
- package/src/raydium_client/accounts/TickArrayState.ts +125 -0
- package/src/raydium_client/errors/index.ts +62 -0
- package/src/raydium_client/index.ts +4 -0
- package/src/raydium_client/instructions/closePosition.ts +32 -0
- package/src/raydium_client/instructions/collectFundFee.ts +69 -0
- package/src/raydium_client/instructions/collectProtocolFee.ts +69 -0
- package/src/raydium_client/instructions/collectRemainingRewards.ts +50 -0
- package/src/raydium_client/instructions/createAmmConfig.ts +54 -0
- package/src/raydium_client/instructions/createOperationAccount.ts +26 -0
- package/src/raydium_client/instructions/createPool.ts +65 -0
- package/src/raydium_client/instructions/decreaseLiquidity.ts +74 -0
- package/src/raydium_client/instructions/decreaseLiquidityV2.ts +82 -0
- package/src/raydium_client/instructions/increaseLiquidity.ts +66 -0
- package/src/raydium_client/instructions/increaseLiquidityV2.ts +75 -0
- package/src/raydium_client/instructions/initializeReward.ts +56 -0
- package/src/raydium_client/instructions/openPosition.ts +96 -0
- package/src/raydium_client/instructions/openPositionV2.ts +108 -0
- package/src/raydium_client/instructions/setRewardParams.ts +57 -0
- package/src/raydium_client/instructions/swap.ts +65 -0
- package/src/raydium_client/instructions/swapRouterBaseIn.ts +51 -0
- package/src/raydium_client/instructions/swapV2.ts +71 -0
- package/src/raydium_client/instructions/transferRewardOwner.ts +38 -0
- package/src/raydium_client/instructions/updateAmmConfig.ts +40 -0
- package/src/raydium_client/instructions/updateOperationAccount.ts +45 -0
- package/src/raydium_client/instructions/updatePoolStatus.ts +38 -0
- package/src/raydium_client/instructions/updateRewardInfos.ts +22 -0
- package/src/raydium_client/programId.ts +14 -0
- package/src/raydium_client/types/InitializeRewardParam.ts +76 -0
- package/src/raydium_client/types/Observation.ts +85 -0
- package/src/raydium_client/types/PoolStatusBitFlag.ts +90 -0
- package/src/raydium_client/types/PoolStatusBitIndex.ts +180 -0
- package/src/raydium_client/types/PositionRewardInfo.ts +64 -0
- package/src/raydium_client/types/RewardInfo.ts +148 -0
- package/src/raydium_client/types/RewardState.ts +148 -0
- package/src/raydium_client/types/TickArryBitmap.ts +0 -0
- package/src/raydium_client/types/TickState.ts +116 -0
- 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 +88 -79
- package/src/services/MeteoraService.ts +37 -42
- package/src/services/OrcaService.ts +36 -47
- package/src/services/PoolSimulationService.ts +2 -2
- package/src/services/RaydiumPoolsResponse.ts +1 -1
- package/src/services/RaydiumService.ts +29 -34
- package/src/utils/CreationParameters.ts +4 -4
- package/src/utils/anchorUtils.ts +15 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/instructions.ts +38 -0
- package/src/utils/lookupTable.ts +42 -69
- package/src/utils/meteora.ts +6 -13
- package/src/utils/orca.ts +9 -12
- package/src/utils/pubkey.ts +249 -0
- package/src/utils/tokenUtils.ts +129 -67
- package/src/utils/transactions.ts +79 -83
- package/src/utils/types.ts +39 -39
- package/src/utils/utils.ts +31 -18
- package/src/whirlpools-client/accounts/FeeTier.ts +105 -0
- package/src/whirlpools-client/accounts/Position.ts +169 -0
- package/src/whirlpools-client/accounts/PositionBundle.ts +97 -0
- package/src/whirlpools-client/accounts/TickArray.ts +109 -0
- package/src/whirlpools-client/accounts/TokenBadge.ts +97 -0
- package/src/whirlpools-client/accounts/Whirlpool.ts +241 -0
- package/src/whirlpools-client/accounts/WhirlpoolsConfig.ts +119 -0
- package/src/whirlpools-client/accounts/WhirlpoolsConfigExtension.ts +107 -0
- package/src/whirlpools-client/errors/index.ts +62 -0
- package/src/whirlpools-client/index.ts +4 -0
- package/src/whirlpools-client/instructions/closeBundledPosition.ts +52 -0
- package/src/whirlpools-client/instructions/closePosition.ts +36 -0
- package/src/whirlpools-client/instructions/collectFees.ts +42 -0
- package/src/whirlpools-client/instructions/collectFeesV2.ts +71 -0
- package/src/whirlpools-client/instructions/collectProtocolFees.ts +40 -0
- package/src/whirlpools-client/instructions/collectProtocolFeesV2.ts +69 -0
- package/src/whirlpools-client/instructions/collectReward.ts +52 -0
- package/src/whirlpools-client/instructions/collectRewardV2.ts +66 -0
- package/src/whirlpools-client/instructions/decreaseLiquidity.ts +68 -0
- package/src/whirlpools-client/instructions/decreaseLiquidityV2.ts +84 -0
- package/src/whirlpools-client/instructions/deletePositionBundle.ts +36 -0
- package/src/whirlpools-client/instructions/deleteTokenBadge.ts +36 -0
- package/src/whirlpools-client/instructions/increaseLiquidity.ts +68 -0
- package/src/whirlpools-client/instructions/increaseLiquidityV2.ts +84 -0
- package/src/whirlpools-client/instructions/initializeConfig.ts +51 -0
- package/src/whirlpools-client/instructions/initializeConfigExtension.ts +30 -0
- package/src/whirlpools-client/instructions/initializeFeeTier.ts +49 -0
- package/src/whirlpools-client/instructions/initializePool.ts +64 -0
- package/src/whirlpools-client/instructions/initializePoolV2.ts +67 -0
- package/src/whirlpools-client/instructions/initializePositionBundle.ts +50 -0
- package/src/whirlpools-client/instructions/initializePositionBundleWithMetadata.ts +60 -0
- package/src/whirlpools-client/instructions/initializeReward.ts +50 -0
- package/src/whirlpools-client/instructions/initializeRewardV2.ts +52 -0
- package/src/whirlpools-client/instructions/initializeTickArray.ts +42 -0
- package/src/whirlpools-client/instructions/initializeTokenBadge.ts +38 -0
- package/src/whirlpools-client/instructions/openBundledPosition.ts +66 -0
- package/src/whirlpools-client/instructions/openPosition.ts +70 -0
- package/src/whirlpools-client/instructions/openPositionWithMetadata.ts +80 -0
- package/src/whirlpools-client/instructions/setCollectProtocolFeesAuthority.ts +34 -0
- package/src/whirlpools-client/instructions/setConfigExtensionAuthority.ts +40 -0
- package/src/whirlpools-client/instructions/setDefaultFeeRate.ts +40 -0
- package/src/whirlpools-client/instructions/setDefaultProtocolFeeRate.ts +38 -0
- package/src/whirlpools-client/instructions/setFeeAuthority.ts +26 -0
- package/src/whirlpools-client/instructions/setFeeRate.ts +40 -0
- package/src/whirlpools-client/instructions/setProtocolFeeRate.ts +40 -0
- package/src/whirlpools-client/instructions/setRewardAuthority.ts +40 -0
- package/src/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.ts +46 -0
- package/src/whirlpools-client/instructions/setRewardEmissions.ts +45 -0
- package/src/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.ts +34 -0
- package/src/whirlpools-client/instructions/setRewardEmissionsV2.ts +45 -0
- package/src/whirlpools-client/instructions/setTokenBadgeAuthority.ts +40 -0
- package/src/whirlpools-client/instructions/swap.ts +70 -0
- package/src/whirlpools-client/instructions/swapV2.ts +86 -0
- package/src/whirlpools-client/instructions/twoHopSwap.ts +110 -0
- package/src/whirlpools-client/instructions/twoHopSwapV2.ts +134 -0
- package/src/whirlpools-client/instructions/updateFeesAndRewards.ts +28 -0
- package/src/whirlpools-client/programId.ts +14 -0
- package/src/whirlpools-client/shim/remove-liquidity.ts +128 -0
- package/src/whirlpools-client/types/AccountsType.ts +208 -0
- package/src/whirlpools-client/types/CurrIndex.ts +118 -0
- package/src/whirlpools-client/types/Direction.ts +88 -0
- package/src/whirlpools-client/types/OpenPositionBumps.ts +53 -0
- package/src/whirlpools-client/types/OpenPositionWithMetadataBumps.ts +66 -0
- package/src/whirlpools-client/types/PositionRewardInfo.ts +64 -0
- package/src/whirlpools-client/types/RemainingAccountsInfo.ts +66 -0
- package/src/whirlpools-client/types/RemainingAccountsSlice.ts +64 -0
- package/src/whirlpools-client/types/Tick.ts +107 -0
- package/src/whirlpools-client/types/TickLabel.ts +88 -0
- package/src/whirlpools-client/types/WhirlpoolBumps.ts +53 -0
- package/src/whirlpools-client/types/WhirlpoolRewardInfo.ts +94 -0
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.d.ts +0 -20
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.js +0 -96
- package/dist/@codegen/kliquidity/accounts/CollateralInfos.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.d.ts +0 -89
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.js +0 -242
- package/dist/@codegen/kliquidity/accounts/GlobalConfig.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.d.ts +0 -84
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.js +0 -178
- package/dist/@codegen/kliquidity/accounts/PersonalPositionState.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/PoolState.d.ts +0 -213
- package/dist/@codegen/kliquidity/accounts/PoolState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/PoolState.js +0 -346
- package/dist/@codegen/kliquidity/accounts/PoolState.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/Position.d.ts +0 -48
- package/dist/@codegen/kliquidity/accounts/Position.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/Position.js +0 -156
- package/dist/@codegen/kliquidity/accounts/Position.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.d.ts +0 -80
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.js +0 -171
- package/dist/@codegen/kliquidity/accounts/ProtocolPositionState.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.d.ts +0 -19
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.js +0 -95
- package/dist/@codegen/kliquidity/accounts/ScopeChainAccount.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/TermsSignature.d.ts +0 -19
- package/dist/@codegen/kliquidity/accounts/TermsSignature.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/TermsSignature.js +0 -95
- package/dist/@codegen/kliquidity/accounts/TermsSignature.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/Whirlpool.d.ts +0 -76
- package/dist/@codegen/kliquidity/accounts/Whirlpool.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/Whirlpool.js +0 -211
- package/dist/@codegen/kliquidity/accounts/Whirlpool.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.d.ts +0 -321
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.js +0 -706
- package/dist/@codegen/kliquidity/accounts/WhirlpoolStrategy.js.map +0 -1
- package/dist/@codegen/kliquidity/accounts/index.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/accounts/index.js.map +0 -1
- package/dist/@codegen/kliquidity/errors/anchor.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/errors/anchor.js.map +0 -1
- package/dist/@codegen/kliquidity/errors/custom.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/errors/custom.js.map +0 -1
- package/dist/@codegen/kliquidity/errors/index.d.ts +0 -6
- package/dist/@codegen/kliquidity/errors/index.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/errors/index.js +0 -86
- package/dist/@codegen/kliquidity/errors/index.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.d.ts +0 -18
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.js +0 -68
- package/dist/@codegen/kliquidity/instructions/addKaminoRewards.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/changePool.d.ts +0 -13
- package/dist/@codegen/kliquidity/instructions/changePool.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/changePool.js +0 -25
- package/dist/@codegen/kliquidity/instructions/changePool.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.d.ts +0 -14
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.js +0 -60
- package/dist/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.d.ts +0 -10
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.js +0 -22
- package/dist/@codegen/kliquidity/instructions/closeProgramAccount.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/closeStrategy.d.ts +0 -50
- package/dist/@codegen/kliquidity/instructions/closeStrategy.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/closeStrategy.js +0 -54
- package/dist/@codegen/kliquidity/instructions/closeStrategy.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.d.ts +0 -44
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.js +0 -50
- package/dist/@codegen/kliquidity/instructions/collectFeesAndRewards.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/deposit.d.ts +0 -34
- package/dist/@codegen/kliquidity/instructions/deposit.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/deposit.js +0 -80
- package/dist/@codegen/kliquidity/instructions/deposit.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.d.ts +0 -43
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.js +0 -92
- package/dist/@codegen/kliquidity/instructions/depositAndInvest.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/emergencySwap.d.ts +0 -36
- package/dist/@codegen/kliquidity/instructions/emergencySwap.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/emergencySwap.js +0 -83
- package/dist/@codegen/kliquidity/instructions/emergencySwap.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.d.ts +0 -34
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.js +0 -86
- package/dist/@codegen/kliquidity/instructions/executiveWithdraw.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.d.ts +0 -41
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.js +0 -88
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.d.ts +0 -42
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.js +0 -85
- package/dist/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/index.d.ts +0 -73
- package/dist/@codegen/kliquidity/instructions/index.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/index.js +0 -76
- package/dist/@codegen/kliquidity/instructions/index.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.d.ts +0 -9
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.js +0 -21
- package/dist/@codegen/kliquidity/instructions/initializeCollateralInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.d.ts +0 -8
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.js +0 -20
- package/dist/@codegen/kliquidity/instructions/initializeGlobalConfig.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.d.ts +0 -21
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.js +0 -75
- package/dist/@codegen/kliquidity/instructions/initializeKaminoReward.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.d.ts +0 -20
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.js +0 -72
- package/dist/@codegen/kliquidity/instructions/initializeSharesMetadata.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.d.ts +0 -30
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.js +0 -80
- package/dist/@codegen/kliquidity/instructions/initializeStrategy.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.d.ts +0 -15
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.js +0 -65
- package/dist/@codegen/kliquidity/instructions/insertCollateralInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/invest.d.ts +0 -31
- package/dist/@codegen/kliquidity/instructions/invest.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/invest.js +0 -43
- package/dist/@codegen/kliquidity/instructions/invest.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.d.ts +0 -47
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.js +0 -102
- package/dist/@codegen/kliquidity/instructions/openLiquidityPosition.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/orcaSwap.d.ts +0 -31
- package/dist/@codegen/kliquidity/instructions/orcaSwap.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/orcaSwap.js +0 -80
- package/dist/@codegen/kliquidity/instructions/orcaSwap.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.d.ts +0 -12
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.js +0 -20
- package/dist/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/signTerms.d.ts +0 -13
- package/dist/@codegen/kliquidity/instructions/signTerms.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/signTerms.js +0 -57
- package/dist/@codegen/kliquidity/instructions/signTerms.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.d.ts +0 -43
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.js +0 -92
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.d.ts +0 -34
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.js +0 -80
- package/dist/@codegen/kliquidity/instructions/singleTokenDepositWithMin.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/swapRewards.d.ts +0 -38
- package/dist/@codegen/kliquidity/instructions/swapRewards.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/swapRewards.js +0 -87
- package/dist/@codegen/kliquidity/instructions/swapRewards.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.d.ts +0 -15
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.js +0 -66
- package/dist/@codegen/kliquidity/instructions/updateCollateralInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.d.ts +0 -14
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.js +0 -66
- package/dist/@codegen/kliquidity/instructions/updateGlobalConfig.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.d.ts +0 -21
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.js +0 -72
- package/dist/@codegen/kliquidity/instructions/updateRewardMapping.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.d.ts +0 -18
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.js +0 -70
- package/dist/@codegen/kliquidity/instructions/updateSharesMetadata.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.d.ts +0 -7
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.js +0 -19
- package/dist/@codegen/kliquidity/instructions/updateStrategyAdmin.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.d.ts +0 -15
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.js +0 -66
- package/dist/@codegen/kliquidity/instructions/updateStrategyConfig.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.d.ts +0 -18
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.js +0 -62
- package/dist/@codegen/kliquidity/instructions/updateTreasuryFeeVault.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/withdraw.d.ts +0 -39
- package/dist/@codegen/kliquidity/instructions/withdraw.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/withdraw.js +0 -86
- package/dist/@codegen/kliquidity/instructions/withdraw.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.d.ts +0 -13
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.js +0 -60
- package/dist/@codegen/kliquidity/instructions/withdrawFromTopup.js.map +0 -1
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.d.ts +0 -19
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.js +0 -66
- package/dist/@codegen/kliquidity/instructions/withdrawFromTreasury.js.map +0 -1
- package/dist/@codegen/kliquidity/programId.d.ts +0 -4
- package/dist/@codegen/kliquidity/programId.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/programId.js +0 -9
- package/dist/@codegen/kliquidity/programId.js.map +0 -1
- package/dist/@codegen/kliquidity/types/BalanceStatus.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/BalanceStatus.js.map +0 -1
- package/dist/@codegen/kliquidity/types/BinAddLiquidityStrategy.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/BinAddLiquidityStrategy.js.map +0 -1
- package/dist/@codegen/kliquidity/types/CollateralInfo.d.ts +0 -94
- package/dist/@codegen/kliquidity/types/CollateralInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/CollateralInfo.js +0 -178
- package/dist/@codegen/kliquidity/types/CollateralInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.d.ts +0 -84
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.js +0 -164
- package/dist/@codegen/kliquidity/types/CollateralInfoParams.js.map +0 -1
- package/dist/@codegen/kliquidity/types/CollateralTestToken.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/CollateralTestToken.js.map +0 -1
- package/dist/@codegen/kliquidity/types/CreationStatus.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/CreationStatus.js.map +0 -1
- package/dist/@codegen/kliquidity/types/DEX.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/DEX.js.map +0 -1
- package/dist/@codegen/kliquidity/types/DexSpecificPrice.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/DexSpecificPrice.js.map +0 -1
- package/dist/@codegen/kliquidity/types/DriftDirection.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/DriftDirection.js.map +0 -1
- package/dist/@codegen/kliquidity/types/ExecutiveWithdrawAction.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/ExecutiveWithdrawAction.js.map +0 -1
- package/dist/@codegen/kliquidity/types/ExpanderStep.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/ExpanderStep.js.map +0 -1
- package/dist/@codegen/kliquidity/types/GlobalConfigOption.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/GlobalConfigOption.js.map +0 -1
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.d.ts +0 -64
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.js +0 -136
- package/dist/@codegen/kliquidity/types/KaminoRewardInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/types/LiquidityCalculationMode.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/LiquidityCalculationMode.js.map +0 -1
- package/dist/@codegen/kliquidity/types/MintingMethod.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/MintingMethod.js.map +0 -1
- package/dist/@codegen/kliquidity/types/PeriodicRebalanceState.d.ts +0 -23
- package/dist/@codegen/kliquidity/types/PeriodicRebalanceState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/PeriodicRebalanceState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/PositionRewardInfo.d.ts +0 -28
- package/dist/@codegen/kliquidity/types/PositionRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/PositionRewardInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/types/Price.d.ts +0 -28
- package/dist/@codegen/kliquidity/types/Price.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/Price.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAction.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAction.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftParams.d.ts +0 -76
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftParams.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftParams.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftState.d.ts +0 -89
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftStep.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftStep.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftWindow.d.ts +0 -55
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftWindow.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceAutodriftWindow.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceDriftParams.d.ts +0 -51
- package/dist/@codegen/kliquidity/types/RebalanceDriftParams.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceDriftParams.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceDriftState.d.ts +0 -41
- package/dist/@codegen/kliquidity/types/RebalanceDriftState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceDriftState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceDriftStep.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceDriftStep.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceEffects.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceEffects.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceExpanderState.d.ts +0 -28
- package/dist/@codegen/kliquidity/types/RebalanceExpanderState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceExpanderState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceManualState.d.ts +0 -15
- package/dist/@codegen/kliquidity/types/RebalanceManualState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceManualState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageState.d.ts +0 -28
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.d.ts +0 -28
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceRaw.d.ts +0 -32
- package/dist/@codegen/kliquidity/types/RebalanceRaw.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceRaw.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitState.d.ts +0 -34
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitState.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitState.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitStep.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitStep.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitToken.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceTakeProfitToken.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceType.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RebalanceType.js.map +0 -1
- package/dist/@codegen/kliquidity/types/ReferencePriceType.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/ReferencePriceType.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RemoveLiquidityMode.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RemoveLiquidityMode.js.map +0 -1
- package/dist/@codegen/kliquidity/types/RewardInfo.d.ts +0 -116
- package/dist/@codegen/kliquidity/types/RewardInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/RewardInfo.js +0 -164
- package/dist/@codegen/kliquidity/types/RewardInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/types/ScopePriceIdTest.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/ScopePriceIdTest.js.map +0 -1
- package/dist/@codegen/kliquidity/types/SimulationPrice.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/SimulationPrice.js.map +0 -1
- package/dist/@codegen/kliquidity/types/StakingRateSource.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/StakingRateSource.js.map +0 -1
- package/dist/@codegen/kliquidity/types/StrategyConfigOption.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/StrategyConfigOption.js.map +0 -1
- package/dist/@codegen/kliquidity/types/StrategyStatus.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/StrategyStatus.js.map +0 -1
- package/dist/@codegen/kliquidity/types/StrategyType.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/StrategyType.js.map +0 -1
- package/dist/@codegen/kliquidity/types/SwapLimit.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/SwapLimit.js.map +0 -1
- package/dist/@codegen/kliquidity/types/UpdateCollateralInfoMode.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/UpdateCollateralInfoMode.js.map +0 -1
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.d.ts +0 -68
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.js +0 -116
- package/dist/@codegen/kliquidity/types/WhirlpoolRewardInfo.js.map +0 -1
- package/dist/@codegen/kliquidity/types/WithdrawalCapAccumulatorAction.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/WithdrawalCapAccumulatorAction.js.map +0 -1
- package/dist/@codegen/kliquidity/types/WithdrawalCaps.d.ts +0 -38
- package/dist/@codegen/kliquidity/types/WithdrawalCaps.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/WithdrawalCaps.js.map +0 -1
- package/dist/@codegen/kliquidity/types/index.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/types/index.js.map +0 -1
- package/dist/@codegen/kliquidity/utils/borshAddress.d.ts +0 -4
- package/dist/@codegen/kliquidity/utils/borshAddress.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/utils/borshAddress.js +0 -30
- package/dist/@codegen/kliquidity/utils/borshAddress.js.map +0 -1
- package/dist/@codegen/kliquidity/utils/index.d.ts +0 -2
- package/dist/@codegen/kliquidity/utils/index.d.ts.map +0 -1
- package/dist/@codegen/kliquidity/utils/index.js +0 -18
- package/dist/@codegen/kliquidity/utils/index.js.map +0 -1
- package/dist/@codegen/meteora/accounts/BinArray.d.ts +0 -42
- package/dist/@codegen/meteora/accounts/BinArray.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/BinArray.js +0 -133
- package/dist/@codegen/meteora/accounts/BinArray.js.map +0 -1
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.d.ts +0 -32
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.js +0 -115
- package/dist/@codegen/meteora/accounts/BinArrayBitmapExtension.js.map +0 -1
- package/dist/@codegen/meteora/accounts/LbPair.d.ts +0 -180
- package/dist/@codegen/meteora/accounts/LbPair.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/LbPair.js +0 -300
- package/dist/@codegen/meteora/accounts/LbPair.js.map +0 -1
- package/dist/@codegen/meteora/accounts/Oracle.d.ts +0 -35
- package/dist/@codegen/meteora/accounts/Oracle.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/Oracle.js +0 -115
- package/dist/@codegen/meteora/accounts/Oracle.js.map +0 -1
- package/dist/@codegen/meteora/accounts/Position.d.ts +0 -90
- package/dist/@codegen/meteora/accounts/Position.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/Position.js +0 -180
- package/dist/@codegen/meteora/accounts/Position.js.map +0 -1
- package/dist/@codegen/meteora/accounts/PositionV2.d.ts +0 -114
- package/dist/@codegen/meteora/accounts/PositionV2.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/PositionV2.js +0 -209
- package/dist/@codegen/meteora/accounts/PositionV2.js.map +0 -1
- package/dist/@codegen/meteora/accounts/PresetParameter.d.ts +0 -76
- package/dist/@codegen/meteora/accounts/PresetParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/PresetParameter.js +0 -159
- package/dist/@codegen/meteora/accounts/PresetParameter.js.map +0 -1
- package/dist/@codegen/meteora/accounts/index.d.ts.map +0 -1
- package/dist/@codegen/meteora/accounts/index.js.map +0 -1
- package/dist/@codegen/meteora/errors/anchor.d.ts.map +0 -1
- package/dist/@codegen/meteora/errors/anchor.js.map +0 -1
- package/dist/@codegen/meteora/errors/custom.d.ts.map +0 -1
- package/dist/@codegen/meteora/errors/custom.js.map +0 -1
- package/dist/@codegen/meteora/errors/index.d.ts +0 -6
- package/dist/@codegen/meteora/errors/index.d.ts.map +0 -1
- package/dist/@codegen/meteora/errors/index.js +0 -86
- package/dist/@codegen/meteora/errors/index.js.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidity.d.ts +0 -26
- package/dist/@codegen/meteora/instructions/addLiquidity.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidity.js +0 -76
- package/dist/@codegen/meteora/instructions/addLiquidity.js.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.d.ts +0 -26
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.js +0 -76
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategy.js.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.d.ts +0 -22
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.js +0 -72
- package/dist/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.js.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.d.ts +0 -26
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.js +0 -76
- package/dist/@codegen/meteora/instructions/addLiquidityByWeight.js.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.d.ts +0 -22
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.js +0 -72
- package/dist/@codegen/meteora/instructions/addLiquidityOneSide.js.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.d.ts +0 -22
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.js +0 -72
- package/dist/@codegen/meteora/instructions/addLiquidityOneSidePrecise.js.map +0 -1
- package/dist/@codegen/meteora/instructions/claimFee.d.ts +0 -19
- package/dist/@codegen/meteora/instructions/claimFee.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/claimFee.js +0 -27
- package/dist/@codegen/meteora/instructions/claimFee.js.map +0 -1
- package/dist/@codegen/meteora/instructions/claimReward.d.ts +0 -21
- package/dist/@codegen/meteora/instructions/claimReward.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/claimReward.js +0 -64
- package/dist/@codegen/meteora/instructions/claimReward.js.map +0 -1
- package/dist/@codegen/meteora/instructions/closePosition.d.ts +0 -13
- package/dist/@codegen/meteora/instructions/closePosition.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/closePosition.js +0 -21
- package/dist/@codegen/meteora/instructions/closePosition.js.map +0 -1
- package/dist/@codegen/meteora/instructions/closePresetParameter.d.ts +0 -8
- package/dist/@codegen/meteora/instructions/closePresetParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/closePresetParameter.js +0 -16
- package/dist/@codegen/meteora/instructions/closePresetParameter.js.map +0 -1
- package/dist/@codegen/meteora/instructions/fundReward.d.ts +0 -21
- package/dist/@codegen/meteora/instructions/fundReward.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/fundReward.js +0 -68
- package/dist/@codegen/meteora/instructions/fundReward.js.map +0 -1
- package/dist/@codegen/meteora/instructions/goToABin.d.ts +0 -15
- package/dist/@codegen/meteora/instructions/goToABin.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/goToABin.js +0 -67
- package/dist/@codegen/meteora/instructions/goToABin.js.map +0 -1
- package/dist/@codegen/meteora/instructions/increaseOracleLength.d.ts +0 -15
- package/dist/@codegen/meteora/instructions/increaseOracleLength.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/increaseOracleLength.js +0 -58
- package/dist/@codegen/meteora/instructions/increaseOracleLength.js.map +0 -1
- package/dist/@codegen/meteora/instructions/index.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/index.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeBinArray.d.ts +0 -14
- package/dist/@codegen/meteora/instructions/initializeBinArray.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeBinArray.js +0 -57
- package/dist/@codegen/meteora/instructions/initializeBinArray.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.d.ts +0 -11
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.js +0 -18
- package/dist/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeLbPair.d.ts +0 -24
- package/dist/@codegen/meteora/instructions/initializeLbPair.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeLbPair.js +0 -75
- package/dist/@codegen/meteora/instructions/initializeLbPair.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.d.ts +0 -24
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.js +0 -74
- package/dist/@codegen/meteora/instructions/initializePermissionLbPair.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePosition.d.ts +0 -18
- package/dist/@codegen/meteora/instructions/initializePosition.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePosition.js +0 -65
- package/dist/@codegen/meteora/instructions/initializePosition.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.d.ts +0 -22
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.js +0 -71
- package/dist/@codegen/meteora/instructions/initializePositionByOperator.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePositionPda.d.ts +0 -20
- package/dist/@codegen/meteora/instructions/initializePositionPda.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePositionPda.js +0 -66
- package/dist/@codegen/meteora/instructions/initializePositionPda.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePresetParameter.d.ts +0 -14
- package/dist/@codegen/meteora/instructions/initializePresetParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializePresetParameter.js +0 -58
- package/dist/@codegen/meteora/instructions/initializePresetParameter.js.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeReward.d.ts +0 -21
- package/dist/@codegen/meteora/instructions/initializeReward.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/initializeReward.js +0 -69
- package/dist/@codegen/meteora/instructions/initializeReward.js.map +0 -1
- package/dist/@codegen/meteora/instructions/migrateBinArray.d.ts +0 -6
- package/dist/@codegen/meteora/instructions/migrateBinArray.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/migrateBinArray.js +0 -14
- package/dist/@codegen/meteora/instructions/migrateBinArray.js.map +0 -1
- package/dist/@codegen/meteora/instructions/migratePosition.d.ts +0 -15
- package/dist/@codegen/meteora/instructions/migratePosition.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/migratePosition.js +0 -27
- package/dist/@codegen/meteora/instructions/migratePosition.js.map +0 -1
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.d.ts +0 -21
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.js +0 -33
- package/dist/@codegen/meteora/instructions/removeAllLiquidity.js.map +0 -1
- package/dist/@codegen/meteora/instructions/removeLiquidity.d.ts +0 -26
- package/dist/@codegen/meteora/instructions/removeLiquidity.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/removeLiquidity.js +0 -76
- package/dist/@codegen/meteora/instructions/removeLiquidity.js.map +0 -1
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.d.ts +0 -27
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.js +0 -79
- package/dist/@codegen/meteora/instructions/removeLiquidityByRange.js.map +0 -1
- package/dist/@codegen/meteora/instructions/setActivationSlot.d.ts +0 -12
- package/dist/@codegen/meteora/instructions/setActivationSlot.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/setActivationSlot.js +0 -55
- package/dist/@codegen/meteora/instructions/setActivationSlot.js.map +0 -1
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.d.ts +0 -15
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.js +0 -58
- package/dist/@codegen/meteora/instructions/setLockReleaseSlot.js.map +0 -1
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.d.ts +0 -11
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.js +0 -55
- package/dist/@codegen/meteora/instructions/setPreActivationSlotDuration.js.map +0 -1
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.d.ts +0 -11
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.js +0 -56
- package/dist/@codegen/meteora/instructions/setPreActivationSwapAddress.js.map +0 -1
- package/dist/@codegen/meteora/instructions/swap.d.ts +0 -26
- package/dist/@codegen/meteora/instructions/swap.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/swap.js +0 -78
- package/dist/@codegen/meteora/instructions/swap.js.map +0 -1
- package/dist/@codegen/meteora/instructions/togglePairStatus.d.ts +0 -7
- package/dist/@codegen/meteora/instructions/togglePairStatus.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/togglePairStatus.js +0 -15
- package/dist/@codegen/meteora/instructions/togglePairStatus.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updateFeeOwner.d.ts +0 -8
- package/dist/@codegen/meteora/instructions/updateFeeOwner.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updateFeeOwner.js +0 -16
- package/dist/@codegen/meteora/instructions/updateFeeOwner.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updateFeeParameters.d.ts +0 -14
- package/dist/@codegen/meteora/instructions/updateFeeParameters.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updateFeeParameters.js +0 -58
- package/dist/@codegen/meteora/instructions/updateFeeParameters.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.d.ts +0 -10
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.js +0 -18
- package/dist/@codegen/meteora/instructions/updateFeesAndRewards.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updatePositionOperator.d.ts +0 -13
- package/dist/@codegen/meteora/instructions/updatePositionOperator.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updatePositionOperator.js +0 -58
- package/dist/@codegen/meteora/instructions/updatePositionOperator.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updateRewardDuration.d.ts +0 -16
- package/dist/@codegen/meteora/instructions/updateRewardDuration.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updateRewardDuration.js +0 -62
- package/dist/@codegen/meteora/instructions/updateRewardDuration.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updateRewardFunder.d.ts +0 -15
- package/dist/@codegen/meteora/instructions/updateRewardFunder.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updateRewardFunder.js +0 -62
- package/dist/@codegen/meteora/instructions/updateRewardFunder.js.map +0 -1
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.d.ts +0 -11
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.js +0 -56
- package/dist/@codegen/meteora/instructions/updateWhitelistedWallet.js.map +0 -1
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.d.ts +0 -19
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.js +0 -62
- package/dist/@codegen/meteora/instructions/withdrawIneligibleReward.js.map +0 -1
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.d.ts +0 -20
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.d.ts.map +0 -1
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.js +0 -63
- package/dist/@codegen/meteora/instructions/withdrawProtocolFee.js.map +0 -1
- package/dist/@codegen/meteora/programId.d.ts +0 -4
- package/dist/@codegen/meteora/programId.d.ts.map +0 -1
- package/dist/@codegen/meteora/programId.js +0 -9
- package/dist/@codegen/meteora/programId.js.map +0 -1
- package/dist/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.d.ts +0 -34
- package/dist/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.js.map +0 -1
- package/dist/@codegen/meteora/types/Bin.d.ts +0 -90
- package/dist/@codegen/meteora/types/Bin.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/Bin.js.map +0 -1
- package/dist/@codegen/meteora/types/BinLiquidityDistribution.d.ts +0 -41
- package/dist/@codegen/meteora/types/BinLiquidityDistribution.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/BinLiquidityDistribution.js.map +0 -1
- package/dist/@codegen/meteora/types/BinLiquidityDistributionByWeight.d.ts +0 -33
- package/dist/@codegen/meteora/types/BinLiquidityDistributionByWeight.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/BinLiquidityDistributionByWeight.js.map +0 -1
- package/dist/@codegen/meteora/types/BinLiquidityReduction.d.ts +0 -27
- package/dist/@codegen/meteora/types/BinLiquidityReduction.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/BinLiquidityReduction.js.map +0 -1
- package/dist/@codegen/meteora/types/CompressedBinDepositAmount.d.ts +0 -27
- package/dist/@codegen/meteora/types/CompressedBinDepositAmount.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/CompressedBinDepositAmount.js.map +0 -1
- package/dist/@codegen/meteora/types/FeeInfo.d.ts +0 -38
- package/dist/@codegen/meteora/types/FeeInfo.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/FeeInfo.js.map +0 -1
- package/dist/@codegen/meteora/types/FeeParameter.d.ts +0 -33
- package/dist/@codegen/meteora/types/FeeParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/FeeParameter.js.map +0 -1
- package/dist/@codegen/meteora/types/InitPermissionPairIx.d.ts +0 -48
- package/dist/@codegen/meteora/types/InitPermissionPairIx.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/InitPermissionPairIx.js.map +0 -1
- package/dist/@codegen/meteora/types/InitPresetParametersIx.d.ts +0 -97
- package/dist/@codegen/meteora/types/InitPresetParametersIx.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/InitPresetParametersIx.js.map +0 -1
- package/dist/@codegen/meteora/types/LayoutVersion.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/LayoutVersion.js.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityOneSideParameter.d.ts +0 -56
- package/dist/@codegen/meteora/types/LiquidityOneSideParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityOneSideParameter.js.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameter.d.ts +0 -50
- package/dist/@codegen/meteora/types/LiquidityParameter.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameter.js.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategy.d.ts +0 -104
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategy.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategy.js.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.d.ts +0 -96
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.js.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameterByWeight.d.ts +0 -64
- package/dist/@codegen/meteora/types/LiquidityParameterByWeight.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/LiquidityParameterByWeight.js.map +0 -1
- package/dist/@codegen/meteora/types/Observation.d.ts +0 -42
- package/dist/@codegen/meteora/types/Observation.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/Observation.js.map +0 -1
- package/dist/@codegen/meteora/types/PairStatus.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/PairStatus.js.map +0 -1
- package/dist/@codegen/meteora/types/PairType.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/PairType.js.map +0 -1
- package/dist/@codegen/meteora/types/ProtocolFee.d.ts +0 -28
- package/dist/@codegen/meteora/types/ProtocolFee.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/ProtocolFee.js.map +0 -1
- package/dist/@codegen/meteora/types/RewardInfo.d.ts +0 -84
- package/dist/@codegen/meteora/types/RewardInfo.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/RewardInfo.js +0 -139
- package/dist/@codegen/meteora/types/RewardInfo.js.map +0 -1
- package/dist/@codegen/meteora/types/Rounding.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/Rounding.js.map +0 -1
- package/dist/@codegen/meteora/types/StaticParameters.d.ts +0 -98
- package/dist/@codegen/meteora/types/StaticParameters.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/StaticParameters.js.map +0 -1
- package/dist/@codegen/meteora/types/StrategyParameters.d.ts +0 -85
- package/dist/@codegen/meteora/types/StrategyParameters.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/StrategyParameters.js.map +0 -1
- package/dist/@codegen/meteora/types/StrategyType.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/StrategyType.js.map +0 -1
- package/dist/@codegen/meteora/types/UserRewardInfo.d.ts +0 -28
- package/dist/@codegen/meteora/types/UserRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/UserRewardInfo.js.map +0 -1
- package/dist/@codegen/meteora/types/VariableParameters.d.ts +0 -76
- package/dist/@codegen/meteora/types/VariableParameters.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/VariableParameters.js.map +0 -1
- package/dist/@codegen/meteora/types/index.d.ts.map +0 -1
- package/dist/@codegen/meteora/types/index.js.map +0 -1
- package/dist/@codegen/meteora/utils/borshAddress.d.ts +0 -4
- package/dist/@codegen/meteora/utils/borshAddress.d.ts.map +0 -1
- package/dist/@codegen/meteora/utils/borshAddress.js +0 -30
- package/dist/@codegen/meteora/utils/borshAddress.js.map +0 -1
- package/dist/@codegen/meteora/utils/index.d.ts +0 -2
- package/dist/@codegen/meteora/utils/index.d.ts.map +0 -1
- package/dist/@codegen/meteora/utils/index.js +0 -18
- package/dist/@codegen/meteora/utils/index.js.map +0 -1
- package/dist/@codegen/raydium/accounts/AmmConfig.d.ts +0 -47
- package/dist/@codegen/raydium/accounts/AmmConfig.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/AmmConfig.js +0 -155
- package/dist/@codegen/raydium/accounts/AmmConfig.js.map +0 -1
- package/dist/@codegen/raydium/accounts/ObservationState.d.ts +0 -30
- package/dist/@codegen/raydium/accounts/ObservationState.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/ObservationState.js +0 -120
- package/dist/@codegen/raydium/accounts/ObservationState.js.map +0 -1
- package/dist/@codegen/raydium/accounts/OperationState.d.ts +0 -25
- package/dist/@codegen/raydium/accounts/OperationState.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/OperationState.js +0 -108
- package/dist/@codegen/raydium/accounts/OperationState.js.map +0 -1
- package/dist/@codegen/raydium/accounts/PersonalPositionState.d.ts +0 -54
- package/dist/@codegen/raydium/accounts/PersonalPositionState.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/PersonalPositionState.js +0 -168
- package/dist/@codegen/raydium/accounts/PersonalPositionState.js.map +0 -1
- package/dist/@codegen/raydium/accounts/PoolState.d.ts +0 -129
- package/dist/@codegen/raydium/accounts/PoolState.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/PoolState.js +0 -318
- package/dist/@codegen/raydium/accounts/PoolState.js.map +0 -1
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.d.ts +0 -50
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.js +0 -161
- package/dist/@codegen/raydium/accounts/ProtocolPositionState.js.map +0 -1
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.d.ts +0 -26
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.js +0 -113
- package/dist/@codegen/raydium/accounts/TickArrayBitmapExtension.js.map +0 -1
- package/dist/@codegen/raydium/accounts/TickArrayState.d.ts +0 -32
- package/dist/@codegen/raydium/accounts/TickArrayState.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/TickArrayState.js +0 -121
- package/dist/@codegen/raydium/accounts/TickArrayState.js.map +0 -1
- package/dist/@codegen/raydium/accounts/index.d.ts.map +0 -1
- package/dist/@codegen/raydium/accounts/index.js.map +0 -1
- package/dist/@codegen/raydium/errors/anchor.d.ts.map +0 -1
- package/dist/@codegen/raydium/errors/anchor.js.map +0 -1
- package/dist/@codegen/raydium/errors/custom.d.ts.map +0 -1
- package/dist/@codegen/raydium/errors/custom.js.map +0 -1
- package/dist/@codegen/raydium/errors/index.d.ts +0 -6
- package/dist/@codegen/raydium/errors/index.d.ts.map +0 -1
- package/dist/@codegen/raydium/errors/index.js +0 -86
- package/dist/@codegen/raydium/errors/index.js.map +0 -1
- package/dist/@codegen/raydium/instructions/closePosition.d.ts +0 -11
- package/dist/@codegen/raydium/instructions/closePosition.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/closePosition.js +0 -19
- package/dist/@codegen/raydium/instructions/closePosition.js.map +0 -1
- package/dist/@codegen/raydium/instructions/collectFundFee.d.ts +0 -22
- package/dist/@codegen/raydium/instructions/collectFundFee.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/collectFundFee.js +0 -68
- package/dist/@codegen/raydium/instructions/collectFundFee.js.map +0 -1
- package/dist/@codegen/raydium/instructions/collectProtocolFee.d.ts +0 -22
- package/dist/@codegen/raydium/instructions/collectProtocolFee.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/collectProtocolFee.js +0 -68
- package/dist/@codegen/raydium/instructions/collectProtocolFee.js.map +0 -1
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.d.ts +0 -17
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.js +0 -65
- package/dist/@codegen/raydium/instructions/collectRemainingRewards.js.map +0 -1
- package/dist/@codegen/raydium/instructions/createAmmConfig.d.ts +0 -16
- package/dist/@codegen/raydium/instructions/createAmmConfig.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/createAmmConfig.js +0 -66
- package/dist/@codegen/raydium/instructions/createAmmConfig.js.map +0 -1
- package/dist/@codegen/raydium/instructions/createOperationAccount.d.ts +0 -8
- package/dist/@codegen/raydium/instructions/createOperationAccount.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/createOperationAccount.js +0 -16
- package/dist/@codegen/raydium/instructions/createOperationAccount.js.map +0 -1
- package/dist/@codegen/raydium/instructions/createPool.d.ts +0 -24
- package/dist/@codegen/raydium/instructions/createPool.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/createPool.js +0 -74
- package/dist/@codegen/raydium/instructions/createPool.js.map +0 -1
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.d.ts +0 -24
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.js +0 -71
- package/dist/@codegen/raydium/instructions/decreaseLiquidity.js.map +0 -1
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.d.ts +0 -28
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.js +0 -75
- package/dist/@codegen/raydium/instructions/decreaseLiquidityV2.js.map +0 -1
- package/dist/@codegen/raydium/instructions/increaseLiquidity.d.ts +0 -24
- package/dist/@codegen/raydium/instructions/increaseLiquidity.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/increaseLiquidity.js +0 -71
- package/dist/@codegen/raydium/instructions/increaseLiquidity.js.map +0 -1
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.d.ts +0 -28
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.js +0 -76
- package/dist/@codegen/raydium/instructions/increaseLiquidityV2.js.map +0 -1
- package/dist/@codegen/raydium/instructions/index.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/index.js.map +0 -1
- package/dist/@codegen/raydium/instructions/initializeReward.d.ts +0 -20
- package/dist/@codegen/raydium/instructions/initializeReward.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/initializeReward.js +0 -70
- package/dist/@codegen/raydium/instructions/initializeReward.js.map +0 -1
- package/dist/@codegen/raydium/instructions/openPosition.d.ts +0 -35
- package/dist/@codegen/raydium/instructions/openPosition.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/openPosition.js +0 -90
- package/dist/@codegen/raydium/instructions/openPosition.js.map +0 -1
- package/dist/@codegen/raydium/instructions/openPositionV2.d.ts +0 -40
- package/dist/@codegen/raydium/instructions/openPositionV2.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/openPositionV2.js +0 -97
- package/dist/@codegen/raydium/instructions/openPositionV2.js.map +0 -1
- package/dist/@codegen/raydium/instructions/setRewardParams.d.ts +0 -19
- package/dist/@codegen/raydium/instructions/setRewardParams.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/setRewardParams.js +0 -71
- package/dist/@codegen/raydium/instructions/setRewardParams.js.map +0 -1
- package/dist/@codegen/raydium/instructions/swap.d.ts +0 -23
- package/dist/@codegen/raydium/instructions/swap.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/swap.js +0 -71
- package/dist/@codegen/raydium/instructions/swap.js.map +0 -1
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.d.ts +0 -17
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.js +0 -63
- package/dist/@codegen/raydium/instructions/swapRouterBaseIn.js.map +0 -1
- package/dist/@codegen/raydium/instructions/swapV2.d.ts +0 -26
- package/dist/@codegen/raydium/instructions/swapV2.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/swapV2.js +0 -74
- package/dist/@codegen/raydium/instructions/swapV2.js.map +0 -1
- package/dist/@codegen/raydium/instructions/transferRewardOwner.d.ts +0 -11
- package/dist/@codegen/raydium/instructions/transferRewardOwner.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/transferRewardOwner.js +0 -60
- package/dist/@codegen/raydium/instructions/transferRewardOwner.js.map +0 -1
- package/dist/@codegen/raydium/instructions/updateAmmConfig.d.ts +0 -12
- package/dist/@codegen/raydium/instructions/updateAmmConfig.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/updateAmmConfig.js +0 -56
- package/dist/@codegen/raydium/instructions/updateAmmConfig.js.map +0 -1
- package/dist/@codegen/raydium/instructions/updateOperationAccount.d.ts +0 -13
- package/dist/@codegen/raydium/instructions/updateOperationAccount.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/updateOperationAccount.js +0 -61
- package/dist/@codegen/raydium/instructions/updateOperationAccount.js.map +0 -1
- package/dist/@codegen/raydium/instructions/updatePoolStatus.d.ts +0 -11
- package/dist/@codegen/raydium/instructions/updatePoolStatus.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/updatePoolStatus.js +0 -59
- package/dist/@codegen/raydium/instructions/updatePoolStatus.js.map +0 -1
- package/dist/@codegen/raydium/instructions/updateRewardInfos.d.ts +0 -6
- package/dist/@codegen/raydium/instructions/updateRewardInfos.d.ts.map +0 -1
- package/dist/@codegen/raydium/instructions/updateRewardInfos.js +0 -14
- package/dist/@codegen/raydium/instructions/updateRewardInfos.js.map +0 -1
- package/dist/@codegen/raydium/programId.d.ts +0 -4
- package/dist/@codegen/raydium/programId.d.ts.map +0 -1
- package/dist/@codegen/raydium/programId.js +0 -9
- package/dist/@codegen/raydium/programId.js.map +0 -1
- package/dist/@codegen/raydium/types/InitializeRewardParam.d.ts +0 -33
- package/dist/@codegen/raydium/types/InitializeRewardParam.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/InitializeRewardParam.js.map +0 -1
- package/dist/@codegen/raydium/types/Observation.d.ts +0 -38
- package/dist/@codegen/raydium/types/Observation.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/Observation.js.map +0 -1
- package/dist/@codegen/raydium/types/PoolStatusBitFlag.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/PoolStatusBitFlag.js.map +0 -1
- package/dist/@codegen/raydium/types/PoolStatusBitIndex.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/PoolStatusBitIndex.js.map +0 -1
- package/dist/@codegen/raydium/types/PositionRewardInfo.d.ts +0 -28
- package/dist/@codegen/raydium/types/PositionRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/PositionRewardInfo.js.map +0 -1
- package/dist/@codegen/raydium/types/RewardInfo.d.ts +0 -74
- package/dist/@codegen/raydium/types/RewardInfo.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/RewardInfo.js +0 -150
- package/dist/@codegen/raydium/types/RewardInfo.js.map +0 -1
- package/dist/@codegen/raydium/types/RewardState.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/RewardState.js.map +0 -1
- package/dist/@codegen/raydium/types/TickState.d.ts +0 -53
- package/dist/@codegen/raydium/types/TickState.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/TickState.js.map +0 -1
- package/dist/@codegen/raydium/types/index.d.ts.map +0 -1
- package/dist/@codegen/raydium/types/index.js.map +0 -1
- package/dist/@codegen/raydium/utils/borshAddress.d.ts +0 -4
- package/dist/@codegen/raydium/utils/borshAddress.d.ts.map +0 -1
- package/dist/@codegen/raydium/utils/borshAddress.js +0 -30
- package/dist/@codegen/raydium/utils/borshAddress.js.map +0 -1
- package/dist/@codegen/raydium/utils/index.d.ts +0 -2
- package/dist/@codegen/raydium/utils/index.d.ts.map +0 -1
- package/dist/@codegen/raydium/utils/index.js +0 -18
- package/dist/@codegen/raydium/utils/index.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/FeeTier.d.ts +0 -25
- package/dist/@codegen/whirlpools/accounts/FeeTier.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/FeeTier.js +0 -108
- package/dist/@codegen/whirlpools/accounts/FeeTier.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/Position.d.ts +0 -48
- package/dist/@codegen/whirlpools/accounts/Position.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/Position.js +0 -156
- package/dist/@codegen/whirlpools/accounts/Position.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/PositionBundle.d.ts +0 -22
- package/dist/@codegen/whirlpools/accounts/PositionBundle.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/PositionBundle.js +0 -102
- package/dist/@codegen/whirlpools/accounts/PositionBundle.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/TickArray.d.ts +0 -26
- package/dist/@codegen/whirlpools/accounts/TickArray.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/TickArray.js +0 -109
- package/dist/@codegen/whirlpools/accounts/TickArray.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/TokenBadge.d.ts +0 -22
- package/dist/@codegen/whirlpools/accounts/TokenBadge.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/TokenBadge.js +0 -102
- package/dist/@codegen/whirlpools/accounts/TokenBadge.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/Whirlpool.d.ts +0 -75
- package/dist/@codegen/whirlpools/accounts/Whirlpool.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/Whirlpool.js +0 -210
- package/dist/@codegen/whirlpools/accounts/Whirlpool.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.d.ts +0 -28
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.js +0 -114
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfig.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.d.ts +0 -25
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.js +0 -108
- package/dist/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.js.map +0 -1
- package/dist/@codegen/whirlpools/accounts/index.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/accounts/index.js.map +0 -1
- package/dist/@codegen/whirlpools/errors/anchor.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/errors/anchor.js.map +0 -1
- package/dist/@codegen/whirlpools/errors/custom.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/errors/custom.js.map +0 -1
- package/dist/@codegen/whirlpools/errors/index.d.ts +0 -6
- package/dist/@codegen/whirlpools/errors/index.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/errors/index.js +0 -86
- package/dist/@codegen/whirlpools/errors/index.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.d.ts +0 -14
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.js +0 -62
- package/dist/@codegen/whirlpools/instructions/closeBundledPosition.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/closePosition.d.ts +0 -11
- package/dist/@codegen/whirlpools/instructions/closePosition.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/closePosition.js +0 -23
- package/dist/@codegen/whirlpools/instructions/closePosition.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectFees.d.ts +0 -14
- package/dist/@codegen/whirlpools/instructions/collectFees.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectFees.js +0 -26
- package/dist/@codegen/whirlpools/instructions/collectFees.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.d.ts +0 -23
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.js +0 -75
- package/dist/@codegen/whirlpools/instructions/collectFeesV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.d.ts +0 -13
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.js +0 -25
- package/dist/@codegen/whirlpools/instructions/collectProtocolFees.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.d.ts +0 -22
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.js +0 -74
- package/dist/@codegen/whirlpools/instructions/collectProtocolFeesV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectReward.d.ts +0 -16
- package/dist/@codegen/whirlpools/instructions/collectReward.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectReward.js +0 -64
- package/dist/@codegen/whirlpools/instructions/collectReward.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.d.ts +0 -20
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.js +0 -73
- package/dist/@codegen/whirlpools/instructions/collectRewardV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.d.ts +0 -23
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.js +0 -74
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidity.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.d.ts +0 -29
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.js +0 -83
- package/dist/@codegen/whirlpools/instructions/decreaseLiquidityV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.d.ts +0 -11
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.js +0 -23
- package/dist/@codegen/whirlpools/instructions/deletePositionBundle.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.d.ts +0 -11
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.js +0 -23
- package/dist/@codegen/whirlpools/instructions/deleteTokenBadge.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.d.ts +0 -23
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.js +0 -74
- package/dist/@codegen/whirlpools/instructions/increaseLiquidity.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.d.ts +0 -29
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.js +0 -83
- package/dist/@codegen/whirlpools/instructions/increaseLiquidityV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/index.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/index.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeConfig.d.ts +0 -15
- package/dist/@codegen/whirlpools/instructions/initializeConfig.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeConfig.js +0 -65
- package/dist/@codegen/whirlpools/instructions/initializeConfig.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.d.ts +0 -10
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.js +0 -22
- package/dist/@codegen/whirlpools/instructions/initializeConfigExtension.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.d.ts +0 -15
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.js +0 -66
- package/dist/@codegen/whirlpools/instructions/initializeFeeTier.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePool.d.ts +0 -24
- package/dist/@codegen/whirlpools/instructions/initializePool.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePool.js +0 -79
- package/dist/@codegen/whirlpools/instructions/initializePool.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.d.ts +0 -25
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.js +0 -79
- package/dist/@codegen/whirlpools/instructions/initializePoolV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.d.ts +0 -14
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.js +0 -26
- package/dist/@codegen/whirlpools/instructions/initializePositionBundle.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.d.ts +0 -17
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.js +0 -29
- package/dist/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeReward.d.ts +0 -17
- package/dist/@codegen/whirlpools/instructions/initializeReward.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeReward.js +0 -69
- package/dist/@codegen/whirlpools/instructions/initializeReward.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.d.ts +0 -18
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.js +0 -70
- package/dist/@codegen/whirlpools/instructions/initializeRewardV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.d.ts +0 -13
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.js +0 -57
- package/dist/@codegen/whirlpools/instructions/initializeTickArray.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.d.ts +0 -12
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.js +0 -24
- package/dist/@codegen/whirlpools/instructions/initializeTokenBadge.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.d.ts +0 -19
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.js +0 -71
- package/dist/@codegen/whirlpools/instructions/openBundledPosition.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/openPosition.d.ts +0 -22
- package/dist/@codegen/whirlpools/instructions/openPosition.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/openPosition.js +0 -74
- package/dist/@codegen/whirlpools/instructions/openPosition.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.d.ts +0 -25
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.js +0 -77
- package/dist/@codegen/whirlpools/instructions/openPositionWithMetadata.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.d.ts +0 -8
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.js +0 -20
- package/dist/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.d.ts +0 -9
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.js +0 -21
- package/dist/@codegen/whirlpools/instructions/setConfigExtensionAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.d.ts +0 -12
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.js +0 -60
- package/dist/@codegen/whirlpools/instructions/setDefaultFeeRate.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.d.ts +0 -11
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.js +0 -59
- package/dist/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.d.ts +0 -8
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.js +0 -20
- package/dist/@codegen/whirlpools/instructions/setFeeAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setFeeRate.d.ts +0 -12
- package/dist/@codegen/whirlpools/instructions/setFeeRate.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setFeeRate.js +0 -60
- package/dist/@codegen/whirlpools/instructions/setFeeRate.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.d.ts +0 -12
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.js +0 -60
- package/dist/@codegen/whirlpools/instructions/setProtocolFeeRate.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.d.ts +0 -12
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.js +0 -60
- package/dist/@codegen/whirlpools/instructions/setRewardAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.d.ts +0 -13
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.js +0 -61
- package/dist/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.d.ts +0 -14
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.js +0 -64
- package/dist/@codegen/whirlpools/instructions/setRewardEmissions.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.d.ts +0 -8
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.js +0 -20
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.d.ts +0 -14
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.js +0 -64
- package/dist/@codegen/whirlpools/instructions/setRewardEmissionsV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.d.ts +0 -9
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.js +0 -21
- package/dist/@codegen/whirlpools/instructions/setTokenBadgeAuthority.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/swap.d.ts +0 -25
- package/dist/@codegen/whirlpools/instructions/swap.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/swap.js +0 -78
- package/dist/@codegen/whirlpools/instructions/swap.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/swapV2.d.ts +0 -31
- package/dist/@codegen/whirlpools/instructions/swapV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/swapV2.js +0 -87
- package/dist/@codegen/whirlpools/instructions/swapV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.d.ts +0 -36
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.js +0 -91
- package/dist/@codegen/whirlpools/instructions/twoHopSwap.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.d.ts +0 -42
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.js +0 -100
- package/dist/@codegen/whirlpools/instructions/twoHopSwapV2.js.map +0 -1
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.d.ts +0 -9
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.js +0 -17
- package/dist/@codegen/whirlpools/instructions/updateFeesAndRewards.js.map +0 -1
- package/dist/@codegen/whirlpools/programId.d.ts +0 -4
- package/dist/@codegen/whirlpools/programId.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/programId.js +0 -9
- package/dist/@codegen/whirlpools/programId.js.map +0 -1
- package/dist/@codegen/whirlpools/types/AccountsType.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/AccountsType.js.map +0 -1
- package/dist/@codegen/whirlpools/types/CurrIndex.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/CurrIndex.js.map +0 -1
- package/dist/@codegen/whirlpools/types/Direction.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/Direction.js.map +0 -1
- package/dist/@codegen/whirlpools/types/OpenPositionBumps.d.ts +0 -22
- package/dist/@codegen/whirlpools/types/OpenPositionBumps.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/OpenPositionBumps.js.map +0 -1
- package/dist/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.d.ts +0 -27
- package/dist/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.js.map +0 -1
- package/dist/@codegen/whirlpools/types/PositionRewardInfo.d.ts +0 -28
- package/dist/@codegen/whirlpools/types/PositionRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/PositionRewardInfo.js.map +0 -1
- package/dist/@codegen/whirlpools/types/RemainingAccountsInfo.d.ts +0 -52
- package/dist/@codegen/whirlpools/types/RemainingAccountsInfo.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/RemainingAccountsInfo.js.map +0 -1
- package/dist/@codegen/whirlpools/types/RemainingAccountsSlice.d.ts +0 -51
- package/dist/@codegen/whirlpools/types/RemainingAccountsSlice.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/RemainingAccountsSlice.js.map +0 -1
- package/dist/@codegen/whirlpools/types/Tick.d.ts +0 -48
- package/dist/@codegen/whirlpools/types/Tick.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/Tick.js.map +0 -1
- package/dist/@codegen/whirlpools/types/TickLabel.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/TickLabel.js.map +0 -1
- package/dist/@codegen/whirlpools/types/WhirlpoolBumps.d.ts +0 -22
- package/dist/@codegen/whirlpools/types/WhirlpoolBumps.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/WhirlpoolBumps.js.map +0 -1
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.d.ts +0 -44
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.js +0 -108
- package/dist/@codegen/whirlpools/types/WhirlpoolRewardInfo.js.map +0 -1
- package/dist/@codegen/whirlpools/types/index.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/types/index.js.map +0 -1
- package/dist/@codegen/whirlpools/utils/borshAddress.d.ts +0 -4
- package/dist/@codegen/whirlpools/utils/borshAddress.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/utils/borshAddress.js +0 -30
- package/dist/@codegen/whirlpools/utils/borshAddress.js.map +0 -1
- package/dist/@codegen/whirlpools/utils/index.d.ts +0 -2
- package/dist/@codegen/whirlpools/utils/index.d.ts.map +0 -1
- package/dist/@codegen/whirlpools/utils/index.js +0 -18
- package/dist/@codegen/whirlpools/utils/index.js.map +0 -1
- package/dist/utils/compat.d.ts +0 -4
- package/dist/utils/compat.d.ts.map +0 -1
- package/dist/utils/compat.js +0 -8
- package/dist/utils/compat.js.map +0 -1
- package/dist/utils/jupiter.d.ts +0 -9
- package/dist/utils/jupiter.d.ts.map +0 -1
- package/dist/utils/jupiter.js +0 -32
- package/dist/utils/jupiter.js.map +0 -1
- package/dist/utils/whirlpools.d.ts +0 -14
- package/dist/utils/whirlpools.d.ts.map +0 -1
- package/dist/utils/whirlpools.js +0 -72
- package/dist/utils/whirlpools.js.map +0 -1
- package/src/@codegen/kliquidity/accounts/CollateralInfos.ts +0 -106
- package/src/@codegen/kliquidity/accounts/GlobalConfig.ts +0 -301
- package/src/@codegen/kliquidity/accounts/PersonalPositionState.ts +0 -226
- package/src/@codegen/kliquidity/accounts/PoolState.ts +0 -480
- package/src/@codegen/kliquidity/accounts/Position.ts +0 -180
- package/src/@codegen/kliquidity/accounts/ProtocolPositionState.ts +0 -212
- package/src/@codegen/kliquidity/accounts/ScopeChainAccount.ts +0 -100
- package/src/@codegen/kliquidity/accounts/TermsSignature.ts +0 -100
- package/src/@codegen/kliquidity/accounts/Whirlpool.ts +0 -253
- package/src/@codegen/kliquidity/accounts/WhirlpoolStrategy.ts +0 -929
- package/src/@codegen/kliquidity/errors/index.ts +0 -68
- package/src/@codegen/kliquidity/instructions/addKaminoRewards.ts +0 -68
- package/src/@codegen/kliquidity/instructions/changePool.ts +0 -51
- package/src/@codegen/kliquidity/instructions/checkExpectedVaultsBalances.ts +0 -56
- package/src/@codegen/kliquidity/instructions/closeProgramAccount.ts +0 -45
- package/src/@codegen/kliquidity/instructions/closeStrategy.ts +0 -115
- package/src/@codegen/kliquidity/instructions/collectFeesAndRewards.ts +0 -105
- package/src/@codegen/kliquidity/instructions/deposit.ts +0 -96
- package/src/@codegen/kliquidity/instructions/depositAndInvest.ts +0 -115
- package/src/@codegen/kliquidity/instructions/emergencySwap.ts +0 -101
- package/src/@codegen/kliquidity/instructions/executiveWithdraw.ts +0 -101
- package/src/@codegen/kliquidity/instructions/flashSwapUnevenVaultsEnd.ts +0 -102
- package/src/@codegen/kliquidity/instructions/flashSwapUnevenVaultsStart.ts +0 -98
- package/src/@codegen/kliquidity/instructions/index.ts +0 -135
- package/src/@codegen/kliquidity/instructions/initializeCollateralInfo.ts +0 -43
- package/src/@codegen/kliquidity/instructions/initializeGlobalConfig.ts +0 -41
- package/src/@codegen/kliquidity/instructions/initializeKaminoReward.ts +0 -78
- package/src/@codegen/kliquidity/instructions/initializeSharesMetadata.ts +0 -75
- package/src/@codegen/kliquidity/instructions/initializeStrategy.ts +0 -92
- package/src/@codegen/kliquidity/instructions/insertCollateralInfo.ts +0 -60
- package/src/@codegen/kliquidity/instructions/invest.ts +0 -85
- package/src/@codegen/kliquidity/instructions/openLiquidityPosition.ts +0 -129
- package/src/@codegen/kliquidity/instructions/orcaSwap.ts +0 -93
- package/src/@codegen/kliquidity/instructions/permisionlessWithdrawFromTreasury.ts +0 -45
- package/src/@codegen/kliquidity/instructions/signTerms.ts +0 -53
- package/src/@codegen/kliquidity/instructions/singleTokenDepositAndInvestWithMin.ts +0 -115
- package/src/@codegen/kliquidity/instructions/singleTokenDepositWithMin.ts +0 -96
- package/src/@codegen/kliquidity/instructions/swapRewards.ts +0 -107
- package/src/@codegen/kliquidity/instructions/updateCollateralInfo.ts +0 -63
- package/src/@codegen/kliquidity/instructions/updateGlobalConfig.ts +0 -63
- package/src/@codegen/kliquidity/instructions/updateRewardMapping.ts +0 -76
- package/src/@codegen/kliquidity/instructions/updateSharesMetadata.ts +0 -71
- package/src/@codegen/kliquidity/instructions/updateStrategyAdmin.ts +0 -39
- package/src/@codegen/kliquidity/instructions/updateStrategyConfig.ts +0 -64
- package/src/@codegen/kliquidity/instructions/updateTreasuryFeeVault.ts +0 -63
- package/src/@codegen/kliquidity/instructions/withdraw.ts +0 -105
- package/src/@codegen/kliquidity/instructions/withdrawFromTopup.ts +0 -55
- package/src/@codegen/kliquidity/instructions/withdrawFromTreasury.ts +0 -67
- package/src/@codegen/kliquidity/programId.ts +0 -9
- package/src/@codegen/kliquidity/types/BalanceStatus.ts +0 -91
- package/src/@codegen/kliquidity/types/BinAddLiquidityStrategy.ts +0 -190
- package/src/@codegen/kliquidity/types/CollateralInfo.ts +0 -185
- package/src/@codegen/kliquidity/types/CollateralInfoParams.ts +0 -167
- package/src/@codegen/kliquidity/types/CollateralTestToken.ts +0 -871
- package/src/@codegen/kliquidity/types/CreationStatus.ts +0 -181
- package/src/@codegen/kliquidity/types/DEX.ts +0 -119
- package/src/@codegen/kliquidity/types/DexSpecificPrice.ts +0 -117
- package/src/@codegen/kliquidity/types/DriftDirection.ts +0 -91
- package/src/@codegen/kliquidity/types/ExecutiveWithdrawAction.ts +0 -121
- package/src/@codegen/kliquidity/types/ExpanderStep.ts +0 -102
- package/src/@codegen/kliquidity/types/GlobalConfigOption.ts +0 -721
- package/src/@codegen/kliquidity/types/KaminoRewardInfo.ts +0 -131
- package/src/@codegen/kliquidity/types/LiquidityCalculationMode.ts +0 -91
- package/src/@codegen/kliquidity/types/MintingMethod.ts +0 -91
- package/src/@codegen/kliquidity/types/PeriodicRebalanceState.ts +0 -54
- package/src/@codegen/kliquidity/types/PositionRewardInfo.ts +0 -65
- package/src/@codegen/kliquidity/types/Price.ts +0 -62
- package/src/@codegen/kliquidity/types/RebalanceAction.ts +0 -167
- package/src/@codegen/kliquidity/types/RebalanceAutodriftParams.ts +0 -123
- package/src/@codegen/kliquidity/types/RebalanceAutodriftState.ts +0 -85
- package/src/@codegen/kliquidity/types/RebalanceAutodriftStep.ts +0 -91
- package/src/@codegen/kliquidity/types/RebalanceAutodriftWindow.ts +0 -107
- package/src/@codegen/kliquidity/types/RebalanceDriftParams.ts +0 -95
- package/src/@codegen/kliquidity/types/RebalanceDriftState.ts +0 -77
- package/src/@codegen/kliquidity/types/RebalanceDriftStep.ts +0 -91
- package/src/@codegen/kliquidity/types/RebalanceEffects.ts +0 -105
- package/src/@codegen/kliquidity/types/RebalanceExpanderState.ts +0 -65
- package/src/@codegen/kliquidity/types/RebalanceManualState.ts +0 -38
- package/src/@codegen/kliquidity/types/RebalancePricePercentageState.ts +0 -70
- package/src/@codegen/kliquidity/types/RebalancePricePercentageWithResetState.ts +0 -78
- package/src/@codegen/kliquidity/types/RebalanceRaw.ts +0 -77
- package/src/@codegen/kliquidity/types/RebalanceTakeProfitState.ts +0 -57
- package/src/@codegen/kliquidity/types/RebalanceTakeProfitStep.ts +0 -121
- package/src/@codegen/kliquidity/types/RebalanceTakeProfitToken.ts +0 -88
- package/src/@codegen/kliquidity/types/RebalanceType.ts +0 -271
- package/src/@codegen/kliquidity/types/ReferencePriceType.ts +0 -91
- package/src/@codegen/kliquidity/types/RemoveLiquidityMode.ts +0 -147
- package/src/@codegen/kliquidity/types/RewardInfo.ts +0 -191
- package/src/@codegen/kliquidity/types/ScopePriceIdTest.ts +0 -2131
- package/src/@codegen/kliquidity/types/SimulationPrice.ts +0 -147
- package/src/@codegen/kliquidity/types/StakingRateSource.ts +0 -91
- package/src/@codegen/kliquidity/types/StrategyConfigOption.ts +0 -1591
- package/src/@codegen/kliquidity/types/StrategyStatus.ts +0 -181
- package/src/@codegen/kliquidity/types/StrategyType.ts +0 -119
- package/src/@codegen/kliquidity/types/SwapLimit.ts +0 -158
- package/src/@codegen/kliquidity/types/UpdateCollateralInfoMode.ts +0 -421
- package/src/@codegen/kliquidity/types/WhirlpoolRewardInfo.ts +0 -119
- package/src/@codegen/kliquidity/types/WithdrawalCapAccumulatorAction.ts +0 -93
- package/src/@codegen/kliquidity/types/WithdrawalCaps.ts +0 -86
- package/src/@codegen/kliquidity/utils/borshAddress.ts +0 -43
- package/src/@codegen/kliquidity/utils/index.ts +0 -1
- package/src/@codegen/meteora/accounts/BinArray.ts +0 -145
- package/src/@codegen/meteora/accounts/BinArrayBitmapExtension.ts +0 -130
- package/src/@codegen/meteora/accounts/LbPair.ts +0 -412
- package/src/@codegen/meteora/accounts/Oracle.ts +0 -125
- package/src/@codegen/meteora/accounts/Position.ts +0 -240
- package/src/@codegen/meteora/accounts/PositionV2.ts +0 -288
- package/src/@codegen/meteora/accounts/PresetParameter.ts +0 -202
- package/src/@codegen/meteora/errors/index.ts +0 -68
- package/src/@codegen/meteora/instructions/addLiquidity.ts +0 -83
- package/src/@codegen/meteora/instructions/addLiquidityByStrategy.ts +0 -83
- package/src/@codegen/meteora/instructions/addLiquidityByStrategyOneSide.ts +0 -75
- package/src/@codegen/meteora/instructions/addLiquidityByWeight.ts +0 -83
- package/src/@codegen/meteora/instructions/addLiquidityOneSide.ts +0 -75
- package/src/@codegen/meteora/instructions/addLiquidityOneSidePrecise.ts +0 -75
- package/src/@codegen/meteora/instructions/claimFee.ts +0 -59
- package/src/@codegen/meteora/instructions/claimReward.ts +0 -67
- package/src/@codegen/meteora/instructions/closePosition.ts +0 -47
- package/src/@codegen/meteora/instructions/closePresetParameter.ts +0 -37
- package/src/@codegen/meteora/instructions/fundReward.ts +0 -71
- package/src/@codegen/meteora/instructions/goToABin.ts +0 -63
- package/src/@codegen/meteora/instructions/increaseOracleLength.ts +0 -55
- package/src/@codegen/meteora/instructions/initializeBinArray.ts +0 -53
- package/src/@codegen/meteora/instructions/initializeBinArrayBitmapExtension.ts +0 -42
- package/src/@codegen/meteora/instructions/initializeLbPair.ts +0 -80
- package/src/@codegen/meteora/instructions/initializePermissionLbPair.ts +0 -77
- package/src/@codegen/meteora/instructions/initializePosition.ts +0 -66
- package/src/@codegen/meteora/instructions/initializePositionByOperator.ts +0 -75
- package/src/@codegen/meteora/instructions/initializePositionPda.ts +0 -69
- package/src/@codegen/meteora/instructions/initializePresetParameter.ts +0 -53
- package/src/@codegen/meteora/instructions/initializeReward.ts +0 -71
- package/src/@codegen/meteora/instructions/migrateBinArray.ts +0 -33
- package/src/@codegen/meteora/instructions/migratePosition.ts +0 -55
- package/src/@codegen/meteora/instructions/removeAllLiquidity.ts +0 -65
- package/src/@codegen/meteora/instructions/removeLiquidity.ts +0 -83
- package/src/@codegen/meteora/instructions/removeLiquidityByRange.ts +0 -87
- package/src/@codegen/meteora/instructions/setActivationSlot.ts +0 -49
- package/src/@codegen/meteora/instructions/setLockReleaseSlot.ts +0 -55
- package/src/@codegen/meteora/instructions/setPreActivationSlotDuration.ts +0 -49
- package/src/@codegen/meteora/instructions/setPreActivationSwapAddress.ts +0 -49
- package/src/@codegen/meteora/instructions/swap.ts +0 -84
- package/src/@codegen/meteora/instructions/togglePairStatus.ts +0 -35
- package/src/@codegen/meteora/instructions/updateFeeOwner.ts +0 -37
- package/src/@codegen/meteora/instructions/updateFeeParameters.ts +0 -53
- package/src/@codegen/meteora/instructions/updateFeesAndRewards.ts +0 -41
- package/src/@codegen/meteora/instructions/updatePositionOperator.ts +0 -53
- package/src/@codegen/meteora/instructions/updateRewardDuration.ts +0 -60
- package/src/@codegen/meteora/instructions/updateRewardFunder.ts +0 -58
- package/src/@codegen/meteora/instructions/updateWhitelistedWallet.ts +0 -49
- package/src/@codegen/meteora/instructions/withdrawIneligibleReward.ts +0 -63
- package/src/@codegen/meteora/instructions/withdrawProtocolFee.ts +0 -65
- package/src/@codegen/meteora/programId.ts +0 -9
- package/src/@codegen/meteora/types/AddLiquiditySingleSidePreciseParameter.ts +0 -80
- package/src/@codegen/meteora/types/Bin.ts +0 -162
- package/src/@codegen/meteora/types/BinLiquidityDistribution.ts +0 -86
- package/src/@codegen/meteora/types/BinLiquidityDistributionByWeight.ts +0 -70
- package/src/@codegen/meteora/types/BinLiquidityReduction.ts +0 -65
- package/src/@codegen/meteora/types/CompressedBinDepositAmount.ts +0 -64
- package/src/@codegen/meteora/types/FeeInfo.ts +0 -86
- package/src/@codegen/meteora/types/FeeParameter.ts +0 -71
- package/src/@codegen/meteora/types/InitPermissionPairIx.ts +0 -104
- package/src/@codegen/meteora/types/InitPresetParametersIx.ts +0 -170
- package/src/@codegen/meteora/types/LayoutVersion.ts +0 -88
- package/src/@codegen/meteora/types/LiquidityOneSideParameter.ts +0 -113
- package/src/@codegen/meteora/types/LiquidityParameter.ts +0 -96
- package/src/@codegen/meteora/types/LiquidityParameterByStrategy.ts +0 -120
- package/src/@codegen/meteora/types/LiquidityParameterByStrategyOneSide.ts +0 -108
- package/src/@codegen/meteora/types/LiquidityParameterByWeight.ts +0 -125
- package/src/@codegen/meteora/types/Observation.ts +0 -86
- package/src/@codegen/meteora/types/PairStatus.ts +0 -89
- package/src/@codegen/meteora/types/PairType.ts +0 -89
- package/src/@codegen/meteora/types/ProtocolFee.ts +0 -62
- package/src/@codegen/meteora/types/RewardInfo.ts +0 -153
- package/src/@codegen/meteora/types/Rounding.ts +0 -86
- package/src/@codegen/meteora/types/StaticParameters.ts +0 -171
- package/src/@codegen/meteora/types/StrategyParameters.ts +0 -98
- package/src/@codegen/meteora/types/StrategyType.ts +0 -299
- package/src/@codegen/meteora/types/UserRewardInfo.ts +0 -72
- package/src/@codegen/meteora/types/VariableParameters.ts +0 -132
- package/src/@codegen/meteora/utils/borshAddress.ts +0 -43
- package/src/@codegen/meteora/utils/index.ts +0 -1
- package/src/@codegen/raydium/accounts/AmmConfig.ts +0 -172
- package/src/@codegen/raydium/accounts/ObservationState.ts +0 -132
- package/src/@codegen/raydium/accounts/OperationState.ts +0 -116
- package/src/@codegen/raydium/accounts/PersonalPositionState.ts +0 -196
- package/src/@codegen/raydium/accounts/PoolState.ts +0 -396
- package/src/@codegen/raydium/accounts/ProtocolPositionState.ts +0 -182
- package/src/@codegen/raydium/accounts/TickArrayBitmapExtension.ts +0 -124
- package/src/@codegen/raydium/accounts/TickArrayState.ts +0 -136
- package/src/@codegen/raydium/errors/index.ts +0 -68
- package/src/@codegen/raydium/instructions/closePosition.ts +0 -43
- package/src/@codegen/raydium/instructions/collectFundFee.ts +0 -72
- package/src/@codegen/raydium/instructions/collectProtocolFee.ts +0 -72
- package/src/@codegen/raydium/instructions/collectRemainingRewards.ts +0 -65
- package/src/@codegen/raydium/instructions/createAmmConfig.ts +0 -65
- package/src/@codegen/raydium/instructions/createOperationAccount.ts +0 -37
- package/src/@codegen/raydium/instructions/createPool.ts +0 -80
- package/src/@codegen/raydium/instructions/decreaseLiquidity.ts +0 -77
- package/src/@codegen/raydium/instructions/decreaseLiquidityV2.ts +0 -85
- package/src/@codegen/raydium/instructions/increaseLiquidity.ts +0 -77
- package/src/@codegen/raydium/instructions/increaseLiquidityV2.ts +0 -86
- package/src/@codegen/raydium/instructions/initializeReward.ts +0 -71
- package/src/@codegen/raydium/instructions/openPosition.ts +0 -107
- package/src/@codegen/raydium/instructions/openPositionV2.ts +0 -119
- package/src/@codegen/raydium/instructions/setRewardParams.ts +0 -72
- package/src/@codegen/raydium/instructions/swap.ts +0 -76
- package/src/@codegen/raydium/instructions/swapRouterBaseIn.ts +0 -62
- package/src/@codegen/raydium/instructions/swapV2.ts +0 -82
- package/src/@codegen/raydium/instructions/transferRewardOwner.ts +0 -53
- package/src/@codegen/raydium/instructions/updateAmmConfig.ts +0 -51
- package/src/@codegen/raydium/instructions/updateOperationAccount.ts +0 -56
- package/src/@codegen/raydium/instructions/updatePoolStatus.ts +0 -53
- package/src/@codegen/raydium/instructions/updateRewardInfos.ts +0 -33
- package/src/@codegen/raydium/programId.ts +0 -9
- package/src/@codegen/raydium/types/InitializeRewardParam.ts +0 -77
- package/src/@codegen/raydium/types/Observation.ts +0 -86
- package/src/@codegen/raydium/types/PoolStatusBitFlag.ts +0 -91
- package/src/@codegen/raydium/types/PoolStatusBitIndex.ts +0 -181
- package/src/@codegen/raydium/types/PositionRewardInfo.ts +0 -65
- package/src/@codegen/raydium/types/RewardInfo.ts +0 -149
- package/src/@codegen/raydium/types/RewardState.ts +0 -149
- package/src/@codegen/raydium/types/TickState.ts +0 -117
- package/src/@codegen/raydium/utils/borshAddress.ts +0 -43
- package/src/@codegen/raydium/utils/index.ts +0 -1
- package/src/@codegen/whirlpools/accounts/FeeTier.ts +0 -116
- package/src/@codegen/whirlpools/accounts/Position.ts +0 -180
- package/src/@codegen/whirlpools/accounts/PositionBundle.ts +0 -108
- package/src/@codegen/whirlpools/accounts/TickArray.ts +0 -120
- package/src/@codegen/whirlpools/accounts/TokenBadge.ts +0 -108
- package/src/@codegen/whirlpools/accounts/Whirlpool.ts +0 -252
- package/src/@codegen/whirlpools/accounts/WhirlpoolsConfig.ts +0 -124
- package/src/@codegen/whirlpools/accounts/WhirlpoolsConfigExtension.ts +0 -118
- package/src/@codegen/whirlpools/errors/index.ts +0 -68
- package/src/@codegen/whirlpools/instructions/closeBundledPosition.ts +0 -59
- package/src/@codegen/whirlpools/instructions/closePosition.ts +0 -47
- package/src/@codegen/whirlpools/instructions/collectFees.ts +0 -53
- package/src/@codegen/whirlpools/instructions/collectFeesV2.ts +0 -82
- package/src/@codegen/whirlpools/instructions/collectProtocolFees.ts +0 -51
- package/src/@codegen/whirlpools/instructions/collectProtocolFeesV2.ts +0 -80
- package/src/@codegen/whirlpools/instructions/collectReward.ts +0 -63
- package/src/@codegen/whirlpools/instructions/collectRewardV2.ts +0 -77
- package/src/@codegen/whirlpools/instructions/decreaseLiquidity.ts +0 -79
- package/src/@codegen/whirlpools/instructions/decreaseLiquidityV2.ts +0 -95
- package/src/@codegen/whirlpools/instructions/deletePositionBundle.ts +0 -47
- package/src/@codegen/whirlpools/instructions/deleteTokenBadge.ts +0 -47
- package/src/@codegen/whirlpools/instructions/increaseLiquidity.ts +0 -79
- package/src/@codegen/whirlpools/instructions/increaseLiquidityV2.ts +0 -95
- package/src/@codegen/whirlpools/instructions/initializeConfig.ts +0 -62
- package/src/@codegen/whirlpools/instructions/initializeConfigExtension.ts +0 -45
- package/src/@codegen/whirlpools/instructions/initializeFeeTier.ts +0 -64
- package/src/@codegen/whirlpools/instructions/initializePool.ts +0 -83
- package/src/@codegen/whirlpools/instructions/initializePoolV2.ts +0 -86
- package/src/@codegen/whirlpools/instructions/initializePositionBundle.ts +0 -53
- package/src/@codegen/whirlpools/instructions/initializePositionBundleWithMetadata.ts +0 -59
- package/src/@codegen/whirlpools/instructions/initializeReward.ts +0 -69
- package/src/@codegen/whirlpools/instructions/initializeRewardV2.ts +0 -71
- package/src/@codegen/whirlpools/instructions/initializeTickArray.ts +0 -53
- package/src/@codegen/whirlpools/instructions/initializeTokenBadge.ts +0 -49
- package/src/@codegen/whirlpools/instructions/openBundledPosition.ts +0 -73
- package/src/@codegen/whirlpools/instructions/openPosition.ts +0 -77
- package/src/@codegen/whirlpools/instructions/openPositionWithMetadata.ts +0 -83
- package/src/@codegen/whirlpools/instructions/setCollectProtocolFeesAuthority.ts +0 -41
- package/src/@codegen/whirlpools/instructions/setConfigExtensionAuthority.ts +0 -43
- package/src/@codegen/whirlpools/instructions/setDefaultFeeRate.ts +0 -55
- package/src/@codegen/whirlpools/instructions/setDefaultProtocolFeeRate.ts +0 -53
- package/src/@codegen/whirlpools/instructions/setFeeAuthority.ts +0 -41
- package/src/@codegen/whirlpools/instructions/setFeeRate.ts +0 -55
- package/src/@codegen/whirlpools/instructions/setProtocolFeeRate.ts +0 -55
- package/src/@codegen/whirlpools/instructions/setRewardAuthority.ts +0 -55
- package/src/@codegen/whirlpools/instructions/setRewardAuthorityBySuperAuthority.ts +0 -57
- package/src/@codegen/whirlpools/instructions/setRewardEmissions.ts +0 -60
- package/src/@codegen/whirlpools/instructions/setRewardEmissionsSuperAuthority.ts +0 -41
- package/src/@codegen/whirlpools/instructions/setRewardEmissionsV2.ts +0 -60
- package/src/@codegen/whirlpools/instructions/setTokenBadgeAuthority.ts +0 -43
- package/src/@codegen/whirlpools/instructions/swap.ts +0 -85
- package/src/@codegen/whirlpools/instructions/swapV2.ts +0 -101
- package/src/@codegen/whirlpools/instructions/twoHopSwap.ts +0 -109
- package/src/@codegen/whirlpools/instructions/twoHopSwapV2.ts +0 -125
- package/src/@codegen/whirlpools/instructions/updateFeesAndRewards.ts +0 -39
- package/src/@codegen/whirlpools/programId.ts +0 -9
- package/src/@codegen/whirlpools/types/AccountsType.ts +0 -209
- package/src/@codegen/whirlpools/types/CurrIndex.ts +0 -119
- package/src/@codegen/whirlpools/types/Direction.ts +0 -89
- package/src/@codegen/whirlpools/types/OpenPositionBumps.ts +0 -54
- package/src/@codegen/whirlpools/types/OpenPositionWithMetadataBumps.ts +0 -67
- package/src/@codegen/whirlpools/types/PositionRewardInfo.ts +0 -65
- package/src/@codegen/whirlpools/types/RemainingAccountsInfo.ts +0 -67
- package/src/@codegen/whirlpools/types/RemainingAccountsSlice.ts +0 -65
- package/src/@codegen/whirlpools/types/Tick.ts +0 -108
- package/src/@codegen/whirlpools/types/TickLabel.ts +0 -89
- package/src/@codegen/whirlpools/types/WhirlpoolBumps.ts +0 -54
- package/src/@codegen/whirlpools/types/WhirlpoolRewardInfo.ts +0 -95
- package/src/@codegen/whirlpools/utils/borshAddress.ts +0 -43
- package/src/@codegen/whirlpools/utils/index.ts +0 -1
- package/src/utils/compat.ts +0 -6
- package/src/utils/jupiter.ts +0 -30
- package/src/utils/whirlpools.ts +0 -119
- /package/dist/{@codegen/kliquidity → kamino-client}/accounts/index.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/accounts/index.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/errors/anchor.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/errors/anchor.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/errors/custom.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/errors/custom.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/BalanceStatus.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/BalanceStatus.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/BinAddLiquidityStrategy.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/BinAddLiquidityStrategy.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/CollateralTestToken.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/CollateralTestToken.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/CreationStatus.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/CreationStatus.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/DEX.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/DEX.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/DexSpecificPrice.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/DexSpecificPrice.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/DriftDirection.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/DriftDirection.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ExecutiveWithdrawAction.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ExecutiveWithdrawAction.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ExpanderStep.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ExpanderStep.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/GlobalConfigOption.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/GlobalConfigOption.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/LiquidityCalculationMode.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/LiquidityCalculationMode.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/MintingMethod.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/MintingMethod.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/PeriodicRebalanceState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/PositionRewardInfo.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/Price.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAction.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAction.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAutodriftParams.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAutodriftState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAutodriftStep.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAutodriftStep.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceAutodriftWindow.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceDriftParams.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceDriftState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceDriftStep.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceDriftStep.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceEffects.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceEffects.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceExpanderState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceManualState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalancePricePercentageState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalancePricePercentageWithResetState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceRaw.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceTakeProfitState.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceTakeProfitStep.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceTakeProfitStep.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceTakeProfitToken.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceTakeProfitToken.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceType.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RebalanceType.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ReferencePriceType.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ReferencePriceType.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RemoveLiquidityMode.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/RemoveLiquidityMode.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ScopePriceIdTest.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/ScopePriceIdTest.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/SimulationPrice.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/SimulationPrice.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StakingRateSource.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StakingRateSource.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StrategyConfigOption.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StrategyConfigOption.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StrategyStatus.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StrategyStatus.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StrategyType.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/StrategyType.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/SwapLimit.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/SwapLimit.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/UpdateCollateralInfoMode.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/UpdateCollateralInfoMode.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/WithdrawalCapAccumulatorAction.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/WithdrawalCapAccumulatorAction.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/WithdrawalCaps.js +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/index.d.ts +0 -0
- /package/dist/{@codegen/kliquidity → kamino-client}/types/index.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/accounts/index.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/accounts/index.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/errors/anchor.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/errors/anchor.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/errors/custom.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/errors/custom.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/instructions/index.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/instructions/index.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/AddLiquiditySingleSidePreciseParameter.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/Bin.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/BinLiquidityDistribution.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/BinLiquidityDistributionByWeight.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/BinLiquidityReduction.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/CompressedBinDepositAmount.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/FeeInfo.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/FeeParameter.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/InitPermissionPairIx.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/InitPresetParametersIx.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LayoutVersion.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LayoutVersion.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LiquidityOneSideParameter.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LiquidityParameter.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LiquidityParameterByStrategy.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LiquidityParameterByStrategyOneSide.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/LiquidityParameterByWeight.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/Observation.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/PairStatus.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/PairStatus.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/PairType.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/PairType.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/ProtocolFee.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/Rounding.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/Rounding.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/StaticParameters.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/StrategyParameters.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/StrategyType.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/StrategyType.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/UserRewardInfo.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/VariableParameters.js +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/index.d.ts +0 -0
- /package/dist/{@codegen/meteora → meteora_client}/types/index.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/accounts/index.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/accounts/index.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/errors/anchor.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/errors/anchor.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/errors/custom.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/errors/custom.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/instructions/index.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/instructions/index.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/InitializeRewardParam.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/Observation.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/PoolStatusBitFlag.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/PoolStatusBitFlag.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/PoolStatusBitIndex.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/PoolStatusBitIndex.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/PositionRewardInfo.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/RewardState.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/RewardState.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/TickState.js +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/index.d.ts +0 -0
- /package/dist/{@codegen/raydium → raydium_client}/types/index.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/accounts/index.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/accounts/index.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/errors/anchor.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/errors/anchor.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/errors/custom.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/errors/custom.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/instructions/index.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/instructions/index.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/AccountsType.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/AccountsType.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/CurrIndex.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/CurrIndex.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/Direction.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/Direction.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/OpenPositionBumps.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/OpenPositionWithMetadataBumps.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/PositionRewardInfo.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/RemainingAccountsInfo.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/RemainingAccountsSlice.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/Tick.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/TickLabel.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/TickLabel.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/WhirlpoolBumps.js +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/index.d.ts +0 -0
- /package/dist/{@codegen/whirlpools → whirlpools-client}/types/index.js +0 -0
- /package/src/{@codegen/kliquidity → kamino-client}/accounts/index.ts +0 -0
- /package/src/{@codegen/kliquidity → kamino-client}/errors/anchor.ts +0 -0
- /package/src/{@codegen/kliquidity → kamino-client}/errors/custom.ts +0 -0
- /package/src/{@codegen/kliquidity → kamino-client}/types/index.ts +0 -0
- /package/src/{@codegen/meteora → meteora_client}/accounts/index.ts +0 -0
- /package/src/{@codegen/meteora → meteora_client}/errors/anchor.ts +0 -0
- /package/src/{@codegen/meteora → meteora_client}/errors/custom.ts +0 -0
- /package/src/{@codegen/meteora → meteora_client}/instructions/index.ts +0 -0
- /package/src/{@codegen/meteora → meteora_client}/types/index.ts +0 -0
- /package/src/{@codegen/raydium → raydium_client}/accounts/index.ts +0 -0
- /package/src/{@codegen/raydium → raydium_client}/errors/anchor.ts +0 -0
- /package/src/{@codegen/raydium → raydium_client}/errors/custom.ts +0 -0
- /package/src/{@codegen/raydium → raydium_client}/instructions/index.ts +0 -0
- /package/src/{@codegen/raydium → raydium_client}/types/index.ts +0 -0
- /package/src/{@codegen/whirlpools → whirlpools-client}/accounts/index.ts +0 -0
- /package/src/{@codegen/whirlpools → whirlpools-client}/errors/anchor.ts +0 -0
- /package/src/{@codegen/whirlpools → whirlpools-client}/errors/custom.ts +0 -0
- /package/src/{@codegen/whirlpools → whirlpools-client}/instructions/index.ts +0 -0
- /package/src/{@codegen/whirlpools → whirlpools-client}/types/index.ts +0 -0
package/dist/Kamino.js
CHANGED
|
@@ -3,65 +3,70 @@ 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 = void 0;
|
|
6
|
+
exports.Kamino = exports.KAMINO_IDL = void 0;
|
|
7
7
|
const hubble_config_1 = require("@hubbleprotocol/hubble-config");
|
|
8
|
-
const
|
|
8
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
9
9
|
const bs58_1 = __importDefault(require("bs58"));
|
|
10
|
-
const
|
|
10
|
+
const programId_1 = require("./kamino-client/programId");
|
|
11
|
+
const accounts_1 = require("./kamino-client/accounts");
|
|
11
12
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
12
|
-
const
|
|
13
|
-
const accounts_2 = require("./@codegen/whirlpools/accounts");
|
|
13
|
+
const whirlpools_client_1 = require("./whirlpools-client");
|
|
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");
|
|
18
19
|
const scope_sdk_1 = require("@kamino-finance/scope-sdk");
|
|
19
20
|
const utils_1 = require("./utils");
|
|
20
|
-
const
|
|
21
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
22
|
+
const instructions_1 = require("./kamino-client/instructions");
|
|
21
23
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
22
|
-
const
|
|
24
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
25
|
+
const StrategyStatus_1 = require("./kamino-client/types/StrategyStatus");
|
|
23
26
|
const constants_1 = require("./constants");
|
|
24
|
-
const types_1 = require("
|
|
25
|
-
const
|
|
27
|
+
const types_1 = require("./kamino-client/types");
|
|
28
|
+
const raydium_client_1 = require("./raydium_client");
|
|
29
|
+
const programId_3 = require("./raydium_client/programId");
|
|
30
|
+
const idl_json_1 = __importDefault(require("./kamino-client/idl.json"));
|
|
26
31
|
const services_1 = require("./services");
|
|
27
32
|
const add_liquidity_1 = require("@orca-so/whirlpool-sdk/dist/position/quotes/add-liquidity");
|
|
28
|
-
const
|
|
33
|
+
const instructions_2 = require("./kamino-client/instructions");
|
|
34
|
+
const StrategyConfigOption_1 = require("./kamino-client/types/StrategyConfigOption");
|
|
29
35
|
const DefaultStrategyConfig_1 = require("./constants/DefaultStrategyConfig");
|
|
30
36
|
const pubkeys_1 = require("./constants/pubkeys");
|
|
31
37
|
const CreationParameters_1 = require("./utils/CreationParameters");
|
|
32
38
|
const deposit_method_1 = require("./constants/deposit_method");
|
|
33
39
|
const JupService_1 = require("./services/JupService");
|
|
34
40
|
const PoolSimulationService_1 = require("./services/PoolSimulationService");
|
|
35
|
-
const RebalanceType_1 = require("
|
|
41
|
+
const RebalanceType_1 = require("./kamino-client/types/RebalanceType");
|
|
36
42
|
const transactions_1 = require("./utils/transactions");
|
|
37
43
|
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");
|
|
38
48
|
const priceReferenceTypes_1 = require("./utils/priceReferenceTypes");
|
|
39
49
|
const utils_2 = require("./rebalance_methods/utils");
|
|
40
50
|
const consts_1 = require("./rebalance_methods/consts");
|
|
41
51
|
const autodriftRebalance_1 = require("./rebalance_methods/autodriftRebalance");
|
|
42
|
-
const
|
|
52
|
+
const remove_liquidity_1 = require("./whirlpools-client/shim/remove-liquidity");
|
|
53
|
+
const programId_4 = require("./meteora_client/programId");
|
|
43
54
|
const MeteoraService_1 = require("./services/MeteoraService");
|
|
44
55
|
const meteora_1 = require("./utils/meteora");
|
|
45
|
-
const
|
|
46
|
-
const instructions_3 = require("
|
|
56
|
+
const accounts_2 = require("./meteora_client/accounts");
|
|
57
|
+
const instructions_3 = require("./meteora_client/instructions");
|
|
58
|
+
const pubkey_1 = require("./utils/pubkey");
|
|
47
59
|
const lib_1 = require("@raydium-io/raydium-sdk-v2/lib");
|
|
48
|
-
|
|
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)();
|
|
60
|
+
exports.KAMINO_IDL = idl_json_1.default;
|
|
57
61
|
class Kamino {
|
|
58
62
|
_cluster;
|
|
59
|
-
|
|
60
|
-
_legacyConnection;
|
|
63
|
+
_connection;
|
|
61
64
|
_config;
|
|
62
65
|
_globalConfig;
|
|
63
66
|
_scope;
|
|
64
|
-
|
|
67
|
+
_provider;
|
|
68
|
+
_kaminoProgram;
|
|
69
|
+
_kaminoProgramId;
|
|
65
70
|
_orcaService;
|
|
66
71
|
_raydiumService;
|
|
67
72
|
_meteoraService;
|
|
@@ -69,45 +74,56 @@ class Kamino {
|
|
|
69
74
|
/**
|
|
70
75
|
* Create a new instance of the Kamino SDK class.
|
|
71
76
|
* @param cluster Name of the Solana cluster
|
|
72
|
-
* @param
|
|
73
|
-
* @param legacyConnection Connection to the Solana cluster
|
|
77
|
+
* @param connection Connection to the Solana cluster
|
|
74
78
|
* @param globalConfig override kamino global config
|
|
75
79
|
* @param programId override kamino program id
|
|
76
80
|
* @param whirlpoolProgramId override whirlpool program id
|
|
77
81
|
* @param raydiumProgramId override raydium program id
|
|
78
|
-
* @param meteoraProgramId
|
|
79
|
-
* @param jupBaseAPI
|
|
80
82
|
*/
|
|
81
|
-
constructor(cluster,
|
|
83
|
+
constructor(cluster, connection, globalConfig, programId, whirlpoolProgramId, raydiumProgramId, meteoraProgramId, jupBaseAPI) {
|
|
82
84
|
this._cluster = cluster;
|
|
83
|
-
this.
|
|
84
|
-
this._legacyConnection = legacyConnection;
|
|
85
|
+
this._connection = connection;
|
|
85
86
|
this._config = (0, hubble_config_1.getConfigByCluster)(cluster);
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
this._provider = new anchor_1.AnchorProvider(connection, (0, utils_1.getReadOnlyWallet)(), {
|
|
88
|
+
commitment: connection.commitment,
|
|
89
|
+
});
|
|
90
|
+
if (programId && programId.equals(pubkeys_1.STAGING_KAMINO_PROGRAM_ID)) {
|
|
91
|
+
this._kaminoProgramId = programId;
|
|
88
92
|
this._globalConfig = pubkeys_1.STAGING_GLOBAL_CONFIG;
|
|
89
93
|
}
|
|
90
94
|
else {
|
|
91
|
-
this.
|
|
92
|
-
this._globalConfig = globalConfig ? globalConfig :
|
|
95
|
+
this._kaminoProgramId = programId ? programId : this._config.kamino.programId;
|
|
96
|
+
this._globalConfig = globalConfig ? globalConfig : new web3_js_1.PublicKey(this._config.kamino.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);
|
|
93
106
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.
|
|
107
|
+
if (meteoraProgramId) {
|
|
108
|
+
(0, programId_4.setMeteoraProgramId)(meteoraProgramId);
|
|
109
|
+
}
|
|
110
|
+
this._orcaService = new services_1.OrcaService(connection, cluster, whirlpoolProgramId);
|
|
111
|
+
this._raydiumService = new services_1.RaydiumService(connection, raydiumProgramId);
|
|
112
|
+
this._meteoraService = new MeteoraService_1.MeteoraService(connection, meteoraProgramId);
|
|
98
113
|
if (jupBaseAPI) {
|
|
99
114
|
this._jupBaseAPI = jupBaseAPI;
|
|
100
115
|
}
|
|
101
116
|
}
|
|
102
|
-
getConnection = () => this.
|
|
103
|
-
getProgramID = () => this.
|
|
117
|
+
getConnection = () => this._connection;
|
|
118
|
+
getProgramID = () => this._kaminoProgramId;
|
|
119
|
+
getProgram = () => this._kaminoProgram;
|
|
104
120
|
setGlobalConfig = (globalConfig) => {
|
|
105
121
|
this._globalConfig = globalConfig;
|
|
106
122
|
};
|
|
107
123
|
getGlobalConfig = () => this._globalConfig;
|
|
108
124
|
getDepositableTokens = async () => {
|
|
109
125
|
const collateralInfos = await this.getCollateralInfos();
|
|
110
|
-
return collateralInfos.filter((x) => x.mint
|
|
126
|
+
return collateralInfos.filter((x) => !x.mint.equals(web3_js_1.SystemProgram.programId));
|
|
111
127
|
};
|
|
112
128
|
getCollateralInfos = async () => {
|
|
113
129
|
const config = await this.getGlobalConfigState(this._globalConfig);
|
|
@@ -118,19 +134,19 @@ class Kamino {
|
|
|
118
134
|
};
|
|
119
135
|
getDisabledTokensPrices = async (collateralInfos) => {
|
|
120
136
|
const collInfos = collateralInfos ? collateralInfos : await this.getCollateralInfos();
|
|
121
|
-
const disabledTokens = collInfos.filter((x) => x.disabled && x.mint
|
|
137
|
+
const disabledTokens = collInfos.filter((x) => x.disabled && !x.mint.equals(web3_js_1.PublicKey.default));
|
|
122
138
|
return JupService_1.JupService.getDollarPrices(disabledTokens.map((x) => x.mint), this._jupBaseAPI);
|
|
123
139
|
};
|
|
124
140
|
getSupportedDexes = () => ['ORCA', 'RAYDIUM', 'METEORA'];
|
|
125
141
|
// todo: see if we can read this dynamically
|
|
126
142
|
getFeeTiersForDex = (dex) => {
|
|
127
|
-
if (dex
|
|
143
|
+
if (dex == 'ORCA') {
|
|
128
144
|
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)];
|
|
129
145
|
}
|
|
130
|
-
else if (dex
|
|
146
|
+
else if (dex == 'RAYDIUM') {
|
|
131
147
|
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)];
|
|
132
148
|
}
|
|
133
|
-
else if (dex
|
|
149
|
+
else if (dex == 'METEORA') {
|
|
134
150
|
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)];
|
|
135
151
|
}
|
|
136
152
|
else {
|
|
@@ -214,13 +230,13 @@ class Kamino {
|
|
|
214
230
|
getFieldsForManualRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
215
231
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
216
232
|
const defaultFields = (0, rebalance_methods_1.getDefaultManualRebalanceFieldInfos)(price);
|
|
217
|
-
let lowerPrice = defaultFields.find((x) => x.label
|
|
218
|
-
const lowerPriceInput = fieldOverrides.find((x) => x.label
|
|
233
|
+
let lowerPrice = defaultFields.find((x) => x.label == 'rangePriceLower').value;
|
|
234
|
+
const lowerPriceInput = fieldOverrides.find((x) => x.label == 'rangePriceLower');
|
|
219
235
|
if (lowerPriceInput) {
|
|
220
236
|
lowerPrice = lowerPriceInput.value;
|
|
221
237
|
}
|
|
222
|
-
let upperPrice = defaultFields.find((x) => x.label
|
|
223
|
-
const upperPriceInput = fieldOverrides.find((x) => x.label
|
|
238
|
+
let upperPrice = defaultFields.find((x) => x.label == 'rangePriceUpper').value;
|
|
239
|
+
const upperPriceInput = fieldOverrides.find((x) => x.label == 'rangePriceUpper');
|
|
224
240
|
if (upperPriceInput) {
|
|
225
241
|
upperPrice = upperPriceInput.value;
|
|
226
242
|
}
|
|
@@ -228,196 +244,196 @@ class Kamino {
|
|
|
228
244
|
};
|
|
229
245
|
getFieldsForPricePercentageMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
230
246
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
231
|
-
const defaultFields = (0,
|
|
232
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
233
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
247
|
+
const defaultFields = (0, rebalance_methods_2.getDefaultPricePercentageRebalanceFieldInfos)(price);
|
|
248
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label == 'lowerRangeBps').value;
|
|
249
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'lowerRangeBps');
|
|
234
250
|
if (lowerPriceDifferenceBPSInput) {
|
|
235
251
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
236
252
|
}
|
|
237
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
238
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
253
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label == 'upperRangeBps').value;
|
|
254
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'upperRangeBps');
|
|
239
255
|
if (upperPriceDifferenceBPSInput) {
|
|
240
256
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
241
257
|
}
|
|
242
|
-
return (0,
|
|
258
|
+
return (0, rebalance_methods_2.getPricePercentageRebalanceFieldInfos)(price, new decimal_js_1.default(lowerPriceDifferenceBPS), new decimal_js_1.default(upperPriceDifferenceBPS));
|
|
243
259
|
};
|
|
244
260
|
getFieldsForPricePercentageWithResetMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
245
261
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
246
|
-
const defaultFields = (0,
|
|
247
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
248
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
262
|
+
const defaultFields = (0, rebalance_methods_3.getDefaultPricePercentageWithResetRebalanceFieldInfos)(price);
|
|
263
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label == 'lowerRangeBps').value;
|
|
264
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'lowerRangeBps');
|
|
249
265
|
if (lowerPriceDifferenceBPSInput) {
|
|
250
266
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
251
267
|
}
|
|
252
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
253
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
268
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label == 'upperRangeBps').value;
|
|
269
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'upperRangeBps');
|
|
254
270
|
if (upperPriceDifferenceBPSInput) {
|
|
255
271
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
256
272
|
}
|
|
257
|
-
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
258
|
-
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
273
|
+
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label == 'resetLowerRangeBps').value;
|
|
274
|
+
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'resetLowerRangeBps');
|
|
259
275
|
if (lowerResetPriceDifferenceBPSInput) {
|
|
260
276
|
lowerResetPriceDifferenceBPS = lowerResetPriceDifferenceBPSInput.value;
|
|
261
277
|
}
|
|
262
|
-
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
263
|
-
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
278
|
+
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label == 'resetUpperRangeBps').value;
|
|
279
|
+
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'resetUpperRangeBps');
|
|
264
280
|
if (upperResetPriceDifferenceBPSInput) {
|
|
265
281
|
upperResetPriceDifferenceBPS = upperResetPriceDifferenceBPSInput.value;
|
|
266
282
|
}
|
|
267
|
-
return (0,
|
|
283
|
+
return (0, rebalance_methods_3.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));
|
|
268
284
|
};
|
|
269
285
|
getFieldsForDriftRebalanceMethod = async (dex, fieldOverrides, tickSpacing, tokenAMint, tokenBMint, poolPrice) => {
|
|
270
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
271
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
286
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenAMint);
|
|
287
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenBMint);
|
|
272
288
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
273
|
-
const defaultFields = (0,
|
|
274
|
-
let startMidTick = defaultFields.find((x) => x.label
|
|
275
|
-
const startMidTickInput = fieldOverrides.find((x) => x.label
|
|
289
|
+
const defaultFields = (0, rebalance_methods_4.getDefaultDriftRebalanceFieldInfos)(dex, tickSpacing, price, tokenADecimals, tokenBDecimals);
|
|
290
|
+
let startMidTick = defaultFields.find((x) => x.label == 'startMidTick').value;
|
|
291
|
+
const startMidTickInput = fieldOverrides.find((x) => x.label == 'startMidTick');
|
|
276
292
|
if (startMidTickInput) {
|
|
277
293
|
startMidTick = startMidTickInput.value;
|
|
278
294
|
}
|
|
279
|
-
let ticksBelowMid = defaultFields.find((x) => x.label
|
|
280
|
-
const ticksBelowMidInput = fieldOverrides.find((x) => x.label
|
|
295
|
+
let ticksBelowMid = defaultFields.find((x) => x.label == 'ticksBelowMid').value;
|
|
296
|
+
const ticksBelowMidInput = fieldOverrides.find((x) => x.label == 'ticksBelowMid');
|
|
281
297
|
if (ticksBelowMidInput) {
|
|
282
298
|
ticksBelowMid = ticksBelowMidInput.value;
|
|
283
299
|
}
|
|
284
|
-
let ticksAboveMid = defaultFields.find((x) => x.label
|
|
285
|
-
const ticksAboveMidInput = fieldOverrides.find((x) => x.label
|
|
300
|
+
let ticksAboveMid = defaultFields.find((x) => x.label == 'ticksAboveMid').value;
|
|
301
|
+
const ticksAboveMidInput = fieldOverrides.find((x) => x.label == 'ticksAboveMid');
|
|
286
302
|
if (ticksAboveMidInput) {
|
|
287
303
|
ticksAboveMid = ticksAboveMidInput.value;
|
|
288
304
|
}
|
|
289
|
-
let secondsPerTick = defaultFields.find((x) => x.label
|
|
290
|
-
const secondsPerTickInput = fieldOverrides.find((x) => x.label
|
|
305
|
+
let secondsPerTick = defaultFields.find((x) => x.label == 'secondsPerTick').value;
|
|
306
|
+
const secondsPerTickInput = fieldOverrides.find((x) => x.label == 'secondsPerTick');
|
|
291
307
|
if (secondsPerTickInput) {
|
|
292
308
|
secondsPerTick = secondsPerTickInput.value;
|
|
293
309
|
}
|
|
294
|
-
let direction = defaultFields.find((x) => x.label
|
|
295
|
-
const directionInput = fieldOverrides.find((x) => x.label
|
|
310
|
+
let direction = defaultFields.find((x) => x.label == 'direction').value;
|
|
311
|
+
const directionInput = fieldOverrides.find((x) => x.label == 'direction');
|
|
296
312
|
if (directionInput) {
|
|
297
313
|
direction = directionInput.value;
|
|
298
314
|
}
|
|
299
|
-
const fieldInfos = (0,
|
|
315
|
+
const fieldInfos = (0, rebalance_methods_4.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));
|
|
300
316
|
return fieldInfos;
|
|
301
317
|
};
|
|
302
318
|
getFieldsForTakeProfitRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
303
319
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
304
|
-
const defaultFields = (0,
|
|
305
|
-
let lowerRangePrice = defaultFields.find((x) => x.label
|
|
306
|
-
const lowerRangePriceInput = fieldOverrides.find((x) => x.label
|
|
320
|
+
const defaultFields = (0, rebalance_methods_5.getDefaultTakeProfitRebalanceFieldsInfos)(price);
|
|
321
|
+
let lowerRangePrice = defaultFields.find((x) => x.label == 'rangePriceLower').value;
|
|
322
|
+
const lowerRangePriceInput = fieldOverrides.find((x) => x.label == 'rangePriceLower');
|
|
307
323
|
if (lowerRangePriceInput) {
|
|
308
324
|
lowerRangePrice = lowerRangePriceInput.value;
|
|
309
325
|
}
|
|
310
|
-
let upperRangePrice = defaultFields.find((x) => x.label
|
|
311
|
-
const upperRangePriceInput = fieldOverrides.find((x) => x.label
|
|
326
|
+
let upperRangePrice = defaultFields.find((x) => x.label == 'rangePriceUpper').value;
|
|
327
|
+
const upperRangePriceInput = fieldOverrides.find((x) => x.label == 'rangePriceUpper');
|
|
312
328
|
if (upperRangePriceInput) {
|
|
313
329
|
upperRangePrice = upperRangePriceInput.value;
|
|
314
330
|
}
|
|
315
|
-
let destinationToken = defaultFields.find((x) => x.label
|
|
316
|
-
const destinationTokenInput = fieldOverrides.find((x) => x.label
|
|
331
|
+
let destinationToken = defaultFields.find((x) => x.label == 'destinationToken').value;
|
|
332
|
+
const destinationTokenInput = fieldOverrides.find((x) => x.label == 'destinationToken');
|
|
317
333
|
if (destinationTokenInput) {
|
|
318
334
|
destinationToken = destinationTokenInput.value;
|
|
319
335
|
}
|
|
320
|
-
return (0,
|
|
336
|
+
return (0, rebalance_methods_5.getTakeProfitRebalanceFieldsInfos)(new decimal_js_1.default(lowerRangePrice), new decimal_js_1.default(upperRangePrice), new decimal_js_1.default(destinationToken), true);
|
|
321
337
|
};
|
|
322
338
|
getFieldsForPeriodicRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
323
339
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
324
|
-
const defaultFields = (0,
|
|
325
|
-
let period = new decimal_js_1.default(defaultFields.find((x) => x.label
|
|
326
|
-
const periodInput = fieldOverrides.find((x) => x.label
|
|
340
|
+
const defaultFields = (0, rebalance_methods_5.getDefaultPeriodicRebalanceFieldInfos)(price);
|
|
341
|
+
let period = new decimal_js_1.default(defaultFields.find((x) => x.label == 'period').value);
|
|
342
|
+
const periodInput = fieldOverrides.find((x) => x.label == 'period');
|
|
327
343
|
if (periodInput) {
|
|
328
344
|
period = new decimal_js_1.default(periodInput.value);
|
|
329
345
|
}
|
|
330
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
331
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
346
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label == 'lowerRangeBps').value;
|
|
347
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'lowerRangeBps');
|
|
332
348
|
if (lowerPriceDifferenceBPSInput) {
|
|
333
349
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
334
350
|
}
|
|
335
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
336
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
351
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label == 'upperRangeBps').value;
|
|
352
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'upperRangeBps');
|
|
337
353
|
if (upperPriceDifferenceBPSInput) {
|
|
338
354
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
339
355
|
}
|
|
340
|
-
return (0,
|
|
356
|
+
return (0, rebalance_methods_5.getPeriodicRebalanceRebalanceFieldInfos)(price, period, new decimal_js_1.default(lowerPriceDifferenceBPS), new decimal_js_1.default(upperPriceDifferenceBPS));
|
|
341
357
|
};
|
|
342
358
|
getFieldsForExpanderRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, poolPrice) => {
|
|
343
359
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
344
|
-
const defaultFields = (0,
|
|
345
|
-
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
346
|
-
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
360
|
+
const defaultFields = (0, rebalance_methods_5.getDefaultExpanderRebalanceFieldInfos)(price);
|
|
361
|
+
let lowerPriceDifferenceBPS = defaultFields.find((x) => x.label == 'lowerRangeBps').value;
|
|
362
|
+
const lowerPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'lowerRangeBps');
|
|
347
363
|
if (lowerPriceDifferenceBPSInput) {
|
|
348
364
|
lowerPriceDifferenceBPS = lowerPriceDifferenceBPSInput.value;
|
|
349
365
|
}
|
|
350
|
-
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
351
|
-
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
366
|
+
let upperPriceDifferenceBPS = defaultFields.find((x) => x.label == 'upperRangeBps').value;
|
|
367
|
+
const upperPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'upperRangeBps');
|
|
352
368
|
if (upperPriceDifferenceBPSInput) {
|
|
353
369
|
upperPriceDifferenceBPS = upperPriceDifferenceBPSInput.value;
|
|
354
370
|
}
|
|
355
|
-
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
356
|
-
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
371
|
+
let lowerResetPriceDifferenceBPS = defaultFields.find((x) => x.label == 'resetLowerRangeBps').value;
|
|
372
|
+
const lowerResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'resetLowerRangeBps');
|
|
357
373
|
if (lowerResetPriceDifferenceBPSInput) {
|
|
358
374
|
lowerResetPriceDifferenceBPS = lowerResetPriceDifferenceBPSInput.value;
|
|
359
375
|
}
|
|
360
|
-
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label
|
|
361
|
-
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label
|
|
376
|
+
let upperResetPriceDifferenceBPS = defaultFields.find((x) => x.label == 'resetUpperRangeBps').value;
|
|
377
|
+
const upperResetPriceDifferenceBPSInput = fieldOverrides.find((x) => x.label == 'resetUpperRangeBps');
|
|
362
378
|
if (upperResetPriceDifferenceBPSInput) {
|
|
363
379
|
upperResetPriceDifferenceBPS = upperResetPriceDifferenceBPSInput.value;
|
|
364
380
|
}
|
|
365
|
-
let expansionBPS = defaultFields.find((x) => x.label
|
|
366
|
-
const expansionBPSInput = fieldOverrides.find((x) => x.label
|
|
381
|
+
let expansionBPS = defaultFields.find((x) => x.label == 'expansionBps').value;
|
|
382
|
+
const expansionBPSInput = fieldOverrides.find((x) => x.label == 'expansionBps');
|
|
367
383
|
if (expansionBPSInput) {
|
|
368
384
|
expansionBPS = expansionBPSInput.value;
|
|
369
385
|
}
|
|
370
|
-
let maxNumberOfExpansions = defaultFields.find((x) => x.label
|
|
371
|
-
const maxNumberOfExpansionsInput = fieldOverrides.find((x) => x.label
|
|
386
|
+
let maxNumberOfExpansions = defaultFields.find((x) => x.label == 'maxNumberOfExpansions').value;
|
|
387
|
+
const maxNumberOfExpansionsInput = fieldOverrides.find((x) => x.label == 'maxNumberOfExpansions');
|
|
372
388
|
if (maxNumberOfExpansionsInput) {
|
|
373
389
|
maxNumberOfExpansions = maxNumberOfExpansionsInput.value;
|
|
374
390
|
}
|
|
375
|
-
let swapUnevenAllowed = defaultFields.find((x) => x.label
|
|
376
|
-
const swapUnevenAllowedInput = fieldOverrides.find((x) => x.label
|
|
391
|
+
let swapUnevenAllowed = defaultFields.find((x) => x.label == 'swapUnevenAllowed').value;
|
|
392
|
+
const swapUnevenAllowedInput = fieldOverrides.find((x) => x.label == 'swapUnevenAllowed');
|
|
377
393
|
if (swapUnevenAllowedInput) {
|
|
378
394
|
swapUnevenAllowed = swapUnevenAllowedInput.value;
|
|
379
395
|
}
|
|
380
|
-
return (0,
|
|
396
|
+
return (0, rebalance_methods_5.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));
|
|
381
397
|
};
|
|
382
398
|
getFieldsForAutodriftRebalanceMethod = async (dex, fieldOverrides, tokenAMint, tokenBMint, tickSpacing, poolPrice) => {
|
|
383
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
384
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
399
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenAMint);
|
|
400
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenBMint);
|
|
385
401
|
const price = poolPrice ? poolPrice : new decimal_js_1.default(await this.getPriceForPair(dex, tokenAMint, tokenBMint));
|
|
386
402
|
// TODO: maybe we will need to get real staking price instead of pool price for this to be accurate.
|
|
387
403
|
const defaultFields = (0, autodriftRebalance_1.getDefaultAutodriftRebalanceFieldInfos)(dex, price, tokenADecimals, tokenBDecimals, tickSpacing);
|
|
388
|
-
const lastMidTick = defaultFields.find((x) => x.label
|
|
389
|
-
let initDriftTicksPerEpoch = defaultFields.find((x) => x.label
|
|
390
|
-
const initDriftTicksPerEpochInput = fieldOverrides.find((x) => x.label
|
|
404
|
+
const lastMidTick = defaultFields.find((x) => x.label == 'lastMidTick').value;
|
|
405
|
+
let initDriftTicksPerEpoch = defaultFields.find((x) => x.label == 'initDriftTicksPerEpoch').value;
|
|
406
|
+
const initDriftTicksPerEpochInput = fieldOverrides.find((x) => x.label == 'initDriftTicksPerEpoch');
|
|
391
407
|
if (initDriftTicksPerEpochInput) {
|
|
392
408
|
initDriftTicksPerEpoch = initDriftTicksPerEpochInput.value;
|
|
393
409
|
}
|
|
394
|
-
let ticksBelowMid = defaultFields.find((x) => x.label
|
|
395
|
-
const ticksBelowMidInput = fieldOverrides.find((x) => x.label
|
|
410
|
+
let ticksBelowMid = defaultFields.find((x) => x.label == 'ticksBelowMid').value;
|
|
411
|
+
const ticksBelowMidInput = fieldOverrides.find((x) => x.label == 'ticksBelowMid');
|
|
396
412
|
if (ticksBelowMidInput) {
|
|
397
413
|
ticksBelowMid = ticksBelowMidInput.value;
|
|
398
414
|
}
|
|
399
|
-
let ticksAboveMid = defaultFields.find((x) => x.label
|
|
400
|
-
const ticksAboveMidInput = fieldOverrides.find((x) => x.label
|
|
415
|
+
let ticksAboveMid = defaultFields.find((x) => x.label == 'ticksAboveMid').value;
|
|
416
|
+
const ticksAboveMidInput = fieldOverrides.find((x) => x.label == 'ticksAboveMid');
|
|
401
417
|
if (ticksAboveMidInput) {
|
|
402
418
|
ticksAboveMid = ticksAboveMidInput.value;
|
|
403
419
|
}
|
|
404
|
-
let frontrunMultiplierBps = defaultFields.find((x) => x.label
|
|
405
|
-
const frontrunMultiplierBpsInput = fieldOverrides.find((x) => x.label
|
|
420
|
+
let frontrunMultiplierBps = defaultFields.find((x) => x.label == 'frontrunMultiplierBps').value;
|
|
421
|
+
const frontrunMultiplierBpsInput = fieldOverrides.find((x) => x.label == 'frontrunMultiplierBps');
|
|
406
422
|
if (frontrunMultiplierBpsInput) {
|
|
407
423
|
frontrunMultiplierBps = frontrunMultiplierBpsInput.value;
|
|
408
424
|
}
|
|
409
|
-
let stakingRateASource = defaultFields.find((x) => x.label
|
|
410
|
-
const stakingRateASourceInput = fieldOverrides.find((x) => x.label
|
|
425
|
+
let stakingRateASource = defaultFields.find((x) => x.label == 'stakingRateASource').value;
|
|
426
|
+
const stakingRateASourceInput = fieldOverrides.find((x) => x.label == 'stakingRateASource');
|
|
411
427
|
if (stakingRateASourceInput) {
|
|
412
428
|
stakingRateASource = stakingRateASourceInput.value;
|
|
413
429
|
}
|
|
414
|
-
let stakingRateBSource = defaultFields.find((x) => x.label
|
|
415
|
-
const stakingRateBSourceInput = fieldOverrides.find((x) => x.label
|
|
430
|
+
let stakingRateBSource = defaultFields.find((x) => x.label == 'stakingRateBSource').value;
|
|
431
|
+
const stakingRateBSourceInput = fieldOverrides.find((x) => x.label == 'stakingRateBSource');
|
|
416
432
|
if (stakingRateBSourceInput) {
|
|
417
433
|
stakingRateBSource = stakingRateBSourceInput.value;
|
|
418
434
|
}
|
|
419
|
-
let initialDriftDirection = defaultFields.find((x) => x.label
|
|
420
|
-
const initialDriftDirectionInput = fieldOverrides.find((x) => x.label
|
|
435
|
+
let initialDriftDirection = defaultFields.find((x) => x.label == 'initialDriftDirection').value;
|
|
436
|
+
const initialDriftDirectionInput = fieldOverrides.find((x) => x.label == 'initialDriftDirection');
|
|
421
437
|
if (initialDriftDirectionInput) {
|
|
422
438
|
initialDriftDirection = initialDriftDirectionInput.value;
|
|
423
439
|
}
|
|
@@ -430,27 +446,27 @@ class Kamino {
|
|
|
430
446
|
* @param amountA
|
|
431
447
|
*/
|
|
432
448
|
getPriceForPair = async (dex, poolTokenA, poolTokenB) => {
|
|
433
|
-
if (dex
|
|
449
|
+
if (dex == 'ORCA') {
|
|
434
450
|
const pools = await this.getOrcaPoolsForTokens(poolTokenA, poolTokenB);
|
|
435
|
-
if (pools.length
|
|
451
|
+
if (pools.length == 0) {
|
|
436
452
|
throw new Error(`No pool found for ${poolTokenA.toString()} and ${poolTokenB.toString()}`);
|
|
437
453
|
}
|
|
438
454
|
return pools[0].price;
|
|
439
455
|
}
|
|
440
|
-
else if (dex
|
|
456
|
+
else if (dex == 'RAYDIUM') {
|
|
441
457
|
const pools = await this.getRaydiumPoolsForTokens(poolTokenA, poolTokenB);
|
|
442
|
-
if (pools.length
|
|
458
|
+
if (pools.length == 0) {
|
|
443
459
|
throw new Error(`No pool found for ${poolTokenA.toString()} and ${poolTokenB.toString()}`);
|
|
444
460
|
}
|
|
445
461
|
return pools[0].price;
|
|
446
462
|
}
|
|
447
|
-
else if (dex
|
|
463
|
+
else if (dex == 'METEORA') {
|
|
448
464
|
const pools = await this.getMeteoraPoolsForTokens(poolTokenA, poolTokenB);
|
|
449
|
-
if (pools.length
|
|
465
|
+
if (pools.length == 0) {
|
|
450
466
|
throw new Error(`No pool found for ${poolTokenA.toString()} and ${poolTokenB.toString()}`);
|
|
451
467
|
}
|
|
452
|
-
const decimalsX = await (0, utils_1.getMintDecimals)(this.
|
|
453
|
-
const decimalsY = await (0, utils_1.getMintDecimals)(this.
|
|
468
|
+
const decimalsX = await (0, utils_1.getMintDecimals)(this._connection, poolTokenA);
|
|
469
|
+
const decimalsY = await (0, utils_1.getMintDecimals)(this._connection, poolTokenB);
|
|
454
470
|
return (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(pools[0].pool.activeId, pools[0].pool.binStep, decimalsX, decimalsY).toNumber();
|
|
455
471
|
}
|
|
456
472
|
else {
|
|
@@ -459,23 +475,23 @@ class Kamino {
|
|
|
459
475
|
};
|
|
460
476
|
getDefaultRebalanceFields = async (dex, poolTokenA, poolTokenB, tickSpacing, rebalanceMethod) => {
|
|
461
477
|
const price = new decimal_js_1.default(await this.getPriceForPair(dex, poolTokenA, poolTokenB));
|
|
462
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
463
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
478
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, poolTokenA);
|
|
479
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, poolTokenB);
|
|
464
480
|
switch (rebalanceMethod) {
|
|
465
481
|
case CreationParameters_1.ManualRebalanceMethod:
|
|
466
482
|
return (0, rebalance_methods_1.getDefaultManualRebalanceFieldInfos)(price);
|
|
467
483
|
case CreationParameters_1.PricePercentageRebalanceMethod:
|
|
468
|
-
return (0,
|
|
484
|
+
return (0, rebalance_methods_2.getDefaultPricePercentageRebalanceFieldInfos)(price);
|
|
469
485
|
case CreationParameters_1.PricePercentageWithResetRangeRebalanceMethod:
|
|
470
|
-
return (0,
|
|
486
|
+
return (0, rebalance_methods_3.getDefaultPricePercentageWithResetRebalanceFieldInfos)(price);
|
|
471
487
|
case CreationParameters_1.DriftRebalanceMethod:
|
|
472
|
-
return (0,
|
|
488
|
+
return (0, rebalance_methods_4.getDefaultDriftRebalanceFieldInfos)(dex, tickSpacing, price, tokenADecimals, tokenBDecimals);
|
|
473
489
|
case CreationParameters_1.TakeProfitMethod:
|
|
474
|
-
return (0,
|
|
490
|
+
return (0, rebalance_methods_5.getDefaultTakeProfitRebalanceFieldsInfos)(price);
|
|
475
491
|
case CreationParameters_1.PeriodicRebalanceMethod:
|
|
476
|
-
return (0,
|
|
492
|
+
return (0, rebalance_methods_5.getDefaultPeriodicRebalanceFieldInfos)(price);
|
|
477
493
|
case CreationParameters_1.ExpanderMethod:
|
|
478
|
-
return (0,
|
|
494
|
+
return (0, rebalance_methods_5.getDefaultExpanderRebalanceFieldInfos)(price);
|
|
479
495
|
case CreationParameters_1.AutodriftMethod:
|
|
480
496
|
return (0, autodriftRebalance_1.getDefaultAutodriftRebalanceFieldInfos)(dex, price, tokenADecimals, tokenBDecimals, tickSpacing);
|
|
481
497
|
default:
|
|
@@ -486,17 +502,17 @@ class Kamino {
|
|
|
486
502
|
* 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
|
|
487
503
|
*/
|
|
488
504
|
getPoolInitializedForDexPairTier = async (dex, poolTokenA, poolTokenB, feeBPS) => {
|
|
489
|
-
if (dex
|
|
490
|
-
let pool =
|
|
505
|
+
if (dex == 'ORCA') {
|
|
506
|
+
let pool = web3_js_1.PublicKey.default;
|
|
491
507
|
const orcaPools = await this.getOrcaPoolsForTokens(poolTokenA, poolTokenB);
|
|
492
508
|
orcaPools.forEach((element) => {
|
|
493
|
-
if (element.lpFeeRate * CreationParameters_1.FullBPS
|
|
494
|
-
pool =
|
|
509
|
+
if (element.lpFeeRate * CreationParameters_1.FullBPS == feeBPS.toNumber()) {
|
|
510
|
+
pool = new web3_js_1.PublicKey(element.address);
|
|
495
511
|
}
|
|
496
512
|
});
|
|
497
513
|
return pool;
|
|
498
514
|
}
|
|
499
|
-
else if (dex
|
|
515
|
+
else if (dex == 'RAYDIUM') {
|
|
500
516
|
const pools = [];
|
|
501
517
|
const raydiumPools = await this.getRaydiumPoolsForTokens(poolTokenA, poolTokenB);
|
|
502
518
|
raydiumPools.forEach((element) => {
|
|
@@ -504,26 +520,26 @@ class Kamino {
|
|
|
504
520
|
pools.push(element);
|
|
505
521
|
}
|
|
506
522
|
});
|
|
507
|
-
if (pools.length
|
|
508
|
-
return
|
|
523
|
+
if (pools.length == 0) {
|
|
524
|
+
return web3_js_1.PublicKey.default;
|
|
509
525
|
}
|
|
510
|
-
let pool =
|
|
526
|
+
let pool = web3_js_1.PublicKey.default;
|
|
511
527
|
let tickSpacing = Number.MAX_VALUE;
|
|
512
528
|
pools.forEach((element) => {
|
|
513
529
|
if (element.ammConfig.tickSpacing < tickSpacing) {
|
|
514
|
-
pool =
|
|
530
|
+
pool = new web3_js_1.PublicKey(element.id);
|
|
515
531
|
tickSpacing = element.ammConfig.tickSpacing;
|
|
516
532
|
}
|
|
517
533
|
});
|
|
518
534
|
return pool;
|
|
519
535
|
}
|
|
520
|
-
else if (dex
|
|
521
|
-
let pool =
|
|
536
|
+
else if (dex == 'METEORA') {
|
|
537
|
+
let pool = web3_js_1.PublicKey.default;
|
|
522
538
|
const pools = await this.getMeteoraPoolsForTokens(poolTokenA, poolTokenB);
|
|
523
539
|
pools.forEach((element) => {
|
|
524
540
|
const feeRateBps = element.pool.parameters.baseFactor * element.pool.binStep;
|
|
525
|
-
if (feeRateBps
|
|
526
|
-
pool =
|
|
541
|
+
if (feeRateBps == feeBPS.toNumber()) {
|
|
542
|
+
pool = new web3_js_1.PublicKey(element.key);
|
|
527
543
|
}
|
|
528
544
|
});
|
|
529
545
|
return pool;
|
|
@@ -536,21 +552,21 @@ class Kamino {
|
|
|
536
552
|
* Return generic information for all pools in a given dex, for given mints and fee tier
|
|
537
553
|
*/
|
|
538
554
|
async getExistentPoolsForPair(dex, tokenMintA, tokenMintB) {
|
|
539
|
-
if (dex
|
|
555
|
+
if (dex == 'ORCA') {
|
|
540
556
|
const pools = await this.getOrcaPoolsForTokens(tokenMintA, tokenMintB);
|
|
541
557
|
const genericPoolInfos = await Promise.all(pools.map(async (pool) => {
|
|
542
|
-
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex,
|
|
558
|
+
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex, new web3_js_1.PublicKey(pool.address)));
|
|
543
559
|
// read price from pool
|
|
544
|
-
const poolData = await this._orcaService.getPool(
|
|
560
|
+
const poolData = await this._orcaService.getPool(new web3_js_1.PublicKey(pool.address));
|
|
545
561
|
if (!poolData) {
|
|
546
562
|
throw new Error(`Pool ${pool.address} not found`);
|
|
547
563
|
}
|
|
548
564
|
const poolInfo = {
|
|
549
565
|
dex,
|
|
550
|
-
address:
|
|
551
|
-
price:
|
|
552
|
-
tokenMintA:
|
|
553
|
-
tokenMintB:
|
|
566
|
+
address: new web3_js_1.PublicKey(pool.address),
|
|
567
|
+
price: poolData.price,
|
|
568
|
+
tokenMintA: new web3_js_1.PublicKey(pool.tokenA.mint),
|
|
569
|
+
tokenMintB: new web3_js_1.PublicKey(pool.tokenB.mint),
|
|
554
570
|
tvl: pool.tvl ? new decimal_js_1.default(pool.tvl) : undefined,
|
|
555
571
|
feeRate: new decimal_js_1.default(pool.lpFeeRate).mul(CreationParameters_1.FullBPS),
|
|
556
572
|
volumeOnLast7d: pool.volume ? new decimal_js_1.default(pool.volume.week) : undefined,
|
|
@@ -561,16 +577,16 @@ class Kamino {
|
|
|
561
577
|
}));
|
|
562
578
|
return genericPoolInfos;
|
|
563
579
|
}
|
|
564
|
-
else if (dex
|
|
580
|
+
else if (dex == 'RAYDIUM') {
|
|
565
581
|
const pools = await this.getRaydiumPoolsForTokens(tokenMintA, tokenMintB);
|
|
566
582
|
const genericPoolInfos = await Promise.all(pools.map(async (pool) => {
|
|
567
|
-
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex,
|
|
583
|
+
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex, new web3_js_1.PublicKey(pool.id)));
|
|
568
584
|
const poolInfo = {
|
|
569
585
|
dex,
|
|
570
|
-
address:
|
|
586
|
+
address: new web3_js_1.PublicKey(pool.id),
|
|
571
587
|
price: new decimal_js_1.default(pool.price),
|
|
572
|
-
tokenMintA:
|
|
573
|
-
tokenMintB:
|
|
588
|
+
tokenMintA: new web3_js_1.PublicKey(pool.mintA),
|
|
589
|
+
tokenMintB: new web3_js_1.PublicKey(pool.mintB),
|
|
574
590
|
tvl: new decimal_js_1.default(pool.tvl),
|
|
575
591
|
feeRate: new decimal_js_1.default(pool.ammConfig.tradeFeeRate).div(new decimal_js_1.default(CreationParameters_1.FullPercentage)),
|
|
576
592
|
volumeOnLast7d: new decimal_js_1.default(pool.week.volume),
|
|
@@ -581,12 +597,12 @@ class Kamino {
|
|
|
581
597
|
}));
|
|
582
598
|
return genericPoolInfos;
|
|
583
599
|
}
|
|
584
|
-
else if (dex
|
|
600
|
+
else if (dex == 'METEORA') {
|
|
585
601
|
const pools = await this.getMeteoraPoolsForTokens(tokenMintA, tokenMintB);
|
|
586
602
|
const genericPoolInfos = await Promise.all(pools.map(async (pool) => {
|
|
587
603
|
const positionsCount = new decimal_js_1.default(await this.getPositionsCountForPool(dex, pool.key));
|
|
588
|
-
const decimalsX = await (0, utils_1.getMintDecimals)(this.
|
|
589
|
-
const decimalsY = await (0, utils_1.getMintDecimals)(this.
|
|
604
|
+
const decimalsX = await (0, utils_1.getMintDecimals)(this._connection, pool.pool.tokenXMint);
|
|
605
|
+
const decimalsY = await (0, utils_1.getMintDecimals)(this._connection, pool.pool.tokenYMint);
|
|
590
606
|
const price = (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(pool.pool.activeId, pool.pool.binStep, decimalsX, decimalsY);
|
|
591
607
|
const poolInfo = {
|
|
592
608
|
dex,
|
|
@@ -614,8 +630,8 @@ class Kamino {
|
|
|
614
630
|
const poolTokenBString = poolTokenB.toString();
|
|
615
631
|
const whirlpools = await this._orcaService.getOrcaWhirlpools();
|
|
616
632
|
whirlpools.whirlpools.forEach((element) => {
|
|
617
|
-
if ((element.tokenA.mint
|
|
618
|
-
(element.tokenA.mint
|
|
633
|
+
if ((element.tokenA.mint == poolTokenAString && element.tokenB.mint == poolTokenBString) ||
|
|
634
|
+
(element.tokenA.mint == poolTokenBString && element.tokenB.mint == poolTokenAString))
|
|
619
635
|
pools.push(element);
|
|
620
636
|
});
|
|
621
637
|
return pools;
|
|
@@ -626,8 +642,8 @@ class Kamino {
|
|
|
626
642
|
const poolTokenBString = poolTokenB.toString();
|
|
627
643
|
const raydiumPools = await this._raydiumService.getRaydiumWhirlpools();
|
|
628
644
|
raydiumPools.data.forEach((element) => {
|
|
629
|
-
if ((element.mintA
|
|
630
|
-
(element.mintA
|
|
645
|
+
if ((element.mintA == poolTokenAString && element.mintB == poolTokenBString) ||
|
|
646
|
+
(element.mintA == poolTokenBString && element.mintB == poolTokenAString)) {
|
|
631
647
|
pools.push(element);
|
|
632
648
|
}
|
|
633
649
|
});
|
|
@@ -637,8 +653,8 @@ class Kamino {
|
|
|
637
653
|
const pools = [];
|
|
638
654
|
const meteoraPools = await this._meteoraService.getMeteoraPools();
|
|
639
655
|
meteoraPools.forEach((element) => {
|
|
640
|
-
if ((element.pool.tokenXMint
|
|
641
|
-
(element.pool.tokenXMint
|
|
656
|
+
if ((element.pool.tokenXMint.equals(poolTokenA) && element.pool.tokenYMint.equals(poolTokenB)) ||
|
|
657
|
+
(element.pool.tokenXMint.equals(poolTokenB) && element.pool.tokenYMint.equals(poolTokenA))) {
|
|
642
658
|
pools.push(element);
|
|
643
659
|
}
|
|
644
660
|
});
|
|
@@ -677,39 +693,35 @@ class Kamino {
|
|
|
677
693
|
getAllStrategiesWithFilters = async (strategyFilters) => {
|
|
678
694
|
const filters = [];
|
|
679
695
|
filters.push({
|
|
680
|
-
dataSize:
|
|
696
|
+
dataSize: accounts_1.WhirlpoolStrategy.layout.span + 8,
|
|
681
697
|
});
|
|
682
698
|
filters.push({
|
|
683
699
|
memcmp: {
|
|
684
|
-
offset:
|
|
700
|
+
offset: 0,
|
|
685
701
|
bytes: bs58_1.default.encode(accounts_1.WhirlpoolStrategy.discriminator),
|
|
686
|
-
encoding: 'base58',
|
|
687
702
|
},
|
|
688
703
|
});
|
|
689
704
|
if (strategyFilters.owner) {
|
|
690
705
|
filters.push({
|
|
691
706
|
memcmp: {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
encoding: 'base58',
|
|
707
|
+
bytes: strategyFilters.owner.toBase58(),
|
|
708
|
+
offset: 8,
|
|
695
709
|
},
|
|
696
710
|
});
|
|
697
711
|
}
|
|
698
712
|
if (strategyFilters.strategyCreationStatus) {
|
|
699
713
|
filters.push({
|
|
700
714
|
memcmp: {
|
|
701
|
-
offset: 1625n,
|
|
702
715
|
bytes: (0, utils_1.strategyCreationStatusToBase58)(strategyFilters.strategyCreationStatus),
|
|
703
|
-
|
|
716
|
+
offset: 1625,
|
|
704
717
|
},
|
|
705
718
|
});
|
|
706
719
|
}
|
|
707
720
|
if (strategyFilters.strategyType) {
|
|
708
721
|
filters.push({
|
|
709
722
|
memcmp: {
|
|
710
|
-
offset: 1120n,
|
|
711
723
|
bytes: (0, utils_1.strategyTypeToBase58)(strategyFilters.strategyType).toString(),
|
|
712
|
-
|
|
724
|
+
offset: 1120,
|
|
713
725
|
},
|
|
714
726
|
});
|
|
715
727
|
}
|
|
@@ -717,20 +729,16 @@ class Kamino {
|
|
|
717
729
|
const value = !strategyFilters.isCommunity ? '1' : '2';
|
|
718
730
|
filters.push({
|
|
719
731
|
memcmp: {
|
|
720
|
-
offset: 1664n,
|
|
721
732
|
bytes: value,
|
|
722
|
-
|
|
733
|
+
offset: 1664,
|
|
723
734
|
},
|
|
724
735
|
});
|
|
725
736
|
}
|
|
726
|
-
return (await this.
|
|
727
|
-
.getProgramAccounts(this.getProgramID(), {
|
|
737
|
+
return (await this._connection.getProgramAccounts(this._kaminoProgramId, {
|
|
728
738
|
filters,
|
|
729
|
-
|
|
730
|
-
})
|
|
731
|
-
.send()).map((x) => {
|
|
739
|
+
})).map((x) => {
|
|
732
740
|
const res = {
|
|
733
|
-
strategy: accounts_1.WhirlpoolStrategy.decode(
|
|
741
|
+
strategy: accounts_1.WhirlpoolStrategy.decode(x.account.data),
|
|
734
742
|
address: x.pubkey,
|
|
735
743
|
};
|
|
736
744
|
return res;
|
|
@@ -746,38 +754,32 @@ class Kamino {
|
|
|
746
754
|
* @param kTokenMint - mint address of the kToken
|
|
747
755
|
*/
|
|
748
756
|
getStrategyByKTokenMint = async (kTokenMint) => {
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
{
|
|
754
|
-
memcmp: {
|
|
755
|
-
offset: 0n,
|
|
756
|
-
bytes: bs58_1.default.encode(accounts_1.WhirlpoolStrategy.discriminator),
|
|
757
|
-
encoding: 'base58',
|
|
757
|
+
const matchingStrategies = await this._connection.getProgramAccounts(this._kaminoProgram.programId, {
|
|
758
|
+
filters: [
|
|
759
|
+
{
|
|
760
|
+
dataSize: accounts_1.WhirlpoolStrategy.layout.span + 8,
|
|
758
761
|
},
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
encoding: 'base58',
|
|
762
|
+
{
|
|
763
|
+
memcmp: {
|
|
764
|
+
offset: 0,
|
|
765
|
+
bytes: bs58_1.default.encode(accounts_1.WhirlpoolStrategy.discriminator),
|
|
766
|
+
},
|
|
765
767
|
},
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
768
|
+
{
|
|
769
|
+
memcmp: {
|
|
770
|
+
bytes: kTokenMint.toBase58(),
|
|
771
|
+
offset: 720,
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
],
|
|
775
|
+
});
|
|
774
776
|
if (matchingStrategies.length === 0) {
|
|
775
777
|
return null;
|
|
776
778
|
}
|
|
777
779
|
if (matchingStrategies.length > 1) {
|
|
778
|
-
throw new Error(`Multiple strategies found for kToken mint: ${kTokenMint}. Strategies found: ${matchingStrategies.map((x) => x.pubkey)}`);
|
|
780
|
+
throw new Error(`Multiple strategies found for kToken mint: ${kTokenMint.toBase58()}. Strategies found: ${matchingStrategies.map((x) => x.pubkey.toBase58())}`);
|
|
779
781
|
}
|
|
780
|
-
const decodedStrategy = accounts_1.WhirlpoolStrategy.decode(
|
|
782
|
+
const decodedStrategy = accounts_1.WhirlpoolStrategy.decode(matchingStrategies[0].account.data);
|
|
781
783
|
return {
|
|
782
784
|
address: matchingStrategies[0].pubkey,
|
|
783
785
|
strategy: decodedStrategy,
|
|
@@ -800,19 +802,6 @@ class Kamino {
|
|
|
800
802
|
return { price: balances.computedHoldings.totalSum.div(sharesIssued).mul(sharesFactor), balance: balances };
|
|
801
803
|
}
|
|
802
804
|
};
|
|
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
|
-
};
|
|
816
805
|
/**
|
|
817
806
|
* Batch fetch share data for all or a filtered list of strategies
|
|
818
807
|
* @param strategyFilters strategy filters or a list of strategy public keys
|
|
@@ -828,16 +817,16 @@ class Kamino {
|
|
|
828
817
|
const allScopePrices = strategiesWithAddresses.map((x) => x.strategy.scopePrices);
|
|
829
818
|
const scopePrices = await this._scope.getMultipleOraclePrices(allScopePrices);
|
|
830
819
|
const scopePricesMap = scopePrices.reduce((map, [address, price]) => {
|
|
831
|
-
map[address] = price;
|
|
820
|
+
map[address.toBase58()] = price;
|
|
832
821
|
return map;
|
|
833
822
|
}, {});
|
|
834
|
-
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') && x.strategy.position
|
|
823
|
+
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') && !x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
835
824
|
const raydiumPoolsPromise = this.getRaydiumPools(raydiumStrategies.map((x) => x.strategy.pool));
|
|
836
825
|
const raydiumPositionsPromise = this.getRaydiumPositions(raydiumStrategies.map((x) => x.strategy.position));
|
|
837
|
-
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') && x.strategy.position
|
|
826
|
+
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') && !x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
838
827
|
const orcaPoolsPromise = this.getWhirlpools(orcaStrategies.map((x) => x.strategy.pool));
|
|
839
828
|
const orcaPositionsPromise = this.getOrcaPositions(orcaStrategies.map((x) => x.strategy.position));
|
|
840
|
-
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') && x.strategy.position
|
|
829
|
+
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') && !x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
841
830
|
const meteoraPoolsPromise = this.getMeteoraPools(meteoraStrategies.map((x) => x.strategy.pool));
|
|
842
831
|
const meteoraPositionsPromise = this.getMeteoraPositions(meteoraStrategies.map((x) => x.strategy.position));
|
|
843
832
|
const [raydiumPools, raydiumPositions, orcaPools, orcaPositions, meteoraPools, meteoraPositions] = await Promise.all([
|
|
@@ -848,11 +837,11 @@ class Kamino {
|
|
|
848
837
|
meteoraPoolsPromise,
|
|
849
838
|
meteoraPositionsPromise,
|
|
850
839
|
]);
|
|
851
|
-
const inactiveStrategies = strategiesWithAddresses.filter((x) => x.strategy.position
|
|
840
|
+
const inactiveStrategies = strategiesWithAddresses.filter((x) => x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
852
841
|
const collInfos = collateralInfos ? collateralInfos : await this.getCollateralInfos();
|
|
853
842
|
const disabledPrices = disabledTokensPrices ? disabledTokensPrices : await this.getDisabledTokensPrices(collInfos);
|
|
854
843
|
for (const { strategy, address } of inactiveStrategies) {
|
|
855
|
-
const strategyPrices = await this.getStrategyPrices(strategy, collInfos, scopePricesMap[strategy.scopePrices], disabledPrices);
|
|
844
|
+
const strategyPrices = await this.getStrategyPrices(strategy, collInfos, scopePricesMap[strategy.scopePrices.toBase58()], disabledPrices);
|
|
856
845
|
result.push({
|
|
857
846
|
address,
|
|
858
847
|
strategy,
|
|
@@ -904,7 +893,7 @@ class Kamino {
|
|
|
904
893
|
if (!position) {
|
|
905
894
|
throw new Error(`Position ${strategy.position.toString()} could not be found.`);
|
|
906
895
|
}
|
|
907
|
-
fetchBalances.push(fetchBalance(strategy, pool, position, collateralInfos, prices ? prices[strategy.scopePrices] : undefined, disabledTokensPrices).then((balance) => {
|
|
896
|
+
fetchBalances.push(fetchBalance(strategy, pool, position, collateralInfos, prices ? prices[strategy.scopePrices.toBase58()] : undefined, disabledTokensPrices).then((balance) => {
|
|
908
897
|
return { balance, strategyWithAddress: { strategy, address } };
|
|
909
898
|
}));
|
|
910
899
|
}
|
|
@@ -927,11 +916,11 @@ class Kamino {
|
|
|
927
916
|
let upperResetPrice = null;
|
|
928
917
|
const dex = (0, utils_1.numberToDex)(strategy.strategyDex.toNumber());
|
|
929
918
|
if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
930
|
-
const state = (0,
|
|
919
|
+
const state = (0, rebalance_methods_3.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
931
920
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
932
921
|
}
|
|
933
922
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
934
|
-
const state = (0,
|
|
923
|
+
const state = (0, rebalance_methods_5.deserializeExpanderRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
935
924
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
936
925
|
}
|
|
937
926
|
const balance = {
|
|
@@ -965,11 +954,11 @@ class Kamino {
|
|
|
965
954
|
let upperResetPrice = null;
|
|
966
955
|
const dex = (0, utils_1.numberToDex)(strategy.strategyDex.toNumber());
|
|
967
956
|
if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
968
|
-
const state = (0,
|
|
957
|
+
const state = (0, rebalance_methods_3.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
969
958
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
970
959
|
}
|
|
971
960
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
972
|
-
const state = (0,
|
|
961
|
+
const state = (0, rebalance_methods_5.deserializeExpanderRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
973
962
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
974
963
|
}
|
|
975
964
|
const balance = {
|
|
@@ -1044,11 +1033,11 @@ class Kamino {
|
|
|
1044
1033
|
let upperResetPrice = null;
|
|
1045
1034
|
const dex = (0, utils_1.numberToDex)(strategy.strategyDex.toNumber());
|
|
1046
1035
|
if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
1047
|
-
const state = (0,
|
|
1036
|
+
const state = (0, rebalance_methods_3.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
1048
1037
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
1049
1038
|
}
|
|
1050
1039
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
1051
|
-
const state = (0,
|
|
1040
|
+
const state = (0, rebalance_methods_5.deserializeExpanderRebalanceWithStateOverride)(dex, decimalsA, decimalsB, poolPrice, strategy.rebalanceRaw);
|
|
1052
1041
|
[lowerResetPrice, upperResetPrice] = (0, utils_2.extractPricesFromDeserializedState)(state);
|
|
1053
1042
|
}
|
|
1054
1043
|
const balance = {
|
|
@@ -1060,7 +1049,7 @@ class Kamino {
|
|
|
1060
1049
|
return balance;
|
|
1061
1050
|
};
|
|
1062
1051
|
getOrcaTokensBalances = (strategy, pool, position, mode = 'WITHDRAW') => {
|
|
1063
|
-
const quote = (0,
|
|
1052
|
+
const quote = (0, remove_liquidity_1.getRemoveLiquidityQuote)({
|
|
1064
1053
|
positionAddress: strategy.position,
|
|
1065
1054
|
liquidity: position.liquidity,
|
|
1066
1055
|
slippageTolerance: whirlpool_sdk_1.Percentage.fromFraction(0, 1000),
|
|
@@ -1110,7 +1099,7 @@ class Kamino {
|
|
|
1110
1099
|
}
|
|
1111
1100
|
};
|
|
1112
1101
|
getTokenAccountBalance = async (tokenAccount) => {
|
|
1113
|
-
const tokenAccountBalance = await this.
|
|
1102
|
+
const tokenAccountBalance = await this._connection.getTokenAccountBalance(tokenAccount);
|
|
1114
1103
|
if (!tokenAccountBalance.value) {
|
|
1115
1104
|
throw new Error(`Could not get token account balance for ${tokenAccount.toString()}.`);
|
|
1116
1105
|
}
|
|
@@ -1121,7 +1110,7 @@ class Kamino {
|
|
|
1121
1110
|
* @param tokenAccount
|
|
1122
1111
|
*/
|
|
1123
1112
|
getTokenAccountBalanceOrZero = async (tokenAccount) => {
|
|
1124
|
-
const tokenAccountExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
1113
|
+
const tokenAccountExists = await (0, transactions_1.checkIfAccountExists)(this._connection, tokenAccount);
|
|
1125
1114
|
if (tokenAccountExists) {
|
|
1126
1115
|
return await this.getTokenAccountBalance(tokenAccount);
|
|
1127
1116
|
}
|
|
@@ -1135,13 +1124,13 @@ class Kamino {
|
|
|
1135
1124
|
if (!disabledPrices) {
|
|
1136
1125
|
disabledPrices = await this.getDisabledTokensPrices(collateralInfos);
|
|
1137
1126
|
}
|
|
1138
|
-
if (strategy.strategyDex.toNumber()
|
|
1127
|
+
if (strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA')) {
|
|
1139
1128
|
return this.getStrategyBalancesOrca(strategy, collateralInfos, scopePrices, disabledPrices);
|
|
1140
1129
|
}
|
|
1141
|
-
else if (strategy.strategyDex.toNumber()
|
|
1130
|
+
else if (strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1142
1131
|
return this.getStrategyBalancesRaydium(strategy, collateralInfos, scopePrices, disabledPrices);
|
|
1143
1132
|
}
|
|
1144
|
-
else if (strategy.strategyDex.toNumber()
|
|
1133
|
+
else if (strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
1145
1134
|
return this.getStrategyBalancesMeteora(strategy, collateralInfos, scopePrices, disabledPrices);
|
|
1146
1135
|
}
|
|
1147
1136
|
else {
|
|
@@ -1149,31 +1138,41 @@ class Kamino {
|
|
|
1149
1138
|
}
|
|
1150
1139
|
};
|
|
1151
1140
|
getStrategyTokensBalances = async (strategy, mode = 'WITHDRAW') => {
|
|
1152
|
-
if (strategy.strategyDex.toNumber()
|
|
1153
|
-
const [whirlpoolAcc, positionAcc] =
|
|
1141
|
+
if (strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA')) {
|
|
1142
|
+
const [whirlpoolAcc, positionAcc] = await this.getConnection().getMultipleAccountsInfo([
|
|
1143
|
+
strategy.pool,
|
|
1144
|
+
strategy.position,
|
|
1145
|
+
]);
|
|
1154
1146
|
if (!whirlpoolAcc) {
|
|
1155
1147
|
throw Error(`Could not fetch Orca whirlpool state with pubkey ${strategy.pool.toString()}`);
|
|
1156
1148
|
}
|
|
1157
1149
|
if (!positionAcc) {
|
|
1158
1150
|
throw Error(`Could not fetch Orca whirlpool position state with pubkey ${strategy.position.toString()}`);
|
|
1159
1151
|
}
|
|
1160
|
-
const whirlpool =
|
|
1161
|
-
|
|
1152
|
+
const [whirlpool, position] = await Promise.all([
|
|
1153
|
+
whirlpools_client_1.Whirlpool.decode(whirlpoolAcc.data),
|
|
1154
|
+
whirlpools_client_1.Position.decode(positionAcc.data),
|
|
1155
|
+
]);
|
|
1162
1156
|
return this.getOrcaTokensBalances(strategy, whirlpool, position, mode);
|
|
1163
1157
|
}
|
|
1164
|
-
else if (strategy.strategyDex.toNumber()
|
|
1165
|
-
const [poolStateAcc, positionAcc] =
|
|
1158
|
+
else if (strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1159
|
+
const [poolStateAcc, positionAcc] = await this.getConnection().getMultipleAccountsInfo([
|
|
1160
|
+
strategy.pool,
|
|
1161
|
+
strategy.position,
|
|
1162
|
+
]);
|
|
1166
1163
|
if (!poolStateAcc) {
|
|
1167
1164
|
throw Error(`Could not fetch Raydium pool state with pubkey ${strategy.pool.toString()}`);
|
|
1168
1165
|
}
|
|
1169
1166
|
if (!positionAcc) {
|
|
1170
1167
|
throw Error(`Could not fetch Raydium position state with pubkey ${strategy.position.toString()}`);
|
|
1171
1168
|
}
|
|
1172
|
-
const poolState =
|
|
1173
|
-
|
|
1169
|
+
const [poolState, position] = await Promise.all([
|
|
1170
|
+
raydium_client_1.PoolState.decode(poolStateAcc.data),
|
|
1171
|
+
raydium_client_1.PersonalPositionState.decode(positionAcc.data),
|
|
1172
|
+
]);
|
|
1174
1173
|
return this.getRaydiumTokensBalances(strategy, poolState, position, mode);
|
|
1175
1174
|
}
|
|
1176
|
-
else if (strategy.strategyDex.toNumber()
|
|
1175
|
+
else if (strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
1177
1176
|
return this.getMeteoraTokensBalances(strategy);
|
|
1178
1177
|
}
|
|
1179
1178
|
else {
|
|
@@ -1188,21 +1187,21 @@ class Kamino {
|
|
|
1188
1187
|
const strategies = await this.getStrategiesShareData({ strategyCreationStatus: 'LIVE' });
|
|
1189
1188
|
let totalTokenAmount = new decimal_js_1.default(0);
|
|
1190
1189
|
const vaults = [];
|
|
1191
|
-
for (const { strategy, address
|
|
1190
|
+
for (const { strategy, address, shareData } of strategies) {
|
|
1192
1191
|
const aTotal = shareData.balance.computedHoldings.invested.a.plus(shareData.balance.computedHoldings.available.a);
|
|
1193
1192
|
const bTotal = shareData.balance.computedHoldings.invested.b.plus(shareData.balance.computedHoldings.available.b);
|
|
1194
1193
|
let amount = new decimal_js_1.default(0);
|
|
1195
|
-
if (strategy.tokenAMint
|
|
1194
|
+
if (strategy.tokenAMint.equals(new web3_js_1.PublicKey(tokenMint)) && aTotal.greaterThan(0)) {
|
|
1196
1195
|
amount = aTotal;
|
|
1197
1196
|
}
|
|
1198
|
-
else if (strategy.tokenBMint
|
|
1197
|
+
else if (strategy.tokenBMint.equals(new web3_js_1.PublicKey(tokenMint)) && bTotal.greaterThan(0)) {
|
|
1199
1198
|
amount = bTotal;
|
|
1200
1199
|
}
|
|
1201
1200
|
if (amount.greaterThan(0)) {
|
|
1202
1201
|
totalTokenAmount = totalTokenAmount.plus(amount);
|
|
1203
1202
|
vaults.push({
|
|
1204
|
-
address:
|
|
1205
|
-
frontendUrl: `${constants_1.FRONTEND_KAMINO_STRATEGY_URL}/${
|
|
1203
|
+
address: address,
|
|
1204
|
+
frontendUrl: `${constants_1.FRONTEND_KAMINO_STRATEGY_URL}/${address}`,
|
|
1206
1205
|
amount,
|
|
1207
1206
|
});
|
|
1208
1207
|
}
|
|
@@ -1210,53 +1209,66 @@ class Kamino {
|
|
|
1210
1209
|
return { totalTokenAmount, vaults, timestamp: new Date() };
|
|
1211
1210
|
};
|
|
1212
1211
|
getAccountOwner = async (pk) => {
|
|
1213
|
-
const acc = await this.getConnection().getAccountInfo(pk)
|
|
1214
|
-
if (acc
|
|
1215
|
-
throw Error(`Could not fetch mint ${pk}`);
|
|
1212
|
+
const acc = await this.getConnection().getAccountInfo(pk);
|
|
1213
|
+
if (acc == null) {
|
|
1214
|
+
throw Error(`Could not fetch mint ${pk.toString()}`);
|
|
1216
1215
|
}
|
|
1217
|
-
return acc.
|
|
1216
|
+
return acc.owner;
|
|
1218
1217
|
};
|
|
1219
1218
|
getStrategyBalancesOrca = async (strategy, collateralInfos, scopePrices, disabledTokensPrices) => {
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1219
|
+
const [whirlpoolAcc, positionAcc] = await this.getConnection().getMultipleAccountsInfo([
|
|
1220
|
+
strategy.pool,
|
|
1221
|
+
strategy.position,
|
|
1222
|
+
]);
|
|
1222
1223
|
if (!whirlpoolAcc) {
|
|
1223
1224
|
throw Error(`Could not fetch Orca whirlpool state with pubkey ${strategy.pool.toString()}`);
|
|
1224
1225
|
}
|
|
1225
1226
|
if (!positionAcc) {
|
|
1226
1227
|
throw Error(`Could not fetch Orca whirlpool position state with pubkey ${strategy.position.toString()}`);
|
|
1227
1228
|
}
|
|
1228
|
-
const whirlpool =
|
|
1229
|
-
|
|
1229
|
+
const [whirlpool, position] = await Promise.all([
|
|
1230
|
+
whirlpools_client_1.Whirlpool.decode(whirlpoolAcc.data),
|
|
1231
|
+
whirlpools_client_1.Position.decode(positionAcc.data),
|
|
1232
|
+
]);
|
|
1230
1233
|
return this.getOrcaBalances(strategy, whirlpool, position, collateralInfos, scopePrices, disabledTokensPrices, undefined);
|
|
1231
1234
|
};
|
|
1232
1235
|
getStrategyBalancesRaydium = async (strategy, collateralInfos, scopePrices, disabledTokensPrices) => {
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1236
|
+
const [poolStateAcc, positionAcc] = await this.getConnection().getMultipleAccountsInfo([
|
|
1237
|
+
strategy.pool,
|
|
1238
|
+
strategy.position,
|
|
1239
|
+
]);
|
|
1240
|
+
if (!poolStateAcc) {
|
|
1241
|
+
throw Error(`Could not fetch Raydium pool state with pubkey ${strategy.pool.toString()}`);
|
|
1237
1242
|
}
|
|
1238
|
-
if (!positionAcc
|
|
1239
|
-
throw Error(`Could not fetch Raydium position state with pubkey ${strategy.position}`);
|
|
1243
|
+
if (!positionAcc) {
|
|
1244
|
+
throw Error(`Could not fetch Raydium position state with pubkey ${strategy.position.toString()}`);
|
|
1240
1245
|
}
|
|
1241
|
-
const poolState =
|
|
1242
|
-
|
|
1246
|
+
const [poolState, position] = await Promise.all([
|
|
1247
|
+
raydium_client_1.PoolState.decode(poolStateAcc.data),
|
|
1248
|
+
raydium_client_1.PersonalPositionState.decode(positionAcc.data),
|
|
1249
|
+
]);
|
|
1243
1250
|
return this.getRaydiumBalances(strategy, poolState, position, collateralInfos, scopePrices, disabledTokensPrices);
|
|
1244
1251
|
};
|
|
1245
1252
|
getStrategyBalancesMeteora = async (strategy, collateralInfos, scopePrices, disabledTokensPrices) => {
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1253
|
+
const [poolStateAcc, positionAcc] = await this.getConnection().getMultipleAccountsInfo([
|
|
1254
|
+
strategy.pool,
|
|
1255
|
+
strategy.position,
|
|
1256
|
+
]);
|
|
1248
1257
|
if (!poolStateAcc) {
|
|
1249
|
-
throw Error(`Could not fetch Meteora pool state with pubkey ${strategy.pool}`);
|
|
1258
|
+
throw Error(`Could not fetch Meteora pool state with pubkey ${strategy.pool.toString()}`);
|
|
1250
1259
|
}
|
|
1251
1260
|
if (!positionAcc) {
|
|
1252
|
-
throw Error(`Could not fetch Meteora position state with pubkey ${strategy.position}`);
|
|
1261
|
+
throw Error(`Could not fetch Meteora position state with pubkey ${strategy.position.toString()}`);
|
|
1253
1262
|
}
|
|
1254
|
-
const poolState = accounts_4.LbPair.decode(Buffer.from(poolStateAcc.data[0], 'base64'));
|
|
1255
1263
|
try {
|
|
1256
|
-
const position =
|
|
1264
|
+
const [poolState, position] = await Promise.all([
|
|
1265
|
+
accounts_2.LbPair.decode(poolStateAcc.data),
|
|
1266
|
+
accounts_2.PositionV2.decode(positionAcc.data),
|
|
1267
|
+
]);
|
|
1257
1268
|
return this.getMeteoraBalances(strategy, poolState, position, collateralInfos, scopePrices, disabledTokensPrices);
|
|
1258
1269
|
}
|
|
1259
1270
|
catch (e) {
|
|
1271
|
+
const poolState = accounts_2.LbPair.decode(poolStateAcc.data);
|
|
1260
1272
|
return this.getMeteoraBalances(strategy, poolState, undefined, collateralInfos, scopePrices, disabledTokensPrices);
|
|
1261
1273
|
}
|
|
1262
1274
|
};
|
|
@@ -1313,7 +1325,7 @@ class Kamino {
|
|
|
1313
1325
|
}
|
|
1314
1326
|
}
|
|
1315
1327
|
else {
|
|
1316
|
-
if (collateralInfo.mint
|
|
1328
|
+
if (collateralInfo.mint.equals(web3_js_1.PublicKey.default)) {
|
|
1317
1329
|
continue;
|
|
1318
1330
|
}
|
|
1319
1331
|
disabledTokens.push(collateralInfo.mint);
|
|
@@ -1324,7 +1336,7 @@ class Kamino {
|
|
|
1324
1336
|
? disabledTokensPrices
|
|
1325
1337
|
: await JupService_1.JupService.getDollarPrices(disabledTokens, this._jupBaseAPI);
|
|
1326
1338
|
for (const [token, price] of tokensPrices) {
|
|
1327
|
-
const collInfo = collateralInfos.find((x) => x.mint
|
|
1339
|
+
const collInfo = collateralInfos.find((x) => x.mint.equals(token));
|
|
1328
1340
|
if (!collInfo) {
|
|
1329
1341
|
console.log(`Could not find collateral info for token ${token.toString()}`);
|
|
1330
1342
|
continue;
|
|
@@ -1372,7 +1384,7 @@ class Kamino {
|
|
|
1372
1384
|
else {
|
|
1373
1385
|
prices = await this._scope.getOraclePrices({ prices: strategy.scopePrices });
|
|
1374
1386
|
}
|
|
1375
|
-
let jupPrices;
|
|
1387
|
+
let jupPrices = new pubkey_1.PubkeyHashMap();
|
|
1376
1388
|
if (disabledTokensPrices) {
|
|
1377
1389
|
jupPrices = disabledTokensPrices;
|
|
1378
1390
|
}
|
|
@@ -1429,28 +1441,22 @@ class Kamino {
|
|
|
1429
1441
|
/**
|
|
1430
1442
|
* Get all token accounts for the specified share mint
|
|
1431
1443
|
*/
|
|
1432
|
-
getShareTokenAccounts =
|
|
1444
|
+
getShareTokenAccounts = (shareMint) => {
|
|
1433
1445
|
//how to get all token accounts for specific mint: https://spl.solana.com/token#finding-all-token-accounts-for-a-specific-mint
|
|
1434
1446
|
//get it from the hardcoded token program and create a filter with the actual mint address
|
|
1435
1447
|
//datasize:165 filter selects all token accounts, memcmp filter selects based on the mint address withing each token account
|
|
1436
|
-
return this.
|
|
1437
|
-
.
|
|
1438
|
-
|
|
1439
|
-
encoding: 'jsonParsed',
|
|
1440
|
-
})
|
|
1441
|
-
.send();
|
|
1448
|
+
return this._connection.getParsedProgramAccounts(spl_token_1.TOKEN_PROGRAM_ID, {
|
|
1449
|
+
filters: [{ dataSize: 165 }, { memcmp: { offset: 0, bytes: shareMint.toBase58() } }],
|
|
1450
|
+
});
|
|
1442
1451
|
};
|
|
1443
1452
|
/**
|
|
1444
1453
|
* Get all token accounts for the specified wallet
|
|
1445
1454
|
*/
|
|
1446
|
-
getAllTokenAccounts =
|
|
1455
|
+
getAllTokenAccounts = (wallet) => {
|
|
1447
1456
|
//how to get all token accounts for specific wallet: https://spl.solana.com/token#finding-all-token-accounts-for-a-wallet
|
|
1448
|
-
return this.
|
|
1449
|
-
.
|
|
1450
|
-
|
|
1451
|
-
encoding: 'jsonParsed',
|
|
1452
|
-
})
|
|
1453
|
-
.send();
|
|
1457
|
+
return this._connection.getParsedProgramAccounts(spl_token_1.TOKEN_PROGRAM_ID, {
|
|
1458
|
+
filters: [{ dataSize: 165 }, { memcmp: { offset: 32, bytes: wallet.toString() } }],
|
|
1459
|
+
});
|
|
1454
1460
|
};
|
|
1455
1461
|
/**
|
|
1456
1462
|
* Get all token accounts that are holding a specific Kamino whirlpool strategy
|
|
@@ -1464,13 +1470,13 @@ class Kamino {
|
|
|
1464
1470
|
*/
|
|
1465
1471
|
getStrategyRange = async (strategy) => {
|
|
1466
1472
|
const stratWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
1467
|
-
if (stratWithAddress.strategy.strategyDex.toNumber()
|
|
1473
|
+
if (stratWithAddress.strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA')) {
|
|
1468
1474
|
return this.getStrategyRangeOrca(strategy);
|
|
1469
1475
|
}
|
|
1470
|
-
else if (stratWithAddress.strategy.strategyDex.toNumber()
|
|
1476
|
+
else if (stratWithAddress.strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1471
1477
|
return this.getStrategyRangeRaydium(strategy);
|
|
1472
1478
|
}
|
|
1473
|
-
else if (stratWithAddress.strategy.strategyDex.toNumber()
|
|
1479
|
+
else if (stratWithAddress.strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
1474
1480
|
return this.getStrategyRangeMeteora(strategy);
|
|
1475
1481
|
}
|
|
1476
1482
|
else {
|
|
@@ -1479,7 +1485,7 @@ class Kamino {
|
|
|
1479
1485
|
};
|
|
1480
1486
|
getStrategyRangeOrca = async (strategy) => {
|
|
1481
1487
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
1482
|
-
if (strategyState.position
|
|
1488
|
+
if (strategyState.position == web3_js_1.PublicKey.default) {
|
|
1483
1489
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1484
1490
|
}
|
|
1485
1491
|
else {
|
|
@@ -1488,7 +1494,7 @@ class Kamino {
|
|
|
1488
1494
|
};
|
|
1489
1495
|
getStrategyRangeRaydium = async (strategy) => {
|
|
1490
1496
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
1491
|
-
if (strategyState.position
|
|
1497
|
+
if (strategyState.position == web3_js_1.PublicKey.default) {
|
|
1492
1498
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1493
1499
|
}
|
|
1494
1500
|
else {
|
|
@@ -1497,7 +1503,7 @@ class Kamino {
|
|
|
1497
1503
|
};
|
|
1498
1504
|
getStrategyRangeMeteora = async (strategy) => {
|
|
1499
1505
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
1500
|
-
if (strategyState.position
|
|
1506
|
+
if (strategyState.position == web3_js_1.PublicKey.default) {
|
|
1501
1507
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1502
1508
|
}
|
|
1503
1509
|
else {
|
|
@@ -1505,13 +1511,13 @@ class Kamino {
|
|
|
1505
1511
|
}
|
|
1506
1512
|
};
|
|
1507
1513
|
getPositionRange = async (dex, position, decimalsA, decimalsB) => {
|
|
1508
|
-
if (dex
|
|
1514
|
+
if (dex == 'ORCA') {
|
|
1509
1515
|
return this.getPositionRangeOrca(position, decimalsA, decimalsB);
|
|
1510
1516
|
}
|
|
1511
|
-
else if (dex
|
|
1517
|
+
else if (dex == 'RAYDIUM') {
|
|
1512
1518
|
return this.getPositionRangeRaydium(position, decimalsA, decimalsB);
|
|
1513
1519
|
}
|
|
1514
|
-
else if (dex
|
|
1520
|
+
else if (dex == 'METEORA') {
|
|
1515
1521
|
return this.getPositionRangeMeteora(position, decimalsA, decimalsB);
|
|
1516
1522
|
}
|
|
1517
1523
|
else {
|
|
@@ -1519,10 +1525,10 @@ class Kamino {
|
|
|
1519
1525
|
}
|
|
1520
1526
|
};
|
|
1521
1527
|
getPositionRangeOrca = async (positionPk, decimalsA, decimalsB) => {
|
|
1522
|
-
if (positionPk
|
|
1528
|
+
if (positionPk.equals(web3_js_1.PublicKey.default)) {
|
|
1523
1529
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1524
1530
|
}
|
|
1525
|
-
const position = await
|
|
1531
|
+
const position = await whirlpools_client_1.Position.fetch(this._connection, positionPk, this._orcaService.getWhirlpoolProgramId());
|
|
1526
1532
|
if (!position) {
|
|
1527
1533
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1528
1534
|
}
|
|
@@ -1532,10 +1538,10 @@ class Kamino {
|
|
|
1532
1538
|
return positionRange;
|
|
1533
1539
|
};
|
|
1534
1540
|
getPositionRangeRaydium = async (positionPk, decimalsA, decimalsB) => {
|
|
1535
|
-
if (positionPk
|
|
1541
|
+
if (positionPk.equals(web3_js_1.PublicKey.default)) {
|
|
1536
1542
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1537
1543
|
}
|
|
1538
|
-
const position = await
|
|
1544
|
+
const position = await raydium_client_1.PersonalPositionState.fetch(this._connection, positionPk, this._raydiumService.getRaydiumProgramId());
|
|
1539
1545
|
if (!position) {
|
|
1540
1546
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1541
1547
|
}
|
|
@@ -1545,14 +1551,14 @@ class Kamino {
|
|
|
1545
1551
|
return positionRange;
|
|
1546
1552
|
};
|
|
1547
1553
|
getPositionRangeMeteora = async (positionPk, decimalsA, decimalsB) => {
|
|
1548
|
-
if (positionPk
|
|
1554
|
+
if (positionPk.equals(web3_js_1.PublicKey.default)) {
|
|
1549
1555
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1550
1556
|
}
|
|
1551
|
-
const position = await
|
|
1557
|
+
const position = await accounts_2.PositionV2.fetch(this._connection, positionPk, this._meteoraService.getMeteoraProgramId());
|
|
1552
1558
|
if (!position) {
|
|
1553
1559
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1554
1560
|
}
|
|
1555
|
-
const pool = await
|
|
1561
|
+
const pool = await accounts_2.LbPair.fetch(this._connection, position.lbPair);
|
|
1556
1562
|
if (!pool) {
|
|
1557
1563
|
return { lowerPrice: utils_1.ZERO, upperPrice: utils_1.ZERO };
|
|
1558
1564
|
}
|
|
@@ -1571,14 +1577,10 @@ class Kamino {
|
|
|
1571
1577
|
const result = [];
|
|
1572
1578
|
for (const tokenAccount of tokenAccounts) {
|
|
1573
1579
|
const accountData = tokenAccount.account.data;
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
// @ts-ignore
|
|
1579
|
-
amount: new decimal_js_1.default(accountData.parsed.info.tokenAmount.uiAmountString),
|
|
1580
|
-
});
|
|
1581
|
-
}
|
|
1580
|
+
result.push({
|
|
1581
|
+
holderPubkey: new web3_js_1.PublicKey(accountData.parsed.info.owner),
|
|
1582
|
+
amount: new decimal_js_1.default(accountData.parsed.info.tokenAmount.uiAmountString),
|
|
1583
|
+
});
|
|
1582
1584
|
}
|
|
1583
1585
|
return result;
|
|
1584
1586
|
};
|
|
@@ -1588,17 +1590,18 @@ class Kamino {
|
|
|
1588
1590
|
*/
|
|
1589
1591
|
getWhirlpools = async (whirlpools) => {
|
|
1590
1592
|
// todo: make this map have Pubkey as key
|
|
1591
|
-
const whirlpoolMap = new
|
|
1592
|
-
const
|
|
1593
|
+
const whirlpoolMap = new pubkey_1.PubkeyHashMap();
|
|
1594
|
+
const whirlpoolStrings = whirlpools.map((whirlpool) => whirlpool.toBase58());
|
|
1595
|
+
const uniqueWhirlpools = [...new Set(whirlpoolStrings)].map((value) => new web3_js_1.PublicKey(value));
|
|
1593
1596
|
if (uniqueWhirlpools.length === 1) {
|
|
1594
1597
|
const whirlpool = await this.getWhirlpoolByAddress(whirlpools[0]);
|
|
1595
1598
|
whirlpoolMap.set(whirlpools[0], whirlpool);
|
|
1596
1599
|
return whirlpoolMap;
|
|
1597
1600
|
}
|
|
1598
|
-
const fetched = await (0, utils_1.batchFetch)(uniqueWhirlpools, (chunk) =>
|
|
1601
|
+
const fetched = await (0, utils_1.batchFetch)(uniqueWhirlpools, (chunk) => whirlpools_client_1.Whirlpool.fetchMultiple(this._connection, chunk, this._orcaService.getWhirlpoolProgramId()));
|
|
1599
1602
|
fetched.reduce((map, whirlpool, i) => {
|
|
1600
1603
|
whirlpoolMap.set(uniqueWhirlpools[i], whirlpool);
|
|
1601
|
-
map[uniqueWhirlpools[i]] = whirlpool;
|
|
1604
|
+
map[uniqueWhirlpools[i].toBase58()] = whirlpool;
|
|
1602
1605
|
return map;
|
|
1603
1606
|
}, {});
|
|
1604
1607
|
return whirlpoolMap;
|
|
@@ -1608,54 +1611,55 @@ class Kamino {
|
|
|
1608
1611
|
* @param positions
|
|
1609
1612
|
*/
|
|
1610
1613
|
getOrcaPositions = async (positions) => {
|
|
1611
|
-
const nonDefaults = positions.filter((value) => value !==
|
|
1612
|
-
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) =>
|
|
1614
|
+
const nonDefaults = positions.filter((value) => value.toBase58() !== web3_js_1.PublicKey.default.toBase58());
|
|
1615
|
+
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) => whirlpools_client_1.Position.fetchMultiple(this._connection, chunk, this._orcaService.getWhirlpoolProgramId()));
|
|
1613
1616
|
const fetchedMap = fetched.reduce((map, position, i) => {
|
|
1614
|
-
map[nonDefaults[i]] = position;
|
|
1617
|
+
map[nonDefaults[i].toBase58()] = position;
|
|
1615
1618
|
return map;
|
|
1616
1619
|
}, {});
|
|
1617
|
-
return positions.map((position) => fetchedMap[position] || null);
|
|
1620
|
+
return positions.map((position) => fetchedMap[position.toBase58()] || null);
|
|
1618
1621
|
};
|
|
1619
1622
|
/**
|
|
1620
1623
|
* Get a list of Raydium positions from public keys
|
|
1621
1624
|
* @param positions
|
|
1622
1625
|
*/
|
|
1623
1626
|
getRaydiumPositions = async (positions) => {
|
|
1624
|
-
const nonDefaults = positions.filter((value) => value !==
|
|
1625
|
-
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) =>
|
|
1627
|
+
const nonDefaults = positions.filter((value) => value.toBase58() !== web3_js_1.PublicKey.default.toBase58());
|
|
1628
|
+
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) => raydium_client_1.PersonalPositionState.fetchMultiple(this._connection, chunk, this._raydiumService.getRaydiumProgramId()));
|
|
1626
1629
|
const fetchedMap = fetched.reduce((map, position, i) => {
|
|
1627
|
-
map[nonDefaults[i]] = position;
|
|
1630
|
+
map[nonDefaults[i].toBase58()] = position;
|
|
1628
1631
|
return map;
|
|
1629
1632
|
}, {});
|
|
1630
|
-
return positions.map((position) => fetchedMap[position] || null);
|
|
1633
|
+
return positions.map((position) => fetchedMap[position.toBase58()] || null);
|
|
1631
1634
|
};
|
|
1632
1635
|
getMeteoraPositions = async (positions) => {
|
|
1633
|
-
const nonDefaults = positions.filter((value) => value
|
|
1634
|
-
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) =>
|
|
1636
|
+
const nonDefaults = positions.filter((value) => !value.equals(web3_js_1.PublicKey.default));
|
|
1637
|
+
const fetched = await (0, utils_1.batchFetch)(nonDefaults, (chunk) => accounts_2.PositionV2.fetchMultiple(this._connection, chunk, this._meteoraService.getMeteoraProgramId()));
|
|
1635
1638
|
const fetchedMap = fetched.reduce((map, position, i) => {
|
|
1636
|
-
map[nonDefaults[i]] = position;
|
|
1639
|
+
map[nonDefaults[i].toBase58()] = position;
|
|
1637
1640
|
return map;
|
|
1638
1641
|
}, {});
|
|
1639
|
-
return positions.map((position) => fetchedMap[position] || null);
|
|
1642
|
+
return positions.map((position) => fetchedMap[position.toBase58()] || null);
|
|
1640
1643
|
};
|
|
1641
1644
|
/**
|
|
1642
1645
|
* Get whirlpool from public key
|
|
1643
1646
|
* @param whirlpool pubkey of the orca whirlpool
|
|
1644
1647
|
*/
|
|
1645
|
-
getWhirlpoolByAddress = (whirlpool) =>
|
|
1648
|
+
getWhirlpoolByAddress = (whirlpool) => whirlpools_client_1.Whirlpool.fetch(this._connection, whirlpool, this._orcaService.getWhirlpoolProgramId());
|
|
1646
1649
|
/**
|
|
1647
1650
|
* Get a list of Raydium pools from public keys
|
|
1648
1651
|
* @param pools
|
|
1649
1652
|
*/
|
|
1650
1653
|
getRaydiumPools = async (pools) => {
|
|
1651
1654
|
// todo: make this map have Pubkey as key
|
|
1652
|
-
const poolsMap = new
|
|
1653
|
-
const
|
|
1655
|
+
const poolsMap = new pubkey_1.PubkeyHashMap();
|
|
1656
|
+
const poolStrings = pools.map((pool) => pool.toBase58());
|
|
1657
|
+
const uniquePools = [...new Set(poolStrings)].map((value) => new web3_js_1.PublicKey(value));
|
|
1654
1658
|
if (uniquePools.length === 1) {
|
|
1655
1659
|
const pool = await this.getRaydiumPoolByAddress(pools[0]);
|
|
1656
1660
|
poolsMap.set(pools[0], pool);
|
|
1657
1661
|
}
|
|
1658
|
-
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) =>
|
|
1662
|
+
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) => raydium_client_1.PoolState.fetchMultiple(this._connection, chunk, this._raydiumService.getRaydiumProgramId()));
|
|
1659
1663
|
fetched.reduce((map, whirlpool, i) => {
|
|
1660
1664
|
poolsMap.set(uniquePools[i], whirlpool);
|
|
1661
1665
|
return map;
|
|
@@ -1664,36 +1668,34 @@ class Kamino {
|
|
|
1664
1668
|
};
|
|
1665
1669
|
getMeteoraPools = async (pools) => {
|
|
1666
1670
|
// todo: make this map have Pubkey as key
|
|
1667
|
-
const poolsMap = new
|
|
1668
|
-
const
|
|
1671
|
+
const poolsMap = new pubkey_1.PubkeyHashMap();
|
|
1672
|
+
const poolStrings = pools.map((pool) => pool.toBase58());
|
|
1673
|
+
const uniquePools = [...new Set(poolStrings)].map((value) => new web3_js_1.PublicKey(value));
|
|
1669
1674
|
if (uniquePools.length === 1) {
|
|
1670
1675
|
const pool = await this.getMeteoraPoolByAddress(pools[0]);
|
|
1671
1676
|
poolsMap.set(pools[0], pool);
|
|
1672
1677
|
}
|
|
1673
|
-
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) =>
|
|
1678
|
+
const fetched = await (0, utils_1.batchFetch)(uniquePools, (chunk) => accounts_2.LbPair.fetchMultiple(this._connection, chunk, this._meteoraService.getMeteoraProgramId()));
|
|
1674
1679
|
fetched.reduce((map, whirlpool, i) => {
|
|
1675
1680
|
poolsMap.set(uniquePools[i], whirlpool);
|
|
1676
1681
|
return map;
|
|
1677
1682
|
}, {});
|
|
1678
1683
|
return poolsMap;
|
|
1679
1684
|
};
|
|
1680
|
-
getRaydiumAmmConfig = (config) =>
|
|
1685
|
+
getRaydiumAmmConfig = (config) => raydium_client_1.AmmConfig.fetch(this._connection, config, this._raydiumService.getRaydiumProgramId());
|
|
1681
1686
|
/**
|
|
1682
1687
|
* Get Raydium pool from public key
|
|
1683
1688
|
* @param pool pubkey of the orca whirlpool
|
|
1684
1689
|
*/
|
|
1685
|
-
getRaydiumPoolByAddress = (pool) =>
|
|
1686
|
-
getMeteoraPoolByAddress = (pool) =>
|
|
1687
|
-
getEventAuthorityPDA =
|
|
1688
|
-
if (dex.toNumber()
|
|
1689
|
-
return
|
|
1690
|
-
}
|
|
1691
|
-
if (dex.toNumber()
|
|
1692
|
-
const [key] =
|
|
1693
|
-
|
|
1694
|
-
programAddress: this._meteoraService.getMeteoraProgramId(),
|
|
1695
|
-
});
|
|
1696
|
-
return (0, kit_1.some)(key);
|
|
1690
|
+
getRaydiumPoolByAddress = (pool) => raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
1691
|
+
getMeteoraPoolByAddress = (pool) => accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
1692
|
+
getEventAuthorityPDA = (dex) => {
|
|
1693
|
+
if (dex.toNumber() == (0, utils_1.dexToNumber)('ORCA') || dex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
1694
|
+
return this._kaminoProgramId;
|
|
1695
|
+
}
|
|
1696
|
+
if (dex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
1697
|
+
const [key, _] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('__event_authority')], this._meteoraService.getMeteoraProgramId());
|
|
1698
|
+
return key;
|
|
1697
1699
|
}
|
|
1698
1700
|
throw new Error('Invalid dex');
|
|
1699
1701
|
};
|
|
@@ -1709,15 +1711,15 @@ class Kamino {
|
|
|
1709
1711
|
throw Error('Shares amount cant be lower than or equal to 0.');
|
|
1710
1712
|
}
|
|
1711
1713
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1712
|
-
const eventAuthority =
|
|
1713
|
-
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault } =
|
|
1714
|
+
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategy.strategyDex);
|
|
1715
|
+
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault } = this.getTreasuryFeeVaultPDAs(strategyState.strategy.tokenAMint, strategyState.strategy.tokenBMint);
|
|
1714
1716
|
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
1715
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner
|
|
1716
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner
|
|
1717
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner
|
|
1717
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner),
|
|
1718
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner, true, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
1719
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner, true, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
1718
1720
|
]);
|
|
1719
1721
|
const sharesAmountInLamports = sharesAmount.mul(new decimal_js_1.default(10).pow(strategyState.strategy.sharesMintDecimals.toString()));
|
|
1720
|
-
const programId =
|
|
1722
|
+
const programId = (0, utils_1.getDexProgramId)(strategyState.strategy);
|
|
1721
1723
|
const args = { sharesAmount: new bn_js_1.default(sharesAmountInLamports.floor().toString()) };
|
|
1722
1724
|
const accounts = {
|
|
1723
1725
|
user: owner,
|
|
@@ -1738,25 +1740,25 @@ class Kamino {
|
|
|
1738
1740
|
sharesMint: strategyState.strategy.sharesMint,
|
|
1739
1741
|
treasuryFeeTokenAVault,
|
|
1740
1742
|
treasuryFeeTokenBVault,
|
|
1741
|
-
tokenProgram:
|
|
1742
|
-
tokenProgram2022:
|
|
1743
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
1744
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
1743
1745
|
positionTokenAccount: strategyState.strategy.positionTokenAccount,
|
|
1744
1746
|
poolProgram: programId,
|
|
1745
|
-
instructionSysvarAccount:
|
|
1747
|
+
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
1746
1748
|
tokenAMint: strategyState.strategy.tokenAMint,
|
|
1747
1749
|
tokenBMint: strategyState.strategy.tokenBMint,
|
|
1748
1750
|
eventAuthority,
|
|
1749
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
1750
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
1751
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
1752
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
1751
1753
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
1752
1754
|
};
|
|
1753
|
-
|
|
1755
|
+
const withdrawIx = (0, instructions_1.withdraw)(args, accounts);
|
|
1754
1756
|
let collectFeesAndRewardsIxns = [];
|
|
1755
1757
|
// for Raydium strats we need to collect fees and rewards before withdrawal
|
|
1756
1758
|
// add rewards vaults accounts to withdraw
|
|
1757
|
-
const isRaydium = strategyState.strategy.strategyDex.toNumber()
|
|
1759
|
+
const isRaydium = strategyState.strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM');
|
|
1758
1760
|
if (isRaydium) {
|
|
1759
|
-
const raydiumPosition = await
|
|
1761
|
+
const raydiumPosition = await raydium_client_1.PersonalPositionState.fetch(this._connection, strategyState.strategy.position, this._raydiumService.getRaydiumProgramId());
|
|
1760
1762
|
if (!raydiumPosition) {
|
|
1761
1763
|
throw new Error('Position is not found');
|
|
1762
1764
|
}
|
|
@@ -1767,94 +1769,39 @@ class Kamino {
|
|
|
1767
1769
|
if (!poolState) {
|
|
1768
1770
|
throw new Error('Pool is not found');
|
|
1769
1771
|
}
|
|
1770
|
-
withdrawIx
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
role: kit_1.AccountRole.WRITABLE,
|
|
1776
|
-
},
|
|
1777
|
-
]),
|
|
1778
|
-
};
|
|
1772
|
+
withdrawIx.keys.push({
|
|
1773
|
+
pubkey: strategyState.strategy.raydiumProtocolPositionOrBaseVaultAuthority,
|
|
1774
|
+
isSigner: false,
|
|
1775
|
+
isWritable: true,
|
|
1776
|
+
});
|
|
1779
1777
|
if (strategyState.strategy.reward0Decimals.toNumber() > 0) {
|
|
1780
|
-
withdrawIx =
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
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
|
-
};
|
|
1778
|
+
withdrawIx.keys = withdrawIx.keys.concat([
|
|
1779
|
+
{ pubkey: poolState.rewardInfos[0].tokenVault, isSigner: false, isWritable: true },
|
|
1780
|
+
{ pubkey: strategyState.strategy.reward0Vault, isSigner: false, isWritable: true },
|
|
1781
|
+
{ pubkey: poolState.rewardInfos[0].tokenMint, isSigner: false, isWritable: true },
|
|
1782
|
+
]);
|
|
1797
1783
|
}
|
|
1798
1784
|
if (strategyState.strategy.reward1Decimals.toNumber() > 0) {
|
|
1799
|
-
withdrawIx =
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
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
|
-
};
|
|
1785
|
+
withdrawIx.keys = withdrawIx.keys.concat([
|
|
1786
|
+
{ pubkey: poolState.rewardInfos[1].tokenVault, isSigner: false, isWritable: true },
|
|
1787
|
+
{ pubkey: strategyState.strategy.reward1Vault, isSigner: false, isWritable: true },
|
|
1788
|
+
{ pubkey: poolState.rewardInfos[1].tokenMint, isSigner: false, isWritable: true },
|
|
1789
|
+
]);
|
|
1816
1790
|
}
|
|
1817
1791
|
if (strategyState.strategy.reward2Decimals.toNumber() > 0) {
|
|
1818
|
-
withdrawIx =
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
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
|
-
};
|
|
1792
|
+
withdrawIx.keys = withdrawIx.keys.concat([
|
|
1793
|
+
{ pubkey: poolState.rewardInfos[2].tokenVault, isSigner: false, isWritable: true },
|
|
1794
|
+
{ pubkey: strategyState.strategy.reward2Vault, isSigner: false, isWritable: true },
|
|
1795
|
+
{ pubkey: poolState.rewardInfos[2].tokenMint, isSigner: false, isWritable: true },
|
|
1796
|
+
]);
|
|
1835
1797
|
}
|
|
1836
|
-
const [poolTickArrayBitmap, _poolTickArrayBitmapBump] =
|
|
1837
|
-
|
|
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
|
-
};
|
|
1798
|
+
const [poolTickArrayBitmap, _poolTickArrayBitmapBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('pool_tick_array_bitmap_extension'), strategyState.strategy.pool.toBuffer()], this._raydiumService.getRaydiumProgramId());
|
|
1799
|
+
withdrawIx.keys.push({ pubkey: poolTickArrayBitmap, isSigner: false, isWritable: true });
|
|
1849
1800
|
}
|
|
1850
1801
|
const res = { prerequisiteIxs: collectFeesAndRewardsIxns, withdrawIx };
|
|
1851
1802
|
// if we withdraw everything also close the shares ATA
|
|
1852
1803
|
if (sharesAtaBalance && sharesAtaBalance.lte(sharesAmount)) {
|
|
1853
|
-
res.closeSharesAtaIx = (0,
|
|
1854
|
-
owner,
|
|
1855
|
-
account: sharesAta,
|
|
1856
|
-
destination: owner.address,
|
|
1857
|
-
}, { programAddress: token_1.TOKEN_PROGRAM_ADDRESS });
|
|
1804
|
+
res.closeSharesAtaIx = (0, spl_token_1.createCloseAccountInstruction)(sharesAta, owner, owner, [], spl_token_1.TOKEN_PROGRAM_ID);
|
|
1858
1805
|
}
|
|
1859
1806
|
return res;
|
|
1860
1807
|
};
|
|
@@ -1873,31 +1820,31 @@ class Kamino {
|
|
|
1873
1820
|
getCreateAssociatedTokenAccountInstructionsIfNotExist = async (owner, strategyState, tokenAData, tokenAAta, tokenBData, tokenBAta, sharesMintData, sharesAta) => {
|
|
1874
1821
|
const instructions = [];
|
|
1875
1822
|
if (!tokenAData) {
|
|
1876
|
-
const tokenProgramA = strategyState.strategy.tokenATokenProgram
|
|
1877
|
-
?
|
|
1823
|
+
const tokenProgramA = strategyState.strategy.tokenATokenProgram == web3_js_1.PublicKey.default
|
|
1824
|
+
? spl_token_1.TOKEN_PROGRAM_ID
|
|
1878
1825
|
: strategyState.strategy.tokenATokenProgram;
|
|
1879
|
-
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenAAta, owner
|
|
1826
|
+
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenAAta, owner, strategyState.strategy.tokenAMint, tokenProgramA));
|
|
1880
1827
|
}
|
|
1881
1828
|
if (!tokenBData) {
|
|
1882
|
-
const tokenProgramB = strategyState.strategy.tokenBTokenProgram
|
|
1883
|
-
?
|
|
1829
|
+
const tokenProgramB = strategyState.strategy.tokenBTokenProgram == web3_js_1.PublicKey.default
|
|
1830
|
+
? spl_token_1.TOKEN_PROGRAM_ID
|
|
1884
1831
|
: strategyState.strategy.tokenBTokenProgram;
|
|
1885
|
-
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenBAta, owner
|
|
1832
|
+
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, tokenBAta, owner, strategyState.strategy.tokenBMint, tokenProgramB));
|
|
1886
1833
|
}
|
|
1887
1834
|
if (!sharesMintData) {
|
|
1888
|
-
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, sharesAta, owner
|
|
1835
|
+
instructions.push((0, utils_1.createAssociatedTokenAccountInstruction)(owner, sharesAta, owner, strategyState.strategy.sharesMint));
|
|
1889
1836
|
}
|
|
1890
1837
|
return instructions;
|
|
1891
1838
|
};
|
|
1892
1839
|
/**
|
|
1893
1840
|
* Check if strategy has already been fetched (is StrategyWithAddress type) and return that,
|
|
1894
|
-
* otherwise fetch it first from
|
|
1841
|
+
* otherwise fetch it first from PublicKey and return it
|
|
1895
1842
|
* @param strategy
|
|
1896
1843
|
* @private
|
|
1897
1844
|
*/
|
|
1898
1845
|
getStrategyStateIfNotFetched = async (strategy) => {
|
|
1899
1846
|
const hasStrategyBeenFetched = (object) => {
|
|
1900
|
-
return
|
|
1847
|
+
return 'strategy' in object;
|
|
1901
1848
|
};
|
|
1902
1849
|
if (hasStrategyBeenFetched(strategy)) {
|
|
1903
1850
|
return strategy;
|
|
@@ -1946,21 +1893,10 @@ class Kamino {
|
|
|
1946
1893
|
* @param tokenBMint
|
|
1947
1894
|
* @private
|
|
1948
1895
|
*/
|
|
1949
|
-
getTreasuryFeeVaultPDAs =
|
|
1950
|
-
const [
|
|
1951
|
-
|
|
1952
|
-
|
|
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
|
-
]);
|
|
1896
|
+
getTreasuryFeeVaultPDAs = (tokenAMint, tokenBMint) => {
|
|
1897
|
+
const [treasuryFeeTokenAVault, _treasuryFeeTokenAVaultBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('treasury_fee_vault'), tokenAMint.toBuffer()], this.getProgramID());
|
|
1898
|
+
const [treasuryFeeTokenBVault, _treasuryFeeTokenBVaultBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('treasury_fee_vault'), tokenBMint.toBuffer()], this.getProgramID());
|
|
1899
|
+
const [treasuryFeeVaultAuthority, _treasuryFeeVaultAuthorityBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('treasury_fee_vault_authority')], this.getProgramID());
|
|
1964
1900
|
return { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority };
|
|
1965
1901
|
};
|
|
1966
1902
|
/**
|
|
@@ -1971,12 +1907,15 @@ class Kamino {
|
|
|
1971
1907
|
*/
|
|
1972
1908
|
withdrawAllShares = async (strategy, owner) => {
|
|
1973
1909
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1974
|
-
const [, sharesData] = await (0, utils_1.
|
|
1975
|
-
if (!sharesData
|
|
1910
|
+
const [sharesAta, sharesData] = await (0, utils_1.getAssociatedTokenAddressAndData)(this._connection, strategyState.strategy.sharesMint, owner);
|
|
1911
|
+
if (!sharesData) {
|
|
1976
1912
|
return null;
|
|
1977
1913
|
}
|
|
1978
|
-
const
|
|
1979
|
-
|
|
1914
|
+
const balance = await this.getTokenAccountBalance(sharesAta);
|
|
1915
|
+
if (balance.isZero()) {
|
|
1916
|
+
return null;
|
|
1917
|
+
}
|
|
1918
|
+
return this.withdrawShares(strategyState, balance, owner);
|
|
1980
1919
|
};
|
|
1981
1920
|
/**
|
|
1982
1921
|
* Get all the accounts needed by the deposit tx, without the swap.
|
|
@@ -1986,14 +1925,14 @@ class Kamino {
|
|
|
1986
1925
|
*/
|
|
1987
1926
|
getAllDepositAccounts = async (strategy, owner) => {
|
|
1988
1927
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
1989
|
-
const globalConfig = await accounts_1.GlobalConfig.fetch(this.
|
|
1928
|
+
const globalConfig = await accounts_1.GlobalConfig.fetch(this._connection, strategyState.strategy.globalConfig, this._kaminoProgram.programId);
|
|
1990
1929
|
if (!globalConfig) {
|
|
1991
1930
|
throw Error(`Could not fetch global config with pubkey ${strategyState.strategy.globalConfig.toString()}`);
|
|
1992
1931
|
}
|
|
1993
1932
|
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
1994
1933
|
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.sharesMint, owner),
|
|
1995
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
1996
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
1934
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenAMint, owner, true, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
1935
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner, true, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
1997
1936
|
]);
|
|
1998
1937
|
const accounts = [
|
|
1999
1938
|
owner,
|
|
@@ -2013,10 +1952,10 @@ class Kamino {
|
|
|
2013
1952
|
strategyState.strategy.sharesMintAuthority,
|
|
2014
1953
|
strategyState.strategy.scopePrices,
|
|
2015
1954
|
globalConfig.tokenInfos,
|
|
2016
|
-
|
|
2017
|
-
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
2018
|
-
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
2019
|
-
|
|
1955
|
+
spl_token_1.TOKEN_PROGRAM_ID,
|
|
1956
|
+
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
1957
|
+
(0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
1958
|
+
web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2020
1959
|
strategyState.strategy.tickArrayLower,
|
|
2021
1960
|
strategyState.strategy.tickArrayUpper,
|
|
2022
1961
|
];
|
|
@@ -2039,11 +1978,9 @@ class Kamino {
|
|
|
2039
1978
|
if (!globalConfig) {
|
|
2040
1979
|
throw Error(`Could not fetch global config with pubkey ${strategyState.strategy.globalConfig.toString()}`);
|
|
2041
1980
|
}
|
|
2042
|
-
const [sharesAta
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.strategy.tokenBMint, owner.address, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS)),
|
|
2046
|
-
]);
|
|
1981
|
+
const [sharesAta] = await (0, utils_1.getAssociatedTokenAddressAndData)(this._connection, strategyState.strategy.sharesMint, owner);
|
|
1982
|
+
const [tokenAAta] = await (0, utils_1.getAssociatedTokenAddressAndData)(this._connection, strategyState.strategy.tokenAMint, owner, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID));
|
|
1983
|
+
const [tokenBAta] = await (0, utils_1.getAssociatedTokenAddressAndData)(this._connection, strategyState.strategy.tokenBMint, owner, (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID));
|
|
2047
1984
|
const lamportsA = amountA.mul(new decimal_js_1.default(10).pow(strategyState.strategy.tokenAMintDecimals.toString()));
|
|
2048
1985
|
const lamportsB = amountB.mul(new decimal_js_1.default(10).pow(strategyState.strategy.tokenBMintDecimals.toString()));
|
|
2049
1986
|
const depositArgs = {
|
|
@@ -2068,29 +2005,29 @@ class Kamino {
|
|
|
2068
2005
|
sharesMintAuthority: strategyState.strategy.sharesMintAuthority,
|
|
2069
2006
|
scopePrices: strategyState.strategy.scopePrices,
|
|
2070
2007
|
tokenInfos: globalConfig.tokenInfos,
|
|
2071
|
-
tokenProgram:
|
|
2072
|
-
instructionSysvarAccount:
|
|
2008
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2009
|
+
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2073
2010
|
tickArrayLower: strategyState.strategy.tickArrayLower,
|
|
2074
2011
|
tickArrayUpper: strategyState.strategy.tickArrayUpper,
|
|
2075
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram,
|
|
2076
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram,
|
|
2012
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2013
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2077
2014
|
};
|
|
2078
|
-
return (0,
|
|
2015
|
+
return (0, instructions_1.deposit)(depositArgs, depositAccounts);
|
|
2079
2016
|
};
|
|
2080
2017
|
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,
|
|
2081
2018
|
onlyDirectRoutes) => {
|
|
2082
2019
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
2083
|
-
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner
|
|
2020
|
+
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner, strategyWithAddress.strategy.tokenAMint, strategyWithAddress.strategy.tokenBMint, initialUserTokenAtaBalances), 'A-getInitialUserTokenBalances', []);
|
|
2084
2021
|
const userTokenBalancesWithoutSolBalanace = {
|
|
2085
2022
|
a: userTokenBalances.a,
|
|
2086
2023
|
b: userTokenBalances.b,
|
|
2087
2024
|
};
|
|
2088
2025
|
// 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
|
|
2089
2026
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenAMint)) {
|
|
2090
|
-
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(
|
|
2027
|
+
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this._connection.getBalance(owner)), utils_1.DECIMALS_SOL));
|
|
2091
2028
|
}
|
|
2092
2029
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenBMint)) {
|
|
2093
|
-
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(
|
|
2030
|
+
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this._connection.getBalance(owner)), utils_1.DECIMALS_SOL));
|
|
2094
2031
|
}
|
|
2095
2032
|
if (!userTokenBalances.a || !userTokenBalances.b) {
|
|
2096
2033
|
throw Error('Error reading user token balances');
|
|
@@ -2098,7 +2035,7 @@ class Kamino {
|
|
|
2098
2035
|
const tokenAMinPostDepositBalance = userTokenBalances.a?.sub(amountToDeposit);
|
|
2099
2036
|
const swapper = swapIxsBuilder
|
|
2100
2037
|
? swapIxsBuilder
|
|
2101
|
-
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user
|
|
2038
|
+
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user, slippageBps, false, allAccounts, profiler, onlyDirectRoutes);
|
|
2102
2039
|
console.log('single sided deposit tokenA tokenAMinPostDepositBalance', tokenAMinPostDepositBalance);
|
|
2103
2040
|
console.log('single sided deposit tokenA userTokenBalances.b', userTokenBalances.b);
|
|
2104
2041
|
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', []);
|
|
@@ -2106,17 +2043,17 @@ class Kamino {
|
|
|
2106
2043
|
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,
|
|
2107
2044
|
onlyDirectRoutes) => {
|
|
2108
2045
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
2109
|
-
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner
|
|
2046
|
+
const userTokenBalances = await profiler(this.getInitialUserTokenBalances(owner, strategyWithAddress.strategy.tokenAMint, strategyWithAddress.strategy.tokenBMint, initialUserTokenAtaBalances), 'A-getInitialUserTokenBalances', []);
|
|
2110
2047
|
const userTokenBalancesWithoutSolBalanace = {
|
|
2111
2048
|
a: userTokenBalances.a,
|
|
2112
2049
|
b: userTokenBalances.b,
|
|
2113
2050
|
};
|
|
2114
2051
|
// 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
|
|
2115
2052
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenAMint)) {
|
|
2116
|
-
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(
|
|
2053
|
+
userTokenBalances.a = userTokenBalances.a?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this._connection.getBalance(owner)), utils_1.DECIMALS_SOL));
|
|
2117
2054
|
}
|
|
2118
2055
|
if ((0, utils_1.isSOLMint)(strategyWithAddress.strategy.tokenBMint)) {
|
|
2119
|
-
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(
|
|
2056
|
+
userTokenBalances.b = userTokenBalances.b?.add((0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this._connection.getBalance(owner)), utils_1.DECIMALS_SOL));
|
|
2120
2057
|
}
|
|
2121
2058
|
if (!userTokenBalances.a || !userTokenBalances.b) {
|
|
2122
2059
|
throw Error('Error reading user token balances');
|
|
@@ -2124,7 +2061,7 @@ class Kamino {
|
|
|
2124
2061
|
const tokenBMinPostDepositBalance = userTokenBalances.b.sub(amountToDeposit);
|
|
2125
2062
|
const swapper = swapIxsBuilder
|
|
2126
2063
|
? swapIxsBuilder
|
|
2127
|
-
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user
|
|
2064
|
+
: (input, tokenAMint, tokenBMint, user, slippageBps, allAccounts) => this.getJupSwapIxsV6(input, tokenAMint, tokenBMint, user, slippageBps, false, allAccounts, profiler, onlyDirectRoutes);
|
|
2128
2065
|
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', []);
|
|
2129
2066
|
};
|
|
2130
2067
|
getInitialUserTokenBalances = async (owner, tokenAMint, tokenBMint, initialUserTokenBalances) => {
|
|
@@ -2135,8 +2072,8 @@ class Kamino {
|
|
|
2135
2072
|
}
|
|
2136
2073
|
else {
|
|
2137
2074
|
const tokenATokenProgram = await this.getAccountOwner(tokenAMint);
|
|
2138
|
-
const tokenAAta = await (0, utils_1.
|
|
2139
|
-
const ataExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2075
|
+
const [tokenAAta] = await (0, utils_1.getAssociatedTokenAddressAndData)(this._connection, tokenAMint, owner, (0, utils_1.keyOrDefault)(tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID));
|
|
2076
|
+
const ataExists = await (0, transactions_1.checkIfAccountExists)(this._connection, tokenAAta);
|
|
2140
2077
|
if (!ataExists) {
|
|
2141
2078
|
initialUserTokenABalance = new decimal_js_1.default(0);
|
|
2142
2079
|
}
|
|
@@ -2149,8 +2086,8 @@ class Kamino {
|
|
|
2149
2086
|
}
|
|
2150
2087
|
else {
|
|
2151
2088
|
const tokenBTokenProgram = await this.getAccountOwner(tokenBMint);
|
|
2152
|
-
const tokenBAta = await (0, utils_1.
|
|
2153
|
-
const ataExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2089
|
+
const [tokenBAta] = await (0, utils_1.getAssociatedTokenAddressAndData)(this._connection, tokenBMint, owner, (0, utils_1.keyOrDefault)(tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID));
|
|
2090
|
+
const ataExists = await (0, transactions_1.checkIfAccountExists)(this._connection, tokenBAta);
|
|
2154
2091
|
if (!ataExists) {
|
|
2155
2092
|
initialUserTokenBBalance = new decimal_js_1.default(0);
|
|
2156
2093
|
}
|
|
@@ -2172,9 +2109,9 @@ class Kamino {
|
|
|
2172
2109
|
throw Error('Token A or B post deposit amount cant be lower than 0.');
|
|
2173
2110
|
}
|
|
2174
2111
|
const [sharesAta, tokenAAta, tokenBAta] = await Promise.all([
|
|
2175
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.sharesMint, owner
|
|
2176
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, owner
|
|
2177
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, owner
|
|
2112
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.sharesMint, owner),
|
|
2113
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, owner, true, (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
2114
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, owner, true, (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
2178
2115
|
]);
|
|
2179
2116
|
let tokenAAtaBalance = initialUserTokenAtaBalances.a;
|
|
2180
2117
|
let tokenBAtaBalance = initialUserTokenAtaBalances.b;
|
|
@@ -2184,7 +2121,7 @@ class Kamino {
|
|
|
2184
2121
|
const createWsolAtasIxns = [];
|
|
2185
2122
|
if ((0, utils_1.isSOLMint)(strategyState.tokenAMint)) {
|
|
2186
2123
|
// read how much SOL the user has and calculate the amount to deposit and balance based on it
|
|
2187
|
-
const solBalance = new decimal_js_1.default(
|
|
2124
|
+
const solBalance = new decimal_js_1.default(await this._connection.getBalance(owner));
|
|
2188
2125
|
const tokenAAtaBalanceLamports = (0, utils_1.collToLamportsDecimal)(tokenAAtaBalance, strategyState.tokenAMintDecimals.toNumber());
|
|
2189
2126
|
const availableSol = solBalance.add(tokenAAtaBalanceLamports);
|
|
2190
2127
|
const solToDeposit = availableSol.sub(tokenAMinPostDepositBalanceLamports);
|
|
@@ -2194,9 +2131,9 @@ class Kamino {
|
|
|
2194
2131
|
tokenAAtaBalance = (0, utils_1.lamportsToNumberDecimal)(aToDeposit, utils_1.DECIMALS_SOL);
|
|
2195
2132
|
}
|
|
2196
2133
|
}
|
|
2197
|
-
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this.
|
|
2134
|
+
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this._connection, new decimal_js_1.default((0, utils_1.lamportsToNumberDecimal)(solToDeposit, utils_1.DECIMALS_SOL)), owner);
|
|
2198
2135
|
// if the wSOL ata is not created, expect to have 0 remaining after the deposit
|
|
2199
|
-
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2136
|
+
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this._connection, createWSolAtaIxns.ata);
|
|
2200
2137
|
if (!wSolAtaExists) {
|
|
2201
2138
|
realTokenAMinPostDepositBalanceLamports = new decimal_js_1.default(0);
|
|
2202
2139
|
}
|
|
@@ -2214,7 +2151,7 @@ class Kamino {
|
|
|
2214
2151
|
}
|
|
2215
2152
|
}
|
|
2216
2153
|
if ((0, utils_1.isSOLMint)(strategyState.tokenBMint)) {
|
|
2217
|
-
const solBalance = new decimal_js_1.default(
|
|
2154
|
+
const solBalance = new decimal_js_1.default(await this._connection.getBalance(owner));
|
|
2218
2155
|
const tokenBAtaBalanceLamports = (0, utils_1.collToLamportsDecimal)(tokenBAtaBalance, strategyState.tokenBMintDecimals.toNumber());
|
|
2219
2156
|
const availableSol = solBalance.add(tokenBAtaBalanceLamports);
|
|
2220
2157
|
const solToDeposit = availableSol.sub(tokenBMinPostDepositBalanceLamports);
|
|
@@ -2225,8 +2162,8 @@ class Kamino {
|
|
|
2225
2162
|
tokenBAtaBalance = (0, utils_1.lamportsToNumberDecimal)(bToDeposit, utils_1.DECIMALS_SOL);
|
|
2226
2163
|
}
|
|
2227
2164
|
}
|
|
2228
|
-
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this.
|
|
2229
|
-
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this.
|
|
2165
|
+
const createWSolAtaIxns = await (0, transactions_1.createWsolAtaIfMissing)(this._connection, new decimal_js_1.default((0, utils_1.lamportsToNumberDecimal)(solToDeposit, utils_1.DECIMALS_SOL)), owner);
|
|
2166
|
+
const wSolAtaExists = await (0, transactions_1.checkIfAccountExists)(this._connection, createWSolAtaIxns.ata);
|
|
2230
2167
|
if (!wSolAtaExists) {
|
|
2231
2168
|
realTokenBMinPostDepositBalanceLamports = new decimal_js_1.default(0);
|
|
2232
2169
|
}
|
|
@@ -2247,20 +2184,14 @@ class Kamino {
|
|
|
2247
2184
|
if (aToDeposit.lessThan(0) || bToDeposit.lessThan(0)) {
|
|
2248
2185
|
throw Error(`Token A or B to deposit amount cannot be lower than 0; aToDeposit=${aToDeposit.toString()} bToDeposit=${bToDeposit.toString()}`);
|
|
2249
2186
|
}
|
|
2250
|
-
const createAtaList = [[strategyState.sharesMint,
|
|
2187
|
+
const createAtaList = [[strategyState.sharesMint, spl_token_1.TOKEN_PROGRAM_ID]];
|
|
2251
2188
|
if (!tokenAAtaBalance.greaterThan(0)) {
|
|
2252
|
-
createAtaList.push([
|
|
2253
|
-
strategyState.tokenAMint,
|
|
2254
|
-
(0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2255
|
-
]);
|
|
2189
|
+
createAtaList.push([strategyState.tokenAMint, (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID)]);
|
|
2256
2190
|
}
|
|
2257
2191
|
if (!tokenBAtaBalance.greaterThan(0)) {
|
|
2258
|
-
createAtaList.push([
|
|
2259
|
-
strategyState.tokenBMint,
|
|
2260
|
-
(0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, token_1.TOKEN_PROGRAM_ADDRESS),
|
|
2261
|
-
]);
|
|
2192
|
+
createAtaList.push([strategyState.tokenBMint, (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID)]);
|
|
2262
2193
|
}
|
|
2263
|
-
const createAtasIxnsPromise = (0, transactions_1.getAtasWithCreateIxnsIfMissing)(this.
|
|
2194
|
+
const createAtasIxnsPromise = (0, transactions_1.getAtasWithCreateIxnsIfMissing)(this._connection, createAtaList.filter(([mint, _tokenProgram]) => !(0, utils_1.isSOLMint)(mint)), owner);
|
|
2264
2195
|
const getGlobalConfigPromise = this.getGlobalConfigState(strategyState.globalConfig);
|
|
2265
2196
|
const [createAtasIxns, amountsToDepositWithSwap, globalConfig] = await Promise.all([
|
|
2266
2197
|
createAtasIxnsPromise,
|
|
@@ -2293,20 +2224,20 @@ class Kamino {
|
|
|
2293
2224
|
sharesMintAuthority: strategyState.sharesMintAuthority,
|
|
2294
2225
|
scopePrices: strategyState.scopePrices,
|
|
2295
2226
|
tokenInfos: globalConfig.tokenInfos,
|
|
2296
|
-
tokenProgram:
|
|
2297
|
-
instructionSysvarAccount:
|
|
2227
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2228
|
+
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2298
2229
|
tickArrayLower: strategyWithAddress.strategy.tickArrayLower,
|
|
2299
2230
|
tickArrayUpper: strategyWithAddress.strategy.tickArrayUpper,
|
|
2300
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenATokenProgram,
|
|
2301
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenBTokenProgram,
|
|
2231
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2232
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyWithAddress.strategy.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2302
2233
|
};
|
|
2303
|
-
const singleSidedDepositIx = (0,
|
|
2234
|
+
const singleSidedDepositIx = (0, instructions_1.singleTokenDepositWithMin)(args, accounts);
|
|
2304
2235
|
let result = [];
|
|
2305
2236
|
if (includeAtaIxns) {
|
|
2306
2237
|
result.push(...createAtasIxns, ...createWsolAtasIxns);
|
|
2307
2238
|
}
|
|
2308
2239
|
// get all unique accounts in the tx so we can use the remaining space (MAX_ACCOUNTS_PER_TRANSACTION - accounts_used) for the swap
|
|
2309
|
-
const extractKeys = (ixs) => ixs.flatMap((ix) => ix.
|
|
2240
|
+
const extractKeys = (ixs) => ixs.flatMap((ix) => ix.keys?.map((key) => key.pubkey) || []);
|
|
2310
2241
|
const allKeys = [
|
|
2311
2242
|
...extractKeys(result),
|
|
2312
2243
|
...extractKeys([checkExpectedVaultsBalancesIx]),
|
|
@@ -2345,15 +2276,15 @@ class Kamino {
|
|
|
2345
2276
|
* @param amountLamports Amount of SOL to deposit into topup vault
|
|
2346
2277
|
* @returns transaction instruction for adding SOL to topup vault
|
|
2347
2278
|
*/
|
|
2348
|
-
upkeepTopupVault =
|
|
2279
|
+
upkeepTopupVault = (owner, amountLamports) => {
|
|
2349
2280
|
if (amountLamports.lessThanOrEqualTo(0)) {
|
|
2350
2281
|
throw Error('Must deposit a positive amount of SOL.');
|
|
2351
2282
|
}
|
|
2352
|
-
const topupVault =
|
|
2353
|
-
const ix =
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2283
|
+
const topupVault = this.getUserTopupVault(owner);
|
|
2284
|
+
const ix = web3_js_1.SystemProgram.transfer({
|
|
2285
|
+
fromPubkey: owner,
|
|
2286
|
+
toPubkey: topupVault,
|
|
2287
|
+
lamports: BigInt(amountLamports.floor().toString()),
|
|
2357
2288
|
});
|
|
2358
2289
|
return ix;
|
|
2359
2290
|
};
|
|
@@ -2363,8 +2294,8 @@ class Kamino {
|
|
|
2363
2294
|
* @returns SOL amount in topup vault
|
|
2364
2295
|
*/
|
|
2365
2296
|
topupVaultBalance = async (owner) => {
|
|
2366
|
-
const topupVault =
|
|
2367
|
-
return (0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(
|
|
2297
|
+
const topupVault = this.getUserTopupVault(owner);
|
|
2298
|
+
return (0, utils_1.lamportsToNumberDecimal)(new decimal_js_1.default(await this._connection.getBalance(topupVault)), utils_1.DECIMALS_SOL);
|
|
2368
2299
|
};
|
|
2369
2300
|
/**
|
|
2370
2301
|
* Get transaction instruction to withdraw SOL from the topup vault.
|
|
@@ -2376,10 +2307,10 @@ class Kamino {
|
|
|
2376
2307
|
if (amount.lessThanOrEqualTo(0)) {
|
|
2377
2308
|
throw Error('Must withdraw a positive amount of SOL.');
|
|
2378
2309
|
}
|
|
2379
|
-
const topupVault =
|
|
2310
|
+
const topupVault = this.getUserTopupVault(owner);
|
|
2380
2311
|
let solToWithdraw;
|
|
2381
2312
|
if (amount.eq(new decimal_js_1.default(constants_1.U64_MAX))) {
|
|
2382
|
-
solToWithdraw = new decimal_js_1.default(
|
|
2313
|
+
solToWithdraw = new decimal_js_1.default(await this._connection.getBalance(topupVault));
|
|
2383
2314
|
}
|
|
2384
2315
|
else {
|
|
2385
2316
|
solToWithdraw = (0, utils_1.collToLamportsDecimal)(amount, utils_1.DECIMALS_SOL);
|
|
@@ -2390,29 +2321,25 @@ class Kamino {
|
|
|
2390
2321
|
const accounts = {
|
|
2391
2322
|
adminAuthority: owner,
|
|
2392
2323
|
topupVault,
|
|
2393
|
-
system:
|
|
2324
|
+
system: web3_js_1.SystemProgram.programId,
|
|
2394
2325
|
};
|
|
2395
|
-
const withdrawIxn = (0,
|
|
2326
|
+
const withdrawIxn = (0, instructions_1.withdrawFromTopup)(args, accounts);
|
|
2396
2327
|
return withdrawIxn;
|
|
2397
2328
|
};
|
|
2398
2329
|
getJupSwapIxsWithMaxAccounts = async (input, tokenAMint, tokenBMint, owner, slippageBps, useOnlyLegacyTransaction, existingAccounts, maxAccounts, profiler = utils_1.noopProfiledFunctionExecution, onlyDirectRoutes) => {
|
|
2399
2330
|
const jupiterQuote = input.tokenAToSwapAmount.lt(utils_1.ZERO)
|
|
2400
2331
|
? await profiler(JupService_1.JupService.getBestRouteV6(owner, input.tokenAToSwapAmount.abs(), tokenAMint, tokenBMint, slippageBps.toNumber(), useOnlyLegacyTransaction, maxAccounts, onlyDirectRoutes), 'C-getBestRouteV6', [])
|
|
2401
2332
|
: await profiler(JupService_1.JupService.getBestRouteV6(owner, input.tokenBToSwapAmount.abs(), tokenBMint, tokenAMint, slippageBps.toNumber(), useOnlyLegacyTransaction, maxAccounts, onlyDirectRoutes), 'C-getBestRouteV6', []);
|
|
2402
|
-
const
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
jupiterQuote.swapInstruction,
|
|
2406
|
-
...(jupiterQuote.cleanupInstruction ? [jupiterQuote.cleanupInstruction] : []),
|
|
2407
|
-
];
|
|
2408
|
-
const allJupAccounts = allJupIxs.flatMap((ix) => ix.accounts?.map((key) => key.address) || []);
|
|
2333
|
+
const { txMessage, lookupTablesAddresses } = await profiler(JupService_1.JupService.deserealizeVersionedTransactions(this._connection, [jupiterQuote.swapTransaction]), 'C-deserealizeVersionedTransactions', []);
|
|
2334
|
+
const allJupIxs = [...(0, transactions_1.removeBudgetAndAtaIxns)(txMessage[0].instructions, [tokenAMint, tokenBMint])];
|
|
2335
|
+
const allJupAccounts = allJupIxs.flatMap((ix) => ix.keys?.map((key) => key.pubkey) || []);
|
|
2409
2336
|
const allAccounts = new Set([...existingAccounts, ...allJupAccounts]);
|
|
2410
2337
|
const prefix = 'getSingleSidedJupRoute:';
|
|
2411
2338
|
console.log(`${prefix} All distinct existing accounts number ${new Set(existingAccounts).size}`);
|
|
2412
2339
|
console.log(`${prefix} All distinct Jup accounts number ${new Set(allJupAccounts).size}`);
|
|
2413
2340
|
console.log(`${prefix} All accounts number ${allAccounts.size}`);
|
|
2414
2341
|
if (allAccounts.size < transactions_1.MAX_ACCOUNTS_PER_TRANSACTION) {
|
|
2415
|
-
return [allJupIxs,
|
|
2342
|
+
return [allJupIxs, lookupTablesAddresses];
|
|
2416
2343
|
}
|
|
2417
2344
|
// 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
|
|
2418
2345
|
throw new Error('All Jupiter swap routes have too many accounts in the instructions');
|
|
@@ -2472,7 +2399,7 @@ class Kamino {
|
|
|
2472
2399
|
tokenAAta,
|
|
2473
2400
|
tokenBAta,
|
|
2474
2401
|
};
|
|
2475
|
-
return (0,
|
|
2402
|
+
return (0, instructions_1.checkExpectedVaultsBalances)(args, accounts);
|
|
2476
2403
|
};
|
|
2477
2404
|
/**
|
|
2478
2405
|
* Get transaction instruction to create a new Kamino strategy.
|
|
@@ -2486,26 +2413,26 @@ class Kamino {
|
|
|
2486
2413
|
* @returns transaction instruction for Kamino strategy creation
|
|
2487
2414
|
*/
|
|
2488
2415
|
createStrategy = async (strategy, pool, owner, dex) => {
|
|
2489
|
-
let tokenAMint =
|
|
2490
|
-
let tokenBMint =
|
|
2491
|
-
if (dex
|
|
2492
|
-
const whirlpoolState = await
|
|
2416
|
+
let tokenAMint = web3_js_1.PublicKey.default;
|
|
2417
|
+
let tokenBMint = web3_js_1.PublicKey.default;
|
|
2418
|
+
if (dex == 'ORCA') {
|
|
2419
|
+
const whirlpoolState = await whirlpools_client_1.Whirlpool.fetch(this._connection, pool, this._orcaService.getWhirlpoolProgramId());
|
|
2493
2420
|
if (!whirlpoolState) {
|
|
2494
2421
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
2495
2422
|
}
|
|
2496
2423
|
tokenAMint = whirlpoolState.tokenMintA;
|
|
2497
2424
|
tokenBMint = whirlpoolState.tokenMintB;
|
|
2498
2425
|
}
|
|
2499
|
-
else if (dex
|
|
2500
|
-
const raydiumPoolState = await
|
|
2426
|
+
else if (dex == 'RAYDIUM') {
|
|
2427
|
+
const raydiumPoolState = await raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
2501
2428
|
if (!raydiumPoolState) {
|
|
2502
2429
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
2503
2430
|
}
|
|
2504
2431
|
tokenAMint = raydiumPoolState.tokenMint0;
|
|
2505
2432
|
tokenBMint = raydiumPoolState.tokenMint1;
|
|
2506
2433
|
}
|
|
2507
|
-
else if (dex
|
|
2508
|
-
const meteoraPoolState = await
|
|
2434
|
+
else if (dex == 'METEORA') {
|
|
2435
|
+
const meteoraPoolState = await accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
2509
2436
|
if (!meteoraPoolState) {
|
|
2510
2437
|
throw Error(`Could not fetch Meteora pool state with pubkey ${pool.toString()}`);
|
|
2511
2438
|
}
|
|
@@ -2519,11 +2446,11 @@ class Kamino {
|
|
|
2519
2446
|
throw Error(`Could not fetch globalConfig with pubkey ${this.getGlobalConfig().toString()}`);
|
|
2520
2447
|
}
|
|
2521
2448
|
const collateralInfos = await this.getCollateralInfo(config.tokenInfos);
|
|
2522
|
-
const tokenACollateralId = collateralInfos.findIndex((x) => x.mint
|
|
2449
|
+
const tokenACollateralId = collateralInfos.findIndex((x) => x.mint.equals(tokenAMint));
|
|
2523
2450
|
if (tokenACollateralId === -1) {
|
|
2524
2451
|
throw Error(`Could not find token A (mint ${tokenAMint}) in collateral infos`);
|
|
2525
2452
|
}
|
|
2526
|
-
const tokenBCollateralId = collateralInfos.findIndex((x) => x.mint
|
|
2453
|
+
const tokenBCollateralId = collateralInfos.findIndex((x) => x.mint.equals(tokenBMint));
|
|
2527
2454
|
if (tokenBCollateralId === -1) {
|
|
2528
2455
|
throw Error(`Could not find token A (mint ${tokenBMint}) in collateral infos`);
|
|
2529
2456
|
}
|
|
@@ -2546,36 +2473,30 @@ class Kamino {
|
|
|
2546
2473
|
sharesMint: programAddresses.sharesMint,
|
|
2547
2474
|
sharesMintAuthority: programAddresses.sharesMintAuthority,
|
|
2548
2475
|
tokenInfos: config.tokenInfos,
|
|
2549
|
-
systemProgram:
|
|
2550
|
-
rent:
|
|
2551
|
-
tokenProgram:
|
|
2476
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
2477
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
2478
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2552
2479
|
tokenATokenProgram,
|
|
2553
2480
|
tokenBTokenProgram,
|
|
2554
2481
|
};
|
|
2555
|
-
|
|
2556
|
-
ix
|
|
2557
|
-
|
|
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
|
-
};
|
|
2482
|
+
const ix = (0, instructions_1.initializeStrategy)(strategyArgs, strategyAccounts);
|
|
2483
|
+
ix.keys.push({ pubkey: config.scopePriceId, isSigner: false, isWritable: false });
|
|
2484
|
+
ix.keys.push({ pubkey: config.scopeProgramId, isSigner: false, isWritable: false });
|
|
2563
2485
|
return ix;
|
|
2564
2486
|
};
|
|
2565
2487
|
/**
|
|
2566
2488
|
* Get transaction instruction to close Kamino strategy, including its position if there is any
|
|
2567
2489
|
* and strategy token accounts.
|
|
2568
2490
|
* @param strategy public key of the strategy
|
|
2569
|
-
* @param admin signer to close the strategy
|
|
2570
2491
|
* @returns instruction to close the strategy
|
|
2571
2492
|
*/
|
|
2572
|
-
withdrawAllAndCloseStrategy = async (
|
|
2493
|
+
withdrawAllAndCloseStrategy = async (strategy) => {
|
|
2573
2494
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
2574
|
-
const withdrawIxns = await this.withdrawAllShares(strategyWithAddress,
|
|
2575
|
-
if (withdrawIxns
|
|
2495
|
+
const withdrawIxns = await this.withdrawAllShares(strategyWithAddress, strategyWithAddress.strategy.adminAuthority);
|
|
2496
|
+
if (withdrawIxns == null) {
|
|
2576
2497
|
return null;
|
|
2577
2498
|
}
|
|
2578
|
-
const closeIxn = await this.closeStrategy(
|
|
2499
|
+
const closeIxn = await this.closeStrategy(strategyWithAddress);
|
|
2579
2500
|
return {
|
|
2580
2501
|
withdrawIxns: [...withdrawIxns.prerequisiteIxs, withdrawIxns.withdrawIx],
|
|
2581
2502
|
closeIxn,
|
|
@@ -2584,21 +2505,20 @@ class Kamino {
|
|
|
2584
2505
|
/**
|
|
2585
2506
|
* Get transaction instruction to close Kamino strategy, including its position if there is any
|
|
2586
2507
|
* and strategy token accounts.
|
|
2587
|
-
* @param admin signer to close the strategy
|
|
2588
2508
|
* @param strategy public key of the strategy
|
|
2589
2509
|
* @returns instruction to close the strategy
|
|
2590
2510
|
*/
|
|
2591
|
-
closeStrategy = async (
|
|
2511
|
+
closeStrategy = async (strategy) => {
|
|
2592
2512
|
const { address: strategyPubkey, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
2593
2513
|
const collInfos = await this.getCollateralInfos();
|
|
2594
|
-
const eventAuthority =
|
|
2595
|
-
const poolProgram =
|
|
2514
|
+
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2515
|
+
const poolProgram = (0, utils_1.getDexProgramId)(strategyState);
|
|
2596
2516
|
let oldPositionOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2597
2517
|
let oldPositionMintOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2598
2518
|
let oldPositionTokenAccountOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2599
2519
|
let oldTickArrayLowerOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2600
2520
|
let oldTickArrayUpperOrBaseVaultAuthority = strategyState.baseVaultAuthority;
|
|
2601
|
-
if (strategyState.position
|
|
2521
|
+
if (!strategyState.position.equals(web3_js_1.PublicKey.default)) {
|
|
2602
2522
|
oldPositionOrBaseVaultAuthority = strategyState.position;
|
|
2603
2523
|
oldPositionMintOrBaseVaultAuthority = strategyState.positionMint;
|
|
2604
2524
|
oldPositionTokenAccountOrBaseVaultAuthority = strategyState.positionTokenAccount;
|
|
@@ -2606,18 +2526,18 @@ class Kamino {
|
|
|
2606
2526
|
oldTickArrayUpperOrBaseVaultAuthority = strategyState.tickArrayUpper;
|
|
2607
2527
|
}
|
|
2608
2528
|
const [userTokenAAta, userTokenBAta] = await Promise.all([
|
|
2609
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, strategyState.adminAuthority, (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
2610
|
-
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, strategyState.adminAuthority, (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
2529
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenAMint, strategyState.adminAuthority, true, (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
2530
|
+
(0, utils_1.getAssociatedTokenAddress)(strategyState.tokenBMint, strategyState.adminAuthority, true, (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID)),
|
|
2611
2531
|
]);
|
|
2612
2532
|
const rewardMints = Array(6).fill(strategyState.pool);
|
|
2613
|
-
const rewardTokenPrograms = Array(6).fill(
|
|
2533
|
+
const rewardTokenPrograms = Array(6).fill(spl_token_1.TOKEN_PROGRAM_ID);
|
|
2614
2534
|
let reward0Vault = strategyState.baseVaultAuthority;
|
|
2615
2535
|
let userReward0Ata = strategyState.baseVaultAuthority;
|
|
2616
2536
|
if ((0, utils_1.isVaultInitialized)(strategyState.reward0Vault, strategyState.reward0Decimals)) {
|
|
2617
2537
|
reward0Vault = strategyState.reward0Vault;
|
|
2618
2538
|
rewardMints[0] = collInfos[strategyState.reward0CollateralId.toNumber()].mint;
|
|
2619
2539
|
rewardTokenPrograms[0] = await this.getAccountOwner(rewardMints[0]);
|
|
2620
|
-
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[0], strategyState.adminAuthority, rewardTokenPrograms[0]);
|
|
2540
|
+
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[0], strategyState.adminAuthority, true, rewardTokenPrograms[0]);
|
|
2621
2541
|
}
|
|
2622
2542
|
let reward1Vault = strategyState.baseVaultAuthority;
|
|
2623
2543
|
let userReward1Ata = strategyState.baseVaultAuthority;
|
|
@@ -2625,7 +2545,7 @@ class Kamino {
|
|
|
2625
2545
|
reward1Vault = strategyState.reward1Vault;
|
|
2626
2546
|
rewardMints[1] = collInfos[strategyState.reward1CollateralId.toNumber()].mint;
|
|
2627
2547
|
rewardTokenPrograms[1] = await this.getAccountOwner(rewardMints[1]);
|
|
2628
|
-
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[1], strategyState.adminAuthority, rewardTokenPrograms[1]);
|
|
2548
|
+
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[1], strategyState.adminAuthority, true, rewardTokenPrograms[1]);
|
|
2629
2549
|
}
|
|
2630
2550
|
let reward2Vault = strategyState.baseVaultAuthority;
|
|
2631
2551
|
let userReward2Ata = strategyState.baseVaultAuthority;
|
|
@@ -2633,7 +2553,7 @@ class Kamino {
|
|
|
2633
2553
|
reward2Vault = strategyState.reward2Vault;
|
|
2634
2554
|
rewardMints[2] = collInfos[strategyState.reward2CollateralId.toNumber()].mint;
|
|
2635
2555
|
rewardTokenPrograms[2] = await this.getAccountOwner(rewardMints[2]);
|
|
2636
|
-
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[2], strategyState.adminAuthority, rewardTokenPrograms[2]);
|
|
2556
|
+
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[2], strategyState.adminAuthority, true, rewardTokenPrograms[2]);
|
|
2637
2557
|
}
|
|
2638
2558
|
let kaminoReward0Vault = strategyState.baseVaultAuthority;
|
|
2639
2559
|
const userKaminoReward0Ata = strategyState.baseVaultAuthority;
|
|
@@ -2641,7 +2561,7 @@ class Kamino {
|
|
|
2641
2561
|
kaminoReward0Vault = strategyState.kaminoRewards[0].rewardVault;
|
|
2642
2562
|
rewardMints[3] = strategyState.kaminoRewards[0].rewardVault;
|
|
2643
2563
|
rewardTokenPrograms[3] = await this.getAccountOwner(rewardMints[3]);
|
|
2644
|
-
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[3], strategyState.adminAuthority, rewardTokenPrograms[3]);
|
|
2564
|
+
userReward0Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[3], strategyState.adminAuthority, true, rewardTokenPrograms[3]);
|
|
2645
2565
|
}
|
|
2646
2566
|
let kaminoReward1Vault = strategyState.baseVaultAuthority;
|
|
2647
2567
|
const userKaminoReward1Ata = strategyState.baseVaultAuthority;
|
|
@@ -2649,7 +2569,7 @@ class Kamino {
|
|
|
2649
2569
|
kaminoReward1Vault = strategyState.kaminoRewards[1].rewardVault;
|
|
2650
2570
|
rewardMints[4] = strategyState.kaminoRewards[1].rewardVault;
|
|
2651
2571
|
rewardTokenPrograms[4] = await this.getAccountOwner(rewardMints[4]);
|
|
2652
|
-
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[4], strategyState.adminAuthority, rewardTokenPrograms[4]);
|
|
2572
|
+
userReward1Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[4], strategyState.adminAuthority, true, rewardTokenPrograms[4]);
|
|
2653
2573
|
}
|
|
2654
2574
|
let kaminoReward2Vault = strategyState.baseVaultAuthority;
|
|
2655
2575
|
const userKaminoReward2Ata = strategyState.baseVaultAuthority;
|
|
@@ -2657,10 +2577,10 @@ class Kamino {
|
|
|
2657
2577
|
kaminoReward2Vault = strategyState.kaminoRewards[2].rewardVault;
|
|
2658
2578
|
rewardMints[5] = strategyState.kaminoRewards[2].rewardVault;
|
|
2659
2579
|
rewardTokenPrograms[5] = await this.getAccountOwner(rewardMints[5]);
|
|
2660
|
-
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[5],
|
|
2580
|
+
userReward2Ata = await (0, utils_1.getAssociatedTokenAddress)(rewardMints[5], strategyState.adminAuthority, true, rewardTokenPrograms[5]);
|
|
2661
2581
|
}
|
|
2662
2582
|
const strategyAccounts = {
|
|
2663
|
-
adminAuthority:
|
|
2583
|
+
adminAuthority: strategyState.adminAuthority,
|
|
2664
2584
|
strategy: strategyPubkey,
|
|
2665
2585
|
oldPositionOrBaseVaultAuthority,
|
|
2666
2586
|
oldPositionMintOrBaseVaultAuthority,
|
|
@@ -2668,8 +2588,8 @@ class Kamino {
|
|
|
2668
2588
|
tokenAVault: strategyState.tokenAVault,
|
|
2669
2589
|
tokenBVault: strategyState.tokenBVault,
|
|
2670
2590
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
2671
|
-
system:
|
|
2672
|
-
tokenProgram:
|
|
2591
|
+
system: web3_js_1.SystemProgram.programId,
|
|
2592
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2673
2593
|
poolProgram: poolProgram,
|
|
2674
2594
|
userTokenAAta,
|
|
2675
2595
|
userTokenBAta,
|
|
@@ -2689,28 +2609,20 @@ class Kamino {
|
|
|
2689
2609
|
oldTickArrayUpperOrBaseVaultAuthority,
|
|
2690
2610
|
pool: strategyState.pool,
|
|
2691
2611
|
eventAuthority,
|
|
2692
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
2693
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
2612
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2613
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2694
2614
|
tokenAMint: strategyState.tokenAMint,
|
|
2695
2615
|
tokenBMint: strategyState.tokenBMint,
|
|
2696
2616
|
};
|
|
2697
|
-
|
|
2617
|
+
const ix = (0, instructions_1.closeStrategy)(strategyAccounts);
|
|
2698
2618
|
for (let i = 0; i < 6; i++) {
|
|
2699
|
-
ix
|
|
2700
|
-
|
|
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
|
-
};
|
|
2619
|
+
ix.keys.push({ pubkey: rewardMints[i], isSigner: false, isWritable: false });
|
|
2620
|
+
ix.keys.push({ pubkey: rewardTokenPrograms[i], isSigner: false, isWritable: false });
|
|
2706
2621
|
}
|
|
2707
2622
|
return ix;
|
|
2708
2623
|
};
|
|
2709
|
-
getUserTopupVault =
|
|
2710
|
-
const [topupVault] =
|
|
2711
|
-
seeds: [Buffer.from('topup_vault'), addressEncoder.encode(user)],
|
|
2712
|
-
programAddress: this.getProgramID(),
|
|
2713
|
-
});
|
|
2624
|
+
getUserTopupVault = (user) => {
|
|
2625
|
+
const [topupVault, _topupVaultBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('topup_vault'), user.toBuffer()], this.getProgramID());
|
|
2714
2626
|
return topupVault;
|
|
2715
2627
|
};
|
|
2716
2628
|
/**
|
|
@@ -2722,31 +2634,11 @@ class Kamino {
|
|
|
2722
2634
|
* @returns object with program addresses for kamino strategy creation
|
|
2723
2635
|
*/
|
|
2724
2636
|
getStrategyProgramAddresses = async (strategy, tokenMintA, tokenMintB) => {
|
|
2725
|
-
const [tokenAVault, tokenABump] =
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
const [
|
|
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
|
-
});
|
|
2637
|
+
const [tokenAVault, tokenABump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('svault_a'), strategy.toBuffer()], this.getProgramID());
|
|
2638
|
+
const [tokenBVault, tokenBBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('svault_b'), strategy.toBuffer()], this.getProgramID());
|
|
2639
|
+
const [baseVaultAuthority, baseVaultAuthorityBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('authority'), tokenAVault.toBuffer(), tokenBVault.toBuffer()], this.getProgramID());
|
|
2640
|
+
const [sharesMint, sharesMintBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('shares'), strategy.toBuffer(), tokenMintA.toBuffer(), tokenMintB.toBuffer()], this.getProgramID());
|
|
2641
|
+
const [sharesMintAuthority, sharesMintAuthorityBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('authority'), sharesMint.toBuffer()], this.getProgramID());
|
|
2750
2642
|
return {
|
|
2751
2643
|
sharesMintAuthority,
|
|
2752
2644
|
tokenAVault,
|
|
@@ -2767,17 +2659,17 @@ class Kamino {
|
|
|
2767
2659
|
* @returns transaction instruction to create the account
|
|
2768
2660
|
*/
|
|
2769
2661
|
createStrategyAccount = async (payer, newStrategy) => {
|
|
2770
|
-
const accountSize =
|
|
2662
|
+
const accountSize = this._kaminoProgram.account.whirlpoolStrategy.size;
|
|
2771
2663
|
return this.createAccountRentExempt(payer, newStrategy, accountSize);
|
|
2772
2664
|
};
|
|
2773
|
-
createAccountRentExempt = async (payer,
|
|
2774
|
-
const lamports = await this.
|
|
2775
|
-
return
|
|
2776
|
-
|
|
2665
|
+
createAccountRentExempt = async (payer, newAccountPubkey, size) => {
|
|
2666
|
+
const lamports = await this._connection.getMinimumBalanceForRentExemption(size);
|
|
2667
|
+
return web3_js_1.SystemProgram.createAccount({
|
|
2668
|
+
programId: this.getProgramID(),
|
|
2669
|
+
fromPubkey: payer,
|
|
2670
|
+
newAccountPubkey,
|
|
2777
2671
|
space: size,
|
|
2778
2672
|
lamports,
|
|
2779
|
-
payer,
|
|
2780
|
-
programAddress: this.getProgramID(),
|
|
2781
2673
|
});
|
|
2782
2674
|
};
|
|
2783
2675
|
/**
|
|
@@ -2789,17 +2681,17 @@ class Kamino {
|
|
|
2789
2681
|
*/
|
|
2790
2682
|
collectFeesAndRewards = async (strategy, owner) => {
|
|
2791
2683
|
const { address: strategyPubkey, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
2792
|
-
const eventAuthority =
|
|
2793
|
-
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } =
|
|
2684
|
+
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2685
|
+
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } = this.getTreasuryFeeVaultPDAs(strategyState.tokenAMint, strategyState.tokenBMint);
|
|
2794
2686
|
let programId = this._orcaService.getWhirlpoolProgramId();
|
|
2795
|
-
let poolRewardVault0 =
|
|
2796
|
-
let poolRewardVault1 =
|
|
2797
|
-
let poolRewardVault2 =
|
|
2798
|
-
let rewardMint0 =
|
|
2799
|
-
let rewardMint1 =
|
|
2800
|
-
let rewardMint2 =
|
|
2687
|
+
let poolRewardVault0 = web3_js_1.PublicKey.default;
|
|
2688
|
+
let poolRewardVault1 = web3_js_1.PublicKey.default;
|
|
2689
|
+
let poolRewardVault2 = web3_js_1.PublicKey.default;
|
|
2690
|
+
let rewardMint0 = web3_js_1.PublicKey.default;
|
|
2691
|
+
let rewardMint1 = web3_js_1.PublicKey.default;
|
|
2692
|
+
let rewardMint2 = web3_js_1.PublicKey.default;
|
|
2801
2693
|
if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA')) {
|
|
2802
|
-
const whirlpool = await
|
|
2694
|
+
const whirlpool = await whirlpools_client_1.Whirlpool.fetch(this._connection, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
2803
2695
|
if (!whirlpool) {
|
|
2804
2696
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
2805
2697
|
}
|
|
@@ -2812,7 +2704,7 @@ class Kamino {
|
|
|
2812
2704
|
}
|
|
2813
2705
|
else if (strategyState.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
2814
2706
|
programId = this._raydiumService.getRaydiumProgramId();
|
|
2815
|
-
const poolState = await
|
|
2707
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
2816
2708
|
if (!poolState) {
|
|
2817
2709
|
throw Error(`Could not fetch Raydium pool state with pubkey ${strategyState.pool.toString()}`);
|
|
2818
2710
|
}
|
|
@@ -2823,9 +2715,9 @@ class Kamino {
|
|
|
2823
2715
|
rewardMint1 = poolState.rewardInfos[1].tokenMint;
|
|
2824
2716
|
rewardMint2 = poolState.rewardInfos[2].tokenMint;
|
|
2825
2717
|
}
|
|
2826
|
-
else if (strategyState.strategyDex.toNumber()
|
|
2718
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
2827
2719
|
programId = this._meteoraService.getMeteoraProgramId();
|
|
2828
|
-
const poolState = await
|
|
2720
|
+
const poolState = await accounts_2.LbPair.fetch(this._connection, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
2829
2721
|
if (!poolState) {
|
|
2830
2722
|
throw Error(`Could not fetch Meteora pool state with pubkey ${strategyState.pool.toString()}`);
|
|
2831
2723
|
}
|
|
@@ -2834,7 +2726,7 @@ class Kamino {
|
|
|
2834
2726
|
poolRewardVault2 = strategyPubkey;
|
|
2835
2727
|
rewardMint0 = poolState.rewardInfos[0].mint;
|
|
2836
2728
|
rewardMint1 = poolState.rewardInfos[1].mint;
|
|
2837
|
-
rewardMint2 = this.
|
|
2729
|
+
rewardMint2 = this._kaminoProgramId;
|
|
2838
2730
|
}
|
|
2839
2731
|
const accounts = {
|
|
2840
2732
|
user: owner || strategyState.adminAuthority,
|
|
@@ -2863,15 +2755,15 @@ class Kamino {
|
|
|
2863
2755
|
tickArrayUpper: strategyState.tickArrayUpper,
|
|
2864
2756
|
raydiumProtocolPositionOrBaseVaultAuthority: strategyState.raydiumProtocolPositionOrBaseVaultAuthority,
|
|
2865
2757
|
poolProgram: programId,
|
|
2866
|
-
instructionSysvarAccount:
|
|
2758
|
+
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2867
2759
|
eventAuthority,
|
|
2868
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
2869
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
2760
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2761
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2870
2762
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
2871
|
-
tokenProgram:
|
|
2872
|
-
tokenProgram2022:
|
|
2763
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2764
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
2873
2765
|
};
|
|
2874
|
-
|
|
2766
|
+
const ixn = (0, instructions_1.collectFeesAndRewards)(accounts);
|
|
2875
2767
|
const pairs = [
|
|
2876
2768
|
[strategyState.reward0Decimals.toNumber(), rewardMint0],
|
|
2877
2769
|
[strategyState.reward1Decimals.toNumber(), rewardMint1],
|
|
@@ -2879,41 +2771,24 @@ class Kamino {
|
|
|
2879
2771
|
];
|
|
2880
2772
|
for (const [decimals, mint] of pairs) {
|
|
2881
2773
|
if (decimals > 0) {
|
|
2774
|
+
ixn.keys.push({ pubkey: mint, isSigner: false, isWritable: false });
|
|
2882
2775
|
const tokenProgram = await this.getAccountOwner(mint);
|
|
2883
|
-
|
|
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
|
-
};
|
|
2776
|
+
ixn.keys.push({ pubkey: tokenProgram, isSigner: false, isWritable: false });
|
|
2890
2777
|
}
|
|
2891
2778
|
}
|
|
2892
|
-
if (strategyState.strategyDex.toNumber()
|
|
2893
|
-
const [poolTickArrayBitmap] =
|
|
2894
|
-
|
|
2895
|
-
programAddress: this._raydiumService.getRaydiumProgramId(),
|
|
2896
|
-
});
|
|
2897
|
-
ix = {
|
|
2898
|
-
...ix,
|
|
2899
|
-
accounts: ix.accounts?.concat([{ address: poolTickArrayBitmap, role: kit_1.AccountRole.READONLY }]),
|
|
2900
|
-
};
|
|
2779
|
+
if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
2780
|
+
const [poolTickArrayBitmap, _poolTickArrayBitmapBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('pool_tick_array_bitmap_extension'), strategyState.pool.toBuffer()], this._raydiumService.getRaydiumProgramId());
|
|
2781
|
+
ixn.keys.push({ pubkey: poolTickArrayBitmap, isSigner: false, isWritable: true });
|
|
2901
2782
|
}
|
|
2902
|
-
return
|
|
2783
|
+
return ixn;
|
|
2903
2784
|
};
|
|
2904
2785
|
/**
|
|
2905
2786
|
* Get orca position metadata program addresses
|
|
2906
2787
|
* @param positionMint mint account of the position
|
|
2907
2788
|
*/
|
|
2908
|
-
getMetadataProgramAddressesOrca =
|
|
2909
|
-
const [position, positionBump] =
|
|
2910
|
-
|
|
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
|
-
});
|
|
2789
|
+
getMetadataProgramAddressesOrca = (positionMint) => {
|
|
2790
|
+
const [position, positionBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('position'), positionMint.toBuffer()], this._orcaService.getWhirlpoolProgramId());
|
|
2791
|
+
const [positionMetadata, positionMetadataBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('metadata'), constants_1.METADATA_PROGRAM_ID.toBuffer(), positionMint.toBuffer()], constants_1.METADATA_PROGRAM_ID);
|
|
2917
2792
|
return {
|
|
2918
2793
|
position,
|
|
2919
2794
|
positionBump,
|
|
@@ -2921,36 +2796,24 @@ class Kamino {
|
|
|
2921
2796
|
positionMetadataBump,
|
|
2922
2797
|
};
|
|
2923
2798
|
};
|
|
2924
|
-
getMetadataProgramAddressesRaydium =
|
|
2925
|
-
const { publicKey: protocolPosition, nonce: protocolPositionBump } = (0, lib_1.getPdaProtocolPositionAddress)(
|
|
2926
|
-
const [position, positionBump] =
|
|
2927
|
-
|
|
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
|
-
});
|
|
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] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('position'), positionMint.toBuffer()], this._raydiumService.getRaydiumProgramId());
|
|
2802
|
+
const [positionMetadata, positionMetadataBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('metadata'), constants_1.METADATA_PROGRAM_ID.toBuffer(), positionMint.toBuffer()], constants_1.METADATA_PROGRAM_ID);
|
|
2934
2803
|
return {
|
|
2935
2804
|
position,
|
|
2936
2805
|
positionBump,
|
|
2937
|
-
protocolPosition
|
|
2806
|
+
protocolPosition,
|
|
2938
2807
|
protocolPositionBump,
|
|
2939
2808
|
positionMetadata,
|
|
2940
2809
|
positionMetadataBump,
|
|
2941
2810
|
};
|
|
2942
2811
|
};
|
|
2943
|
-
getStartEndTicketIndexProgramAddressesOrca =
|
|
2812
|
+
getStartEndTicketIndexProgramAddressesOrca = (whirlpool, whirlpoolState, tickLowerIndex, tickUpperIndex) => {
|
|
2944
2813
|
const startTickIndex = (0, whirlpool_sdk_1.getStartTickIndex)(tickLowerIndex, whirlpoolState.tickSpacing, 0);
|
|
2945
2814
|
const endTickIndex = (0, whirlpool_sdk_1.getStartTickIndex)(tickUpperIndex, whirlpoolState.tickSpacing, 0);
|
|
2946
|
-
const [lowerTickPubkey, lowerTickBump] =
|
|
2947
|
-
|
|
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
|
-
});
|
|
2815
|
+
const [lowerTickPubkey, lowerTickBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('tick_array'), whirlpool.toBuffer(), Buffer.from(startTickIndex.toString())], this._orcaService.getWhirlpoolProgramId());
|
|
2816
|
+
const [upperTickPubkey, upperTickBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('tick_array'), whirlpool.toBuffer(), Buffer.from(endTickIndex.toString())], this._orcaService.getWhirlpoolProgramId());
|
|
2954
2817
|
return {
|
|
2955
2818
|
lowerTick: lowerTickPubkey,
|
|
2956
2819
|
lowerTickBump,
|
|
@@ -2958,17 +2821,11 @@ class Kamino {
|
|
|
2958
2821
|
upperTickBump,
|
|
2959
2822
|
};
|
|
2960
2823
|
};
|
|
2961
|
-
getStartEndTicketIndexProgramAddressesRaydium =
|
|
2824
|
+
getStartEndTicketIndexProgramAddressesRaydium = (pool, poolState, tickLowerIndex, tickUpperIndex) => {
|
|
2962
2825
|
const startTickIndex = lib_1.TickUtils.getTickArrayStartIndexByTick(tickLowerIndex, poolState.tickSpacing);
|
|
2963
2826
|
const endTickIndex = lib_1.TickUtils.getTickArrayStartIndexByTick(tickUpperIndex, poolState.tickSpacing);
|
|
2964
|
-
const [lowerTickPubkey, lowerTickBump] =
|
|
2965
|
-
|
|
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
|
-
});
|
|
2827
|
+
const [lowerTickPubkey, lowerTickBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('tick_array'), pool.toBuffer(), (0, lib_1.i32ToBytes)(startTickIndex)], this._raydiumService.getRaydiumProgramId());
|
|
2828
|
+
const [upperTickPubkey, upperTickBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('tick_array'), pool.toBuffer(), (0, lib_1.i32ToBytes)(endTickIndex)], this._raydiumService.getRaydiumProgramId());
|
|
2972
2829
|
return {
|
|
2973
2830
|
lowerTick: lowerTickPubkey,
|
|
2974
2831
|
lowerTickBump,
|
|
@@ -2977,21 +2834,21 @@ class Kamino {
|
|
|
2977
2834
|
};
|
|
2978
2835
|
};
|
|
2979
2836
|
readMeteoraPosition = async (poolPk, positionPk) => {
|
|
2980
|
-
const pool = await
|
|
2981
|
-
const position = await
|
|
2837
|
+
const pool = await accounts_2.LbPair.fetch(this._connection, poolPk, this._meteoraService.getMeteoraProgramId());
|
|
2838
|
+
const position = await accounts_2.PositionV2.fetch(this._connection, positionPk, this._meteoraService.getMeteoraProgramId());
|
|
2982
2839
|
if (!pool || !position) {
|
|
2983
2840
|
return {
|
|
2984
|
-
|
|
2841
|
+
publicKey: positionPk,
|
|
2985
2842
|
amountX: new decimal_js_1.default(0),
|
|
2986
2843
|
amountY: new decimal_js_1.default(0),
|
|
2987
2844
|
};
|
|
2988
2845
|
}
|
|
2989
|
-
const { lowerTick: lowerTickPk, upperTick: upperTickPk } =
|
|
2990
|
-
const lowerBinArray = await
|
|
2991
|
-
const upperBinArray = await
|
|
2846
|
+
const { lowerTick: lowerTickPk, upperTick: upperTickPk } = this.getStartEndTicketIndexProgramAddressesMeteora(poolPk, position.lowerBinId);
|
|
2847
|
+
const lowerBinArray = await accounts_2.BinArray.fetch(this._connection, lowerTickPk, this._meteoraService.getMeteoraProgramId());
|
|
2848
|
+
const upperBinArray = await accounts_2.BinArray.fetch(this._connection, upperTickPk, this._meteoraService.getMeteoraProgramId());
|
|
2992
2849
|
if (!lowerBinArray || !upperBinArray) {
|
|
2993
2850
|
return {
|
|
2994
|
-
|
|
2851
|
+
publicKey: positionPk,
|
|
2995
2852
|
amountX: new decimal_js_1.default(0),
|
|
2996
2853
|
amountY: new decimal_js_1.default(0),
|
|
2997
2854
|
};
|
|
@@ -3016,17 +2873,17 @@ class Kamino {
|
|
|
3016
2873
|
}
|
|
3017
2874
|
}
|
|
3018
2875
|
return {
|
|
3019
|
-
|
|
2876
|
+
publicKey: positionPk,
|
|
3020
2877
|
amountX: totalAmountX,
|
|
3021
2878
|
amountY: totalAmountY,
|
|
3022
2879
|
};
|
|
3023
2880
|
};
|
|
3024
|
-
getStartEndTicketIndexProgramAddressesMeteora =
|
|
2881
|
+
getStartEndTicketIndexProgramAddressesMeteora = (pool, tickLowerIndex) => {
|
|
3025
2882
|
const meteoraProgramId = this._meteoraService.getMeteoraProgramId();
|
|
3026
2883
|
const lowerBinArrayIndex = (0, meteora_1.binIdToBinArrayIndex)(new bn_js_1.default(tickLowerIndex));
|
|
3027
|
-
const [lowerTick, lowerTickBump] =
|
|
2884
|
+
const [lowerTick, lowerTickBump] = (0, meteora_1.deriveBinArray)(pool, lowerBinArrayIndex, meteoraProgramId);
|
|
3028
2885
|
const upperBinArrayIndex = lowerBinArrayIndex.add(new bn_js_1.default(1));
|
|
3029
|
-
const [upperTick, upperTickBump] =
|
|
2886
|
+
const [upperTick, upperTickBump] = (0, meteora_1.deriveBinArray)(pool, upperBinArrayIndex, meteoraProgramId);
|
|
3030
2887
|
return {
|
|
3031
2888
|
lowerTick,
|
|
3032
2889
|
lowerTickBump,
|
|
@@ -3036,23 +2893,22 @@ class Kamino {
|
|
|
3036
2893
|
};
|
|
3037
2894
|
/**
|
|
3038
2895
|
* Get a transaction to open liquidity position for a Kamino strategy
|
|
3039
|
-
* @param admin strategy admin authority
|
|
3040
2896
|
* @param strategy strategy you want to open liquidity position for
|
|
3041
|
-
* @param positionMint position mint
|
|
2897
|
+
* @param positionMint position mint pubkey
|
|
3042
2898
|
* @param priceLower new position's lower price of the range
|
|
3043
2899
|
* @param priceUpper new position's upper price of the range
|
|
3044
2900
|
* @param status strategy status
|
|
3045
2901
|
*/
|
|
3046
|
-
openPosition = async (
|
|
2902
|
+
openPosition = async (strategy, positionMint, priceLower, priceUpper, status = new StrategyStatus_1.Uninitialized()) => {
|
|
3047
2903
|
const { strategy: strategyState, address: strategyAddress } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3048
2904
|
if (!strategyState) {
|
|
3049
2905
|
throw Error(`Could not fetch strategy state with pubkey ${strategy.toString()}`);
|
|
3050
2906
|
}
|
|
3051
|
-
const eventAuthority =
|
|
3052
|
-
if (strategyState.strategyDex.toNumber()
|
|
3053
|
-
return this.openPositionOrca(
|
|
2907
|
+
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
2908
|
+
if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA')) {
|
|
2909
|
+
return this.openPositionOrca(strategyState.adminAuthority, 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);
|
|
3054
2910
|
}
|
|
3055
|
-
else if (strategyState.strategyDex.toNumber()
|
|
2911
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
3056
2912
|
let reward0Vault = undefined;
|
|
3057
2913
|
let reward1Vault = undefined;
|
|
3058
2914
|
let reward2Vault = undefined;
|
|
@@ -3065,10 +2921,10 @@ class Kamino {
|
|
|
3065
2921
|
if (strategyState.reward2Decimals.toNumber() > 0) {
|
|
3066
2922
|
reward2Vault = strategyState.reward2Vault;
|
|
3067
2923
|
}
|
|
3068
|
-
return this.openPositionRaydium(
|
|
2924
|
+
return this.openPositionRaydium(strategyState.adminAuthority, 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);
|
|
3069
2925
|
}
|
|
3070
|
-
else if (strategyState.strategyDex.toNumber()
|
|
3071
|
-
return this.openPositionMeteora(
|
|
2926
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
2927
|
+
return this.openPositionMeteora(strategyState.adminAuthority, 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);
|
|
3072
2928
|
}
|
|
3073
2929
|
else {
|
|
3074
2930
|
throw new Error(`Invalid dex ${strategyState.strategyDex.toString()}`);
|
|
@@ -3082,24 +2938,24 @@ class Kamino {
|
|
|
3082
2938
|
* @param priceUpper new position's upper price of the range
|
|
3083
2939
|
* @param status strategy status
|
|
3084
2940
|
*/
|
|
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
|
|
2941
|
+
openPositionOrca = async (adminAuthority, strategy, baseVaultAuthority, pool, positionMint, priceLower, priceUpper, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, oldPositionOrBaseVaultAuthority, oldPositionMintOrBaseVaultAuthority, oldPositionTokenAccountOrBaseVaultAuthority, oldTickArrayLowerOrBaseVaultAuthority, oldTickArrayUpperOrBaseVaultAuthority, eventAuthority, status = new StrategyStatus_1.Uninitialized()) => {
|
|
2942
|
+
const whirlpool = await whirlpools_client_1.Whirlpool.fetch(this._connection, pool, this._orcaService.getWhirlpoolProgramId());
|
|
3087
2943
|
if (!whirlpool) {
|
|
3088
2944
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3089
2945
|
}
|
|
3090
2946
|
const isRebalancing = status.discriminator === StrategyStatus_1.Rebalancing.discriminator;
|
|
3091
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
3092
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
2947
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, whirlpool.tokenMintA);
|
|
2948
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, whirlpool.tokenMintB);
|
|
3093
2949
|
const tickLowerIndex = (0, whirlpool_sdk_1.getNextValidTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(priceLower, decimalsA, decimalsB), whirlpool.tickSpacing);
|
|
3094
2950
|
const tickUpperIndex = (0, whirlpool_sdk_1.getNextValidTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(priceUpper, decimalsA, decimalsB), whirlpool.tickSpacing);
|
|
3095
|
-
const { position, positionBump, positionMetadata } =
|
|
3096
|
-
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint
|
|
2951
|
+
const { position, positionBump, positionMetadata } = this.getMetadataProgramAddressesOrca(positionMint);
|
|
2952
|
+
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint, baseVaultAuthority);
|
|
3097
2953
|
const args = {
|
|
3098
2954
|
tickLowerIndex: new bn_js_1.default(tickLowerIndex),
|
|
3099
2955
|
tickUpperIndex: new bn_js_1.default(tickUpperIndex),
|
|
3100
2956
|
bump: positionBump,
|
|
3101
2957
|
};
|
|
3102
|
-
const { lowerTick: startTickIndex, upperTick: endTickIndex } =
|
|
2958
|
+
const { lowerTick: startTickIndex, upperTick: endTickIndex } = this.getStartEndTicketIndexProgramAddressesOrca(pool, whirlpool, tickLowerIndex, tickUpperIndex);
|
|
3103
2959
|
const globalConfig = await this.getGlobalConfigState(this._globalConfig);
|
|
3104
2960
|
if (!globalConfig) {
|
|
3105
2961
|
throw Error(`Could not fetch global config with pubkey ${this._globalConfig.toString()}`);
|
|
@@ -3112,17 +2968,17 @@ class Kamino {
|
|
|
3112
2968
|
tickArrayUpper: endTickIndex,
|
|
3113
2969
|
baseVaultAuthority: baseVaultAuthority,
|
|
3114
2970
|
position,
|
|
3115
|
-
positionMint
|
|
2971
|
+
positionMint,
|
|
3116
2972
|
positionMetadataAccount: positionMetadata,
|
|
3117
2973
|
positionTokenAccount,
|
|
3118
|
-
rent:
|
|
3119
|
-
system:
|
|
3120
|
-
tokenProgram:
|
|
3121
|
-
tokenProgram2022:
|
|
3122
|
-
associatedTokenProgram:
|
|
2974
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
2975
|
+
system: web3_js_1.SystemProgram.programId,
|
|
2976
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2977
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
2978
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
3123
2979
|
poolProgram: this._orcaService.getWhirlpoolProgramId(),
|
|
3124
2980
|
oldPositionOrBaseVaultAuthority: isRebalancing ? oldPositionOrBaseVaultAuthority : baseVaultAuthority,
|
|
3125
|
-
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint
|
|
2981
|
+
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint,
|
|
3126
2982
|
oldPositionTokenAccountOrBaseVaultAuthority: isRebalancing
|
|
3127
2983
|
? oldPositionTokenAccountOrBaseVaultAuthority
|
|
3128
2984
|
: positionTokenAccount,
|
|
@@ -3137,27 +2993,16 @@ class Kamino {
|
|
|
3137
2993
|
tokenInfos: globalConfig.tokenInfos,
|
|
3138
2994
|
tokenAMint,
|
|
3139
2995
|
tokenBMint,
|
|
3140
|
-
eventAuthority
|
|
2996
|
+
eventAuthority,
|
|
3141
2997
|
consensusAccount: pubkeys_1.CONSENSUS_ID,
|
|
3142
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram,
|
|
3143
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram,
|
|
2998
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
2999
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3144
3000
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3145
3001
|
};
|
|
3146
|
-
const
|
|
3147
|
-
const
|
|
3148
|
-
|
|
3149
|
-
|
|
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
|
-
};
|
|
3002
|
+
const ixn = (0, instructions_1.openLiquidityPosition)(args, accounts);
|
|
3003
|
+
const accountIndex = ixn.keys.findIndex((accs) => accs.pubkey.equals(positionMint));
|
|
3004
|
+
ixn.keys[accountIndex].isSigner = true;
|
|
3005
|
+
return ixn;
|
|
3161
3006
|
};
|
|
3162
3007
|
/**
|
|
3163
3008
|
* Get a transaction to open liquidity position for a Kamino strategy
|
|
@@ -3168,23 +3013,23 @@ class Kamino {
|
|
|
3168
3013
|
* @param status strategy status
|
|
3169
3014
|
*/
|
|
3170
3015
|
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) => {
|
|
3171
|
-
const poolState = await
|
|
3016
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
3172
3017
|
if (!poolState) {
|
|
3173
3018
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
3174
3019
|
}
|
|
3175
3020
|
const isRebalancing = status.discriminator === StrategyStatus_1.Rebalancing.discriminator;
|
|
3176
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
3177
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
3021
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, poolState.tokenMint0);
|
|
3022
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, poolState.tokenMint1);
|
|
3178
3023
|
const tickLowerIndex = lib_1.TickMath.getTickWithPriceAndTickspacing(lib_1.TickMath.roundPriceWithTickspacing(priceLower, poolState.tickSpacing, decimalsA, decimalsB), poolState.tickSpacing, decimalsA, decimalsB);
|
|
3179
3024
|
const tickUpperIndex = lib_1.TickMath.getTickWithPriceAndTickspacing(lib_1.TickMath.roundPriceWithTickspacing(priceUpper, poolState.tickSpacing, decimalsA, decimalsB), poolState.tickSpacing, decimalsA, decimalsB);
|
|
3180
|
-
const { position, positionBump, protocolPosition, positionMetadata } =
|
|
3181
|
-
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint
|
|
3025
|
+
const { position, positionBump, protocolPosition, positionMetadata } = this.getMetadataProgramAddressesRaydium(positionMint, pool, tickLowerIndex, tickUpperIndex);
|
|
3026
|
+
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(positionMint, baseVaultAuthority);
|
|
3182
3027
|
const args = {
|
|
3183
3028
|
tickLowerIndex: new bn_js_1.default(tickLowerIndex),
|
|
3184
3029
|
tickUpperIndex: new bn_js_1.default(tickUpperIndex),
|
|
3185
3030
|
bump: positionBump,
|
|
3186
3031
|
};
|
|
3187
|
-
const { lowerTick: startTickIndex, upperTick: endTickIndex } =
|
|
3032
|
+
const { lowerTick: startTickIndex, upperTick: endTickIndex } = this.getStartEndTicketIndexProgramAddressesRaydium(pool, poolState, tickLowerIndex, tickUpperIndex);
|
|
3188
3033
|
const globalConfig = await this.getGlobalConfigState(this._globalConfig);
|
|
3189
3034
|
if (!globalConfig) {
|
|
3190
3035
|
throw Error(`Could not fetch global config with pubkey ${this._globalConfig.toString()}`);
|
|
@@ -3197,17 +3042,17 @@ class Kamino {
|
|
|
3197
3042
|
tickArrayUpper: endTickIndex,
|
|
3198
3043
|
baseVaultAuthority: baseVaultAuthority,
|
|
3199
3044
|
position,
|
|
3200
|
-
positionMint
|
|
3045
|
+
positionMint,
|
|
3201
3046
|
positionMetadataAccount: positionMetadata,
|
|
3202
3047
|
positionTokenAccount,
|
|
3203
|
-
rent:
|
|
3204
|
-
system:
|
|
3205
|
-
tokenProgram:
|
|
3206
|
-
tokenProgram2022:
|
|
3207
|
-
associatedTokenProgram:
|
|
3048
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
3049
|
+
system: web3_js_1.SystemProgram.programId,
|
|
3050
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
3051
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
3052
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
3208
3053
|
poolProgram: this._raydiumService.getRaydiumProgramId(),
|
|
3209
3054
|
oldPositionOrBaseVaultAuthority: isRebalancing ? oldPositionOrBaseVaultAuthority : baseVaultAuthority,
|
|
3210
|
-
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint
|
|
3055
|
+
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint,
|
|
3211
3056
|
oldPositionTokenAccountOrBaseVaultAuthority: isRebalancing
|
|
3212
3057
|
? oldPositionTokenAccountOrBaseVaultAuthority
|
|
3213
3058
|
: positionTokenAccount,
|
|
@@ -3224,68 +3069,42 @@ class Kamino {
|
|
|
3224
3069
|
tokenBMint,
|
|
3225
3070
|
eventAuthority,
|
|
3226
3071
|
consensusAccount: pubkeys_1.CONSENSUS_ID,
|
|
3227
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram,
|
|
3228
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram,
|
|
3072
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3073
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3229
3074
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3230
3075
|
};
|
|
3231
|
-
const [poolTickArrayBitmap] =
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
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
|
-
};
|
|
3076
|
+
const [poolTickArrayBitmap, _poolTickArrayBitmapBump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('pool_tick_array_bitmap_extension'), pool.toBuffer()], this._raydiumService.getRaydiumProgramId());
|
|
3077
|
+
const ix = (0, instructions_1.openLiquidityPosition)(args, accounts);
|
|
3078
|
+
ix.keys = ix.keys.concat([
|
|
3079
|
+
{ pubkey: protocolPosition, isSigner: false, isWritable: true },
|
|
3080
|
+
{ pubkey: oldProtocolPositionOrBaseVaultAuthority, isSigner: false, isWritable: true },
|
|
3081
|
+
{ pubkey: constants_1.METADATA_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
3082
|
+
{ pubkey: poolTickArrayBitmap, isSigner: false, isWritable: true },
|
|
3083
|
+
]);
|
|
3245
3084
|
if (strategyRewardOVault) {
|
|
3246
|
-
ix =
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
{ address: poolState.rewardInfos[0].tokenMint, role: kit_1.AccountRole.READONLY },
|
|
3252
|
-
]),
|
|
3253
|
-
};
|
|
3085
|
+
ix.keys = ix.keys.concat([
|
|
3086
|
+
{ pubkey: poolState.rewardInfos[0].tokenVault, isSigner: false, isWritable: true },
|
|
3087
|
+
{ pubkey: strategyRewardOVault, isSigner: false, isWritable: true },
|
|
3088
|
+
{ pubkey: poolState.rewardInfos[0].tokenMint, isSigner: false, isWritable: false },
|
|
3089
|
+
]);
|
|
3254
3090
|
}
|
|
3255
3091
|
if (strategyReward1Vault) {
|
|
3256
|
-
ix =
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
{ address: poolState.rewardInfos[1].tokenMint, role: kit_1.AccountRole.READONLY },
|
|
3262
|
-
]),
|
|
3263
|
-
};
|
|
3092
|
+
ix.keys = ix.keys.concat([
|
|
3093
|
+
{ pubkey: poolState.rewardInfos[1].tokenVault, isSigner: false, isWritable: true },
|
|
3094
|
+
{ pubkey: strategyReward1Vault, isSigner: false, isWritable: true },
|
|
3095
|
+
{ pubkey: poolState.rewardInfos[1].tokenMint, isSigner: false, isWritable: false },
|
|
3096
|
+
]);
|
|
3264
3097
|
}
|
|
3265
3098
|
if (strategyReward2Vault) {
|
|
3266
|
-
ix =
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
{ address: poolState.rewardInfos[2].tokenMint, role: kit_1.AccountRole.READONLY },
|
|
3272
|
-
]),
|
|
3273
|
-
};
|
|
3274
|
-
}
|
|
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
|
-
};
|
|
3099
|
+
ix.keys = ix.keys.concat([
|
|
3100
|
+
{ pubkey: poolState.rewardInfos[2].tokenVault, isSigner: false, isWritable: true },
|
|
3101
|
+
{ pubkey: strategyReward2Vault, isSigner: false, isWritable: true },
|
|
3102
|
+
{ pubkey: poolState.rewardInfos[2].tokenMint, isSigner: false, isWritable: false },
|
|
3103
|
+
]);
|
|
3284
3104
|
}
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
};
|
|
3105
|
+
const accountIndex = ix.keys.findIndex((accs) => accs.pubkey.equals(positionMint));
|
|
3106
|
+
ix.keys[accountIndex].isSigner = true;
|
|
3107
|
+
return ix;
|
|
3289
3108
|
};
|
|
3290
3109
|
/**
|
|
3291
3110
|
* Get a transaction to open liquidity position for a Kamino strategy
|
|
@@ -3296,23 +3115,23 @@ class Kamino {
|
|
|
3296
3115
|
* @param status strategy status
|
|
3297
3116
|
*/
|
|
3298
3117
|
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()) => {
|
|
3299
|
-
const lbPair = await
|
|
3118
|
+
const lbPair = await accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
3300
3119
|
if (!lbPair) {
|
|
3301
3120
|
throw Error(`Could not fetch meteora lbpair state with pubkey ${pool.toString()}`);
|
|
3302
3121
|
}
|
|
3303
3122
|
const isRebalancing = status.discriminator === StrategyStatus_1.Rebalancing.discriminator;
|
|
3304
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
3305
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
3123
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, lbPair.tokenXMint);
|
|
3124
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, lbPair.tokenYMint);
|
|
3306
3125
|
const tickLowerIndex = (0, meteora_1.getBinIdFromPriceWithDecimals)(priceLower, lbPair.binStep, true, decimalsA, decimalsB);
|
|
3307
3126
|
const tickUpperIndex = (0, meteora_1.getBinIdFromPriceWithDecimals)(priceUpper, lbPair.binStep, true, decimalsA, decimalsB);
|
|
3308
|
-
const { position: positionMint, positionBump, positionMetadata
|
|
3309
|
-
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(position
|
|
3127
|
+
const { position: positionMint, positionBump, positionMetadata } = this.getMetadataProgramAddressesOrca(position);
|
|
3128
|
+
const positionTokenAccount = await (0, utils_1.getAssociatedTokenAddress)(position, baseVaultAuthority);
|
|
3310
3129
|
const args = {
|
|
3311
3130
|
tickLowerIndex: new bn_js_1.default(tickLowerIndex),
|
|
3312
3131
|
tickUpperIndex: new bn_js_1.default(tickUpperIndex),
|
|
3313
3132
|
bump: positionBump,
|
|
3314
3133
|
};
|
|
3315
|
-
const { lowerTick: startTickIndex, upperTick: endTickIndex } =
|
|
3134
|
+
const { lowerTick: startTickIndex, upperTick: endTickIndex } = this.getStartEndTicketIndexProgramAddressesMeteora(pool, tickLowerIndex);
|
|
3316
3135
|
const globalConfig = await this.getGlobalConfigState(this._globalConfig);
|
|
3317
3136
|
if (!globalConfig) {
|
|
3318
3137
|
throw Error(`Could not fetch global config with pubkey ${this._globalConfig.toString()}`);
|
|
@@ -3324,16 +3143,16 @@ class Kamino {
|
|
|
3324
3143
|
tickArrayLower: startTickIndex,
|
|
3325
3144
|
tickArrayUpper: endTickIndex,
|
|
3326
3145
|
baseVaultAuthority: baseVaultAuthority,
|
|
3327
|
-
position
|
|
3146
|
+
position,
|
|
3328
3147
|
positionMint,
|
|
3329
3148
|
positionMetadataAccount: positionMetadata,
|
|
3330
3149
|
positionTokenAccount,
|
|
3331
|
-
rent:
|
|
3332
|
-
system:
|
|
3333
|
-
tokenProgram:
|
|
3334
|
-
tokenProgram2022:
|
|
3335
|
-
associatedTokenProgram:
|
|
3336
|
-
poolProgram: this.
|
|
3150
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
3151
|
+
system: web3_js_1.SystemProgram.programId,
|
|
3152
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
3153
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
3154
|
+
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
3155
|
+
poolProgram: this._orcaService.getWhirlpoolProgramId(),
|
|
3337
3156
|
oldPositionOrBaseVaultAuthority: isRebalancing ? oldPositionOrBaseVaultAuthority : baseVaultAuthority,
|
|
3338
3157
|
oldPositionMintOrBaseVaultAuthority: isRebalancing ? oldPositionMintOrBaseVaultAuthority : positionMint,
|
|
3339
3158
|
oldPositionTokenAccountOrBaseVaultAuthority: isRebalancing
|
|
@@ -3352,25 +3171,14 @@ class Kamino {
|
|
|
3352
3171
|
tokenBMint,
|
|
3353
3172
|
eventAuthority,
|
|
3354
3173
|
consensusAccount: pubkeys_1.CONSENSUS_ID,
|
|
3355
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram,
|
|
3356
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram,
|
|
3174
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3175
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3357
3176
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3358
3177
|
};
|
|
3359
|
-
const
|
|
3360
|
-
const
|
|
3361
|
-
|
|
3362
|
-
|
|
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
|
-
};
|
|
3178
|
+
const ixn = (0, instructions_1.openLiquidityPosition)(args, accounts);
|
|
3179
|
+
const accountIndex = ixn.keys.findIndex((accs) => accs.pubkey.equals(position));
|
|
3180
|
+
ixn.keys[accountIndex].isSigner = true;
|
|
3181
|
+
return ixn;
|
|
3374
3182
|
};
|
|
3375
3183
|
/**
|
|
3376
3184
|
* Get a transaction for executive withdrawal from a Kamino strategy.
|
|
@@ -3378,19 +3186,19 @@ class Kamino {
|
|
|
3378
3186
|
* @param action withdrawal action
|
|
3379
3187
|
* @returns transaction for executive withdrawal
|
|
3380
3188
|
*/
|
|
3381
|
-
executiveWithdraw = async (
|
|
3189
|
+
executiveWithdraw = async (strategy, action) => {
|
|
3382
3190
|
const { address: strategyPubkey, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3383
|
-
const eventAuthority =
|
|
3191
|
+
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3384
3192
|
const globalConfig = await this.getGlobalConfigState(strategyState.globalConfig);
|
|
3385
|
-
if (globalConfig
|
|
3193
|
+
if (globalConfig == null) {
|
|
3386
3194
|
throw new Error(`Unable to fetch GlobalConfig with Pubkey ${strategyState.globalConfig}`);
|
|
3387
3195
|
}
|
|
3388
3196
|
const args = {
|
|
3389
3197
|
action: action.discriminator,
|
|
3390
3198
|
};
|
|
3391
|
-
const programId =
|
|
3199
|
+
const programId = (0, utils_1.getDexProgramId)(strategyState);
|
|
3392
3200
|
const accounts = {
|
|
3393
|
-
adminAuthority:
|
|
3201
|
+
adminAuthority: strategyState.adminAuthority,
|
|
3394
3202
|
strategy: strategyPubkey,
|
|
3395
3203
|
globalConfig: strategyState.globalConfig,
|
|
3396
3204
|
pool: strategyState.pool,
|
|
@@ -3410,60 +3218,50 @@ class Kamino {
|
|
|
3410
3218
|
poolProgram: programId,
|
|
3411
3219
|
tokenInfos: globalConfig.tokenInfos,
|
|
3412
3220
|
eventAuthority,
|
|
3413
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
3414
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
3221
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3222
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3415
3223
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3416
|
-
tokenProgram:
|
|
3417
|
-
tokenProgram2022:
|
|
3224
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
3225
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
3418
3226
|
};
|
|
3419
|
-
|
|
3227
|
+
const executiveWithdrawIx = (0, instructions_1.executiveWithdraw)(args, accounts);
|
|
3420
3228
|
// for Raydium strats we need to collect fees and rewards before withdrawal
|
|
3421
3229
|
// add rewards vaults accounts to withdraw
|
|
3422
|
-
const isRaydium = strategyState.strategyDex.toNumber()
|
|
3230
|
+
const isRaydium = strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM');
|
|
3423
3231
|
if (isRaydium) {
|
|
3424
3232
|
const poolState = await this.getRaydiumPoolByAddress(strategyState.pool);
|
|
3425
3233
|
if (!poolState) {
|
|
3426
3234
|
throw new Error('Pool is not found');
|
|
3427
3235
|
}
|
|
3428
3236
|
if (strategyState.reward0Decimals.toNumber() > 0) {
|
|
3429
|
-
executiveWithdrawIx =
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
{ address: strategyState.reward0Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3434
|
-
]),
|
|
3435
|
-
};
|
|
3237
|
+
executiveWithdrawIx.keys = executiveWithdrawIx.keys.concat([
|
|
3238
|
+
{ pubkey: poolState.rewardInfos[0].tokenVault, isSigner: false, isWritable: true },
|
|
3239
|
+
{ pubkey: strategyState.reward0Vault, isSigner: false, isWritable: true },
|
|
3240
|
+
]);
|
|
3436
3241
|
}
|
|
3437
3242
|
if (strategyState.reward1Decimals.toNumber() > 0) {
|
|
3438
|
-
executiveWithdrawIx =
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
{ address: strategyState.reward1Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3443
|
-
]),
|
|
3444
|
-
};
|
|
3243
|
+
executiveWithdrawIx.keys = executiveWithdrawIx.keys.concat([
|
|
3244
|
+
{ pubkey: poolState.rewardInfos[1].tokenVault, isSigner: false, isWritable: true },
|
|
3245
|
+
{ pubkey: strategyState.reward1Vault, isSigner: false, isWritable: true },
|
|
3246
|
+
]);
|
|
3445
3247
|
}
|
|
3446
3248
|
if (strategyState.reward2Decimals.toNumber() > 0) {
|
|
3447
|
-
executiveWithdrawIx =
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
{ address: strategyState.reward2Vault, role: kit_1.AccountRole.WRITABLE },
|
|
3452
|
-
]),
|
|
3453
|
-
};
|
|
3249
|
+
executiveWithdrawIx.keys = executiveWithdrawIx.keys.concat([
|
|
3250
|
+
{ pubkey: poolState.rewardInfos[2].tokenVault, isSigner: false, isWritable: true },
|
|
3251
|
+
{ pubkey: strategyState.reward2Vault, isSigner: false, isWritable: true },
|
|
3252
|
+
]);
|
|
3454
3253
|
}
|
|
3455
3254
|
}
|
|
3456
3255
|
return executiveWithdrawIx;
|
|
3457
3256
|
};
|
|
3458
3257
|
/**
|
|
3459
3258
|
* Get a an instruction to update the reference price type of a strategy
|
|
3460
|
-
* @param admin transaction signer
|
|
3461
3259
|
* @param strategy strategy pubkey or object
|
|
3462
3260
|
* @param referencePriceType new reference price type
|
|
3463
3261
|
*/
|
|
3464
|
-
getUpdateReferencePriceTypeIx = async (
|
|
3465
|
-
const { address } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3466
|
-
return (0, utils_1.getUpdateStrategyConfigIx)(
|
|
3262
|
+
getUpdateReferencePriceTypeIx = async (strategy, referencePriceType) => {
|
|
3263
|
+
const { address, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3264
|
+
return (0, utils_1.getUpdateStrategyConfigIx)(strategyState.adminAuthority, this._globalConfig, address, new StrategyConfigOption_1.UpdateReferencePriceType(), new decimal_js_1.default(referencePriceType.discriminator));
|
|
3467
3265
|
};
|
|
3468
3266
|
/**
|
|
3469
3267
|
* Get a transaction to invest funds from the Kamino vaults and put them into the DEX pool as liquidity.
|
|
@@ -3480,8 +3278,8 @@ class Kamino {
|
|
|
3480
3278
|
if (!globalConfig) {
|
|
3481
3279
|
throw Error(`Could not fetch global config with pubkey ${strategyState.globalConfig.toString()}`);
|
|
3482
3280
|
}
|
|
3483
|
-
const programId =
|
|
3484
|
-
const eventAuthority =
|
|
3281
|
+
const programId = (0, utils_1.getDexProgramId)(strategyState);
|
|
3282
|
+
const eventAuthority = this.getEventAuthorityPDA(strategyState.strategyDex);
|
|
3485
3283
|
const accounts = {
|
|
3486
3284
|
position: strategyState.position,
|
|
3487
3285
|
positionTokenAccount: strategyState.positionTokenAccount,
|
|
@@ -3500,17 +3298,17 @@ class Kamino {
|
|
|
3500
3298
|
raydiumProtocolPositionOrBaseVaultAuthority: strategyState.raydiumProtocolPositionOrBaseVaultAuthority,
|
|
3501
3299
|
tokenInfos: globalConfig.tokenInfos,
|
|
3502
3300
|
poolProgram: programId,
|
|
3503
|
-
instructionSysvarAccount:
|
|
3301
|
+
instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
3504
3302
|
tokenAMint: strategyState.tokenAMint,
|
|
3505
3303
|
tokenBMint: strategyState.tokenBMint,
|
|
3506
3304
|
eventAuthority,
|
|
3507
|
-
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram,
|
|
3508
|
-
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram,
|
|
3305
|
+
tokenATokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenATokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3306
|
+
tokenBTokenProgram: (0, utils_1.keyOrDefault)(strategyState.tokenBTokenProgram, spl_token_1.TOKEN_PROGRAM_ID),
|
|
3509
3307
|
memoProgram: pubkeys_1.MEMO_PROGRAM_ID,
|
|
3510
|
-
tokenProgram:
|
|
3511
|
-
tokenProgram2022:
|
|
3308
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
3309
|
+
tokenProgram2022: pubkeys_1.TOKEN_2022_PROGRAM_ID,
|
|
3512
3310
|
};
|
|
3513
|
-
return (0,
|
|
3311
|
+
return (0, instructions_1.invest)(accounts);
|
|
3514
3312
|
};
|
|
3515
3313
|
/**
|
|
3516
3314
|
* Get a list of instructions to collect the pending fees and invest them into the Kamino strategy's position.
|
|
@@ -3533,11 +3331,11 @@ class Kamino {
|
|
|
3533
3331
|
*/
|
|
3534
3332
|
getPendingFees = async (strategies) => {
|
|
3535
3333
|
const strategiesWithAddresses = await this.getStrategiesWithAddresses(strategies);
|
|
3536
|
-
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') && x.strategy.position
|
|
3334
|
+
const raydiumStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('RAYDIUM') && !x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
3537
3335
|
const raydiumPositionsPromise = this.getRaydiumPositions(raydiumStrategies.map((x) => x.strategy.position));
|
|
3538
|
-
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') && x.strategy.position
|
|
3336
|
+
const orcaStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('ORCA') && !x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
3539
3337
|
const orcaPositionsPromise = this.getOrcaPositions(orcaStrategies.map((x) => x.strategy.position));
|
|
3540
|
-
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') && x.strategy.position
|
|
3338
|
+
const meteoraStrategies = strategiesWithAddresses.filter((x) => x.strategy.strategyDex.toNumber() === (0, utils_1.dexToNumber)('METEORA') && !x.strategy.position.equals(web3_js_1.PublicKey.default));
|
|
3541
3339
|
const meteoraPositionsPromise = this.getMeteoraPositions(meteoraStrategies.map((x) => x.strategy.position));
|
|
3542
3340
|
const [raydiumPositions, orcaPositions, meteoraPositions] = await Promise.all([
|
|
3543
3341
|
raydiumPositionsPromise,
|
|
@@ -3602,20 +3400,20 @@ class Kamino {
|
|
|
3602
3400
|
const rebalanceParams = rebalanceFieldInfos
|
|
3603
3401
|
.filter((x) => x.label != consts_1.RebalanceTypeLabelName && x.enabled)
|
|
3604
3402
|
.map((f) => new decimal_js_1.default(f.value));
|
|
3605
|
-
return this.
|
|
3403
|
+
return this.getUpdateRebalancingParmsIxns(strategyAdmin, strategyWithAddress.address, rebalanceParams, rebalanceType, strategyWithAddress.strategy.tokenAMintDecimals.toNumber(), strategyWithAddress.strategy.tokenBMintDecimals.toNumber());
|
|
3606
3404
|
};
|
|
3607
3405
|
processRebalanceParams = async (dex, pool, rebalanceType, rebalanceParams) => {
|
|
3608
3406
|
const processedRebalanceParams = [...rebalanceParams];
|
|
3609
3407
|
const rebalanceTypeKind = (0, utils_1.numberToRebalanceType)(rebalanceType.toNumber());
|
|
3610
|
-
if (dex
|
|
3408
|
+
if (dex == 'ORCA') {
|
|
3611
3409
|
const { whirlpool: whilrpoolState } = await this.getWhirlpoolStateIfNotFetched(pool);
|
|
3612
|
-
if (rebalanceTypeKind.kind
|
|
3410
|
+
if (rebalanceTypeKind.kind == types_1.RebalanceType.Drift.kind) {
|
|
3613
3411
|
processedRebalanceParams[0] = new decimal_js_1.default((0, whirlpool_sdk_1.getNearestValidTickIndexFromTickIndex)(rebalanceParams[0].toNumber(), whilrpoolState.tickSpacing));
|
|
3614
3412
|
}
|
|
3615
3413
|
}
|
|
3616
3414
|
return processedRebalanceParams;
|
|
3617
3415
|
};
|
|
3618
|
-
|
|
3416
|
+
getUpdateRebalancingParmsIxns = async (strategyAdmin, strategy, rebalanceParams, rebalanceType, tokenADecimals, tokenBDecimals) => {
|
|
3619
3417
|
const { address: strategyAddress, strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
3620
3418
|
if (!rebalanceType) {
|
|
3621
3419
|
rebalanceType = (0, utils_1.numberToRebalanceType)(strategyState.rebalanceType);
|
|
@@ -3630,12 +3428,12 @@ class Kamino {
|
|
|
3630
3428
|
};
|
|
3631
3429
|
const accounts = {
|
|
3632
3430
|
adminAuthority: strategyAdmin,
|
|
3633
|
-
newAccount:
|
|
3431
|
+
newAccount: web3_js_1.PublicKey.default, // not used
|
|
3634
3432
|
globalConfig: this._globalConfig,
|
|
3635
3433
|
strategy: strategyAddress,
|
|
3636
|
-
systemProgram:
|
|
3434
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
3637
3435
|
};
|
|
3638
|
-
return (0,
|
|
3436
|
+
return (0, instructions_1.updateStrategyConfig)(args, accounts);
|
|
3639
3437
|
};
|
|
3640
3438
|
getUpdateRebalancingParamsForUninitializedStratIx = async (strategyAdmin, strategy, rebalanceParams, rebalanceType, tokenADecimals, tokenBDecimals) => {
|
|
3641
3439
|
const value = (0, utils_1.buildStrategyRebalanceParams)(rebalanceParams, rebalanceType, tokenADecimals, tokenBDecimals);
|
|
@@ -3645,12 +3443,12 @@ class Kamino {
|
|
|
3645
3443
|
};
|
|
3646
3444
|
const accounts = {
|
|
3647
3445
|
adminAuthority: strategyAdmin,
|
|
3648
|
-
newAccount:
|
|
3446
|
+
newAccount: web3_js_1.PublicKey.default, // not used
|
|
3649
3447
|
globalConfig: this._globalConfig,
|
|
3650
3448
|
strategy,
|
|
3651
|
-
systemProgram:
|
|
3449
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
3652
3450
|
};
|
|
3653
|
-
return (0,
|
|
3451
|
+
return (0, instructions_1.updateStrategyConfig)(args, accounts);
|
|
3654
3452
|
};
|
|
3655
3453
|
buildStrategyRebalanceParams = async (strategy) => {
|
|
3656
3454
|
const strategyState = await this.getStrategyStateIfNotFetched(strategy);
|
|
@@ -3678,7 +3476,7 @@ class Kamino {
|
|
|
3678
3476
|
throw Error(`Token mint ${tokenAMint.toString()} is not supported`);
|
|
3679
3477
|
}
|
|
3680
3478
|
const pool = await this.getPoolInitializedForDexPairTier(dex, tokenAMint, tokenBMint, feeTier.mul(CreationParameters_1.FullBPS));
|
|
3681
|
-
if (pool
|
|
3479
|
+
if (pool == web3_js_1.PublicKey.default) {
|
|
3682
3480
|
throw Error(`Pool for tokens ${tokenAMint.toString()} and ${tokenBMint.toString()} for feeTier ${feeTier.toString()} does not exist`);
|
|
3683
3481
|
}
|
|
3684
3482
|
const processedRebalanceParams = await this.processRebalanceParams(dex, pool, rebalanceType, rebalanceParams);
|
|
@@ -3686,8 +3484,8 @@ class Kamino {
|
|
|
3686
3484
|
let tokenMintA;
|
|
3687
3485
|
let tokenMintB;
|
|
3688
3486
|
let tickSpacing;
|
|
3689
|
-
if (dex
|
|
3690
|
-
const whirlpoolState = await
|
|
3487
|
+
if (dex == 'ORCA') {
|
|
3488
|
+
const whirlpoolState = await whirlpools_client_1.Whirlpool.fetch(this._connection, pool, this._orcaService.getWhirlpoolProgramId());
|
|
3691
3489
|
if (!whirlpoolState) {
|
|
3692
3490
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3693
3491
|
}
|
|
@@ -3695,8 +3493,8 @@ class Kamino {
|
|
|
3695
3493
|
tokenMintB = whirlpoolState.tokenMintB;
|
|
3696
3494
|
tickSpacing = whirlpoolState.tickSpacing;
|
|
3697
3495
|
}
|
|
3698
|
-
else if (dex
|
|
3699
|
-
const raydiumPoolState = await
|
|
3496
|
+
else if (dex == 'RAYDIUM') {
|
|
3497
|
+
const raydiumPoolState = await raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
3700
3498
|
if (!raydiumPoolState) {
|
|
3701
3499
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
3702
3500
|
}
|
|
@@ -3704,8 +3502,8 @@ class Kamino {
|
|
|
3704
3502
|
tokenMintB = raydiumPoolState.tokenMint1;
|
|
3705
3503
|
tickSpacing = raydiumPoolState.tickSpacing;
|
|
3706
3504
|
}
|
|
3707
|
-
else if (dex
|
|
3708
|
-
const meteoraPoolState = await
|
|
3505
|
+
else if (dex == 'METEORA') {
|
|
3506
|
+
const meteoraPoolState = await accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
3709
3507
|
if (!meteoraPoolState) {
|
|
3710
3508
|
throw Error(`Could not fetch Meteora pool state with pubkey ${pool.toString()}`);
|
|
3711
3509
|
}
|
|
@@ -3719,8 +3517,8 @@ class Kamino {
|
|
|
3719
3517
|
const tokenATokenProgram = await this.getAccountOwner(tokenAMint);
|
|
3720
3518
|
const tokenBTokenProgram = await this.getAccountOwner(tokenBMint);
|
|
3721
3519
|
const initStrategyIx = await this.createStrategy(strategy, pool, strategyAdmin, dex);
|
|
3722
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3723
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3520
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenMintA);
|
|
3521
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenMintB);
|
|
3724
3522
|
const rebalanceKind = (0, utils_1.numberToRebalanceType)(rebalanceType.toNumber());
|
|
3725
3523
|
const updateRebalanceParamsIx = await this.getUpdateRebalancingParamsForUninitializedStratIx(strategyAdmin, strategy, processedRebalanceParams, rebalanceKind, tokenADecimals, tokenBDecimals);
|
|
3726
3524
|
const updateStrategyParamsIxs = await this.getUpdateStrategyParamsIxs(strategyAdmin, strategy, rebalanceType, withdrawFeeBps, performanceFeeBps);
|
|
@@ -3730,15 +3528,15 @@ class Kamino {
|
|
|
3730
3528
|
const tokenBVault = programAddresses.tokenBVault;
|
|
3731
3529
|
const { lowerPrice, upperPrice } = await this.getRebalancePositionRange(dex, price, tokenAMint, tokenBMint, tickSpacing, rebalanceKind, rebalanceParams);
|
|
3732
3530
|
const openPositionIxs = [];
|
|
3733
|
-
const eventAuthority =
|
|
3734
|
-
if (dex
|
|
3531
|
+
const eventAuthority = this.getEventAuthorityPDA(new bn_js_1.default((0, utils_1.dexToNumber)(dex)));
|
|
3532
|
+
if (dex == 'ORCA') {
|
|
3735
3533
|
const whirlpoolWithAddress = await this.getWhirlpoolStateIfNotFetched(pool);
|
|
3736
3534
|
if (!whirlpoolWithAddress) {
|
|
3737
3535
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3738
3536
|
}
|
|
3739
3537
|
const initLowerTickIfNeeded = await this.initializeTickForOrcaPool(strategyAdmin, pool, lowerPrice);
|
|
3740
3538
|
const initUpperTickIfNeeded = await this.initializeTickForOrcaPool(strategyAdmin, pool, upperPrice);
|
|
3741
|
-
const openPositionIx = await this.openPositionOrca(strategyAdmin, strategy, baseVaultAuthority, pool, positionMint, lowerPrice, upperPrice, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority);
|
|
3539
|
+
const openPositionIx = await this.openPositionOrca(strategyAdmin, strategy, baseVaultAuthority, pool, positionMint, lowerPrice, upperPrice, tokenAVault, tokenBVault, tokenAMint, tokenBMint, tokenATokenProgram, tokenBTokenProgram, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, baseVaultAuthority, eventAuthority);
|
|
3742
3540
|
if (initLowerTickIfNeeded.initTickIx) {
|
|
3743
3541
|
openPositionIxs.push(initLowerTickIfNeeded.initTickIx);
|
|
3744
3542
|
}
|
|
@@ -3747,11 +3545,11 @@ class Kamino {
|
|
|
3747
3545
|
}
|
|
3748
3546
|
openPositionIxs.push(openPositionIx);
|
|
3749
3547
|
}
|
|
3750
|
-
else if (dex
|
|
3548
|
+
else if (dex == 'RAYDIUM') {
|
|
3751
3549
|
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);
|
|
3752
3550
|
openPositionIxs.push(openPositionIx);
|
|
3753
3551
|
}
|
|
3754
|
-
else if (dex
|
|
3552
|
+
else if (dex == 'METEORA') {
|
|
3755
3553
|
const lbPair = await this.getMeteoraStateIfNotFetched(pool);
|
|
3756
3554
|
if (!lbPair) {
|
|
3757
3555
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
@@ -3787,23 +3585,23 @@ class Kamino {
|
|
|
3787
3585
|
return this.getRebalancePositionRange(dex, price, tokenAMint, tokenBMint, tickSpacing, rebalanceKind, rebalanceParams);
|
|
3788
3586
|
}
|
|
3789
3587
|
async getRebalancePositionRange(dex, price, tokenAMint, tokenBMint, tickSpacing, rebalanceKind, rebalanceParams) {
|
|
3790
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3791
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3588
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenAMint);
|
|
3589
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, tokenBMint);
|
|
3792
3590
|
switch (rebalanceKind.kind) {
|
|
3793
3591
|
case types_1.RebalanceType.Manual.kind:
|
|
3794
3592
|
return { lowerPrice: rebalanceParams[0], upperPrice: rebalanceParams[1] };
|
|
3795
3593
|
case types_1.RebalanceType.TakeProfit.kind:
|
|
3796
3594
|
return { lowerPrice: rebalanceParams[0], upperPrice: rebalanceParams[1] };
|
|
3797
3595
|
case types_1.RebalanceType.PricePercentage.kind:
|
|
3798
|
-
return (0,
|
|
3596
|
+
return (0, rebalance_methods_2.getPositionRangeFromPercentageRebalanceParams)(price, rebalanceParams[0], rebalanceParams[1]);
|
|
3799
3597
|
case types_1.RebalanceType.PricePercentageWithReset.kind:
|
|
3800
|
-
return (0,
|
|
3598
|
+
return (0, rebalance_methods_3.getPositionRangeFromPricePercentageWithResetParams)(price, rebalanceParams[0], rebalanceParams[1]);
|
|
3801
3599
|
case types_1.RebalanceType.Drift.kind:
|
|
3802
|
-
return (0,
|
|
3600
|
+
return (0, rebalance_methods_4.getPositionRangeFromDriftParams)(dex, tickSpacing, tokenADecimals, tokenBDecimals, rebalanceParams[0], rebalanceParams[1], rebalanceParams[2]);
|
|
3803
3601
|
case types_1.RebalanceType.PeriodicRebalance.kind:
|
|
3804
|
-
return (0,
|
|
3602
|
+
return (0, rebalance_methods_5.getPositionRangeFromPeriodicRebalanceParams)(price, rebalanceParams[1], rebalanceParams[2]);
|
|
3805
3603
|
case types_1.RebalanceType.Expander.kind:
|
|
3806
|
-
return (0,
|
|
3604
|
+
return (0, rebalance_methods_5.getPositionRangeFromExpanderParams)(price, rebalanceParams[0], rebalanceParams[1]);
|
|
3807
3605
|
case types_1.RebalanceType.Autodrift.kind:
|
|
3808
3606
|
const currentTickIndex = (0, whirlpool_sdk_1.priceToTickIndex)(price, tokenADecimals, tokenBDecimals);
|
|
3809
3607
|
const startMidTick = new decimal_js_1.default(currentTickIndex);
|
|
@@ -3819,13 +3617,13 @@ class Kamino {
|
|
|
3819
3617
|
return this.getCurrentPriceFromPool(dex, pool);
|
|
3820
3618
|
}
|
|
3821
3619
|
async getCurrentPriceFromPool(dex, pool) {
|
|
3822
|
-
if (dex
|
|
3620
|
+
if (dex == 'ORCA') {
|
|
3823
3621
|
return this.getOrcaPoolPrice(pool);
|
|
3824
3622
|
}
|
|
3825
|
-
else if (dex
|
|
3623
|
+
else if (dex == 'RAYDIUM') {
|
|
3826
3624
|
return this.getRaydiumPoolPrice(pool);
|
|
3827
3625
|
}
|
|
3828
|
-
else if (dex
|
|
3626
|
+
else if (dex == 'METEORA') {
|
|
3829
3627
|
return this.getMeteoraPoolPrice(pool);
|
|
3830
3628
|
}
|
|
3831
3629
|
else {
|
|
@@ -3833,22 +3631,22 @@ class Kamino {
|
|
|
3833
3631
|
}
|
|
3834
3632
|
}
|
|
3835
3633
|
async getPoolTickSpacing(dex, pool) {
|
|
3836
|
-
if (dex
|
|
3837
|
-
const whirlpoolState = await
|
|
3634
|
+
if (dex == 'ORCA') {
|
|
3635
|
+
const whirlpoolState = await whirlpools_client_1.Whirlpool.fetch(this._connection, pool, this._orcaService.getWhirlpoolProgramId());
|
|
3838
3636
|
if (!whirlpoolState) {
|
|
3839
3637
|
throw Error(`Could not fetch whirlpool state with pubkey ${pool.toString()}`);
|
|
3840
3638
|
}
|
|
3841
3639
|
return whirlpoolState.tickSpacing;
|
|
3842
3640
|
}
|
|
3843
|
-
else if (dex
|
|
3844
|
-
const raydiumPoolState = await
|
|
3641
|
+
else if (dex == 'RAYDIUM') {
|
|
3642
|
+
const raydiumPoolState = await raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
3845
3643
|
if (!raydiumPoolState) {
|
|
3846
3644
|
throw Error(`Could not fetch Raydium pool state with pubkey ${pool.toString()}`);
|
|
3847
3645
|
}
|
|
3848
3646
|
return raydiumPoolState.tickSpacing;
|
|
3849
3647
|
}
|
|
3850
|
-
else if (dex
|
|
3851
|
-
const meteoraPoolState = await
|
|
3648
|
+
else if (dex == 'METEORA') {
|
|
3649
|
+
const meteoraPoolState = await accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
3852
3650
|
if (!meteoraPoolState) {
|
|
3853
3651
|
throw Error(`Could not fetch Meteora pool state with pubkey ${pool.toString()}`);
|
|
3854
3652
|
}
|
|
@@ -3860,13 +3658,13 @@ class Kamino {
|
|
|
3860
3658
|
}
|
|
3861
3659
|
async getPriceRangePercentageBasedFromPool(dex, pool, lowerPriceBpsDifference, upperPriceBpsDifference) {
|
|
3862
3660
|
let poolPrice;
|
|
3863
|
-
if (dex
|
|
3661
|
+
if (dex == 'ORCA') {
|
|
3864
3662
|
poolPrice = await this.getOrcaPoolPrice(pool);
|
|
3865
3663
|
}
|
|
3866
|
-
else if (dex
|
|
3664
|
+
else if (dex == 'RAYDIUM') {
|
|
3867
3665
|
poolPrice = await this.getRaydiumPoolPrice(pool);
|
|
3868
3666
|
}
|
|
3869
|
-
else if (dex
|
|
3667
|
+
else if (dex == 'METEORA') {
|
|
3870
3668
|
poolPrice = await this.getMeteoraPoolPrice(pool);
|
|
3871
3669
|
}
|
|
3872
3670
|
else {
|
|
@@ -3885,24 +3683,24 @@ class Kamino {
|
|
|
3885
3683
|
rebalanceFields = [];
|
|
3886
3684
|
}
|
|
3887
3685
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
3888
|
-
rebalanceFields = (0,
|
|
3686
|
+
rebalanceFields = (0, rebalance_methods_2.readPricePercentageRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3889
3687
|
}
|
|
3890
3688
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
3891
|
-
rebalanceFields = (0,
|
|
3689
|
+
rebalanceFields = (0, rebalance_methods_3.readPricePercentageWithResetRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3892
3690
|
}
|
|
3893
3691
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
3894
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3692
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_4.readDriftRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3895
3693
|
}
|
|
3896
3694
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
3897
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3898
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3899
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3695
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3696
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
3697
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_5.readTakeProfitRebalanceParamsFromStrategy)(tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw));
|
|
3900
3698
|
}
|
|
3901
3699
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
3902
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3700
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_5.readPeriodicRebalanceRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3903
3701
|
}
|
|
3904
3702
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
3905
|
-
rebalanceFields = (0,
|
|
3703
|
+
rebalanceFields = (0, rebalance_methods_5.readExpanderRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3906
3704
|
}
|
|
3907
3705
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
3908
3706
|
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, autodriftRebalance_1.readAutodriftRebalanceParamsFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
@@ -3923,22 +3721,22 @@ class Kamino {
|
|
|
3923
3721
|
rebalanceFields = [];
|
|
3924
3722
|
}
|
|
3925
3723
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
3926
|
-
rebalanceFields = (0,
|
|
3724
|
+
rebalanceFields = (0, rebalance_methods_2.readRawPricePercentageRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3927
3725
|
}
|
|
3928
3726
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
3929
|
-
rebalanceFields = (0,
|
|
3727
|
+
rebalanceFields = (0, rebalance_methods_3.readRawPricePercentageWithResetRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw);
|
|
3930
3728
|
}
|
|
3931
3729
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
3932
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3730
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_4.readRawDriftRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3933
3731
|
}
|
|
3934
3732
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
3935
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3733
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_5.readTakeProfitRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3936
3734
|
}
|
|
3937
3735
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
3938
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3736
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_5.readPeriodicRebalanceRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3939
3737
|
}
|
|
3940
3738
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
3941
|
-
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0,
|
|
3739
|
+
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, rebalance_methods_5.readRawExpanderRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
3942
3740
|
}
|
|
3943
3741
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
3944
3742
|
rebalanceFields = (0, utils_1.rebalanceFieldsDictToInfo)((0, autodriftRebalance_1.readRawAutodriftRebalanceStateFromStrategy)(strategyWithAddress.strategy.rebalanceRaw));
|
|
@@ -3948,46 +3746,6 @@ class Kamino {
|
|
|
3948
3746
|
}
|
|
3949
3747
|
return rebalanceFields;
|
|
3950
3748
|
}
|
|
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
|
-
}
|
|
3991
3749
|
/**
|
|
3992
3750
|
* Get the prices for rebalancing params (range and reset range, if strategy involves a reset range)
|
|
3993
3751
|
*/
|
|
@@ -4000,36 +3758,36 @@ class Kamino {
|
|
|
4000
3758
|
}
|
|
4001
3759
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
4002
3760
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4003
|
-
return (0,
|
|
3761
|
+
return (0, rebalance_methods_2.deserializePricePercentageRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4004
3762
|
}
|
|
4005
3763
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
4006
3764
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4007
|
-
return (0,
|
|
3765
|
+
return (0, rebalance_methods_3.deserializePricePercentageWithResetRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4008
3766
|
}
|
|
4009
3767
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
4010
3768
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
4011
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4012
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3769
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3770
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
4013
3771
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
4014
|
-
return (0,
|
|
3772
|
+
return (0, rebalance_methods_4.deserializeDriftRebalanceFromOnchainParams)(dex, tickSpacing, tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
4015
3773
|
}
|
|
4016
3774
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
4017
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4018
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4019
|
-
return (0,
|
|
3775
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3776
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
3777
|
+
return (0, rebalance_methods_5.deserializeTakeProfitRebalanceFromOnchainParams)(tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
4020
3778
|
}
|
|
4021
3779
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
4022
3780
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4023
|
-
return (0,
|
|
3781
|
+
return (0, rebalance_methods_5.deserializePeriodicRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4024
3782
|
}
|
|
4025
3783
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
4026
3784
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4027
|
-
return (0,
|
|
3785
|
+
return (0, rebalance_methods_5.readExpanderRebalanceFieldInfosFromStrategy)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4028
3786
|
}
|
|
4029
3787
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
4030
3788
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
4031
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4032
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3789
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3790
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
4033
3791
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
4034
3792
|
return (0, autodriftRebalance_1.deserializeAutodriftRebalanceFromOnchainParams)(dex, tokenADecimals, tokenBDecimals, tickSpacing, strategyWithAddress.strategy.rebalanceRaw);
|
|
4035
3793
|
}
|
|
@@ -4052,36 +3810,36 @@ class Kamino {
|
|
|
4052
3810
|
}
|
|
4053
3811
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentage.kind) {
|
|
4054
3812
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4055
|
-
return (0,
|
|
3813
|
+
return (0, rebalance_methods_2.deserializePricePercentageRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4056
3814
|
}
|
|
4057
3815
|
else if (rebalanceKind.kind === RebalanceType_1.PricePercentageWithReset.kind) {
|
|
4058
3816
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4059
|
-
return (0,
|
|
3817
|
+
return (0, rebalance_methods_3.deserializePricePercentageWithResetRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4060
3818
|
}
|
|
4061
3819
|
else if (rebalanceKind.kind === RebalanceType_1.Drift.kind) {
|
|
4062
3820
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
4063
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4064
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3821
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3822
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
4065
3823
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
4066
|
-
return (0,
|
|
3824
|
+
return (0, rebalance_methods_4.deserializeDriftRebalanceWithStateOverride)(dex, tickSpacing, tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
4067
3825
|
}
|
|
4068
3826
|
else if (rebalanceKind.kind === RebalanceType_1.TakeProfit.kind) {
|
|
4069
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4070
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4071
|
-
return (0,
|
|
3827
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3828
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
3829
|
+
return (0, rebalance_methods_5.deserializeTakeProfitRebalanceFromOnchainParams)(tokenADecimals, tokenBDecimals, strategyWithAddress.strategy.rebalanceRaw);
|
|
4072
3830
|
}
|
|
4073
3831
|
else if (rebalanceKind.kind === RebalanceType_1.PeriodicRebalance.kind) {
|
|
4074
3832
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4075
|
-
return (0,
|
|
3833
|
+
return (0, rebalance_methods_5.deserializePeriodicRebalanceFromOnchainParams)(price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4076
3834
|
}
|
|
4077
3835
|
else if (rebalanceKind.kind === RebalanceType_1.Expander.kind) {
|
|
4078
3836
|
const price = await this.getCurrentPrice(strategyWithAddress);
|
|
4079
|
-
return (0,
|
|
3837
|
+
return (0, rebalance_methods_5.deserializeExpanderRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, price, strategyWithAddress.strategy.rebalanceRaw);
|
|
4080
3838
|
}
|
|
4081
3839
|
else if (rebalanceKind.kind === RebalanceType_1.Autodrift.kind) {
|
|
4082
3840
|
const dex = (0, utils_1.numberToDex)(strategyWithAddress.strategy.strategyDex.toNumber());
|
|
4083
|
-
const tokenADecimals = await (0, utils_1.getMintDecimals)(this.
|
|
4084
|
-
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this.
|
|
3841
|
+
const tokenADecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenAMint);
|
|
3842
|
+
const tokenBDecimals = await (0, utils_1.getMintDecimals)(this._connection, strategyWithAddress.strategy.tokenBMint);
|
|
4085
3843
|
const tickSpacing = await this.getPoolTickSpacing(dex, strategyWithAddress.strategy.pool);
|
|
4086
3844
|
return (0, autodriftRebalance_1.deserializeAutodriftRebalanceWithStateOverride)(dex, tokenADecimals, tokenBDecimals, tickSpacing, strategyWithAddress.strategy.rebalanceRaw);
|
|
4087
3845
|
}
|
|
@@ -4097,7 +3855,7 @@ class Kamino {
|
|
|
4097
3855
|
*/
|
|
4098
3856
|
getUpdatedRebalanceFieldInfos(initialRebalanceFieldInfos, updatedFields) {
|
|
4099
3857
|
const newRebalanceFieldInfos = initialRebalanceFieldInfos.map((f) => {
|
|
4100
|
-
const updatedField = updatedFields.find((x) => x.label
|
|
3858
|
+
const updatedField = updatedFields.find((x) => x.label == f.label);
|
|
4101
3859
|
if (updatedField) {
|
|
4102
3860
|
return { ...f, value: updatedField.value };
|
|
4103
3861
|
}
|
|
@@ -4117,13 +3875,13 @@ class Kamino {
|
|
|
4117
3875
|
* Read the pool price for a specific dex and pool
|
|
4118
3876
|
*/
|
|
4119
3877
|
async getPoolPrice(dex, pool) {
|
|
4120
|
-
if (dex
|
|
3878
|
+
if (dex == 'ORCA') {
|
|
4121
3879
|
return this.getOrcaPoolPrice(pool);
|
|
4122
3880
|
}
|
|
4123
|
-
else if (dex
|
|
3881
|
+
else if (dex == 'RAYDIUM') {
|
|
4124
3882
|
return this.getRaydiumPoolPrice(pool);
|
|
4125
3883
|
}
|
|
4126
|
-
else if (dex
|
|
3884
|
+
else if (dex == 'METEORA') {
|
|
4127
3885
|
return this.getMeteoraPoolPrice(pool);
|
|
4128
3886
|
}
|
|
4129
3887
|
else {
|
|
@@ -4131,14 +3889,18 @@ class Kamino {
|
|
|
4131
3889
|
}
|
|
4132
3890
|
}
|
|
4133
3891
|
async getOrcaPoolPrice(pool) {
|
|
4134
|
-
const
|
|
3892
|
+
const orca = new whirlpool_sdk_1.OrcaWhirlpoolClient({
|
|
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);
|
|
4135
3897
|
if (!poolData) {
|
|
4136
3898
|
throw Error(`Could not fetch Whirlpool data for ${pool.toString()}`);
|
|
4137
3899
|
}
|
|
4138
3900
|
return poolData.price;
|
|
4139
3901
|
}
|
|
4140
3902
|
async getRaydiumPoolPrice(pool) {
|
|
4141
|
-
const poolState = await
|
|
3903
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
4142
3904
|
if (!poolState) {
|
|
4143
3905
|
throw new Error(`Raydium poolState ${pool.toString()} is not found`);
|
|
4144
3906
|
}
|
|
@@ -4146,23 +3908,23 @@ class Kamino {
|
|
|
4146
3908
|
return price;
|
|
4147
3909
|
}
|
|
4148
3910
|
async getMeteoraPoolPrice(pool) {
|
|
4149
|
-
const poolState = await
|
|
3911
|
+
const poolState = await accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
4150
3912
|
if (!poolState) {
|
|
4151
3913
|
throw new Error(`Meteora poolState ${pool.toString()} is not found`);
|
|
4152
3914
|
}
|
|
4153
|
-
const decimalsX = await (0, utils_1.getMintDecimals)(this.
|
|
4154
|
-
const decimalsY = await (0, utils_1.getMintDecimals)(this.
|
|
3915
|
+
const decimalsX = await (0, utils_1.getMintDecimals)(this._connection, poolState.tokenXMint);
|
|
3916
|
+
const decimalsY = await (0, utils_1.getMintDecimals)(this._connection, poolState.tokenYMint);
|
|
4155
3917
|
return (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(poolState.activeId, poolState.binStep, decimalsX, decimalsY);
|
|
4156
3918
|
}
|
|
4157
3919
|
async getGenericPoolInfo(dex, pool) {
|
|
4158
3920
|
let poolInfo;
|
|
4159
|
-
if (dex
|
|
3921
|
+
if (dex == 'ORCA') {
|
|
4160
3922
|
poolInfo = await this._orcaService.getGenericPoolInfo(pool);
|
|
4161
3923
|
}
|
|
4162
|
-
else if (dex
|
|
3924
|
+
else if (dex == 'RAYDIUM') {
|
|
4163
3925
|
poolInfo = await this._raydiumService.getGenericPoolInfo(pool);
|
|
4164
3926
|
}
|
|
4165
|
-
else if (dex
|
|
3927
|
+
else if (dex == 'METEORA') {
|
|
4166
3928
|
poolInfo = await this._meteoraService.getGenericPoolInfo(pool);
|
|
4167
3929
|
}
|
|
4168
3930
|
else {
|
|
@@ -4173,75 +3935,74 @@ class Kamino {
|
|
|
4173
3935
|
mintIsSupported = (collateralInfos, tokenMint) => {
|
|
4174
3936
|
let found = false;
|
|
4175
3937
|
collateralInfos.forEach((element) => {
|
|
4176
|
-
if (element.mint
|
|
3938
|
+
if (element.mint.equals(tokenMint)) {
|
|
4177
3939
|
found = true;
|
|
4178
3940
|
}
|
|
4179
3941
|
});
|
|
4180
3942
|
return found;
|
|
4181
3943
|
};
|
|
4182
3944
|
getCollateralInfoFromMint = (mint, collateralInfos) => {
|
|
4183
|
-
const collInfosForMint = collateralInfos.filter((x) => x.mint
|
|
4184
|
-
if (collInfosForMint.length
|
|
3945
|
+
const collInfosForMint = collateralInfos.filter((x) => x.mint.equals(mint));
|
|
3946
|
+
if (collInfosForMint.length == 0) {
|
|
4185
3947
|
return undefined;
|
|
4186
3948
|
}
|
|
4187
3949
|
return collInfosForMint[0];
|
|
4188
3950
|
};
|
|
4189
3951
|
getCollateralIdFromMint = (mint, collateralInfos) => {
|
|
4190
3952
|
for (let i = 0; i < collateralInfos.length; i++) {
|
|
4191
|
-
if (collateralInfos[i].mint
|
|
3953
|
+
if (collateralInfos[i].mint.equals(mint)) {
|
|
4192
3954
|
return i;
|
|
4193
3955
|
}
|
|
4194
3956
|
}
|
|
4195
3957
|
return -1;
|
|
4196
3958
|
};
|
|
4197
3959
|
getMainLookupTablePks = async () => {
|
|
4198
|
-
if (this.
|
|
4199
|
-
this._cluster
|
|
4200
|
-
this._cluster
|
|
4201
|
-
return await this.
|
|
4202
|
-
.getProgramAccounts(
|
|
4203
|
-
filters: [{ memcmp: { offset:
|
|
3960
|
+
if (this._kaminoProgramId.equals(pubkeys_1.STAGING_KAMINO_PROGRAM_ID) ||
|
|
3961
|
+
this._cluster == 'mainnet-beta' ||
|
|
3962
|
+
this._cluster == 'devnet') {
|
|
3963
|
+
return await this._connection
|
|
3964
|
+
.getProgramAccounts(pubkeys_1.ADDRESS_LUT_PROGRAM_ID, {
|
|
3965
|
+
filters: [{ memcmp: { offset: 22, bytes: new web3_js_1.PublicKey(pubkeys_1.LUT_OWNER_KEY).toString() } }],
|
|
4204
3966
|
dataSlice: { length: 0, offset: 0 },
|
|
4205
3967
|
})
|
|
4206
|
-
.send()
|
|
4207
3968
|
.then((res) => res.map((raw) => raw.pubkey));
|
|
4208
3969
|
}
|
|
4209
3970
|
return [];
|
|
4210
3971
|
};
|
|
4211
3972
|
getMainLookupTable = async () => {
|
|
4212
3973
|
const pks = await this.getMainLookupTablePks();
|
|
4213
|
-
if (this.
|
|
4214
|
-
this._cluster
|
|
4215
|
-
this._cluster
|
|
4216
|
-
return
|
|
3974
|
+
if (this._kaminoProgramId.equals(pubkeys_1.STAGING_KAMINO_PROGRAM_ID) ||
|
|
3975
|
+
this._cluster == 'mainnet-beta' ||
|
|
3976
|
+
this._cluster == 'devnet') {
|
|
3977
|
+
return await this._connection.getMultipleAccountsInfo(pks).then((res) => res.map((raw, i) => {
|
|
3978
|
+
return new web3_js_1.AddressLookupTableAccount({
|
|
3979
|
+
key: pks[i],
|
|
3980
|
+
state: web3_js_1.AddressLookupTableAccount.deserialize(raw.data),
|
|
3981
|
+
});
|
|
3982
|
+
}));
|
|
4217
3983
|
}
|
|
4218
3984
|
else {
|
|
4219
3985
|
return undefined;
|
|
4220
3986
|
}
|
|
4221
3987
|
};
|
|
4222
3988
|
getInitLookupTableIx = async (authority, slot) => {
|
|
4223
|
-
let recentSlot;
|
|
4224
|
-
if (
|
|
4225
|
-
recentSlot =
|
|
4226
|
-
}
|
|
4227
|
-
else {
|
|
4228
|
-
recentSlot = await this._rpc.getSlot({ commitment: 'finalized' }).send();
|
|
3989
|
+
let recentSlot = slot;
|
|
3990
|
+
if (!recentSlot) {
|
|
3991
|
+
recentSlot = await this._connection.getSlot();
|
|
4229
3992
|
}
|
|
4230
|
-
const
|
|
4231
|
-
|
|
4232
|
-
authority
|
|
3993
|
+
const slots = await this._connection.getBlocks(recentSlot - 20, recentSlot, 'confirmed');
|
|
3994
|
+
return web3_js_1.AddressLookupTableProgram.createLookupTable({
|
|
3995
|
+
authority,
|
|
4233
3996
|
payer: authority,
|
|
4234
|
-
|
|
4235
|
-
recentSlot: recentSlot,
|
|
3997
|
+
recentSlot: slots[0],
|
|
4236
3998
|
});
|
|
4237
|
-
return [createLookupTableIx, pda[0]];
|
|
4238
3999
|
};
|
|
4239
4000
|
getPopulateLookupTableIxs = async (authority, lookupTable, strategy) => {
|
|
4240
4001
|
const { strategy: strategyState, address } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4241
4002
|
if (!strategyState) {
|
|
4242
4003
|
throw Error(`Could not fetch strategy state with pubkey ${strategy.toString()}`);
|
|
4243
4004
|
}
|
|
4244
|
-
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } =
|
|
4005
|
+
const { treasuryFeeTokenAVault, treasuryFeeTokenBVault, treasuryFeeVaultAuthority } = this.getTreasuryFeeVaultPDAs(strategyState.tokenAMint, strategyState.tokenBMint);
|
|
4245
4006
|
const accountsToBeInserted = [
|
|
4246
4007
|
address,
|
|
4247
4008
|
strategyState.adminAuthority,
|
|
@@ -4268,48 +4029,87 @@ class Kamino {
|
|
|
4268
4029
|
const txs = [];
|
|
4269
4030
|
for (let i = 0; i < entries.length; i += chunkSize) {
|
|
4270
4031
|
const chunk = entries.slice(i, i + chunkSize);
|
|
4271
|
-
txs.push(
|
|
4272
|
-
authority,
|
|
4032
|
+
txs.push(web3_js_1.AddressLookupTableProgram.extendLookupTable({
|
|
4273
4033
|
payer: authority,
|
|
4274
|
-
|
|
4034
|
+
authority,
|
|
4035
|
+
lookupTable,
|
|
4275
4036
|
addresses: chunk,
|
|
4276
4037
|
}));
|
|
4277
4038
|
}
|
|
4278
4039
|
return txs;
|
|
4279
4040
|
};
|
|
4280
4041
|
getLookupTable = async (tablePk) => {
|
|
4281
|
-
const
|
|
4282
|
-
if (!
|
|
4283
|
-
throw new Error(`Could not get lookup table ${tablePk}`);
|
|
4042
|
+
const lookupTableAccount = await this._connection.getAddressLookupTable(tablePk).then((res) => res.value);
|
|
4043
|
+
if (!lookupTableAccount) {
|
|
4044
|
+
throw new Error(`Could not get lookup table ${tablePk.toString()}`);
|
|
4284
4045
|
}
|
|
4285
|
-
return
|
|
4046
|
+
return lookupTableAccount;
|
|
4286
4047
|
};
|
|
4287
4048
|
setupStrategyLookupTable = async (authority, strategy, slot) => {
|
|
4288
|
-
const [createLookupTableIx, lookupTable] = await this.getInitLookupTableIx(authority, slot);
|
|
4289
|
-
const
|
|
4290
|
-
const strategyPk =
|
|
4291
|
-
const
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
}
|
|
4049
|
+
const [createLookupTableIx, lookupTable] = await this.getInitLookupTableIx(authority.publicKey, slot);
|
|
4050
|
+
const populateLookupTableIx = await this.getPopulateLookupTableIxs(authority.publicKey, lookupTable, strategy);
|
|
4051
|
+
const strategyPk = 'address' in strategy ? strategy.address : strategy;
|
|
4052
|
+
const getUpdateStrategyLookupTableIx = await (0, utils_1.getUpdateStrategyConfigIx)(authority.publicKey, this._globalConfig, strategyPk, new StrategyConfigOption_1.UpdateLookupTable(), new decimal_js_1.default(0), lookupTable);
|
|
4053
|
+
const createTableTx = new web3_js_1.Transaction().add(createLookupTableIx);
|
|
4054
|
+
await (0, utils_1.sendTransactionWithLogs)(this._connection, createTableTx, authority.publicKey, [authority]);
|
|
4055
|
+
for (const ix of populateLookupTableIx) {
|
|
4056
|
+
const populateLookupTableTx = new web3_js_1.Transaction().add(ix);
|
|
4057
|
+
await (0, utils_1.sendTransactionWithLogs)(this._connection, populateLookupTableTx, authority.publicKey, [authority]);
|
|
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;
|
|
4298
4098
|
};
|
|
4299
4099
|
// todo(silviu): implement this
|
|
4300
4100
|
// getEstimatedApyAndVolumeOnRange = async (
|
|
4301
4101
|
// dex: Dex,
|
|
4302
|
-
// pool:
|
|
4102
|
+
// pool: PublicKey,
|
|
4303
4103
|
// lowerPrice: Decimal,
|
|
4304
4104
|
// upperPrice: Decimal,
|
|
4305
4105
|
// _startDate: Date,
|
|
4306
4106
|
// _endDate: Date
|
|
4307
4107
|
// ): Promise<GenericPositionRangeInfo> => {
|
|
4308
|
-
// if (dex
|
|
4108
|
+
// if (dex == 'ORCA') {
|
|
4309
4109
|
// return this.getEstimatedApyAndVolumeOnRangeOrca();
|
|
4310
|
-
// } else if (dex
|
|
4110
|
+
// } else if (dex == 'RAYDIUM') {
|
|
4311
4111
|
// return this.getEstimatedApyAndVolumeOnRangeRaydium();
|
|
4312
|
-
// } else if (dex
|
|
4112
|
+
// } else if (dex == 'METEORA') {
|
|
4313
4113
|
// return this.getEstimatedApyAndVolumeOnRangeMeteora();
|
|
4314
4114
|
// } else {
|
|
4315
4115
|
// throw new Error(`Dex ${dex} is not supported`);
|
|
@@ -4346,25 +4146,24 @@ class Kamino {
|
|
|
4346
4146
|
};
|
|
4347
4147
|
/**
|
|
4348
4148
|
* Get a list of transactions to rebalance a Kamino strategy.
|
|
4349
|
-
* @param admin pool admin
|
|
4350
4149
|
* @param strategy strategy pubkey or object
|
|
4351
4150
|
* @param newPosition new liquidity position account pubkey
|
|
4352
4151
|
* @param priceLower new position's lower price of the range
|
|
4353
4152
|
* @param priceUpper new position's upper price of the range
|
|
4354
4153
|
* @returns list of transactions to rebalance (executive withdraw, collect fees/rewards, open new position, invest)
|
|
4355
4154
|
*/
|
|
4356
|
-
rebalance = async (
|
|
4155
|
+
rebalance = async (strategy, newPosition, priceLower, priceUpper) => {
|
|
4357
4156
|
// todo: refactor this to return an object, not a list
|
|
4358
4157
|
const strategyWithAddress = await this.getStrategyStateIfNotFetched(strategy);
|
|
4359
4158
|
const ixs = [];
|
|
4360
4159
|
// if there are no invested tokens we don't need to collect fees and rewards
|
|
4361
4160
|
const stratTokenBalances = await this.getStrategyTokensBalances(strategyWithAddress.strategy);
|
|
4362
|
-
if (strategyWithAddress.strategy.strategyDex.toNumber()
|
|
4161
|
+
if (strategyWithAddress.strategy.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA') ||
|
|
4363
4162
|
stratTokenBalances.invested.a.greaterThan(utils_1.ZERO) ||
|
|
4364
4163
|
stratTokenBalances.invested.b.greaterThan(utils_1.ZERO)) {
|
|
4365
|
-
ixs.push(await this.collectFeesAndRewards(strategyWithAddress
|
|
4164
|
+
ixs.push(await this.collectFeesAndRewards(strategyWithAddress));
|
|
4366
4165
|
}
|
|
4367
|
-
ixs.push(await this.openPosition(
|
|
4166
|
+
ixs.push(await this.openPosition(strategyWithAddress, newPosition, priceLower, priceUpper, new StrategyStatus_1.Rebalancing()));
|
|
4368
4167
|
return ixs;
|
|
4369
4168
|
};
|
|
4370
4169
|
/**
|
|
@@ -4379,18 +4178,14 @@ class Kamino {
|
|
|
4379
4178
|
const positions = [];
|
|
4380
4179
|
for (const tokenAccount of userTokenAccounts) {
|
|
4381
4180
|
const accountData = tokenAccount.account.data;
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
sharesAmount: new decimal_js_1.default(accountData.parsed.info.tokenAmount.uiAmountString),
|
|
4391
|
-
strategyDex: (0, utils_1.numberToDex)(strategy.strategy.strategyDex.toNumber()),
|
|
4392
|
-
});
|
|
4393
|
-
}
|
|
4181
|
+
const strategy = liveStrategies.find((x) => x.strategy.sharesMint.toString() === accountData.parsed.info.mint);
|
|
4182
|
+
if (strategy) {
|
|
4183
|
+
positions.push({
|
|
4184
|
+
shareMint: strategy.strategy.sharesMint,
|
|
4185
|
+
strategy: strategy.address,
|
|
4186
|
+
sharesAmount: new decimal_js_1.default(accountData.parsed.info.tokenAmount.uiAmountString),
|
|
4187
|
+
strategyDex: (0, utils_1.numberToDex)(strategy.strategy.strategyDex.toNumber()),
|
|
4188
|
+
});
|
|
4394
4189
|
}
|
|
4395
4190
|
}
|
|
4396
4191
|
return positions;
|
|
@@ -4398,57 +4193,53 @@ class Kamino {
|
|
|
4398
4193
|
/**
|
|
4399
4194
|
* Get a list of user's Kamino strategy positions
|
|
4400
4195
|
* @param wallet user wallet address
|
|
4401
|
-
* @param strategiesWithShareMintsMap
|
|
4402
|
-
* @param strategiesWithAddressMap
|
|
4403
4196
|
* @returns list of kamino strategy positions
|
|
4404
4197
|
*/
|
|
4405
4198
|
getUserPositionsByStrategiesMap = async (wallet, strategiesWithShareMintsMap, strategiesWithAddressMap) => {
|
|
4406
|
-
const tokenAccounts = await this.
|
|
4407
|
-
|
|
4408
|
-
|
|
4199
|
+
const tokenAccounts = await this._connection.getParsedTokenAccountsByOwner(wallet, {
|
|
4200
|
+
programId: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4201
|
+
});
|
|
4409
4202
|
const mints = tokenAccounts.value.map((accountInfo) => {
|
|
4410
|
-
return accountInfo.account.data.parsed.info.mint;
|
|
4203
|
+
return new web3_js_1.PublicKey(accountInfo.account.data.parsed.info.mint);
|
|
4411
4204
|
});
|
|
4412
|
-
const mintInfos = await (0, utils_1.batchFetch)(mints,
|
|
4413
|
-
const
|
|
4205
|
+
const mintInfos = await (0, utils_1.batchFetch)(mints, (chunk) => this.getConnection().getMultipleAccountsInfo(chunk));
|
|
4206
|
+
const kaminoStrategyAdresses = [];
|
|
4414
4207
|
const kaminoAccountInfos = [];
|
|
4415
|
-
for (
|
|
4416
|
-
const mint = mints[
|
|
4417
|
-
const mintInfo = mintInfos[
|
|
4418
|
-
const accountInfo = tokenAccounts.value[
|
|
4208
|
+
for (const index of mints.keys()) {
|
|
4209
|
+
const mint = mints[index];
|
|
4210
|
+
const mintInfo = mintInfos[index];
|
|
4211
|
+
const accountInfo = tokenAccounts.value[index];
|
|
4419
4212
|
if (!mint || !mintInfo || !accountInfo)
|
|
4420
4213
|
continue;
|
|
4421
|
-
const [expectedMintAuthority] =
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
const addr = strategiesWithShareMintsMap.get(shareMintAddress)?.address;
|
|
4428
|
-
if (!addr)
|
|
4214
|
+
const [expectedMintAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('authority'), mint.toBuffer()], this.getProgramID());
|
|
4215
|
+
const mintData = (0, spl_token_1.unpackMint)(mint, mintInfo, mintInfo.owner);
|
|
4216
|
+
if (mintData.mintAuthority !== null && mintData.mintAuthority.equals(expectedMintAuthority)) {
|
|
4217
|
+
const shareMintAddress = tokenAccounts.value[index].account.data.parsed.info.mint;
|
|
4218
|
+
const address = strategiesWithShareMintsMap.get(new web3_js_1.PublicKey(shareMintAddress))?.address;
|
|
4219
|
+
if (!address)
|
|
4429
4220
|
continue;
|
|
4430
|
-
|
|
4431
|
-
kaminoAccountInfos.push(accountInfo.account
|
|
4221
|
+
kaminoStrategyAdresses.push(new web3_js_1.PublicKey(address));
|
|
4222
|
+
kaminoAccountInfos.push(accountInfo.account);
|
|
4432
4223
|
}
|
|
4433
4224
|
}
|
|
4434
4225
|
let strategies = strategiesWithAddressMap
|
|
4435
4226
|
? Array.from(strategiesWithAddressMap.values())
|
|
4436
4227
|
: [];
|
|
4437
|
-
const missingStrategies =
|
|
4228
|
+
const missingStrategies = kaminoStrategyAdresses.filter((x) => !strategiesWithAddressMap || !strategiesWithAddressMap.has(x));
|
|
4438
4229
|
const missingStrategiesState = await (0, utils_1.batchFetch)(missingStrategies, (chunk) => this.getStrategies(chunk));
|
|
4439
4230
|
strategies = strategies.concat(missingStrategiesState);
|
|
4440
4231
|
const positions = [];
|
|
4441
4232
|
for (const index of strategies.keys()) {
|
|
4442
4233
|
const strategy = strategies[index];
|
|
4443
4234
|
const accountData = kaminoAccountInfos[index];
|
|
4444
|
-
const address =
|
|
4235
|
+
const address = kaminoStrategyAdresses[index];
|
|
4445
4236
|
if (!strategy || !accountData) {
|
|
4446
4237
|
continue;
|
|
4447
4238
|
}
|
|
4448
4239
|
positions.push({
|
|
4449
4240
|
shareMint: strategy.sharesMint,
|
|
4450
4241
|
strategy: address,
|
|
4451
|
-
sharesAmount: new decimal_js_1.default(accountData.tokenAmount.uiAmountString),
|
|
4242
|
+
sharesAmount: new decimal_js_1.default(accountData.data.parsed.info.tokenAmount.uiAmountString),
|
|
4452
4243
|
strategyDex: (0, utils_1.numberToDex)(strategy.strategyDex.toNumber()),
|
|
4453
4244
|
});
|
|
4454
4245
|
}
|
|
@@ -4466,7 +4257,7 @@ class Kamino {
|
|
|
4466
4257
|
const isOrca = (0, utils_1.dexToNumber)('ORCA') === dex;
|
|
4467
4258
|
const isRaydium = (0, utils_1.dexToNumber)('RAYDIUM') === dex;
|
|
4468
4259
|
const isMeteora = (0, utils_1.dexToNumber)('METEORA') === dex;
|
|
4469
|
-
if (strategyState.position
|
|
4260
|
+
if (strategyState.position.equals(web3_js_1.PublicKey.default)) {
|
|
4470
4261
|
return {
|
|
4471
4262
|
totalApr: utils_1.ZERO,
|
|
4472
4263
|
feeApr: utils_1.ZERO,
|
|
@@ -4496,7 +4287,7 @@ class Kamino {
|
|
|
4496
4287
|
getStrategyPerformanceFees = async (strategy, globalConfig) => {
|
|
4497
4288
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4498
4289
|
const globalConfigState = globalConfig || (await this.getGlobalConfigState(strategyState.globalConfig));
|
|
4499
|
-
if (globalConfigState
|
|
4290
|
+
if (globalConfigState == null) {
|
|
4500
4291
|
throw new Error(`Unable to fetch GlobalConfig with Pubkey ${strategyState.globalConfig}`);
|
|
4501
4292
|
}
|
|
4502
4293
|
const globalConfigMinPerformanceFee = new decimal_js_1.default(globalConfigState.minPerformanceFeeBps.toString());
|
|
@@ -4521,13 +4312,13 @@ class Kamino {
|
|
|
4521
4312
|
return this._orcaService.getWhirlpoolLiquidityDistribution(pool, keepOrder, lowestTick, highestTick);
|
|
4522
4313
|
};
|
|
4523
4314
|
getLiquidityDistribution = async (dex, pool, keepOrder = true, lowestTick, highestTick) => {
|
|
4524
|
-
if (dex
|
|
4315
|
+
if (dex == 'ORCA') {
|
|
4525
4316
|
return this.getLiquidityDistributionOrcaWhirlpool(pool, keepOrder, lowestTick, highestTick);
|
|
4526
4317
|
}
|
|
4527
|
-
else if (dex
|
|
4318
|
+
else if (dex == 'RAYDIUM') {
|
|
4528
4319
|
return this.getLiquidityDistributionRaydiumPool(pool, keepOrder, lowestTick, highestTick);
|
|
4529
4320
|
}
|
|
4530
|
-
else if (dex
|
|
4321
|
+
else if (dex == 'METEORA') {
|
|
4531
4322
|
return this.getLiquidityDistributionMeteoraPool(pool, keepOrder, lowestTick, highestTick);
|
|
4532
4323
|
}
|
|
4533
4324
|
else {
|
|
@@ -4535,13 +4326,13 @@ class Kamino {
|
|
|
4535
4326
|
}
|
|
4536
4327
|
};
|
|
4537
4328
|
getPositionsCountForPool = async (dex, pool) => {
|
|
4538
|
-
if (dex
|
|
4329
|
+
if (dex == 'ORCA') {
|
|
4539
4330
|
return this._orcaService.getPositionsCountByPool(pool);
|
|
4540
4331
|
}
|
|
4541
|
-
else if (dex
|
|
4332
|
+
else if (dex == 'RAYDIUM') {
|
|
4542
4333
|
return this._raydiumService.getPositionsCountByPool(pool);
|
|
4543
4334
|
}
|
|
4544
|
-
else if (dex
|
|
4335
|
+
else if (dex == 'METEORA') {
|
|
4545
4336
|
return this._meteoraService.getPositionsCountByPool(pool);
|
|
4546
4337
|
}
|
|
4547
4338
|
else {
|
|
@@ -4637,8 +4428,8 @@ class Kamino {
|
|
|
4637
4428
|
*/
|
|
4638
4429
|
calculateAmountsDistributionWithPriceRange = async (dex, pool, lowerPrice, upperPrice) => {
|
|
4639
4430
|
const tokenAAmountToDeposit = new decimal_js_1.default(100.0);
|
|
4640
|
-
if (dex
|
|
4641
|
-
const poolState = await
|
|
4431
|
+
if (dex == 'RAYDIUM') {
|
|
4432
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, pool, this._raydiumService.getRaydiumProgramId());
|
|
4642
4433
|
if (!poolState) {
|
|
4643
4434
|
throw new Error(`Raydium poolState ${pool.toString()} is not found`);
|
|
4644
4435
|
}
|
|
@@ -4649,23 +4440,23 @@ class Kamino {
|
|
|
4649
4440
|
const amountBDecimal = new decimal_js_1.default(amountB.toString());
|
|
4650
4441
|
return [(0, utils_1.lamportsToNumberDecimal)(amountADecimal, decimalsA), (0, utils_1.lamportsToNumberDecimal)(amountBDecimal, decimalsB)];
|
|
4651
4442
|
}
|
|
4652
|
-
else if (dex
|
|
4653
|
-
const whirlpoolState = await
|
|
4443
|
+
else if (dex == 'ORCA') {
|
|
4444
|
+
const whirlpoolState = await whirlpools_client_1.Whirlpool.fetch(this._connection, pool, this._orcaService.getWhirlpoolProgramId());
|
|
4654
4445
|
if (!whirlpoolState) {
|
|
4655
4446
|
throw new Error(`Raydium poolState ${pool.toString()} is not found`);
|
|
4656
4447
|
}
|
|
4657
4448
|
const tokenMintA = whirlpoolState.tokenMintA;
|
|
4658
4449
|
const tokenMintB = whirlpoolState.tokenMintB;
|
|
4659
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
4660
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
4450
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, tokenMintA);
|
|
4451
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, tokenMintB);
|
|
4661
4452
|
const tickLowerIndex = (0, whirlpool_sdk_1.getNearestValidTickIndexFromTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(lowerPrice, decimalsA, decimalsB), whirlpoolState.tickSpacing);
|
|
4662
4453
|
const tickUpperIndex = (0, whirlpool_sdk_1.getNearestValidTickIndexFromTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(upperPrice, decimalsA, decimalsB), whirlpoolState.tickSpacing);
|
|
4663
4454
|
const params = {
|
|
4664
|
-
tokenMintA
|
|
4665
|
-
tokenMintB
|
|
4455
|
+
tokenMintA,
|
|
4456
|
+
tokenMintB,
|
|
4666
4457
|
tickCurrentIndex: whirlpoolState.tickCurrentIndex,
|
|
4667
4458
|
sqrtPrice: whirlpoolState.sqrtPrice,
|
|
4668
|
-
inputTokenMint:
|
|
4459
|
+
inputTokenMint: tokenMintA,
|
|
4669
4460
|
inputTokenAmount: new bn_js_1.default((0, utils_1.collToLamportsDecimal)(tokenAAmountToDeposit, decimalsA).toString()),
|
|
4670
4461
|
tickLowerIndex,
|
|
4671
4462
|
tickUpperIndex,
|
|
@@ -4677,8 +4468,8 @@ class Kamino {
|
|
|
4677
4468
|
(0, utils_1.lamportsToNumberDecimal)(addLiqResult.estTokenB.toNumber(), decimalsB),
|
|
4678
4469
|
];
|
|
4679
4470
|
}
|
|
4680
|
-
else if (dex
|
|
4681
|
-
const poolState = await
|
|
4471
|
+
else if (dex == 'METEORA') {
|
|
4472
|
+
const poolState = await accounts_2.LbPair.fetch(this._connection, pool, this._meteoraService.getMeteoraProgramId());
|
|
4682
4473
|
if (!poolState) {
|
|
4683
4474
|
throw new Error(`Meteora poolState ${pool.toString()} is not found`);
|
|
4684
4475
|
}
|
|
@@ -4694,7 +4485,7 @@ class Kamino {
|
|
|
4694
4485
|
};
|
|
4695
4486
|
calculateAmountsToBeDeposited = async (strategy, tokenAAmount, tokenBAmount, profiledFunctionExecution = utils_1.noopProfiledFunctionExecution) => {
|
|
4696
4487
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4697
|
-
if (strategyState.shareCalculationMethod === deposit_method_1.
|
|
4488
|
+
if (strategyState.shareCalculationMethod === deposit_method_1.DOLAR_BASED) {
|
|
4698
4489
|
return this.calculateDepostAmountsDollarBased(strategy, tokenAAmount, tokenBAmount);
|
|
4699
4490
|
}
|
|
4700
4491
|
else if (strategyState.shareCalculationMethod === deposit_method_1.PROPORTION_BASED) {
|
|
@@ -4707,7 +4498,7 @@ class Kamino {
|
|
|
4707
4498
|
/// Returns an amount of tokenA and an amount of tokenB that define the ratio of the amounts that can be deposited
|
|
4708
4499
|
calculateAmountsRatioToBeDeposited = async (strategy, holdings, profiler = utils_1.noopProfiledFunctionExecution) => {
|
|
4709
4500
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
4710
|
-
if (strategyState.shareCalculationMethod === deposit_method_1.
|
|
4501
|
+
if (strategyState.shareCalculationMethod === deposit_method_1.DOLAR_BASED) {
|
|
4711
4502
|
return this.calculateDepostAmountsDollarBased(strategy, new decimal_js_1.default(100), undefined);
|
|
4712
4503
|
}
|
|
4713
4504
|
else if (strategyState.shareCalculationMethod === deposit_method_1.PROPORTION_BASED) {
|
|
@@ -4766,7 +4557,7 @@ class Kamino {
|
|
|
4766
4557
|
const isRaydium = (0, utils_1.dexToNumber)('RAYDIUM') === dex;
|
|
4767
4558
|
const isMeteora = (0, utils_1.dexToNumber)('METEORA') === dex;
|
|
4768
4559
|
if (isOrca) {
|
|
4769
|
-
const whirlpool = await
|
|
4560
|
+
const whirlpool = await whirlpools_client_1.Whirlpool.fetch(this._connection, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
4770
4561
|
if (!whirlpool) {
|
|
4771
4562
|
throw new Error(`Unable to get Orca whirlpool for pubkey ${strategyState.pool}`);
|
|
4772
4563
|
}
|
|
@@ -4794,7 +4585,7 @@ class Kamino {
|
|
|
4794
4585
|
return [new decimal_js_1.default(0), new decimal_js_1.default(0)];
|
|
4795
4586
|
}
|
|
4796
4587
|
// Given A in ATA, calc how much A and B
|
|
4797
|
-
const accessor = new orca_dal_1.OrcaDAL(whirlpoolConfig, this._orcaService.getWhirlpoolProgramId(), this.
|
|
4588
|
+
const accessor = new orca_dal_1.OrcaDAL(whirlpoolConfig, this._orcaService.getWhirlpoolProgramId(), this._connection);
|
|
4798
4589
|
const orcaPosition = new orca_position_1.OrcaPosition(accessor);
|
|
4799
4590
|
const defaultSlippagePercentage = whirlpool_sdk_1.Percentage.fromFraction(1, 1000); // 0.1%
|
|
4800
4591
|
const primaryTokenAmount = tokenAAmount || tokenBAmount;
|
|
@@ -4834,8 +4625,8 @@ class Kamino {
|
|
|
4834
4625
|
if (!tokenAAmount && !tokenBAmount) {
|
|
4835
4626
|
return [new decimal_js_1.default(0), new decimal_js_1.default(0)];
|
|
4836
4627
|
}
|
|
4837
|
-
const poolState = await
|
|
4838
|
-
const position = await
|
|
4628
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
4629
|
+
const position = await raydium_client_1.PersonalPositionState.fetch(this._connection, strategyState.position, this._raydiumService.getRaydiumProgramId());
|
|
4839
4630
|
if (!position) {
|
|
4840
4631
|
throw new Error(`position ${strategyState.position.toString()} is not found`);
|
|
4841
4632
|
}
|
|
@@ -4871,7 +4662,7 @@ class Kamino {
|
|
|
4871
4662
|
if (!tokenAAmount && !tokenBAmount) {
|
|
4872
4663
|
return [new decimal_js_1.default(0), new decimal_js_1.default(0)];
|
|
4873
4664
|
}
|
|
4874
|
-
const poolState = await
|
|
4665
|
+
const poolState = await accounts_2.LbPair.fetch(this._connection, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
4875
4666
|
if (!poolState) {
|
|
4876
4667
|
throw new Error(`poolState ${strategyState.pool.toString()} is not found`);
|
|
4877
4668
|
}
|
|
@@ -4882,8 +4673,8 @@ class Kamino {
|
|
|
4882
4673
|
}
|
|
4883
4674
|
else {
|
|
4884
4675
|
const binArrayIndex = (0, meteora_1.binIdToBinArrayIndex)(new bn_js_1.default(poolState.activeId));
|
|
4885
|
-
const [binArrayPk] =
|
|
4886
|
-
const binArray = await
|
|
4676
|
+
const [binArrayPk] = (0, meteora_1.deriveBinArray)(strategyState.pool, binArrayIndex, this._meteoraService.getMeteoraProgramId());
|
|
4677
|
+
const binArray = await accounts_2.BinArray.fetch(this._connection, binArrayPk, this._meteoraService.getMeteoraProgramId());
|
|
4887
4678
|
if (!binArray) {
|
|
4888
4679
|
throw new Error(`bin array ${binArrayPk.toString()} is not found`);
|
|
4889
4680
|
}
|
|
@@ -4902,8 +4693,8 @@ class Kamino {
|
|
|
4902
4693
|
throw new Error(`bin ${poolState.activeId.toString()} is not found`);
|
|
4903
4694
|
}
|
|
4904
4695
|
if (amountADecimal.eq(utils_1.ZERO) && amountBDecimal.eq(utils_1.ZERO)) {
|
|
4905
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
4906
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
4696
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, strategyState.tokenAMint);
|
|
4697
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, strategyState.tokenBMint);
|
|
4907
4698
|
const poolPrice = (0, meteora_1.getPriceOfBinByBinIdWithDecimals)(poolState.activeId, poolState.binStep, decimalsA, decimalsB);
|
|
4908
4699
|
return [tokenAAmount || tokenBAmount.div(poolPrice), tokenBAmount || tokenAAmount.mul(poolPrice)];
|
|
4909
4700
|
}
|
|
@@ -4971,12 +4762,9 @@ class Kamino {
|
|
|
4971
4762
|
* @param owner
|
|
4972
4763
|
*/
|
|
4973
4764
|
async getUserTermsSignatureState(owner) {
|
|
4974
|
-
const pdaSeed = [Buffer.from('signature'),
|
|
4975
|
-
const [signatureStateKey, _signatureStateBump] =
|
|
4976
|
-
|
|
4977
|
-
programAddress: this.getProgramID(),
|
|
4978
|
-
});
|
|
4979
|
-
return await accounts_1.TermsSignature.fetch(this._rpc, signatureStateKey, this.getProgramID());
|
|
4765
|
+
const pdaSeed = [Buffer.from('signature'), owner.toBuffer()];
|
|
4766
|
+
const [signatureStateKey, _signatureStateBump] = web3_js_1.PublicKey.findProgramAddressSync(pdaSeed, this._kaminoProgramId);
|
|
4767
|
+
return await accounts_1.TermsSignature.fetch(this._connection, signatureStateKey);
|
|
4980
4768
|
}
|
|
4981
4769
|
/**
|
|
4982
4770
|
* Get the instruction to store the on chain owner signature of terms&conditions
|
|
@@ -4984,35 +4772,35 @@ class Kamino {
|
|
|
4984
4772
|
* @param signature
|
|
4985
4773
|
*/
|
|
4986
4774
|
async getUserTermsSignatureIx(owner, signature) {
|
|
4987
|
-
const pdaSeed = [Buffer.from('signature'),
|
|
4988
|
-
const [signatureStateKey] =
|
|
4775
|
+
const pdaSeed = [Buffer.from('signature'), owner.toBuffer()];
|
|
4776
|
+
const [signatureStateKey, _signatureStateBump] = web3_js_1.PublicKey.findProgramAddressSync(pdaSeed, this._kaminoProgramId);
|
|
4989
4777
|
const args = {
|
|
4990
4778
|
signature: Array.from(signature),
|
|
4991
4779
|
};
|
|
4992
4780
|
const accounts = {
|
|
4993
4781
|
owner: owner,
|
|
4994
4782
|
ownerSignatureState: signatureStateKey,
|
|
4995
|
-
systemProgram:
|
|
4996
|
-
rent:
|
|
4783
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
4784
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
4997
4785
|
};
|
|
4998
|
-
return (0, instructions_2.signTerms)(args, accounts
|
|
4786
|
+
return (0, instructions_2.signTerms)(args, accounts);
|
|
4999
4787
|
}
|
|
5000
4788
|
async getDepositRatioFromAOrca(strategy, amountA) {
|
|
5001
4789
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
5002
|
-
const whirlpool = await
|
|
4790
|
+
const whirlpool = await whirlpools_client_1.Whirlpool.fetch(this._connection, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
5003
4791
|
if (!whirlpool) {
|
|
5004
4792
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
5005
4793
|
}
|
|
5006
|
-
const position = await
|
|
4794
|
+
const position = await whirlpools_client_1.Position.fetch(this._connection, strategyState.position, this._orcaService.getWhirlpoolProgramId());
|
|
5007
4795
|
if (!position) {
|
|
5008
4796
|
throw new Error(`Whirlpool position ${strategyState.position} does not exist`);
|
|
5009
4797
|
}
|
|
5010
4798
|
const params = {
|
|
5011
|
-
tokenMintA:
|
|
5012
|
-
tokenMintB:
|
|
4799
|
+
tokenMintA: strategyState.tokenAMint,
|
|
4800
|
+
tokenMintB: strategyState.tokenBMint,
|
|
5013
4801
|
tickCurrentIndex: whirlpool.tickCurrentIndex,
|
|
5014
4802
|
sqrtPrice: whirlpool.sqrtPrice,
|
|
5015
|
-
inputTokenMint:
|
|
4803
|
+
inputTokenMint: strategyState.tokenAMint,
|
|
5016
4804
|
inputTokenAmount: amountA,
|
|
5017
4805
|
tickLowerIndex: position.tickLowerIndex,
|
|
5018
4806
|
tickUpperIndex: position.tickUpperIndex,
|
|
@@ -5023,8 +4811,8 @@ class Kamino {
|
|
|
5023
4811
|
}
|
|
5024
4812
|
async getDepositRatioFromAMeteora(strategy) {
|
|
5025
4813
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
5026
|
-
const poolStatePromise =
|
|
5027
|
-
const positionPromise =
|
|
4814
|
+
const poolStatePromise = accounts_2.LbPair.fetch(this._connection, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
4815
|
+
const positionPromise = accounts_2.PositionV2.fetch(this._connection, strategyState.position, this._meteoraService.getMeteoraProgramId());
|
|
5028
4816
|
const [poolState, _position] = await Promise.all([poolStatePromise, positionPromise]);
|
|
5029
4817
|
if (!poolState) {
|
|
5030
4818
|
throw Error(`Could not fetch lb pair state with pubkey ${strategyState.pool.toString()}`);
|
|
@@ -5034,8 +4822,8 @@ class Kamino {
|
|
|
5034
4822
|
async getDepositRatioFromBMeteora(strategy) {
|
|
5035
4823
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
5036
4824
|
const [poolState, _position] = await Promise.all([
|
|
5037
|
-
|
|
5038
|
-
|
|
4825
|
+
accounts_2.LbPair.fetch(this._connection, strategyState.pool, this._meteoraService.getMeteoraProgramId()),
|
|
4826
|
+
accounts_2.PositionV2.fetch(this._connection, strategyState.position, this._meteoraService.getMeteoraProgramId()),
|
|
5039
4827
|
]);
|
|
5040
4828
|
if (!poolState) {
|
|
5041
4829
|
throw Error(`Could not fetch lb pair state with pubkey ${strategyState.pool.toString()}`);
|
|
@@ -5044,20 +4832,20 @@ class Kamino {
|
|
|
5044
4832
|
}
|
|
5045
4833
|
getDepositRatioFromBOrca = async (strategy, amountB) => {
|
|
5046
4834
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
5047
|
-
const whirlpool = await
|
|
4835
|
+
const whirlpool = await whirlpools_client_1.Whirlpool.fetch(this._connection, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
5048
4836
|
if (!whirlpool) {
|
|
5049
4837
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
5050
4838
|
}
|
|
5051
|
-
const position = await
|
|
4839
|
+
const position = await whirlpools_client_1.Position.fetch(this._connection, strategyState.position, this._orcaService.getWhirlpoolProgramId());
|
|
5052
4840
|
if (!position) {
|
|
5053
4841
|
throw new Error(`Whirlpool position ${strategyState.position} does not exist`);
|
|
5054
4842
|
}
|
|
5055
4843
|
const params = {
|
|
5056
|
-
tokenMintA:
|
|
5057
|
-
tokenMintB:
|
|
4844
|
+
tokenMintA: strategyState.tokenAMint,
|
|
4845
|
+
tokenMintB: strategyState.tokenBMint,
|
|
5058
4846
|
tickCurrentIndex: whirlpool.tickCurrentIndex,
|
|
5059
4847
|
sqrtPrice: whirlpool.sqrtPrice,
|
|
5060
|
-
inputTokenMint:
|
|
4848
|
+
inputTokenMint: strategyState.tokenBMint,
|
|
5061
4849
|
inputTokenAmount: amountB,
|
|
5062
4850
|
tickLowerIndex: position.tickLowerIndex,
|
|
5063
4851
|
tickUpperIndex: position.tickUpperIndex,
|
|
@@ -5068,8 +4856,8 @@ class Kamino {
|
|
|
5068
4856
|
};
|
|
5069
4857
|
getDepositRatioFromARaydium = async (strategy, amountA) => {
|
|
5070
4858
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
5071
|
-
const poolState = await
|
|
5072
|
-
const positionState = await
|
|
4859
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
4860
|
+
const positionState = await raydium_client_1.PersonalPositionState.fetch(this._connection, strategyState.position, this._raydiumService.getRaydiumProgramId());
|
|
5073
4861
|
if (!positionState) {
|
|
5074
4862
|
throw new Error(`Raydium position ${strategyState.position.toString()} could not be found.`);
|
|
5075
4863
|
}
|
|
@@ -5084,8 +4872,8 @@ class Kamino {
|
|
|
5084
4872
|
};
|
|
5085
4873
|
getDepositRatioFromBRaydium = async (strategy, amountB) => {
|
|
5086
4874
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
5087
|
-
const poolState = await
|
|
5088
|
-
const positionState = await
|
|
4875
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
4876
|
+
const positionState = await raydium_client_1.PersonalPositionState.fetch(this._connection, strategyState.position, this._raydiumService.getRaydiumProgramId());
|
|
5089
4877
|
if (!positionState) {
|
|
5090
4878
|
throw new Error(`Raydium position ${strategyState.position.toString()} could not be found.`);
|
|
5091
4879
|
}
|
|
@@ -5099,20 +4887,20 @@ class Kamino {
|
|
|
5099
4887
|
return amountsSlippage;
|
|
5100
4888
|
};
|
|
5101
4889
|
getCollateralInfo = async (address) => {
|
|
5102
|
-
const collateralInfos = await accounts_1.CollateralInfos.fetch(this.
|
|
4890
|
+
const collateralInfos = await accounts_1.CollateralInfos.fetch(this._connection, address, this._kaminoProgramId);
|
|
5103
4891
|
if (collateralInfos === null) {
|
|
5104
4892
|
throw new Error('Could not fetch CollateralInfos');
|
|
5105
4893
|
}
|
|
5106
4894
|
return collateralInfos.infos;
|
|
5107
4895
|
};
|
|
5108
4896
|
getGlobalConfigState = async (address) => {
|
|
5109
|
-
return await accounts_1.GlobalConfig.fetch(this.
|
|
4897
|
+
return await accounts_1.GlobalConfig.fetch(this._connection, address, this._kaminoProgramId);
|
|
5110
4898
|
};
|
|
5111
4899
|
getWhirlpoolStrategy = async (address) => {
|
|
5112
|
-
return await accounts_1.WhirlpoolStrategy.fetch(this.
|
|
4900
|
+
return await accounts_1.WhirlpoolStrategy.fetch(this._connection, address, this._kaminoProgramId);
|
|
5113
4901
|
};
|
|
5114
4902
|
getWhirlpoolStrategies = async (addresses) => {
|
|
5115
|
-
return await accounts_1.WhirlpoolStrategy.fetchMultiple(this.
|
|
4903
|
+
return await accounts_1.WhirlpoolStrategy.fetchMultiple(this._connection, addresses, this._kaminoProgramId);
|
|
5116
4904
|
};
|
|
5117
4905
|
getStrategyVaultBalances = async (strategy) => {
|
|
5118
4906
|
const { strategy: strategyState } = await this.getStrategyStateIfNotFetched(strategy);
|
|
@@ -5125,18 +4913,18 @@ class Kamino {
|
|
|
5125
4913
|
return { aVault, bVault };
|
|
5126
4914
|
};
|
|
5127
4915
|
getUpdateStrategyParamsIxs = async (strategyAdmin, strategy, rebalanceType, withdrawFeeBps, performanceFeeBps) => {
|
|
5128
|
-
const updateRebalanceTypeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateRebalanceType(), rebalanceType
|
|
4916
|
+
const updateRebalanceTypeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateRebalanceType(), rebalanceType);
|
|
5129
4917
|
let updateWithdrawalFeeIx = null;
|
|
5130
4918
|
if (withdrawFeeBps) {
|
|
5131
|
-
updateWithdrawalFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateWithdrawFee(), withdrawFeeBps
|
|
4919
|
+
updateWithdrawalFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateWithdrawFee(), withdrawFeeBps);
|
|
5132
4920
|
}
|
|
5133
4921
|
if (!performanceFeeBps) {
|
|
5134
4922
|
performanceFeeBps = DefaultStrategyConfig_1.DefaultPerformanceFeeBps;
|
|
5135
4923
|
}
|
|
5136
|
-
const updateFeesFeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateCollectFeesFee(), performanceFeeBps
|
|
5137
|
-
const updateRewards0FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward0Fee(), performanceFeeBps
|
|
5138
|
-
const updateRewards1FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward1Fee(), performanceFeeBps
|
|
5139
|
-
const updateRewards2FeeIx = await (0, utils_1.getUpdateStrategyConfigIx)(strategyAdmin, this._globalConfig, strategy, new StrategyConfigOption_1.UpdateReward2Fee(), performanceFeeBps
|
|
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);
|
|
5140
4928
|
const ixs = [updateRebalanceTypeIx, updateFeesFeeIx, updateRewards0FeeIx, updateRewards1FeeIx, updateRewards2FeeIx];
|
|
5141
4929
|
if (updateWithdrawalFeeIx) {
|
|
5142
4930
|
ixs.push(updateWithdrawalFeeIx);
|
|
@@ -5155,18 +4943,18 @@ class Kamino {
|
|
|
5155
4943
|
}
|
|
5156
4944
|
const collateralInfos = await this.getCollateralInfo(globalConfig.tokenInfos);
|
|
5157
4945
|
const result = [];
|
|
5158
|
-
if (strategyState.strategyDex.toNumber()
|
|
5159
|
-
const whirlpool = await
|
|
4946
|
+
if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('ORCA')) {
|
|
4947
|
+
const whirlpool = await whirlpools_client_1.Whirlpool.fetch(this._connection, strategyState.pool, this._orcaService.getWhirlpoolProgramId());
|
|
5160
4948
|
if (!whirlpool) {
|
|
5161
4949
|
throw Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
5162
4950
|
}
|
|
5163
4951
|
for (let i = 0; i < 3; i++) {
|
|
5164
|
-
if (whirlpool.rewardInfos[i].mint
|
|
4952
|
+
if (!whirlpool.rewardInfos[i].mint.equals(web3_js_1.PublicKey.default)) {
|
|
5165
4953
|
const collateralId = this.getCollateralIdFromMint(whirlpool.rewardInfos[i].mint, collateralInfos);
|
|
5166
|
-
if (collateralId
|
|
4954
|
+
if (collateralId == -1) {
|
|
5167
4955
|
throw Error(`Could not find collateral id for mint ${whirlpool.rewardInfos[i].mint.toString()}`);
|
|
5168
4956
|
}
|
|
5169
|
-
const rewardVault =
|
|
4957
|
+
const rewardVault = web3_js_1.Keypair.generate();
|
|
5170
4958
|
const args = {
|
|
5171
4959
|
rewardIndex: i,
|
|
5172
4960
|
collateralToken: collateralId,
|
|
@@ -5178,31 +4966,31 @@ class Kamino {
|
|
|
5178
4966
|
strategy: strategyWithAddress.address,
|
|
5179
4967
|
pool: strategyState.pool,
|
|
5180
4968
|
rewardMint: whirlpool.rewardInfos[i].mint,
|
|
5181
|
-
rewardVault: rewardVault,
|
|
4969
|
+
rewardVault: rewardVault.publicKey,
|
|
5182
4970
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
5183
|
-
systemProgram:
|
|
5184
|
-
rent:
|
|
4971
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
4972
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
5185
4973
|
tokenProgram,
|
|
5186
4974
|
tokenInfos: globalConfig.tokenInfos,
|
|
5187
4975
|
};
|
|
5188
|
-
const ix = (0,
|
|
4976
|
+
const ix = (0, instructions_1.updateRewardMapping)(args, accounts);
|
|
5189
4977
|
result.push([ix, rewardVault]);
|
|
5190
4978
|
}
|
|
5191
4979
|
}
|
|
5192
4980
|
return result;
|
|
5193
4981
|
}
|
|
5194
|
-
else if (strategyState.strategyDex.toNumber()
|
|
5195
|
-
const poolState = await
|
|
4982
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('RAYDIUM')) {
|
|
4983
|
+
const poolState = await raydium_client_1.PoolState.fetch(this._connection, strategyState.pool, this._raydiumService.getRaydiumProgramId());
|
|
5196
4984
|
if (!poolState) {
|
|
5197
4985
|
throw new Error(`Could not fetch whirlpool state with pubkey ${strategyState.pool.toString()}`);
|
|
5198
4986
|
}
|
|
5199
4987
|
for (let i = 0; i < 3; i++) {
|
|
5200
|
-
if (poolState.rewardInfos[i].tokenMint
|
|
4988
|
+
if (!poolState.rewardInfos[i].tokenMint.equals(web3_js_1.PublicKey.default)) {
|
|
5201
4989
|
const collateralId = this.getCollateralIdFromMint(poolState.rewardInfos[i].tokenMint, collateralInfos);
|
|
5202
|
-
if (collateralId
|
|
4990
|
+
if (collateralId == -1) {
|
|
5203
4991
|
throw Error(`Could not find collateral id for mint ${poolState.rewardInfos[i].tokenMint.toString()}`);
|
|
5204
4992
|
}
|
|
5205
|
-
const rewardVault =
|
|
4993
|
+
const rewardVault = web3_js_1.Keypair.generate();
|
|
5206
4994
|
const args = {
|
|
5207
4995
|
rewardIndex: i,
|
|
5208
4996
|
collateralToken: collateralId,
|
|
@@ -5214,31 +5002,31 @@ class Kamino {
|
|
|
5214
5002
|
strategy: strategyWithAddress.address,
|
|
5215
5003
|
pool: strategyState.pool,
|
|
5216
5004
|
rewardMint: poolState.rewardInfos[i].tokenMint,
|
|
5217
|
-
rewardVault: rewardVault,
|
|
5005
|
+
rewardVault: rewardVault.publicKey,
|
|
5218
5006
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
5219
|
-
systemProgram:
|
|
5220
|
-
rent:
|
|
5007
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5008
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
5221
5009
|
tokenProgram,
|
|
5222
5010
|
tokenInfos: globalConfig.tokenInfos,
|
|
5223
5011
|
};
|
|
5224
|
-
const ix = (0,
|
|
5012
|
+
const ix = (0, instructions_1.updateRewardMapping)(args, accounts);
|
|
5225
5013
|
result.push([ix, rewardVault]);
|
|
5226
5014
|
}
|
|
5227
5015
|
}
|
|
5228
5016
|
return result;
|
|
5229
5017
|
}
|
|
5230
|
-
else if (strategyState.strategyDex.toNumber()
|
|
5231
|
-
const poolState = await
|
|
5018
|
+
else if (strategyState.strategyDex.toNumber() == (0, utils_1.dexToNumber)('METEORA')) {
|
|
5019
|
+
const poolState = await accounts_2.LbPair.fetch(this._connection, strategyState.pool, this._meteoraService.getMeteoraProgramId());
|
|
5232
5020
|
if (!poolState) {
|
|
5233
5021
|
throw new Error(`Could not fetch meteora state with pubkey ${strategyState.pool.toString()}`);
|
|
5234
5022
|
}
|
|
5235
5023
|
for (let i = 0; i < 2; i++) {
|
|
5236
|
-
if (poolState.rewardInfos[i].mint
|
|
5024
|
+
if (!poolState.rewardInfos[i].mint.equals(web3_js_1.PublicKey.default)) {
|
|
5237
5025
|
const collateralId = this.getCollateralIdFromMint(poolState.rewardInfos[i].mint, collateralInfos);
|
|
5238
|
-
if (collateralId
|
|
5026
|
+
if (collateralId == -1) {
|
|
5239
5027
|
throw Error(`Could not find collateral id for mint ${poolState.rewardInfos[i].mint.toString()}`);
|
|
5240
5028
|
}
|
|
5241
|
-
const rewardVault =
|
|
5029
|
+
const rewardVault = web3_js_1.Keypair.generate();
|
|
5242
5030
|
const args = {
|
|
5243
5031
|
rewardIndex: i,
|
|
5244
5032
|
collateralToken: collateralId,
|
|
@@ -5250,14 +5038,14 @@ class Kamino {
|
|
|
5250
5038
|
strategy: strategyWithAddress.address,
|
|
5251
5039
|
pool: strategyState.pool,
|
|
5252
5040
|
rewardMint: poolState.rewardInfos[i].mint,
|
|
5253
|
-
rewardVault: rewardVault,
|
|
5041
|
+
rewardVault: rewardVault.publicKey,
|
|
5254
5042
|
baseVaultAuthority: strategyState.baseVaultAuthority,
|
|
5255
|
-
systemProgram:
|
|
5256
|
-
rent:
|
|
5043
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5044
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
5257
5045
|
tokenProgram,
|
|
5258
5046
|
tokenInfos: globalConfig.tokenInfos,
|
|
5259
5047
|
};
|
|
5260
|
-
const ix = (0,
|
|
5048
|
+
const ix = (0, instructions_1.updateRewardMapping)(args, accounts);
|
|
5261
5049
|
result.push([ix, rewardVault]);
|
|
5262
5050
|
}
|
|
5263
5051
|
}
|
|
@@ -5276,12 +5064,12 @@ class Kamino {
|
|
|
5276
5064
|
*/
|
|
5277
5065
|
initializeTickForOrcaPool = async (payer, pool, price) => {
|
|
5278
5066
|
const { address: poolAddress, whirlpool: whilrpoolState } = await this.getWhirlpoolStateIfNotFetched(pool);
|
|
5279
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
5280
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
5067
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, whilrpoolState.tokenMintA);
|
|
5068
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, whilrpoolState.tokenMintB);
|
|
5281
5069
|
const tickIndex = (0, whirlpool_sdk_1.getNextValidTickIndex)((0, whirlpool_sdk_1.priceToTickIndex)(price, decimalsA, decimalsB), whilrpoolState.tickSpacing);
|
|
5282
5070
|
const startTickIndex = (0, whirlpool_sdk_1.getStartTickIndex)(tickIndex, whilrpoolState.tickSpacing);
|
|
5283
|
-
const [startTickIndexPk, _startTickIndexBump] =
|
|
5284
|
-
const tick = await
|
|
5071
|
+
const [startTickIndexPk, _startTickIndexBump] = (0, utils_1.getTickArray)(this._orcaService.getWhirlpoolProgramId(), poolAddress, startTickIndex);
|
|
5072
|
+
const tick = await whirlpools_client_1.TickArray.fetch(this._connection, startTickIndexPk, this._orcaService.getWhirlpoolProgramId());
|
|
5285
5073
|
// initialize tick if it doesn't exist
|
|
5286
5074
|
if (!tick) {
|
|
5287
5075
|
const initTickArrayArgs = {
|
|
@@ -5291,11 +5079,11 @@ class Kamino {
|
|
|
5291
5079
|
whirlpool: poolAddress,
|
|
5292
5080
|
funder: payer,
|
|
5293
5081
|
tickArray: startTickIndexPk,
|
|
5294
|
-
systemProgram:
|
|
5082
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5295
5083
|
};
|
|
5296
5084
|
return {
|
|
5297
5085
|
tick: startTickIndexPk,
|
|
5298
|
-
initTickIx: (0,
|
|
5086
|
+
initTickIx: (0, whirlpools_client_1.initializeTickArray)(initTickArrayArgs, initTickArrayAccounts),
|
|
5299
5087
|
};
|
|
5300
5088
|
}
|
|
5301
5089
|
return {
|
|
@@ -5305,12 +5093,12 @@ class Kamino {
|
|
|
5305
5093
|
};
|
|
5306
5094
|
initializeTickForMeteoraPool = async (payer, pool, price) => {
|
|
5307
5095
|
const { address: poolAddress, pool: poolState } = await this.getMeteoraStateIfNotFetched(pool);
|
|
5308
|
-
const decimalsA = await (0, utils_1.getMintDecimals)(this.
|
|
5309
|
-
const decimalsB = await (0, utils_1.getMintDecimals)(this.
|
|
5096
|
+
const decimalsA = await (0, utils_1.getMintDecimals)(this._connection, poolState.tokenXMint);
|
|
5097
|
+
const decimalsB = await (0, utils_1.getMintDecimals)(this._connection, poolState.tokenYMint);
|
|
5310
5098
|
const binArray = (0, meteora_1.getBinIdFromPriceWithDecimals)(price, poolState.binStep, true, decimalsA, decimalsB);
|
|
5311
5099
|
const binArrayIndex = (0, meteora_1.binIdToBinArrayIndex)(new bn_js_1.default(binArray));
|
|
5312
|
-
const [startTickIndexPk] =
|
|
5313
|
-
const tick = await
|
|
5100
|
+
const [startTickIndexPk, _startTickIndexBump] = (0, meteora_1.deriveBinArray)(poolAddress, binArrayIndex, this._meteoraService.getMeteoraProgramId());
|
|
5101
|
+
const tick = await whirlpools_client_1.TickArray.fetch(this._connection, startTickIndexPk, this._meteoraService.getMeteoraProgramId());
|
|
5314
5102
|
// initialize tick if it doesn't exist
|
|
5315
5103
|
if (!tick) {
|
|
5316
5104
|
const initTickArrayArgs = {
|
|
@@ -5319,7 +5107,7 @@ class Kamino {
|
|
|
5319
5107
|
const initTickArrayAccounts = {
|
|
5320
5108
|
funder: payer,
|
|
5321
5109
|
binArray: startTickIndexPk,
|
|
5322
|
-
systemProgram:
|
|
5110
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5323
5111
|
lbPair: poolAddress,
|
|
5324
5112
|
};
|
|
5325
5113
|
return {
|
|
@@ -5332,20 +5120,6 @@ class Kamino {
|
|
|
5332
5120
|
initTickIx: undefined,
|
|
5333
5121
|
};
|
|
5334
5122
|
};
|
|
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
|
-
}
|
|
5349
5123
|
}
|
|
5350
5124
|
exports.Kamino = Kamino;
|
|
5351
5125
|
exports.default = Kamino;
|