@kamino-finance/kliquidity-sdk 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +462 -0
- package/dist/Kamino.d.ts +962 -0
- package/dist/Kamino.js +5116 -0
- package/dist/Kamino.js.map +1 -0
- package/dist/constants/DefaultStrategyConfig.d.ts +6 -0
- package/dist/constants/DefaultStrategyConfig.js +13 -0
- package/dist/constants/DefaultStrategyConfig.js.map +1 -0
- package/dist/constants/deposit_method.d.ts +2 -0
- package/dist/constants/deposit_method.js +6 -0
- package/dist/constants/deposit_method.js.map +1 -0
- package/dist/constants/frontend.d.ts +1 -0
- package/dist/constants/frontend.js +5 -0
- package/dist/constants/frontend.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.js +20 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/metadata.d.ts +3 -0
- package/dist/constants/metadata.js +7 -0
- package/dist/constants/metadata.js.map +1 -0
- package/dist/constants/numericalValues.d.ts +1 -0
- package/dist/constants/numericalValues.js +5 -0
- package/dist/constants/numericalValues.js.map +1 -0
- package/dist/constants/pubkeys.d.ts +10 -0
- package/dist/constants/pubkeys.js +14 -0
- package/dist/constants/pubkeys.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/kamino-client/accounts/CollateralInfos.d.ts +19 -0
- package/dist/kamino-client/accounts/CollateralInfos.js +96 -0
- package/dist/kamino-client/accounts/CollateralInfos.js.map +1 -0
- package/dist/kamino-client/accounts/GlobalConfig.d.ts +88 -0
- package/dist/kamino-client/accounts/GlobalConfig.js +218 -0
- package/dist/kamino-client/accounts/GlobalConfig.js.map +1 -0
- package/dist/kamino-client/accounts/PersonalPositionState.d.ts +83 -0
- package/dist/kamino-client/accounts/PersonalPositionState.js +156 -0
- package/dist/kamino-client/accounts/PersonalPositionState.js.map +1 -0
- package/dist/kamino-client/accounts/PoolState.d.ts +212 -0
- package/dist/kamino-client/accounts/PoolState.js +281 -0
- package/dist/kamino-client/accounts/PoolState.js.map +1 -0
- package/dist/kamino-client/accounts/Position.d.ts +47 -0
- package/dist/kamino-client/accounts/Position.js +146 -0
- package/dist/kamino-client/accounts/Position.js.map +1 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.d.ts +79 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.js +150 -0
- package/dist/kamino-client/accounts/ProtocolPositionState.js.map +1 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.d.ts +18 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.js +95 -0
- package/dist/kamino-client/accounts/ScopeChainAccount.js.map +1 -0
- package/dist/kamino-client/accounts/TermsSignature.d.ts +18 -0
- package/dist/kamino-client/accounts/TermsSignature.js +95 -0
- package/dist/kamino-client/accounts/TermsSignature.js.map +1 -0
- package/dist/kamino-client/accounts/Whirlpool.d.ts +75 -0
- package/dist/kamino-client/accounts/Whirlpool.js +192 -0
- package/dist/kamino-client/accounts/Whirlpool.js.map +1 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.d.ts +317 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.js +596 -0
- package/dist/kamino-client/accounts/WhirlpoolStrategy.js.map +1 -0
- package/dist/kamino-client/accounts/index.d.ts +20 -0
- package/dist/kamino-client/accounts/index.js +24 -0
- package/dist/kamino-client/accounts/index.js.map +1 -0
- package/dist/kamino-client/errors/anchor.d.ts +434 -0
- package/dist/kamino-client/errors/anchor.js +713 -0
- package/dist/kamino-client/errors/anchor.js.map +1 -0
- package/dist/kamino-client/errors/custom.d.ts +1258 -0
- package/dist/kamino-client/errors/custom.js +2054 -0
- package/dist/kamino-client/errors/custom.js.map +1 -0
- package/dist/kamino-client/errors/index.d.ts +5 -0
- package/dist/kamino-client/errors/index.js +70 -0
- package/dist/kamino-client/errors/index.js.map +1 -0
- package/dist/kamino-client/idl.json +7186 -0
- package/dist/kamino-client/instructions/addKaminoRewards.d.ts +17 -0
- package/dist/kamino-client/instructions/addKaminoRewards.js +55 -0
- package/dist/kamino-client/instructions/addKaminoRewards.js.map +1 -0
- package/dist/kamino-client/instructions/changePool.d.ts +12 -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 +13 -0
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.js +51 -0
- package/dist/kamino-client/instructions/checkExpectedVaultsBalances.js.map +1 -0
- package/dist/kamino-client/instructions/closeProgramAccount.d.ts +9 -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 +49 -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 +43 -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 +33 -0
- package/dist/kamino-client/instructions/deposit.js +79 -0
- package/dist/kamino-client/instructions/deposit.js.map +1 -0
- package/dist/kamino-client/instructions/depositAndInvest.d.ts +42 -0
- package/dist/kamino-client/instructions/depositAndInvest.js +95 -0
- package/dist/kamino-client/instructions/depositAndInvest.js.map +1 -0
- package/dist/kamino-client/instructions/emergencySwap.d.ts +35 -0
- package/dist/kamino-client/instructions/emergencySwap.js +70 -0
- package/dist/kamino-client/instructions/emergencySwap.js.map +1 -0
- package/dist/kamino-client/instructions/executiveWithdraw.d.ts +33 -0
- package/dist/kamino-client/instructions/executiveWithdraw.js +77 -0
- package/dist/kamino-client/instructions/executiveWithdraw.js.map +1 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.d.ts +40 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.js +83 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsEnd.js.map +1 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.d.ts +41 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.js +80 -0
- package/dist/kamino-client/instructions/flashSwapUnevenVaultsStart.js.map +1 -0
- package/dist/kamino-client/instructions/index.d.ts +72 -0
- package/dist/kamino-client/instructions/index.js +76 -0
- package/dist/kamino-client/instructions/index.js.map +1 -0
- package/dist/kamino-client/instructions/initializeCollateralInfo.d.ts +8 -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 +7 -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 +20 -0
- package/dist/kamino-client/instructions/initializeKaminoReward.js +58 -0
- package/dist/kamino-client/instructions/initializeKaminoReward.js.map +1 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.d.ts +19 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.js +63 -0
- package/dist/kamino-client/instructions/initializeSharesMetadata.js.map +1 -0
- package/dist/kamino-client/instructions/initializeStrategy.d.ts +29 -0
- package/dist/kamino-client/instructions/initializeStrategy.js +67 -0
- package/dist/kamino-client/instructions/initializeStrategy.js.map +1 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.d.ts +14 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.js +52 -0
- package/dist/kamino-client/instructions/insertCollateralInfo.js.map +1 -0
- package/dist/kamino-client/instructions/invest.d.ts +30 -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 +46 -0
- package/dist/kamino-client/instructions/openLiquidityPosition.js +117 -0
- package/dist/kamino-client/instructions/openLiquidityPosition.js.map +1 -0
- package/dist/kamino-client/instructions/orcaSwap.d.ts +30 -0
- package/dist/kamino-client/instructions/orcaSwap.js +71 -0
- package/dist/kamino-client/instructions/orcaSwap.js.map +1 -0
- package/dist/kamino-client/instructions/permisionlessWithdrawFromTreasury.d.ts +11 -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 +12 -0
- package/dist/kamino-client/instructions/signTerms.js +48 -0
- package/dist/kamino-client/instructions/signTerms.js.map +1 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.d.ts +42 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.js +95 -0
- package/dist/kamino-client/instructions/singleTokenDepositAndInvestWithMin.js.map +1 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.d.ts +33 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.js +79 -0
- package/dist/kamino-client/instructions/singleTokenDepositWithMin.js.map +1 -0
- package/dist/kamino-client/instructions/swapRewards.d.ts +37 -0
- package/dist/kamino-client/instructions/swapRewards.js +98 -0
- package/dist/kamino-client/instructions/swapRewards.js.map +1 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.d.ts +42 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.js +82 -0
- package/dist/kamino-client/instructions/swapUnevenVaults.js.map +1 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.d.ts +14 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.js +53 -0
- package/dist/kamino-client/instructions/updateCollateralInfo.js.map +1 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.d.ts +13 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.js +53 -0
- package/dist/kamino-client/instructions/updateGlobalConfig.js.map +1 -0
- package/dist/kamino-client/instructions/updateRewardMapping.d.ts +20 -0
- package/dist/kamino-client/instructions/updateRewardMapping.js +59 -0
- package/dist/kamino-client/instructions/updateRewardMapping.js.map +1 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.d.ts +17 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.js +61 -0
- package/dist/kamino-client/instructions/updateSharesMetadata.js.map +1 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.d.ts +14 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.js +53 -0
- package/dist/kamino-client/instructions/updateStrategyConfig.js.map +1 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.d.ts +17 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.js +57 -0
- package/dist/kamino-client/instructions/updateTreasuryFeeVault.js.map +1 -0
- package/dist/kamino-client/instructions/withdraw.d.ts +38 -0
- package/dist/kamino-client/instructions/withdraw.js +89 -0
- package/dist/kamino-client/instructions/withdraw.js.map +1 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.d.ts +12 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.js +47 -0
- package/dist/kamino-client/instructions/withdrawFromTopup.js.map +1 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.d.ts +18 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.js +57 -0
- package/dist/kamino-client/instructions/withdrawFromTreasury.js.map +1 -0
- package/dist/kamino-client/programId.d.ts +4 -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 +31 -0
- package/dist/kamino-client/types/BalanceStatus.js +102 -0
- package/dist/kamino-client/types/BalanceStatus.js.map +1 -0
- package/dist/kamino-client/types/BinAddLiquidityStrategy.d.ts +76 -0
- package/dist/kamino-client/types/BinAddLiquidityStrategy.js +162 -0
- package/dist/kamino-client/types/BinAddLiquidityStrategy.js.map +1 -0
- package/dist/kamino-client/types/CollateralInfo.d.ts +93 -0
- package/dist/kamino-client/types/CollateralInfo.js +152 -0
- package/dist/kamino-client/types/CollateralInfo.js.map +1 -0
- package/dist/kamino-client/types/CollateralInfoParams.d.ts +83 -0
- package/dist/kamino-client/types/CollateralInfoParams.js +140 -0
- package/dist/kamino-client/types/CollateralInfoParams.js.map +1 -0
- package/dist/kamino-client/types/CollateralTestToken.d.ts +369 -0
- package/dist/kamino-client/types/CollateralTestToken.js +778 -0
- package/dist/kamino-client/types/CollateralTestToken.js.map +1 -0
- package/dist/kamino-client/types/CreationStatus.d.ts +70 -0
- package/dist/kamino-client/types/CreationStatus.js +180 -0
- package/dist/kamino-client/types/CreationStatus.js.map +1 -0
- package/dist/kamino-client/types/DEX.d.ts +44 -0
- package/dist/kamino-client/types/DEX.js +128 -0
- package/dist/kamino-client/types/DEX.js.map +1 -0
- package/dist/kamino-client/types/DexSpecificPrice.d.ts +46 -0
- package/dist/kamino-client/types/DexSpecificPrice.js +116 -0
- package/dist/kamino-client/types/DexSpecificPrice.js.map +1 -0
- package/dist/kamino-client/types/DriftDirection.d.ts +31 -0
- package/dist/kamino-client/types/DriftDirection.js +102 -0
- package/dist/kamino-client/types/DriftDirection.js.map +1 -0
- package/dist/kamino-client/types/ExecutiveWithdrawAction.d.ts +44 -0
- package/dist/kamino-client/types/ExecutiveWithdrawAction.js +128 -0
- package/dist/kamino-client/types/ExecutiveWithdrawAction.js.map +1 -0
- package/dist/kamino-client/types/ExpanderStep.d.ts +38 -0
- package/dist/kamino-client/types/ExpanderStep.js +107 -0
- package/dist/kamino-client/types/ExpanderStep.js.map +1 -0
- package/dist/kamino-client/types/GlobalConfigOption.d.ts +304 -0
- package/dist/kamino-client/types/GlobalConfigOption.js +648 -0
- package/dist/kamino-client/types/GlobalConfigOption.js.map +1 -0
- package/dist/kamino-client/types/KaminoRewardInfo.d.ts +63 -0
- package/dist/kamino-client/types/KaminoRewardInfo.js +116 -0
- package/dist/kamino-client/types/KaminoRewardInfo.js.map +1 -0
- package/dist/kamino-client/types/LiquidityCalculationMode.d.ts +31 -0
- package/dist/kamino-client/types/LiquidityCalculationMode.js +102 -0
- package/dist/kamino-client/types/LiquidityCalculationMode.js.map +1 -0
- package/dist/kamino-client/types/MintingMethod.d.ts +31 -0
- package/dist/kamino-client/types/MintingMethod.js +102 -0
- package/dist/kamino-client/types/MintingMethod.js.map +1 -0
- package/dist/kamino-client/types/PeriodicRebalanceState.d.ts +22 -0
- package/dist/kamino-client/types/PeriodicRebalanceState.js +65 -0
- package/dist/kamino-client/types/PeriodicRebalanceState.js.map +1 -0
- package/dist/kamino-client/types/PositionRewardInfo.d.ts +27 -0
- package/dist/kamino-client/types/PositionRewardInfo.js +70 -0
- package/dist/kamino-client/types/PositionRewardInfo.js.map +1 -0
- package/dist/kamino-client/types/Price.d.ts +27 -0
- package/dist/kamino-client/types/Price.js +70 -0
- package/dist/kamino-client/types/Price.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAction.d.ts +83 -0
- package/dist/kamino-client/types/RebalanceAction.js +150 -0
- package/dist/kamino-client/types/RebalanceAction.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftParams.d.ts +75 -0
- package/dist/kamino-client/types/RebalanceAutodriftParams.js +100 -0
- package/dist/kamino-client/types/RebalanceAutodriftParams.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftState.d.ts +88 -0
- package/dist/kamino-client/types/RebalanceAutodriftState.js +76 -0
- package/dist/kamino-client/types/RebalanceAutodriftState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftStep.d.ts +31 -0
- package/dist/kamino-client/types/RebalanceAutodriftStep.js +102 -0
- package/dist/kamino-client/types/RebalanceAutodriftStep.js.map +1 -0
- package/dist/kamino-client/types/RebalanceAutodriftWindow.d.ts +54 -0
- package/dist/kamino-client/types/RebalanceAutodriftWindow.js +98 -0
- package/dist/kamino-client/types/RebalanceAutodriftWindow.js.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftParams.d.ts +50 -0
- package/dist/kamino-client/types/RebalanceDriftParams.js +92 -0
- package/dist/kamino-client/types/RebalanceDriftParams.js.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftState.d.ts +40 -0
- package/dist/kamino-client/types/RebalanceDriftState.js +80 -0
- package/dist/kamino-client/types/RebalanceDriftState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceDriftStep.d.ts +31 -0
- package/dist/kamino-client/types/RebalanceDriftStep.js +102 -0
- package/dist/kamino-client/types/RebalanceDriftStep.js.map +1 -0
- package/dist/kamino-client/types/RebalanceEffects.d.ts +39 -0
- package/dist/kamino-client/types/RebalanceEffects.js +108 -0
- package/dist/kamino-client/types/RebalanceEffects.js.map +1 -0
- package/dist/kamino-client/types/RebalanceExpanderState.d.ts +27 -0
- package/dist/kamino-client/types/RebalanceExpanderState.js +70 -0
- package/dist/kamino-client/types/RebalanceExpanderState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceManualState.d.ts +14 -0
- package/dist/kamino-client/types/RebalanceManualState.js +51 -0
- package/dist/kamino-client/types/RebalanceManualState.js.map +1 -0
- package/dist/kamino-client/types/RebalancePricePercentageState.d.ts +27 -0
- package/dist/kamino-client/types/RebalancePricePercentageState.js +73 -0
- package/dist/kamino-client/types/RebalancePricePercentageState.js.map +1 -0
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.d.ts +27 -0
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.js +75 -0
- package/dist/kamino-client/types/RebalancePricePercentageWithResetState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceRaw.d.ts +31 -0
- package/dist/kamino-client/types/RebalanceRaw.js +75 -0
- package/dist/kamino-client/types/RebalanceRaw.js.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitState.d.ts +33 -0
- package/dist/kamino-client/types/RebalanceTakeProfitState.js +62 -0
- package/dist/kamino-client/types/RebalanceTakeProfitState.js.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitStep.d.ts +44 -0
- package/dist/kamino-client/types/RebalanceTakeProfitStep.js +128 -0
- package/dist/kamino-client/types/RebalanceTakeProfitStep.js.map +1 -0
- package/dist/kamino-client/types/RebalanceTakeProfitToken.d.ts +31 -0
- package/dist/kamino-client/types/RebalanceTakeProfitToken.js +99 -0
- package/dist/kamino-client/types/RebalanceTakeProfitToken.js.map +1 -0
- package/dist/kamino-client/types/RebalanceType.d.ts +109 -0
- package/dist/kamino-client/types/RebalanceType.js +258 -0
- package/dist/kamino-client/types/RebalanceType.js.map +1 -0
- package/dist/kamino-client/types/ReferencePriceType.d.ts +31 -0
- package/dist/kamino-client/types/ReferencePriceType.js +102 -0
- package/dist/kamino-client/types/ReferencePriceType.js.map +1 -0
- package/dist/kamino-client/types/RemoveLiquidityMode.d.ts +59 -0
- package/dist/kamino-client/types/RemoveLiquidityMode.js +142 -0
- package/dist/kamino-client/types/RemoveLiquidityMode.js.map +1 -0
- package/dist/kamino-client/types/RewardInfo.d.ts +115 -0
- package/dist/kamino-client/types/RewardInfo.js +128 -0
- package/dist/kamino-client/types/RewardInfo.js.map +1 -0
- package/dist/kamino-client/types/ScopeConversionChain.d.ts +0 -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 +915 -0
- package/dist/kamino-client/types/ScopePriceIdTest.js +1871 -0
- package/dist/kamino-client/types/ScopePriceIdTest.js.map +1 -0
- package/dist/kamino-client/types/SimulationPrice.d.ts +59 -0
- package/dist/kamino-client/types/SimulationPrice.js +142 -0
- package/dist/kamino-client/types/SimulationPrice.js.map +1 -0
- package/dist/kamino-client/types/StakingRateSource.d.ts +31 -0
- package/dist/kamino-client/types/StakingRateSource.js +102 -0
- package/dist/kamino-client/types/StakingRateSource.js.map +1 -0
- package/dist/kamino-client/types/StrategyConfigOption.d.ts +668 -0
- package/dist/kamino-client/types/StrategyConfigOption.js +1377 -0
- package/dist/kamino-client/types/StrategyConfigOption.js.map +1 -0
- package/dist/kamino-client/types/StrategyStatus.d.ts +70 -0
- package/dist/kamino-client/types/StrategyStatus.js +180 -0
- package/dist/kamino-client/types/StrategyStatus.js.map +1 -0
- package/dist/kamino-client/types/StrategyType.d.ts +44 -0
- package/dist/kamino-client/types/StrategyType.js +128 -0
- package/dist/kamino-client/types/StrategyType.js.map +1 -0
- package/dist/kamino-client/types/SwapLimit.d.ts +66 -0
- package/dist/kamino-client/types/SwapLimit.js +138 -0
- package/dist/kamino-client/types/SwapLimit.js.map +1 -0
- package/dist/kamino-client/types/UpdateCollateralInfoMode.d.ts +174 -0
- package/dist/kamino-client/types/UpdateCollateralInfoMode.js +388 -0
- package/dist/kamino-client/types/UpdateCollateralInfoMode.js.map +1 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.d.ts +67 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.js +92 -0
- package/dist/kamino-client/types/WhirlpoolRewardInfo.js.map +1 -0
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.d.ts +31 -0
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.js +102 -0
- package/dist/kamino-client/types/WithdrawalCapAccumulatorAction.js.map +1 -0
- package/dist/kamino-client/types/WithdrawalCaps.d.ts +37 -0
- package/dist/kamino-client/types/WithdrawalCaps.js +85 -0
- package/dist/kamino-client/types/WithdrawalCaps.js.map +1 -0
- package/dist/kamino-client/types/index.d.ts +160 -0
- package/dist/kamino-client/types/index.js +127 -0
- package/dist/kamino-client/types/index.js.map +1 -0
- package/dist/meteora_client/accounts/BinArray.d.ts +41 -0
- package/dist/meteora_client/accounts/BinArray.js +127 -0
- package/dist/meteora_client/accounts/BinArray.js.map +1 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.d.ts +31 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.js +110 -0
- package/dist/meteora_client/accounts/BinArrayBitmapExtension.js.map +1 -0
- package/dist/meteora_client/accounts/LbPair.d.ts +179 -0
- package/dist/meteora_client/accounts/LbPair.js +246 -0
- package/dist/meteora_client/accounts/LbPair.js.map +1 -0
- package/dist/meteora_client/accounts/Oracle.d.ts +34 -0
- package/dist/meteora_client/accounts/Oracle.js +109 -0
- package/dist/meteora_client/accounts/Oracle.js.map +1 -0
- package/dist/meteora_client/accounts/Position.d.ts +89 -0
- package/dist/meteora_client/accounts/Position.js +156 -0
- package/dist/meteora_client/accounts/Position.js.map +1 -0
- package/dist/meteora_client/accounts/PositionV2.d.ts +113 -0
- package/dist/meteora_client/accounts/PositionV2.js +177 -0
- package/dist/meteora_client/accounts/PositionV2.js.map +1 -0
- package/dist/meteora_client/accounts/PresetParameter.d.ts +75 -0
- package/dist/meteora_client/accounts/PresetParameter.js +140 -0
- package/dist/meteora_client/accounts/PresetParameter.js.map +1 -0
- package/dist/meteora_client/accounts/index.d.ts +14 -0
- package/dist/meteora_client/accounts/index.js +18 -0
- package/dist/meteora_client/accounts/index.js.map +1 -0
- package/dist/meteora_client/errors/anchor.d.ts +434 -0
- package/dist/meteora_client/errors/anchor.js +713 -0
- package/dist/meteora_client/errors/anchor.js.map +1 -0
- package/dist/meteora_client/errors/custom.d.ts +474 -0
- package/dist/meteora_client/errors/custom.js +778 -0
- package/dist/meteora_client/errors/custom.js.map +1 -0
- package/dist/meteora_client/errors/index.d.ts +5 -0
- package/dist/meteora_client/errors/index.js +70 -0
- package/dist/meteora_client/errors/index.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidity.d.ts +25 -0
- package/dist/meteora_client/instructions/addLiquidity.js +67 -0
- package/dist/meteora_client/instructions/addLiquidity.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.d.ts +25 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.js +67 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategy.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.d.ts +21 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.js +63 -0
- package/dist/meteora_client/instructions/addLiquidityByStrategyOneSide.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.d.ts +25 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.js +67 -0
- package/dist/meteora_client/instructions/addLiquidityByWeight.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.d.ts +21 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.js +63 -0
- package/dist/meteora_client/instructions/addLiquidityOneSide.js.map +1 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.d.ts +21 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.js +63 -0
- package/dist/meteora_client/instructions/addLiquidityOneSidePrecise.js.map +1 -0
- package/dist/meteora_client/instructions/claimFee.d.ts +18 -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 +20 -0
- package/dist/meteora_client/instructions/claimReward.js +55 -0
- package/dist/meteora_client/instructions/claimReward.js.map +1 -0
- package/dist/meteora_client/instructions/closePosition.d.ts +12 -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 +7 -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 +20 -0
- package/dist/meteora_client/instructions/fundReward.js +59 -0
- package/dist/meteora_client/instructions/fundReward.js.map +1 -0
- package/dist/meteora_client/instructions/goToABin.d.ts +14 -0
- package/dist/meteora_client/instructions/goToABin.js +54 -0
- package/dist/meteora_client/instructions/goToABin.js.map +1 -0
- package/dist/meteora_client/instructions/increaseOracleLength.d.ts +14 -0
- package/dist/meteora_client/instructions/increaseOracleLength.js +49 -0
- package/dist/meteora_client/instructions/increaseOracleLength.js.map +1 -0
- package/dist/meteora_client/instructions/index.d.ts +84 -0
- package/dist/meteora_client/instructions/index.js +88 -0
- package/dist/meteora_client/instructions/index.js.map +1 -0
- package/dist/meteora_client/instructions/initializeBinArray.d.ts +13 -0
- package/dist/meteora_client/instructions/initializeBinArray.js +48 -0
- package/dist/meteora_client/instructions/initializeBinArray.js.map +1 -0
- package/dist/meteora_client/instructions/initializeBinArrayBitmapExtension.d.ts +10 -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 +23 -0
- package/dist/meteora_client/instructions/initializeLbPair.js +66 -0
- package/dist/meteora_client/instructions/initializeLbPair.js.map +1 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.d.ts +23 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.js +65 -0
- package/dist/meteora_client/instructions/initializePermissionLbPair.js.map +1 -0
- package/dist/meteora_client/instructions/initializePosition.d.ts +17 -0
- package/dist/meteora_client/instructions/initializePosition.js +56 -0
- package/dist/meteora_client/instructions/initializePosition.js.map +1 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.d.ts +21 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.js +61 -0
- package/dist/meteora_client/instructions/initializePositionByOperator.js.map +1 -0
- package/dist/meteora_client/instructions/initializePositionPda.d.ts +19 -0
- package/dist/meteora_client/instructions/initializePositionPda.js +57 -0
- package/dist/meteora_client/instructions/initializePositionPda.js.map +1 -0
- package/dist/meteora_client/instructions/initializePresetParameter.d.ts +13 -0
- package/dist/meteora_client/instructions/initializePresetParameter.js +49 -0
- package/dist/meteora_client/instructions/initializePresetParameter.js.map +1 -0
- package/dist/meteora_client/instructions/initializeReward.d.ts +20 -0
- package/dist/meteora_client/instructions/initializeReward.js +59 -0
- package/dist/meteora_client/instructions/initializeReward.js.map +1 -0
- package/dist/meteora_client/instructions/migrateBinArray.d.ts +5 -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 +14 -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 +20 -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 +25 -0
- package/dist/meteora_client/instructions/removeLiquidity.js +67 -0
- package/dist/meteora_client/instructions/removeLiquidity.js.map +1 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.d.ts +26 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.js +70 -0
- package/dist/meteora_client/instructions/removeLiquidityByRange.js.map +1 -0
- package/dist/meteora_client/instructions/setActivationSlot.d.ts +11 -0
- package/dist/meteora_client/instructions/setActivationSlot.js +46 -0
- package/dist/meteora_client/instructions/setActivationSlot.js.map +1 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.d.ts +14 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.js +49 -0
- package/dist/meteora_client/instructions/setLockReleaseSlot.js.map +1 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.d.ts +10 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.js +46 -0
- package/dist/meteora_client/instructions/setPreActivationSlotDuration.js.map +1 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.d.ts +10 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.js +48 -0
- package/dist/meteora_client/instructions/setPreActivationSwapAddress.js.map +1 -0
- package/dist/meteora_client/instructions/swap.d.ts +25 -0
- package/dist/meteora_client/instructions/swap.js +67 -0
- package/dist/meteora_client/instructions/swap.js.map +1 -0
- package/dist/meteora_client/instructions/togglePairStatus.d.ts +6 -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 +7 -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 +13 -0
- package/dist/meteora_client/instructions/updateFeeParameters.js +49 -0
- package/dist/meteora_client/instructions/updateFeeParameters.js.map +1 -0
- package/dist/meteora_client/instructions/updateFeesAndRewards.d.ts +9 -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 +12 -0
- package/dist/meteora_client/instructions/updatePositionOperator.js +48 -0
- package/dist/meteora_client/instructions/updatePositionOperator.js.map +1 -0
- package/dist/meteora_client/instructions/updateRewardDuration.d.ts +15 -0
- package/dist/meteora_client/instructions/updateRewardDuration.js +53 -0
- package/dist/meteora_client/instructions/updateRewardDuration.js.map +1 -0
- package/dist/meteora_client/instructions/updateRewardFunder.d.ts +14 -0
- package/dist/meteora_client/instructions/updateRewardFunder.js +52 -0
- package/dist/meteora_client/instructions/updateRewardFunder.js.map +1 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.d.ts +10 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.js +46 -0
- package/dist/meteora_client/instructions/updateWhitelistedWallet.js.map +1 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.d.ts +18 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.js +53 -0
- package/dist/meteora_client/instructions/withdrawIneligibleReward.js.map +1 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.d.ts +19 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.js +54 -0
- package/dist/meteora_client/instructions/withdrawProtocolFee.js.map +1 -0
- package/dist/meteora_client/programId.d.ts +5 -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 +33 -0
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.js +74 -0
- package/dist/meteora_client/types/AddLiquiditySingleSidePreciseParameter.js.map +1 -0
- package/dist/meteora_client/types/Bin.d.ts +89 -0
- package/dist/meteora_client/types/Bin.js +115 -0
- package/dist/meteora_client/types/Bin.js.map +1 -0
- package/dist/meteora_client/types/BinLiquidityDistribution.d.ts +40 -0
- package/dist/meteora_client/types/BinLiquidityDistribution.js +75 -0
- package/dist/meteora_client/types/BinLiquidityDistribution.js.map +1 -0
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.d.ts +32 -0
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.js +66 -0
- package/dist/meteora_client/types/BinLiquidityDistributionByWeight.js.map +1 -0
- package/dist/meteora_client/types/BinLiquidityReduction.d.ts +26 -0
- package/dist/meteora_client/types/BinLiquidityReduction.js +66 -0
- package/dist/meteora_client/types/BinLiquidityReduction.js.map +1 -0
- package/dist/meteora_client/types/CompressedBinDepositAmount.d.ts +26 -0
- package/dist/meteora_client/types/CompressedBinDepositAmount.js +66 -0
- package/dist/meteora_client/types/CompressedBinDepositAmount.js.map +1 -0
- package/dist/meteora_client/types/FeeInfo.d.ts +37 -0
- package/dist/meteora_client/types/FeeInfo.js +85 -0
- package/dist/meteora_client/types/FeeInfo.js.map +1 -0
- package/dist/meteora_client/types/FeeParameter.d.ts +32 -0
- package/dist/meteora_client/types/FeeParameter.js +66 -0
- package/dist/meteora_client/types/FeeParameter.js.map +1 -0
- package/dist/meteora_client/types/InitPermissionPairIx.d.ts +47 -0
- package/dist/meteora_client/types/InitPermissionPairIx.js +97 -0
- package/dist/meteora_client/types/InitPermissionPairIx.js.map +1 -0
- package/dist/meteora_client/types/InitPresetParametersIx.d.ts +96 -0
- package/dist/meteora_client/types/InitPresetParametersIx.js +117 -0
- package/dist/meteora_client/types/InitPresetParametersIx.js.map +1 -0
- package/dist/meteora_client/types/LayoutVersion.d.ts +31 -0
- package/dist/meteora_client/types/LayoutVersion.js +99 -0
- package/dist/meteora_client/types/LayoutVersion.js.map +1 -0
- package/dist/meteora_client/types/LiquidityOneSideParameter.d.ts +55 -0
- package/dist/meteora_client/types/LiquidityOneSideParameter.js +86 -0
- package/dist/meteora_client/types/LiquidityOneSideParameter.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameter.d.ts +49 -0
- package/dist/meteora_client/types/LiquidityParameter.js +80 -0
- package/dist/meteora_client/types/LiquidityParameter.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategy.d.ts +103 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategy.js +92 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategy.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.d.ts +95 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.js +86 -0
- package/dist/meteora_client/types/LiquidityParameterByStrategyOneSide.js.map +1 -0
- package/dist/meteora_client/types/LiquidityParameterByWeight.d.ts +63 -0
- package/dist/meteora_client/types/LiquidityParameterByWeight.js +92 -0
- package/dist/meteora_client/types/LiquidityParameterByWeight.js.map +1 -0
- package/dist/meteora_client/types/Observation.d.ts +41 -0
- package/dist/meteora_client/types/Observation.js +79 -0
- package/dist/meteora_client/types/Observation.js.map +1 -0
- package/dist/meteora_client/types/PairStatus.d.ts +31 -0
- package/dist/meteora_client/types/PairStatus.js +102 -0
- package/dist/meteora_client/types/PairStatus.js.map +1 -0
- package/dist/meteora_client/types/PairType.d.ts +31 -0
- package/dist/meteora_client/types/PairType.js +102 -0
- package/dist/meteora_client/types/PairType.js.map +1 -0
- package/dist/meteora_client/types/ProtocolFee.d.ts +27 -0
- package/dist/meteora_client/types/ProtocolFee.js +70 -0
- package/dist/meteora_client/types/ProtocolFee.js.map +1 -0
- package/dist/meteora_client/types/RewardInfo.d.ts +83 -0
- package/dist/meteora_client/types/RewardInfo.js +112 -0
- package/dist/meteora_client/types/RewardInfo.js.map +1 -0
- package/dist/meteora_client/types/Rounding.d.ts +31 -0
- package/dist/meteora_client/types/Rounding.js +99 -0
- package/dist/meteora_client/types/Rounding.js.map +1 -0
- package/dist/meteora_client/types/StaticParameters.d.ts +97 -0
- package/dist/meteora_client/types/StaticParameters.js +118 -0
- package/dist/meteora_client/types/StaticParameters.js.map +1 -0
- package/dist/meteora_client/types/StrategyParameters.d.ts +84 -0
- package/dist/meteora_client/types/StrategyParameters.js +82 -0
- package/dist/meteora_client/types/StrategyParameters.js.map +1 -0
- package/dist/meteora_client/types/StrategyType.d.ts +122 -0
- package/dist/meteora_client/types/StrategyType.js +284 -0
- package/dist/meteora_client/types/StrategyType.js.map +1 -0
- package/dist/meteora_client/types/UserRewardInfo.d.ts +27 -0
- package/dist/meteora_client/types/UserRewardInfo.js +73 -0
- package/dist/meteora_client/types/UserRewardInfo.js.map +1 -0
- package/dist/meteora_client/types/VariableParameters.d.ts +75 -0
- package/dist/meteora_client/types/VariableParameters.js +98 -0
- package/dist/meteora_client/types/VariableParameters.js.map +1 -0
- package/dist/meteora_client/types/index.d.ts +67 -0
- package/dist/meteora_client/types/index.js +81 -0
- package/dist/meteora_client/types/index.js.map +1 -0
- package/dist/models/EnrichedScopePrice.d.ts +28 -0
- package/dist/models/EnrichedScopePrice.js +3 -0
- package/dist/models/EnrichedScopePrice.js.map +1 -0
- package/dist/models/Holdings.d.ts +13 -0
- package/dist/models/Holdings.js +3 -0
- package/dist/models/Holdings.js.map +1 -0
- package/dist/models/KaminoPosition.d.ts +10 -0
- package/dist/models/KaminoPosition.js +3 -0
- package/dist/models/KaminoPosition.js.map +1 -0
- package/dist/models/KaminoStrategyWithShareMint.d.ts +8 -0
- package/dist/models/KaminoStrategyWithShareMint.js +3 -0
- package/dist/models/KaminoStrategyWithShareMint.js.map +1 -0
- package/dist/models/KaminoToken.d.ts +5 -0
- package/dist/models/KaminoToken.js +3 -0
- package/dist/models/KaminoToken.js.map +1 -0
- package/dist/models/LbPairWithAddress.d.ts +7 -0
- package/dist/models/LbPairWithAddress.js +3 -0
- package/dist/models/LbPairWithAddress.js.map +1 -0
- package/dist/models/MultipleAccountsResponse.d.ts +42 -0
- package/dist/models/MultipleAccountsResponse.js +3 -0
- package/dist/models/MultipleAccountsResponse.js.map +1 -0
- package/dist/models/PoolSimulationResponseData.d.ts +27 -0
- package/dist/models/PoolSimulationResponseData.js +3 -0
- package/dist/models/PoolSimulationResponseData.js.map +1 -0
- package/dist/models/PriceData.d.ts +15 -0
- package/dist/models/PriceData.js +3 -0
- package/dist/models/PriceData.js.map +1 -0
- package/dist/models/RaydiumPoolWithAddress.d.ts +7 -0
- package/dist/models/RaydiumPoolWithAddress.js +3 -0
- package/dist/models/RaydiumPoolWithAddress.js.map +1 -0
- package/dist/models/ShareData.d.ts +15 -0
- package/dist/models/ShareData.js +25 -0
- package/dist/models/ShareData.js.map +1 -0
- package/dist/models/StrategyBalances.d.ts +14 -0
- package/dist/models/StrategyBalances.js +3 -0
- package/dist/models/StrategyBalances.js.map +1 -0
- package/dist/models/StrategyHolder.d.ts +6 -0
- package/dist/models/StrategyHolder.js +3 -0
- package/dist/models/StrategyHolder.js.map +1 -0
- package/dist/models/StrategyPrices.d.ts +10 -0
- package/dist/models/StrategyPrices.js +3 -0
- package/dist/models/StrategyPrices.js.map +1 -0
- package/dist/models/StrategyProgramAddress.d.ts +13 -0
- package/dist/models/StrategyProgramAddress.js +3 -0
- package/dist/models/StrategyProgramAddress.js.map +1 -0
- package/dist/models/StrategyVaultBalances.d.ts +5 -0
- package/dist/models/StrategyVaultBalances.js +3 -0
- package/dist/models/StrategyVaultBalances.js.map +1 -0
- package/dist/models/StrategyVaultTokens.d.ts +12 -0
- package/dist/models/StrategyVaultTokens.js +3 -0
- package/dist/models/StrategyVaultTokens.js.map +1 -0
- package/dist/models/StrategyWithAddress.d.ts +7 -0
- package/dist/models/StrategyWithAddress.js +3 -0
- package/dist/models/StrategyWithAddress.js.map +1 -0
- package/dist/models/StrategyWithPendingFees.d.ts +6 -0
- package/dist/models/StrategyWithPendingFees.js +3 -0
- package/dist/models/StrategyWithPendingFees.js.map +1 -0
- package/dist/models/TokenAmounts.d.ts +5 -0
- package/dist/models/TokenAmounts.js +3 -0
- package/dist/models/TokenAmounts.js.map +1 -0
- package/dist/models/TreasuryFeeVault.d.ts +7 -0
- package/dist/models/TreasuryFeeVault.js +3 -0
- package/dist/models/TreasuryFeeVault.js.map +1 -0
- package/dist/models/WhirlpoolWithAddress.d.ts +7 -0
- package/dist/models/WhirlpoolWithAddress.js +3 -0
- package/dist/models/WhirlpoolWithAddress.js.map +1 -0
- package/dist/models/index.d.ts +19 -0
- package/dist/models/index.js +36 -0
- package/dist/models/index.js.map +1 -0
- package/dist/raydium_client/accounts/AmmConfig.d.ts +46 -0
- package/dist/raydium_client/accounts/AmmConfig.js +145 -0
- package/dist/raydium_client/accounts/AmmConfig.js.map +1 -0
- package/dist/raydium_client/accounts/ObservationState.d.ts +29 -0
- package/dist/raydium_client/accounts/ObservationState.js +116 -0
- package/dist/raydium_client/accounts/ObservationState.js.map +1 -0
- package/dist/raydium_client/accounts/OperationState.d.ts +24 -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 +53 -0
- package/dist/raydium_client/accounts/PersonalPositionState.js +156 -0
- package/dist/raydium_client/accounts/PersonalPositionState.js.map +1 -0
- package/dist/raydium_client/accounts/PoolState.d.ts +128 -0
- package/dist/raydium_client/accounts/PoolState.js +281 -0
- package/dist/raydium_client/accounts/PoolState.js.map +1 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.d.ts +49 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.js +150 -0
- package/dist/raydium_client/accounts/ProtocolPositionState.js.map +1 -0
- package/dist/raydium_client/accounts/TickArrayBitmapExtension.d.ts +25 -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 +31 -0
- package/dist/raydium_client/accounts/TickArrayState.js +117 -0
- package/dist/raydium_client/accounts/TickArrayState.js.map +1 -0
- package/dist/raydium_client/accounts/index.d.ts +16 -0
- package/dist/raydium_client/accounts/index.js +20 -0
- package/dist/raydium_client/accounts/index.js.map +1 -0
- package/dist/raydium_client/errors/anchor.d.ts +434 -0
- package/dist/raydium_client/errors/anchor.js +713 -0
- package/dist/raydium_client/errors/anchor.js.map +1 -0
- package/dist/raydium_client/errors/custom.d.ts +338 -0
- package/dist/raydium_client/errors/custom.js +556 -0
- package/dist/raydium_client/errors/custom.js.map +1 -0
- package/dist/raydium_client/errors/index.d.ts +5 -0
- package/dist/raydium_client/errors/index.js +70 -0
- package/dist/raydium_client/errors/index.js.map +1 -0
- package/dist/raydium_client/index.d.ts +4 -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 +10 -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 +21 -0
- package/dist/raydium_client/instructions/collectFundFee.js +67 -0
- package/dist/raydium_client/instructions/collectFundFee.js.map +1 -0
- package/dist/raydium_client/instructions/collectProtocolFee.d.ts +21 -0
- package/dist/raydium_client/instructions/collectProtocolFee.js +67 -0
- package/dist/raydium_client/instructions/collectProtocolFee.js.map +1 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.d.ts +16 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.js +52 -0
- package/dist/raydium_client/instructions/collectRemainingRewards.js.map +1 -0
- package/dist/raydium_client/instructions/createAmmConfig.d.ts +15 -0
- package/dist/raydium_client/instructions/createAmmConfig.js +57 -0
- package/dist/raydium_client/instructions/createAmmConfig.js.map +1 -0
- package/dist/raydium_client/instructions/createOperationAccount.d.ts +7 -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 +23 -0
- package/dist/raydium_client/instructions/createPool.js +61 -0
- package/dist/raydium_client/instructions/createPool.js.map +1 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.d.ts +23 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.js +70 -0
- package/dist/raydium_client/instructions/decreaseLiquidity.js.map +1 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.d.ts +27 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.js +74 -0
- package/dist/raydium_client/instructions/decreaseLiquidityV2.js.map +1 -0
- package/dist/raydium_client/instructions/increaseLiquidity.d.ts +23 -0
- package/dist/raydium_client/instructions/increaseLiquidity.js +62 -0
- package/dist/raydium_client/instructions/increaseLiquidity.js.map +1 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.d.ts +27 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.js +67 -0
- package/dist/raydium_client/instructions/increaseLiquidityV2.js.map +1 -0
- package/dist/raydium_client/instructions/index.d.ts +46 -0
- package/dist/raydium_client/instructions/index.js +50 -0
- package/dist/raydium_client/instructions/index.js.map +1 -0
- package/dist/raydium_client/instructions/initializeReward.d.ts +19 -0
- package/dist/raydium_client/instructions/initializeReward.js +57 -0
- package/dist/raydium_client/instructions/initializeReward.js.map +1 -0
- package/dist/raydium_client/instructions/openPosition.d.ts +34 -0
- package/dist/raydium_client/instructions/openPosition.js +81 -0
- package/dist/raydium_client/instructions/openPosition.js.map +1 -0
- package/dist/raydium_client/instructions/openPositionV2.d.ts +39 -0
- package/dist/raydium_client/instructions/openPositionV2.js +88 -0
- package/dist/raydium_client/instructions/openPositionV2.js.map +1 -0
- package/dist/raydium_client/instructions/setRewardParams.d.ts +18 -0
- package/dist/raydium_client/instructions/setRewardParams.js +58 -0
- package/dist/raydium_client/instructions/setRewardParams.js.map +1 -0
- package/dist/raydium_client/instructions/swap.d.ts +22 -0
- package/dist/raydium_client/instructions/swap.js +62 -0
- package/dist/raydium_client/instructions/swap.js.map +1 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.d.ts +16 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.js +54 -0
- package/dist/raydium_client/instructions/swapRouterBaseIn.js.map +1 -0
- package/dist/raydium_client/instructions/swapV2.d.ts +25 -0
- package/dist/raydium_client/instructions/swapV2.js +65 -0
- package/dist/raydium_client/instructions/swapV2.js.map +1 -0
- package/dist/raydium_client/instructions/transferRewardOwner.d.ts +10 -0
- package/dist/raydium_client/instructions/transferRewardOwner.js +46 -0
- package/dist/raydium_client/instructions/transferRewardOwner.js.map +1 -0
- package/dist/raydium_client/instructions/updateAmmConfig.d.ts +11 -0
- package/dist/raydium_client/instructions/updateAmmConfig.js +47 -0
- package/dist/raydium_client/instructions/updateAmmConfig.js.map +1 -0
- package/dist/raydium_client/instructions/updateOperationAccount.d.ts +12 -0
- package/dist/raydium_client/instructions/updateOperationAccount.js +51 -0
- package/dist/raydium_client/instructions/updateOperationAccount.js.map +1 -0
- package/dist/raydium_client/instructions/updatePoolStatus.d.ts +10 -0
- package/dist/raydium_client/instructions/updatePoolStatus.js +46 -0
- package/dist/raydium_client/instructions/updatePoolStatus.js.map +1 -0
- package/dist/raydium_client/instructions/updateRewardInfos.d.ts +5 -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 +5 -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 +32 -0
- package/dist/raydium_client/types/InitializeRewardParam.js +79 -0
- package/dist/raydium_client/types/InitializeRewardParam.js.map +1 -0
- package/dist/raydium_client/types/Observation.d.ts +37 -0
- package/dist/raydium_client/types/Observation.js +85 -0
- package/dist/raydium_client/types/Observation.js.map +1 -0
- package/dist/raydium_client/types/PoolStatusBitFlag.d.ts +31 -0
- package/dist/raydium_client/types/PoolStatusBitFlag.js +102 -0
- package/dist/raydium_client/types/PoolStatusBitFlag.js.map +1 -0
- package/dist/raydium_client/types/PoolStatusBitIndex.d.ts +70 -0
- package/dist/raydium_client/types/PoolStatusBitIndex.js +180 -0
- package/dist/raydium_client/types/PoolStatusBitIndex.js.map +1 -0
- package/dist/raydium_client/types/PositionRewardInfo.d.ts +27 -0
- package/dist/raydium_client/types/PositionRewardInfo.js +70 -0
- package/dist/raydium_client/types/PositionRewardInfo.js.map +1 -0
- package/dist/raydium_client/types/RewardInfo.d.ts +73 -0
- package/dist/raydium_client/types/RewardInfo.js +128 -0
- package/dist/raydium_client/types/RewardInfo.js.map +1 -0
- package/dist/raydium_client/types/RewardState.d.ts +57 -0
- package/dist/raydium_client/types/RewardState.js +154 -0
- package/dist/raydium_client/types/RewardState.js.map +1 -0
- package/dist/raydium_client/types/TickArryBitmap.d.ts +0 -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 +52 -0
- package/dist/raydium_client/types/TickState.js +103 -0
- package/dist/raydium_client/types/TickState.js.map +1 -0
- package/dist/raydium_client/types/index.d.ts +22 -0
- package/dist/raydium_client/types/index.js +43 -0
- package/dist/raydium_client/types/index.js.map +1 -0
- package/dist/rebalance_methods/autodriftRebalance.d.ts +20 -0
- package/dist/rebalance_methods/autodriftRebalance.js +220 -0
- package/dist/rebalance_methods/autodriftRebalance.js.map +1 -0
- package/dist/rebalance_methods/consts.d.ts +1 -0
- package/dist/rebalance_methods/consts.js +5 -0
- package/dist/rebalance_methods/consts.js.map +1 -0
- package/dist/rebalance_methods/driftRebalance.d.ts +17 -0
- package/dist/rebalance_methods/driftRebalance.js +180 -0
- package/dist/rebalance_methods/driftRebalance.js.map +1 -0
- package/dist/rebalance_methods/expanderRebalance.d.ts +18 -0
- package/dist/rebalance_methods/expanderRebalance.js +283 -0
- package/dist/rebalance_methods/expanderRebalance.js.map +1 -0
- package/dist/rebalance_methods/index.d.ts +7 -0
- package/dist/rebalance_methods/index.js +24 -0
- package/dist/rebalance_methods/index.js.map +1 -0
- package/dist/rebalance_methods/manualRebalance.d.ts +5 -0
- package/dist/rebalance_methods/manualRebalance.js +35 -0
- package/dist/rebalance_methods/manualRebalance.js.map +1 -0
- package/dist/rebalance_methods/math_utils.d.ts +4 -0
- package/dist/rebalance_methods/math_utils.js +18 -0
- package/dist/rebalance_methods/math_utils.js.map +1 -0
- package/dist/rebalance_methods/periodicRebalance.d.ts +14 -0
- package/dist/rebalance_methods/periodicRebalance.js +92 -0
- package/dist/rebalance_methods/periodicRebalance.js.map +1 -0
- package/dist/rebalance_methods/pricePercentageRebalance.d.ts +13 -0
- package/dist/rebalance_methods/pricePercentageRebalance.js +150 -0
- package/dist/rebalance_methods/pricePercentageRebalance.js.map +1 -0
- package/dist/rebalance_methods/pricePercentageWithResetRebalance.d.ts +14 -0
- package/dist/rebalance_methods/pricePercentageWithResetRebalance.js +233 -0
- package/dist/rebalance_methods/pricePercentageWithResetRebalance.js.map +1 -0
- package/dist/rebalance_methods/takeProfitRebalance.d.ts +14 -0
- package/dist/rebalance_methods/takeProfitRebalance.js +99 -0
- package/dist/rebalance_methods/takeProfitRebalance.js.map +1 -0
- package/dist/rebalance_methods/utils.d.ts +10 -0
- package/dist/rebalance_methods/utils.js +103 -0
- package/dist/rebalance_methods/utils.js.map +1 -0
- package/dist/services/JupService.d.ts +22 -0
- package/dist/services/JupService.js +130 -0
- package/dist/services/JupService.js.map +1 -0
- package/dist/services/MeteoraService.d.ts +24 -0
- package/dist/services/MeteoraService.js +193 -0
- package/dist/services/MeteoraService.js.map +1 -0
- package/dist/services/OrcaService.d.ts +36 -0
- package/dist/services/OrcaService.js +290 -0
- package/dist/services/OrcaService.js.map +1 -0
- package/dist/services/OrcaWhirlpoolsResponse.d.ts +105 -0
- package/dist/services/OrcaWhirlpoolsResponse.js +3 -0
- package/dist/services/OrcaWhirlpoolsResponse.js.map +1 -0
- package/dist/services/PoolSimulationService.d.ts +20 -0
- package/dist/services/PoolSimulationService.js +30 -0
- package/dist/services/PoolSimulationService.js.map +1 -0
- package/dist/services/RaydiumPoolsResponse.d.ts +85 -0
- package/dist/services/RaydiumPoolsResponse.js +3 -0
- package/dist/services/RaydiumPoolsResponse.js.map +1 -0
- package/dist/services/RaydiumService.d.ts +18 -0
- package/dist/services/RaydiumService.js +202 -0
- package/dist/services/RaydiumService.js.map +1 -0
- package/dist/services/WhirlpoolAprApy.d.ts +13 -0
- package/dist/services/WhirlpoolAprApy.js +3 -0
- package/dist/services/WhirlpoolAprApy.js.map +1 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +22 -0
- package/dist/services/index.js.map +1 -0
- package/dist/utils/CreationParameters.d.ts +32 -0
- package/dist/utils/CreationParameters.js +81 -0
- package/dist/utils/CreationParameters.js.map +1 -0
- package/dist/utils/anchorUtils.d.ts +5 -0
- package/dist/utils/anchorUtils.js +27 -0
- package/dist/utils/anchorUtils.js.map +1 -0
- package/dist/utils/batch.d.ts +2 -0
- package/dist/utils/batch.js +24 -0
- package/dist/utils/batch.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/instructions.d.ts +6 -0
- package/dist/utils/instructions.js +40 -0
- package/dist/utils/instructions.js.map +1 -0
- package/dist/utils/lookupTable.d.ts +4 -0
- package/dist/utils/lookupTable.js +51 -0
- package/dist/utils/lookupTable.js.map +1 -0
- package/dist/utils/math.d.ts +3 -0
- package/dist/utils/math.js +16 -0
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/meteora.d.ts +20 -0
- package/dist/utils/meteora.js +80 -0
- package/dist/utils/meteora.js.map +1 -0
- package/dist/utils/orca.d.ts +2 -0
- package/dist/utils/orca.js +8 -0
- package/dist/utils/orca.js.map +1 -0
- package/dist/utils/priceReferenceTypes.d.ts +3 -0
- package/dist/utils/priceReferenceTypes.js +12 -0
- package/dist/utils/priceReferenceTypes.js.map +1 -0
- package/dist/utils/pubkey.d.ts +65 -0
- package/dist/utils/pubkey.js +218 -0
- package/dist/utils/pubkey.js.map +1 -0
- package/dist/utils/raydium.d.ts +1 -0
- package/dist/utils/raydium.js +15 -0
- package/dist/utils/raydium.js.map +1 -0
- package/dist/utils/tokenUtils.d.ts +47 -0
- package/dist/utils/tokenUtils.js +185 -0
- package/dist/utils/tokenUtils.js.map +1 -0
- package/dist/utils/transactions.d.ts +13 -0
- package/dist/utils/transactions.js +147 -0
- package/dist/utils/transactions.js.map +1 -0
- package/dist/utils/types.d.ts +178 -0
- package/dist/utils/types.js +110 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/utils.d.ts +36 -0
- package/dist/utils/utils.js +313 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/whirlpools-client/accounts/FeeTier.d.ts +24 -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 +47 -0
- package/dist/whirlpools-client/accounts/Position.js +146 -0
- package/dist/whirlpools-client/accounts/Position.js.map +1 -0
- package/dist/whirlpools-client/accounts/PositionBundle.d.ts +21 -0
- package/dist/whirlpools-client/accounts/PositionBundle.js +101 -0
- package/dist/whirlpools-client/accounts/PositionBundle.js.map +1 -0
- package/dist/whirlpools-client/accounts/TickArray.d.ts +25 -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 +21 -0
- package/dist/whirlpools-client/accounts/TokenBadge.js +101 -0
- package/dist/whirlpools-client/accounts/TokenBadge.js.map +1 -0
- package/dist/whirlpools-client/accounts/Whirlpool.d.ts +74 -0
- package/dist/whirlpools-client/accounts/Whirlpool.js +191 -0
- package/dist/whirlpools-client/accounts/Whirlpool.js.map +1 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.d.ts +27 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.js +111 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfig.js.map +1 -0
- package/dist/whirlpools-client/accounts/WhirlpoolsConfigExtension.d.ts +24 -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 +16 -0
- package/dist/whirlpools-client/accounts/index.js +20 -0
- package/dist/whirlpools-client/accounts/index.js.map +1 -0
- package/dist/whirlpools-client/errors/anchor.d.ts +434 -0
- package/dist/whirlpools-client/errors/anchor.js +713 -0
- package/dist/whirlpools-client/errors/anchor.js.map +1 -0
- package/dist/whirlpools-client/errors/custom.d.ts +434 -0
- package/dist/whirlpools-client/errors/custom.js +713 -0
- package/dist/whirlpools-client/errors/custom.js.map +1 -0
- package/dist/whirlpools-client/errors/index.d.ts +5 -0
- package/dist/whirlpools-client/errors/index.js +70 -0
- package/dist/whirlpools-client/errors/index.js.map +1 -0
- package/dist/whirlpools-client/index.d.ts +4 -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 +13 -0
- package/dist/whirlpools-client/instructions/closeBundledPosition.js +57 -0
- package/dist/whirlpools-client/instructions/closeBundledPosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/closePosition.d.ts +10 -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 +13 -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 +22 -0
- package/dist/whirlpools-client/instructions/collectFeesV2.js +66 -0
- package/dist/whirlpools-client/instructions/collectFeesV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectProtocolFees.d.ts +12 -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 +21 -0
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.js +65 -0
- package/dist/whirlpools-client/instructions/collectProtocolFeesV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectReward.d.ts +15 -0
- package/dist/whirlpools-client/instructions/collectReward.js +55 -0
- package/dist/whirlpools-client/instructions/collectReward.js.map +1 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.d.ts +19 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.js +64 -0
- package/dist/whirlpools-client/instructions/collectRewardV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.d.ts +22 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.js +65 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidity.js.map +1 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.d.ts +28 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.js +74 -0
- package/dist/whirlpools-client/instructions/decreaseLiquidityV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/deletePositionBundle.d.ts +10 -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 +10 -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 +22 -0
- package/dist/whirlpools-client/instructions/increaseLiquidity.js +65 -0
- package/dist/whirlpools-client/instructions/increaseLiquidity.js.map +1 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.d.ts +28 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.js +74 -0
- package/dist/whirlpools-client/instructions/increaseLiquidityV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/index.d.ts +92 -0
- package/dist/whirlpools-client/instructions/index.js +96 -0
- package/dist/whirlpools-client/instructions/index.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeConfig.d.ts +14 -0
- package/dist/whirlpools-client/instructions/initializeConfig.js +55 -0
- package/dist/whirlpools-client/instructions/initializeConfig.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeConfigExtension.d.ts +9 -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 +14 -0
- package/dist/whirlpools-client/instructions/initializeFeeTier.js +53 -0
- package/dist/whirlpools-client/instructions/initializeFeeTier.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePool.d.ts +23 -0
- package/dist/whirlpools-client/instructions/initializePool.js +62 -0
- package/dist/whirlpools-client/instructions/initializePool.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.d.ts +24 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.js +62 -0
- package/dist/whirlpools-client/instructions/initializePoolV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializePositionBundle.d.ts +13 -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 +16 -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 +16 -0
- package/dist/whirlpools-client/instructions/initializeReward.js +52 -0
- package/dist/whirlpools-client/instructions/initializeReward.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.d.ts +17 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.js +53 -0
- package/dist/whirlpools-client/instructions/initializeRewardV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.d.ts +12 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.js +48 -0
- package/dist/whirlpools-client/instructions/initializeTickArray.js.map +1 -0
- package/dist/whirlpools-client/instructions/initializeTokenBadge.d.ts +11 -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 +18 -0
- package/dist/whirlpools-client/instructions/openBundledPosition.js +66 -0
- package/dist/whirlpools-client/instructions/openBundledPosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/openPosition.d.ts +21 -0
- package/dist/whirlpools-client/instructions/openPosition.js +69 -0
- package/dist/whirlpools-client/instructions/openPosition.js.map +1 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.d.ts +24 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.js +76 -0
- package/dist/whirlpools-client/instructions/openPositionWithMetadata.js.map +1 -0
- package/dist/whirlpools-client/instructions/setCollectProtocolFeesAuthority.d.ts +7 -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 +8 -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 +11 -0
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.js +47 -0
- package/dist/whirlpools-client/instructions/setDefaultFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.d.ts +10 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.js +46 -0
- package/dist/whirlpools-client/instructions/setDefaultProtocolFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setFeeAuthority.d.ts +7 -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 +11 -0
- package/dist/whirlpools-client/instructions/setFeeRate.js +47 -0
- package/dist/whirlpools-client/instructions/setFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.d.ts +11 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.js +47 -0
- package/dist/whirlpools-client/instructions/setProtocolFeeRate.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.d.ts +11 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.js +47 -0
- package/dist/whirlpools-client/instructions/setRewardAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.d.ts +12 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.js +52 -0
- package/dist/whirlpools-client/instructions/setRewardAuthorityBySuperAuthority.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.d.ts +13 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.js +51 -0
- package/dist/whirlpools-client/instructions/setRewardEmissions.js.map +1 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsSuperAuthority.d.ts +7 -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 +13 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.js +51 -0
- package/dist/whirlpools-client/instructions/setRewardEmissionsV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/setTokenBadgeAuthority.d.ts +8 -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 +24 -0
- package/dist/whirlpools-client/instructions/swap.js +65 -0
- package/dist/whirlpools-client/instructions/swap.js.map +1 -0
- package/dist/whirlpools-client/instructions/swapV2.d.ts +30 -0
- package/dist/whirlpools-client/instructions/swapV2.js +74 -0
- package/dist/whirlpools-client/instructions/swapV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.d.ts +35 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.js +94 -0
- package/dist/whirlpools-client/instructions/twoHopSwap.js.map +1 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.d.ts +41 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.js +111 -0
- package/dist/whirlpools-client/instructions/twoHopSwapV2.js.map +1 -0
- package/dist/whirlpools-client/instructions/updateFeesAndRewards.d.ts +8 -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 +5 -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 +15 -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 +83 -0
- package/dist/whirlpools-client/types/AccountsType.js +206 -0
- package/dist/whirlpools-client/types/AccountsType.js.map +1 -0
- package/dist/whirlpools-client/types/CurrIndex.d.ts +44 -0
- package/dist/whirlpools-client/types/CurrIndex.js +128 -0
- package/dist/whirlpools-client/types/CurrIndex.js.map +1 -0
- package/dist/whirlpools-client/types/Direction.d.ts +31 -0
- package/dist/whirlpools-client/types/Direction.js +102 -0
- package/dist/whirlpools-client/types/Direction.js.map +1 -0
- package/dist/whirlpools-client/types/OpenPositionBumps.d.ts +21 -0
- package/dist/whirlpools-client/types/OpenPositionBumps.js +61 -0
- package/dist/whirlpools-client/types/OpenPositionBumps.js.map +1 -0
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.d.ts +26 -0
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.js +66 -0
- package/dist/whirlpools-client/types/OpenPositionWithMetadataBumps.js.map +1 -0
- package/dist/whirlpools-client/types/PositionRewardInfo.d.ts +27 -0
- package/dist/whirlpools-client/types/PositionRewardInfo.js +70 -0
- package/dist/whirlpools-client/types/PositionRewardInfo.js.map +1 -0
- package/dist/whirlpools-client/types/RemainingAccountsInfo.d.ts +51 -0
- package/dist/whirlpools-client/types/RemainingAccountsInfo.js +62 -0
- package/dist/whirlpools-client/types/RemainingAccountsInfo.js.map +1 -0
- package/dist/whirlpools-client/types/RemainingAccountsSlice.d.ts +50 -0
- package/dist/whirlpools-client/types/RemainingAccountsSlice.js +67 -0
- package/dist/whirlpools-client/types/RemainingAccountsSlice.js.map +1 -0
- package/dist/whirlpools-client/types/Tick.d.ts +47 -0
- package/dist/whirlpools-client/types/Tick.js +97 -0
- package/dist/whirlpools-client/types/Tick.js.map +1 -0
- package/dist/whirlpools-client/types/TickLabel.d.ts +31 -0
- package/dist/whirlpools-client/types/TickLabel.js +102 -0
- package/dist/whirlpools-client/types/TickLabel.js.map +1 -0
- package/dist/whirlpools-client/types/WhirlpoolBumps.d.ts +21 -0
- package/dist/whirlpools-client/types/WhirlpoolBumps.js +61 -0
- package/dist/whirlpools-client/types/WhirlpoolBumps.js.map +1 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.d.ts +43 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.js +92 -0
- package/dist/whirlpools-client/types/WhirlpoolRewardInfo.js.map +1 -0
- package/dist/whirlpools-client/types/index.d.ts +32 -0
- package/dist/whirlpools-client/types/index.js +51 -0
- package/dist/whirlpools-client/types/index.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PricePercentageRebalanceTypeName = void 0;
|
|
7
|
+
exports.getPricePercentageRebalanceFieldInfos = getPricePercentageRebalanceFieldInfos;
|
|
8
|
+
exports.getPositionRangeFromPercentageRebalanceParams = getPositionRangeFromPercentageRebalanceParams;
|
|
9
|
+
exports.getDefaultPricePercentageRebalanceFieldInfos = getDefaultPricePercentageRebalanceFieldInfos;
|
|
10
|
+
exports.readPricePercentageRebalanceParamsFromStrategy = readPricePercentageRebalanceParamsFromStrategy;
|
|
11
|
+
exports.readRawPricePercentageRebalanceStateFromStrategy = readRawPricePercentageRebalanceStateFromStrategy;
|
|
12
|
+
exports.readPricePercentageRebalanceStateFromStrategy = readPricePercentageRebalanceStateFromStrategy;
|
|
13
|
+
exports.deserializePricePercentageRebalanceFromOnchainParams = deserializePricePercentageRebalanceFromOnchainParams;
|
|
14
|
+
exports.deserializePricePercentageRebalanceWithStateOverride = deserializePricePercentageRebalanceWithStateOverride;
|
|
15
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
16
|
+
const CreationParameters_1 = require("../utils/CreationParameters");
|
|
17
|
+
const consts_1 = require("./consts");
|
|
18
|
+
const utils_1 = require("../utils");
|
|
19
|
+
const utils_2 = require("./utils");
|
|
20
|
+
const whirlpool_sdk_1 = require("@orca-so/whirlpool-sdk");
|
|
21
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
22
|
+
const math_utils_1 = require("./math_utils");
|
|
23
|
+
const meteora_1 = require("../utils/meteora");
|
|
24
|
+
exports.PricePercentageRebalanceTypeName = 'pricePercentage';
|
|
25
|
+
function getPricePercentageRebalanceFieldInfos(poolPrice, lowerPercentageBPS, upperPercentageBPS, enabled = true) {
|
|
26
|
+
const rebalanceType = {
|
|
27
|
+
label: consts_1.RebalanceTypeLabelName,
|
|
28
|
+
type: 'string',
|
|
29
|
+
value: exports.PricePercentageRebalanceTypeName,
|
|
30
|
+
enabled,
|
|
31
|
+
};
|
|
32
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
33
|
+
label: 'lowerRangeBps',
|
|
34
|
+
type: 'number',
|
|
35
|
+
value: lowerPercentageBPS,
|
|
36
|
+
enabled,
|
|
37
|
+
};
|
|
38
|
+
const upperBpsRebalanceFieldInfo = {
|
|
39
|
+
label: 'upperRangeBps',
|
|
40
|
+
type: 'number',
|
|
41
|
+
value: upperPercentageBPS,
|
|
42
|
+
enabled,
|
|
43
|
+
};
|
|
44
|
+
const { lowerPrice, upperPrice } = getPositionRangeFromPercentageRebalanceParams(poolPrice, lowerPercentageBPS, upperPercentageBPS);
|
|
45
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
46
|
+
label: 'rangePriceLower',
|
|
47
|
+
type: 'number',
|
|
48
|
+
value: lowerPrice,
|
|
49
|
+
enabled: false,
|
|
50
|
+
};
|
|
51
|
+
const upperRangeRebalanceFieldInfo = {
|
|
52
|
+
label: 'rangePriceUpper',
|
|
53
|
+
type: 'number',
|
|
54
|
+
value: upperPrice,
|
|
55
|
+
enabled: false,
|
|
56
|
+
};
|
|
57
|
+
return [
|
|
58
|
+
rebalanceType,
|
|
59
|
+
lowerBpsRebalanceFieldInfo,
|
|
60
|
+
upperBpsRebalanceFieldInfo,
|
|
61
|
+
lowerRangeRebalanceFieldInfo,
|
|
62
|
+
upperRangeRebalanceFieldInfo,
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
function getPositionRangeFromPercentageRebalanceParams(price, lowerPercentageBPS, upperPercentageBPS) {
|
|
66
|
+
return (0, math_utils_1.getPriceRangeFromPriceAndDiffBPS)(price, lowerPercentageBPS, upperPercentageBPS);
|
|
67
|
+
}
|
|
68
|
+
function getDefaultPricePercentageRebalanceFieldInfos(price) {
|
|
69
|
+
const fieldInfos = getPricePercentageRebalanceFieldInfos(price, CreationParameters_1.DefaultLowerPercentageBPSDecimal, CreationParameters_1.DefaultUpperPercentageBPSDecimal);
|
|
70
|
+
return fieldInfos;
|
|
71
|
+
}
|
|
72
|
+
function readPricePercentageRebalanceParamsFromStrategy(rebalanceRaw) {
|
|
73
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
74
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
75
|
+
label: 'lowerRangeBps',
|
|
76
|
+
type: 'number',
|
|
77
|
+
value: new decimal_js_1.default(paramsBuffer.readUint16LE(0)),
|
|
78
|
+
enabled: true,
|
|
79
|
+
};
|
|
80
|
+
const upperBpsRebalanceFieldInfo = {
|
|
81
|
+
label: 'upperRangeBps',
|
|
82
|
+
type: 'number',
|
|
83
|
+
value: new decimal_js_1.default(paramsBuffer.readUint16LE(2)),
|
|
84
|
+
enabled: true,
|
|
85
|
+
};
|
|
86
|
+
return [lowerBpsRebalanceFieldInfo, upperBpsRebalanceFieldInfo];
|
|
87
|
+
}
|
|
88
|
+
function readRawPricePercentageRebalanceStateFromStrategy(rebalanceRaw) {
|
|
89
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
90
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
91
|
+
label: 'rangePriceLower',
|
|
92
|
+
type: 'number',
|
|
93
|
+
value: new decimal_js_1.default((0, utils_1.readBigUint128LE)(stateBuffer, 0).toString()),
|
|
94
|
+
enabled: false,
|
|
95
|
+
};
|
|
96
|
+
const upperRangeRebalanceFieldInfo = {
|
|
97
|
+
label: 'rangePriceUpper',
|
|
98
|
+
type: 'number',
|
|
99
|
+
value: new decimal_js_1.default((0, utils_1.readBigUint128LE)(stateBuffer, 16).toString()),
|
|
100
|
+
enabled: false,
|
|
101
|
+
};
|
|
102
|
+
return [lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];
|
|
103
|
+
}
|
|
104
|
+
function readPricePercentageRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw) {
|
|
105
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
106
|
+
const lowerSqrtPriceX64 = (0, utils_1.readBigUint128LE)(stateBuffer, 0).toString();
|
|
107
|
+
const upperSqrtPriceX64 = (0, utils_1.readBigUint128LE)(stateBuffer, 16).toString();
|
|
108
|
+
let lowerPrice, upperPrice;
|
|
109
|
+
if (dex == 'ORCA') {
|
|
110
|
+
lowerPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
111
|
+
upperPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
112
|
+
}
|
|
113
|
+
else if (dex == 'RAYDIUM') {
|
|
114
|
+
lowerPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
115
|
+
upperPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
116
|
+
}
|
|
117
|
+
else if (dex == 'METEORA') {
|
|
118
|
+
lowerPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
119
|
+
upperPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new Error(`Unknown DEX ${dex}`);
|
|
123
|
+
}
|
|
124
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
125
|
+
label: 'rangePriceLower',
|
|
126
|
+
type: 'number',
|
|
127
|
+
value: lowerPrice,
|
|
128
|
+
enabled: false,
|
|
129
|
+
};
|
|
130
|
+
const upperRangeRebalanceFieldInfo = {
|
|
131
|
+
label: 'rangePriceUpper',
|
|
132
|
+
type: 'number',
|
|
133
|
+
value: upperPrice,
|
|
134
|
+
enabled: false,
|
|
135
|
+
};
|
|
136
|
+
return [lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];
|
|
137
|
+
}
|
|
138
|
+
function deserializePricePercentageRebalanceFromOnchainParams(price, rebalanceRaw) {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
const params = readPricePercentageRebalanceParamsFromStrategy(rebalanceRaw);
|
|
141
|
+
const lowerRangeBPS = new decimal_js_1.default((_a = params.find((param) => param.label == 'lowerRangeBps')) === null || _a === void 0 ? void 0 : _a.value);
|
|
142
|
+
const upperRangeBPS = new decimal_js_1.default((_b = params.find((param) => param.label == 'upperRangeBps')) === null || _b === void 0 ? void 0 : _b.value);
|
|
143
|
+
return getPricePercentageRebalanceFieldInfos(price, lowerRangeBPS, upperRangeBPS);
|
|
144
|
+
}
|
|
145
|
+
function deserializePricePercentageRebalanceWithStateOverride(dex, tokenADecimals, tokenBDecimals, price, rebalanceRaw) {
|
|
146
|
+
const stateFields = readPricePercentageRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw);
|
|
147
|
+
const fields = deserializePricePercentageRebalanceFromOnchainParams(price, rebalanceRaw);
|
|
148
|
+
return (0, utils_2.upsertManyRebalanceFieldInfos)(fields, stateFields);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=pricePercentageRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricePercentageRebalance.js","sourceRoot":"","sources":["../../src/rebalance_methods/pricePercentageRebalance.ts"],"names":[],"mappings":";;;;;;AAcA,sFAkDC;AAED,sGAMC;AAED,oGAOC;AAED,wGAiBC;AAED,4GAgBC;AAED,sGAsCC;AAED,oHASC;AAED,oHAYC;AAvLD,4DAAiC;AAEjC,oEAAiH;AAEjH,qCAAkD;AAClD,oCAAiD;AACjD,mCAAwD;AACxD,0DAA6D;AAC7D,kDAAuB;AACvB,6CAAgE;AAChE,8CAAwD;AAE3C,QAAA,gCAAgC,GAAG,iBAAiB,CAAC;AAElE,SAAgB,qCAAqC,CACnD,SAAkB,EAClB,kBAA2B,EAC3B,kBAA2B,EAC3B,UAAmB,IAAI;IAEvB,MAAM,aAAa,GAAuB;QACxC,KAAK,EAAE,+BAAsB;QAC7B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,wCAAgC;QACvC,OAAO;KACR,CAAC;IACF,MAAM,0BAA0B,GAAuB;QACrD,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,kBAAkB;QACzB,OAAO;KACR,CAAC;IACF,MAAM,0BAA0B,GAAuB;QACrD,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,kBAAkB;QACzB,OAAO;KACR,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,6CAA6C,CAC9E,SAAS,EACT,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;IACF,MAAM,4BAA4B,GAAuB;QACvD,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,UAAW;QAClB,OAAO,EAAE,KAAK;KACf,CAAC;IACF,MAAM,4BAA4B,GAAuB;QACvD,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,UAAW;QAClB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,OAAO;QACL,aAAa;QACb,0BAA0B;QAC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E,KAAM,CAAC,CAAC;IAClG,OAAO,qCAAqC,CAAC,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;AACpF,CAAC;AAED,SAAgB,oDAAoD,CAClE,GAAQ,EACR,cAAsB,EACtB,cAAsB,EACtB,KAAc,EACd,YAA0B;IAE1B,MAAM,WAAW,GAAG,6CAA6C,CAAC,GAAG,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAErH,MAAM,MAAM,GAAG,oDAAoD,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAEzF,OAAO,IAAA,qCAA6B,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { PositionRange, RebalanceFieldInfo } from '../utils/types';\nimport { DefaultLowerPercentageBPSDecimal, DefaultUpperPercentageBPSDecimal } from '../utils/CreationParameters';\nimport { RebalanceRaw } from '../kamino-client/types';\nimport { RebalanceTypeLabelName } from './consts';\nimport { Dex, readBigUint128LE } from '../utils';\nimport { upsertManyRebalanceFieldInfos } from './utils';\nimport { sqrtPriceX64ToPrice } from '@orca-so/whirlpool-sdk';\nimport BN from 'bn.js';\nimport { getPriceRangeFromPriceAndDiffBPS } from './math_utils';\nimport { getPriceFromQ64Price } from '../utils/meteora';\n\nexport const PricePercentageRebalanceTypeName = 'pricePercentage';\n\nexport function getPricePercentageRebalanceFieldInfos(\n poolPrice: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal,\n enabled: boolean = true\n): RebalanceFieldInfo[] {\n const rebalanceType: RebalanceFieldInfo = {\n label: RebalanceTypeLabelName,\n type: 'string',\n value: PricePercentageRebalanceTypeName,\n enabled,\n };\n const lowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lowerRangeBps',\n type: 'number',\n value: lowerPercentageBPS,\n enabled,\n };\n const upperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'upperRangeBps',\n type: 'number',\n value: upperPercentageBPS,\n enabled,\n };\n\n const { lowerPrice, upperPrice } = getPositionRangeFromPercentageRebalanceParams(\n poolPrice,\n lowerPercentageBPS,\n upperPercentageBPS\n );\n const lowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: lowerPrice!,\n enabled: false,\n };\n const upperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: upperPrice!,\n enabled: false,\n };\n\n return [\n rebalanceType,\n lowerBpsRebalanceFieldInfo,\n upperBpsRebalanceFieldInfo,\n lowerRangeRebalanceFieldInfo,\n upperRangeRebalanceFieldInfo,\n ];\n}\n\nexport function getPositionRangeFromPercentageRebalanceParams(\n price: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal\n): PositionRange {\n return getPriceRangeFromPriceAndDiffBPS(price, lowerPercentageBPS, upperPercentageBPS);\n}\n\nexport function getDefaultPricePercentageRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[] {\n const fieldInfos = getPricePercentageRebalanceFieldInfos(\n price,\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal\n );\n return fieldInfos;\n}\n\nexport function readPricePercentageRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[] {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n\n const lowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lowerRangeBps',\n type: 'number',\n value: new Decimal(paramsBuffer.readUint16LE(0)),\n enabled: true,\n };\n const upperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'upperRangeBps',\n type: 'number',\n value: new Decimal(paramsBuffer.readUint16LE(2)),\n enabled: true,\n };\n\n return [lowerBpsRebalanceFieldInfo, upperBpsRebalanceFieldInfo];\n}\n\nexport function readRawPricePercentageRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[] {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n\n const lowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: new Decimal(readBigUint128LE(stateBuffer, 0).toString()),\n enabled: false,\n };\n const upperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: new Decimal(readBigUint128LE(stateBuffer, 16).toString()),\n enabled: false,\n };\n return [lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];\n}\n\nexport function readPricePercentageRebalanceStateFromStrategy(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n\n const lowerSqrtPriceX64 = readBigUint128LE(stateBuffer, 0).toString();\n const upperSqrtPriceX64 = readBigUint128LE(stateBuffer, 16).toString();\n let lowerPrice: Decimal, upperPrice: Decimal;\n\n if (dex == 'ORCA') {\n lowerPrice = sqrtPriceX64ToPrice(new BN(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n upperPrice = sqrtPriceX64ToPrice(new BN(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else if (dex == 'RAYDIUM') {\n lowerPrice = sqrtPriceX64ToPrice(new BN(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n upperPrice = sqrtPriceX64ToPrice(new BN(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else if (dex == 'METEORA') {\n lowerPrice = getPriceFromQ64Price(new Decimal(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n upperPrice = getPriceFromQ64Price(new Decimal(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else {\n throw new Error(`Unknown DEX ${dex}`);\n }\n\n const lowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: lowerPrice,\n enabled: false,\n };\n const upperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: upperPrice,\n enabled: false,\n };\n return [lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];\n}\n\nexport function deserializePricePercentageRebalanceFromOnchainParams(\n price: Decimal,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const params = readPricePercentageRebalanceParamsFromStrategy(rebalanceRaw);\n\n const lowerRangeBPS = new Decimal(params.find((param) => param.label == 'lowerRangeBps')?.value!);\n const upperRangeBPS = new Decimal(params.find((param) => param.label == 'upperRangeBps')?.value!);\n return getPricePercentageRebalanceFieldInfos(price, lowerRangeBPS, upperRangeBPS);\n}\n\nexport function deserializePricePercentageRebalanceWithStateOverride(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n price: Decimal,\n rebalanceRaw: RebalanceRaw\n) {\n const stateFields = readPricePercentageRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw);\n\n const fields = deserializePricePercentageRebalanceFromOnchainParams(price, rebalanceRaw);\n\n return upsertManyRebalanceFieldInfos(fields, stateFields);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { PositionRange, RebalanceFieldInfo } from '../utils/types';
|
|
3
|
+
import { RebalanceRaw } from '../kamino-client/types';
|
|
4
|
+
import { Dex } from '../utils';
|
|
5
|
+
export declare const PricePercentageWithResetRebalanceTypeName = "pricePercentageWithReset";
|
|
6
|
+
export declare function getPricePercentageWithResetRebalanceFieldInfos(price: Decimal, lowerPercentageBPS: Decimal, upperPercentageBPS: Decimal, resetLowerPercentageBPS: Decimal, resetUpperPercentageBPS: Decimal, enabled?: boolean): RebalanceFieldInfo[];
|
|
7
|
+
export declare function getPositionRangeFromPricePercentageWithResetParams(price: Decimal, lowerPercentageBPS: Decimal, upperPercentageBPS: Decimal): PositionRange;
|
|
8
|
+
export declare function getPositionResetRangeFromPricePercentageWithResetParams(price: Decimal, lowerPercentageBPS: Decimal, upperPercentageBPS: Decimal, resetLowerPercentageBPS: Decimal, resetUpperPercentageBPS: Decimal): PositionRange;
|
|
9
|
+
export declare function getDefaultPricePercentageWithResetRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[];
|
|
10
|
+
export declare function readPricePercentageWithResetRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
11
|
+
export declare function readRawPricePercentageWithResetRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
12
|
+
export declare function readPricePercentageWithResetRebalanceStateFromStrategy(dex: Dex, tokenADecimals: number, tokenBDecimals: number, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
13
|
+
export declare function deserializePricePercentageWithResetRebalanceFromOnchainParams(price: Decimal, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
14
|
+
export declare function deserializePricePercentageWithResetRebalanceWithStateOverride(dex: Dex, tokenADecimals: number, tokenBDecimals: number, price: Decimal, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PricePercentageWithResetRebalanceTypeName = void 0;
|
|
7
|
+
exports.getPricePercentageWithResetRebalanceFieldInfos = getPricePercentageWithResetRebalanceFieldInfos;
|
|
8
|
+
exports.getPositionRangeFromPricePercentageWithResetParams = getPositionRangeFromPricePercentageWithResetParams;
|
|
9
|
+
exports.getPositionResetRangeFromPricePercentageWithResetParams = getPositionResetRangeFromPricePercentageWithResetParams;
|
|
10
|
+
exports.getDefaultPricePercentageWithResetRebalanceFieldInfos = getDefaultPricePercentageWithResetRebalanceFieldInfos;
|
|
11
|
+
exports.readPricePercentageWithResetRebalanceParamsFromStrategy = readPricePercentageWithResetRebalanceParamsFromStrategy;
|
|
12
|
+
exports.readRawPricePercentageWithResetRebalanceStateFromStrategy = readRawPricePercentageWithResetRebalanceStateFromStrategy;
|
|
13
|
+
exports.readPricePercentageWithResetRebalanceStateFromStrategy = readPricePercentageWithResetRebalanceStateFromStrategy;
|
|
14
|
+
exports.deserializePricePercentageWithResetRebalanceFromOnchainParams = deserializePricePercentageWithResetRebalanceFromOnchainParams;
|
|
15
|
+
exports.deserializePricePercentageWithResetRebalanceWithStateOverride = deserializePricePercentageWithResetRebalanceWithStateOverride;
|
|
16
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
|
+
const CreationParameters_1 = require("../utils/CreationParameters");
|
|
18
|
+
const consts_1 = require("./consts");
|
|
19
|
+
const utils_1 = require("../utils");
|
|
20
|
+
const whirlpool_sdk_1 = require("@orca-so/whirlpool-sdk");
|
|
21
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
22
|
+
const utils_2 = require("./utils");
|
|
23
|
+
const math_utils_1 = require("./math_utils");
|
|
24
|
+
const meteora_1 = require("../utils/meteora");
|
|
25
|
+
exports.PricePercentageWithResetRebalanceTypeName = 'pricePercentageWithReset';
|
|
26
|
+
function getPricePercentageWithResetRebalanceFieldInfos(price, lowerPercentageBPS, upperPercentageBPS, resetLowerPercentageBPS, resetUpperPercentageBPS, enabled = true) {
|
|
27
|
+
const rebalanceType = {
|
|
28
|
+
label: consts_1.RebalanceTypeLabelName,
|
|
29
|
+
type: 'string',
|
|
30
|
+
value: exports.PricePercentageWithResetRebalanceTypeName,
|
|
31
|
+
enabled,
|
|
32
|
+
};
|
|
33
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
34
|
+
label: 'lowerRangeBps',
|
|
35
|
+
type: 'number',
|
|
36
|
+
value: lowerPercentageBPS,
|
|
37
|
+
enabled,
|
|
38
|
+
};
|
|
39
|
+
const upperBpsRebalanceFieldInfo = {
|
|
40
|
+
label: 'upperRangeBps',
|
|
41
|
+
type: 'number',
|
|
42
|
+
value: upperPercentageBPS,
|
|
43
|
+
enabled,
|
|
44
|
+
};
|
|
45
|
+
const resetLowerBpsRebalanceFieldInfo = {
|
|
46
|
+
label: 'resetLowerRangeBps',
|
|
47
|
+
type: 'number',
|
|
48
|
+
value: resetLowerPercentageBPS,
|
|
49
|
+
enabled,
|
|
50
|
+
};
|
|
51
|
+
const resetUpperBpsRebalanceFieldInfo = {
|
|
52
|
+
label: 'resetUpperRangeBps',
|
|
53
|
+
type: 'number',
|
|
54
|
+
value: resetUpperPercentageBPS,
|
|
55
|
+
enabled,
|
|
56
|
+
};
|
|
57
|
+
const { lowerPrice, upperPrice } = getPositionRangeFromPricePercentageWithResetParams(price, lowerPercentageBPS, upperPercentageBPS);
|
|
58
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
59
|
+
label: 'rangePriceLower',
|
|
60
|
+
type: 'number',
|
|
61
|
+
value: lowerPrice,
|
|
62
|
+
enabled: false,
|
|
63
|
+
};
|
|
64
|
+
const upperRangeRebalanceFieldInfo = {
|
|
65
|
+
label: 'rangePriceUpper',
|
|
66
|
+
type: 'number',
|
|
67
|
+
value: upperPrice,
|
|
68
|
+
enabled: false,
|
|
69
|
+
};
|
|
70
|
+
const { lowerPrice: resetLowerPrice, upperPrice: resetUpperPrice } = getPositionResetRangeFromPricePercentageWithResetParams(price, lowerPercentageBPS, upperPercentageBPS, resetLowerPercentageBPS, resetUpperPercentageBPS);
|
|
71
|
+
const resetLowerRangeRebalanceFieldInfo = {
|
|
72
|
+
label: 'resetPriceLower',
|
|
73
|
+
type: 'number',
|
|
74
|
+
value: resetLowerPrice,
|
|
75
|
+
enabled: false,
|
|
76
|
+
};
|
|
77
|
+
const resetUpperRangeRebalanceFieldInfo = {
|
|
78
|
+
label: 'resetPriceUpper',
|
|
79
|
+
type: 'number',
|
|
80
|
+
value: resetUpperPrice,
|
|
81
|
+
enabled: false,
|
|
82
|
+
};
|
|
83
|
+
return [
|
|
84
|
+
rebalanceType,
|
|
85
|
+
lowerBpsRebalanceFieldInfo,
|
|
86
|
+
upperBpsRebalanceFieldInfo,
|
|
87
|
+
resetLowerBpsRebalanceFieldInfo,
|
|
88
|
+
resetUpperBpsRebalanceFieldInfo,
|
|
89
|
+
lowerRangeRebalanceFieldInfo,
|
|
90
|
+
upperRangeRebalanceFieldInfo,
|
|
91
|
+
resetLowerRangeRebalanceFieldInfo,
|
|
92
|
+
resetUpperRangeRebalanceFieldInfo,
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
function getPositionRangeFromPricePercentageWithResetParams(price, lowerPercentageBPS, upperPercentageBPS) {
|
|
96
|
+
return (0, math_utils_1.getPriceRangeFromPriceAndDiffBPS)(price, lowerPercentageBPS, upperPercentageBPS);
|
|
97
|
+
}
|
|
98
|
+
function getPositionResetRangeFromPricePercentageWithResetParams(price, lowerPercentageBPS, upperPercentageBPS, resetLowerPercentageBPS, resetUpperPercentageBPS) {
|
|
99
|
+
return (0, math_utils_1.getResetRangeFromPriceAndDiffBPS)(price, lowerPercentageBPS, upperPercentageBPS, resetLowerPercentageBPS, resetUpperPercentageBPS);
|
|
100
|
+
}
|
|
101
|
+
function getDefaultPricePercentageWithResetRebalanceFieldInfos(price) {
|
|
102
|
+
const fieldInfos = getPricePercentageWithResetRebalanceFieldInfos(price, CreationParameters_1.DefaultLowerPercentageBPSDecimal, CreationParameters_1.DefaultUpperPercentageBPSDecimal, CreationParameters_1.DefaultLowerPercentageBPSDecimal, CreationParameters_1.DefaultUpperPercentageBPSDecimal);
|
|
103
|
+
return fieldInfos;
|
|
104
|
+
}
|
|
105
|
+
function readPricePercentageWithResetRebalanceParamsFromStrategy(rebalanceRaw) {
|
|
106
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
107
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
108
|
+
label: 'lowerRangeBps',
|
|
109
|
+
type: 'number',
|
|
110
|
+
value: new decimal_js_1.default(paramsBuffer.readUint16LE(0)),
|
|
111
|
+
enabled: true,
|
|
112
|
+
};
|
|
113
|
+
const upperBpsRebalanceFieldInfo = {
|
|
114
|
+
label: 'upperRangeBps',
|
|
115
|
+
type: 'number',
|
|
116
|
+
value: new decimal_js_1.default(paramsBuffer.readUint16LE(2)),
|
|
117
|
+
enabled: true,
|
|
118
|
+
};
|
|
119
|
+
const resetLowerBpsRebalanceFieldInfo = {
|
|
120
|
+
label: 'resetLowerRangeBps',
|
|
121
|
+
type: 'number',
|
|
122
|
+
value: new decimal_js_1.default(paramsBuffer.readUint16LE(4)),
|
|
123
|
+
enabled: true,
|
|
124
|
+
};
|
|
125
|
+
const resetUpperBpsRebalanceFieldInfo = {
|
|
126
|
+
label: 'resetUpperRangeBps',
|
|
127
|
+
type: 'number',
|
|
128
|
+
value: new decimal_js_1.default(paramsBuffer.readUint16LE(6)),
|
|
129
|
+
enabled: true,
|
|
130
|
+
};
|
|
131
|
+
return [
|
|
132
|
+
lowerBpsRebalanceFieldInfo,
|
|
133
|
+
upperBpsRebalanceFieldInfo,
|
|
134
|
+
resetLowerBpsRebalanceFieldInfo,
|
|
135
|
+
resetUpperBpsRebalanceFieldInfo,
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
function readRawPricePercentageWithResetRebalanceStateFromStrategy(rebalanceRaw) {
|
|
139
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
140
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
141
|
+
label: 'lastRebalanceLowerResetPoolPrice',
|
|
142
|
+
type: 'number',
|
|
143
|
+
value: new decimal_js_1.default((0, utils_1.readBigUint128LE)(stateBuffer, 0).toString()),
|
|
144
|
+
enabled: false,
|
|
145
|
+
};
|
|
146
|
+
const upperRangeRebalanceFieldInfo = {
|
|
147
|
+
label: 'lastRebalanceUpperResetPoolPrice',
|
|
148
|
+
type: 'number',
|
|
149
|
+
value: new decimal_js_1.default((0, utils_1.readBigUint128LE)(stateBuffer, 16).toString()),
|
|
150
|
+
enabled: false,
|
|
151
|
+
};
|
|
152
|
+
return [lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];
|
|
153
|
+
}
|
|
154
|
+
function readPricePercentageWithResetRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw) {
|
|
155
|
+
var _a, _b, _c, _d;
|
|
156
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
157
|
+
const params = readPricePercentageWithResetRebalanceParamsFromStrategy(rebalanceRaw);
|
|
158
|
+
const lowerRangeBps = new decimal_js_1.default((_a = params.find((param) => param.label == 'lowerRangeBps')) === null || _a === void 0 ? void 0 : _a.value.toString());
|
|
159
|
+
const upperRangeBps = new decimal_js_1.default((_b = params.find((param) => param.label == 'upperRangeBps')) === null || _b === void 0 ? void 0 : _b.value.toString());
|
|
160
|
+
const resetLowerRangeBps = new decimal_js_1.default((_c = params.find((param) => param.label == 'resetLowerRangeBps')) === null || _c === void 0 ? void 0 : _c.value.toString());
|
|
161
|
+
const resetUpperRangeBps = new decimal_js_1.default((_d = params.find((param) => param.label == 'resetUpperRangeBps')) === null || _d === void 0 ? void 0 : _d.value.toString());
|
|
162
|
+
const lowerResetSqrtPriceX64 = (0, utils_1.readBigUint128LE)(stateBuffer, 0).toString();
|
|
163
|
+
const upperResetSqrtPriceX64 = (0, utils_1.readBigUint128LE)(stateBuffer, 16).toString();
|
|
164
|
+
let lowerResetPrice, upperResetPrice;
|
|
165
|
+
if (dex == 'ORCA') {
|
|
166
|
+
lowerResetPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(lowerResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
167
|
+
upperResetPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(upperResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
168
|
+
}
|
|
169
|
+
else if (dex == 'RAYDIUM') {
|
|
170
|
+
lowerResetPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(lowerResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
171
|
+
upperResetPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(upperResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
172
|
+
}
|
|
173
|
+
else if (dex == 'METEORA') {
|
|
174
|
+
lowerResetPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(lowerResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
175
|
+
upperResetPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(upperResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
throw new Error(`Unknown DEX ${dex}`);
|
|
179
|
+
}
|
|
180
|
+
const resetLowerFactor = resetLowerRangeBps.mul(lowerRangeBps).div(CreationParameters_1.FullBPSDecimal);
|
|
181
|
+
const resetUpperFactor = resetUpperRangeBps.mul(upperRangeBps).div(CreationParameters_1.FullBPSDecimal);
|
|
182
|
+
const lowerPositionPrice = lowerResetPrice
|
|
183
|
+
.mul(CreationParameters_1.FullBPSDecimal.sub(lowerRangeBps))
|
|
184
|
+
.div(CreationParameters_1.FullBPSDecimal.sub(resetLowerFactor));
|
|
185
|
+
const upperPositionPrice = upperResetPrice
|
|
186
|
+
.mul(CreationParameters_1.FullBPSDecimal.add(upperRangeBps))
|
|
187
|
+
.div(CreationParameters_1.FullBPSDecimal.add(resetUpperFactor));
|
|
188
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
189
|
+
label: 'rangePriceLower',
|
|
190
|
+
type: 'number',
|
|
191
|
+
value: lowerPositionPrice,
|
|
192
|
+
enabled: true,
|
|
193
|
+
};
|
|
194
|
+
const upperBpsRebalanceFieldInfo = {
|
|
195
|
+
label: 'rangePriceUpper',
|
|
196
|
+
type: 'number',
|
|
197
|
+
value: upperPositionPrice,
|
|
198
|
+
enabled: true,
|
|
199
|
+
};
|
|
200
|
+
const resetLowerBpsRebalanceFieldInfo = {
|
|
201
|
+
label: 'resetPriceLower',
|
|
202
|
+
type: 'number',
|
|
203
|
+
value: lowerResetPrice,
|
|
204
|
+
enabled: true,
|
|
205
|
+
};
|
|
206
|
+
const resetUpperBpsRebalanceFieldInfo = {
|
|
207
|
+
label: 'resetPriceUpper',
|
|
208
|
+
type: 'number',
|
|
209
|
+
value: upperResetPrice,
|
|
210
|
+
enabled: true,
|
|
211
|
+
};
|
|
212
|
+
return [
|
|
213
|
+
lowerBpsRebalanceFieldInfo,
|
|
214
|
+
upperBpsRebalanceFieldInfo,
|
|
215
|
+
resetLowerBpsRebalanceFieldInfo,
|
|
216
|
+
resetUpperBpsRebalanceFieldInfo,
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
function deserializePricePercentageWithResetRebalanceFromOnchainParams(price, rebalanceRaw) {
|
|
220
|
+
var _a, _b, _c, _d;
|
|
221
|
+
const params = readPricePercentageWithResetRebalanceParamsFromStrategy(rebalanceRaw);
|
|
222
|
+
const lowerRangeBps = new decimal_js_1.default((_a = params.find((param) => param.label == 'lowerRangeBps')) === null || _a === void 0 ? void 0 : _a.value.toString());
|
|
223
|
+
const upperRangeBps = new decimal_js_1.default((_b = params.find((param) => param.label == 'upperRangeBps')) === null || _b === void 0 ? void 0 : _b.value.toString());
|
|
224
|
+
const lowerResetRangeBps = new decimal_js_1.default((_c = params.find((param) => param.label == 'resetLowerRangeBps')) === null || _c === void 0 ? void 0 : _c.value.toString());
|
|
225
|
+
const upperResetRangeBps = new decimal_js_1.default((_d = params.find((param) => param.label == 'resetUpperRangeBps')) === null || _d === void 0 ? void 0 : _d.value.toString());
|
|
226
|
+
return getPricePercentageWithResetRebalanceFieldInfos(price, lowerRangeBps, upperRangeBps, lowerResetRangeBps, upperResetRangeBps);
|
|
227
|
+
}
|
|
228
|
+
function deserializePricePercentageWithResetRebalanceWithStateOverride(dex, tokenADecimals, tokenBDecimals, price, rebalanceRaw) {
|
|
229
|
+
const stateFields = readPricePercentageWithResetRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw);
|
|
230
|
+
const fields = deserializePricePercentageWithResetRebalanceFromOnchainParams(price, rebalanceRaw);
|
|
231
|
+
return (0, utils_2.upsertManyRebalanceFieldInfos)(fields, stateFields);
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=pricePercentageWithResetRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricePercentageWithResetRebalance.js","sourceRoot":"","sources":["../../src/rebalance_methods/pricePercentageWithResetRebalance.ts"],"names":[],"mappings":";;;;;;AAkBA,wGAyFC;AAED,gHAMC;AAED,0HAcC;AAED,sHASC;AAED,0HAoCC;AAED,8HAkBC;AAED,wHAmFC;AAED,sIAsBC;AAED,sIAiBC;AAxUD,4DAAiC;AAEjC,oEAIqC;AAErC,qCAAkD;AAClD,oCAAiD;AACjD,0DAA6D;AAC7D,kDAAuB;AACvB,mCAAwD;AACxD,6CAAkG;AAClG,8CAAwD;AAE3C,QAAA,yCAAyC,GAAG,0BAA0B,CAAC;AAEpF,SAAgB,8CAA8C,CAC5D,KAAc,EACd,kBAA2B,EAC3B,kBAA2B,EAC3B,uBAAgC,EAChC,uBAAgC,EAChC,UAAmB,IAAI;IAEvB,MAAM,aAAa,GAAuB;QACxC,KAAK,EAAE,+BAAsB;QAC7B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,iDAAyC;QAChD,OAAO;KACR,CAAC;IACF,MAAM,0BAA0B,GAAuB;QACrD,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,kBAAkB;QACzB,OAAO;KACR,CAAC;IACF,MAAM,0BAA0B,GAAuB;QACrD,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,KAAK,E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AC,KAAK,IAAI,oBAAoB,CAAC,0CAAE,KAAK,CAAC,QAAQ,EAAG,CAC/E,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAI,oBAAO,CACpC,MAAA,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,oBAAoB,CAAC,0CAAE,KAAK,CAAC,QAAQ,EAAG,CAC/E,CAAC;IAEF,OAAO,8CAA8C,CACnD,KAAK,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;AACJ,CAAC;AAED,SAAgB,6DAA6D,CAC3E,GAAQ,EACR,cAAsB,EACtB,cAAsB,EACtB,KAAc,EACd,YAA0B;IAE1B,MAAM,WAAW,GAAG,sDAAsD,CACxE,GAAG,EACH,cAAc,EACd,cAAc,EACd,YAAY,CACb,CAAC;IAEF,MAAM,MAAM,GAAG,6DAA6D,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAElG,OAAO,IAAA,qCAA6B,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { PositionRange, RebalanceFieldInfo } from '../utils/types';\nimport {\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal,\n FullBPSDecimal,\n} from '../utils/CreationParameters';\nimport { RebalanceRaw } from '../kamino-client/types';\nimport { RebalanceTypeLabelName } from './consts';\nimport { Dex, readBigUint128LE } from '../utils';\nimport { sqrtPriceX64ToPrice } from '@orca-so/whirlpool-sdk';\nimport BN from 'bn.js';\nimport { upsertManyRebalanceFieldInfos } from './utils';\nimport { getPriceRangeFromPriceAndDiffBPS, getResetRangeFromPriceAndDiffBPS } from './math_utils';\nimport { getPriceFromQ64Price } from '../utils/meteora';\n\nexport const PricePercentageWithResetRebalanceTypeName = 'pricePercentageWithReset';\n\nexport function getPricePercentageWithResetRebalanceFieldInfos(\n price: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal,\n resetLowerPercentageBPS: Decimal,\n resetUpperPercentageBPS: Decimal,\n enabled: boolean = true\n): RebalanceFieldInfo[] {\n const rebalanceType: RebalanceFieldInfo = {\n label: RebalanceTypeLabelName,\n type: 'string',\n value: PricePercentageWithResetRebalanceTypeName,\n enabled,\n };\n const lowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lowerRangeBps',\n type: 'number',\n value: lowerPercentageBPS,\n enabled,\n };\n const upperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'upperRangeBps',\n type: 'number',\n value: upperPercentageBPS,\n enabled,\n };\n const resetLowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetLowerRangeBps',\n type: 'number',\n value: resetLowerPercentageBPS,\n enabled,\n };\n const resetUpperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetUpperRangeBps',\n type: 'number',\n value: resetUpperPercentageBPS,\n enabled,\n };\n\n const { lowerPrice, upperPrice } = getPositionRangeFromPricePercentageWithResetParams(\n price,\n lowerPercentageBPS,\n upperPercentageBPS\n );\n const lowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: lowerPrice,\n enabled: false,\n };\n const upperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: upperPrice,\n enabled: false,\n };\n\n const { lowerPrice: resetLowerPrice, upperPrice: resetUpperPrice } =\n getPositionResetRangeFromPricePercentageWithResetParams(\n price,\n lowerPercentageBPS,\n upperPercentageBPS,\n resetLowerPercentageBPS,\n resetUpperPercentageBPS\n );\n const resetLowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetPriceLower',\n type: 'number',\n value: resetLowerPrice,\n enabled: false,\n };\n const resetUpperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetPriceUpper',\n type: 'number',\n value: resetUpperPrice,\n enabled: false,\n };\n\n return [\n rebalanceType,\n lowerBpsRebalanceFieldInfo,\n upperBpsRebalanceFieldInfo,\n resetLowerBpsRebalanceFieldInfo,\n resetUpperBpsRebalanceFieldInfo,\n lowerRangeRebalanceFieldInfo,\n upperRangeRebalanceFieldInfo,\n resetLowerRangeRebalanceFieldInfo,\n resetUpperRangeRebalanceFieldInfo,\n ];\n}\n\nexport function getPositionRangeFromPricePercentageWithResetParams(\n price: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal\n): PositionRange {\n return getPriceRangeFromPriceAndDiffBPS(price, lowerPercentageBPS, upperPercentageBPS);\n}\n\nexport function getPositionResetRangeFromPricePercentageWithResetParams(\n price: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal,\n resetLowerPercentageBPS: Decimal,\n resetUpperPercentageBPS: Decimal\n): PositionRange {\n return getResetRangeFromPriceAndDiffBPS(\n price,\n lowerPercentageBPS,\n upperPercentageBPS,\n resetLowerPercentageBPS,\n resetUpperPercentageBPS\n );\n}\n\nexport function getDefaultPricePercentageWithResetRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[] {\n const fieldInfos = getPricePercentageWithResetRebalanceFieldInfos(\n price,\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal,\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal\n );\n return fieldInfos;\n}\n\nexport function readPricePercentageWithResetRebalanceParamsFromStrategy(\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n\n const lowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lowerRangeBps',\n type: 'number',\n value: new Decimal(paramsBuffer.readUint16LE(0)),\n enabled: true,\n };\n const upperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'upperRangeBps',\n type: 'number',\n value: new Decimal(paramsBuffer.readUint16LE(2)),\n enabled: true,\n };\n const resetLowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetLowerRangeBps',\n type: 'number',\n value: new Decimal(paramsBuffer.readUint16LE(4)),\n enabled: true,\n };\n const resetUpperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetUpperRangeBps',\n type: 'number',\n value: new Decimal(paramsBuffer.readUint16LE(6)),\n enabled: true,\n };\n\n return [\n lowerBpsRebalanceFieldInfo,\n upperBpsRebalanceFieldInfo,\n resetLowerBpsRebalanceFieldInfo,\n resetUpperBpsRebalanceFieldInfo,\n ];\n}\n\nexport function readRawPricePercentageWithResetRebalanceStateFromStrategy(\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n\n const lowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lastRebalanceLowerResetPoolPrice',\n type: 'number',\n value: new Decimal(readBigUint128LE(stateBuffer, 0).toString()),\n enabled: false,\n };\n const upperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lastRebalanceUpperResetPoolPrice',\n type: 'number',\n value: new Decimal(readBigUint128LE(stateBuffer, 16).toString()),\n enabled: false,\n };\n return [lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];\n}\n\nexport function readPricePercentageWithResetRebalanceStateFromStrategy(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n const params = readPricePercentageWithResetRebalanceParamsFromStrategy(rebalanceRaw);\n const lowerRangeBps = new Decimal(params.find((param) => param.label == 'lowerRangeBps')?.value.toString()!);\n const upperRangeBps = new Decimal(params.find((param) => param.label == 'upperRangeBps')?.value!.toString()!);\n const resetLowerRangeBps = new Decimal(\n params.find((param) => param.label == 'resetLowerRangeBps')?.value.toString()!\n );\n const resetUpperRangeBps = new Decimal(\n params.find((param) => param.label == 'resetUpperRangeBps')?.value!.toString()!\n );\n\n const lowerResetSqrtPriceX64 = readBigUint128LE(stateBuffer, 0).toString();\n const upperResetSqrtPriceX64 = readBigUint128LE(stateBuffer, 16).toString();\n\n let lowerResetPrice: Decimal, upperResetPrice: Decimal;\n\n if (dex == 'ORCA') {\n lowerResetPrice = sqrtPriceX64ToPrice(new BN(lowerResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n upperResetPrice = sqrtPriceX64ToPrice(new BN(upperResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else if (dex == 'RAYDIUM') {\n lowerResetPrice = sqrtPriceX64ToPrice(new BN(lowerResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n upperResetPrice = sqrtPriceX64ToPrice(new BN(upperResetSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else if (dex == 'METEORA') {\n lowerResetPrice = getPriceFromQ64Price(\n new Decimal(lowerResetSqrtPriceX64.toString()),\n tokenADecimals,\n tokenBDecimals\n );\n upperResetPrice = getPriceFromQ64Price(\n new Decimal(upperResetSqrtPriceX64.toString()),\n tokenADecimals,\n tokenBDecimals\n );\n } else {\n throw new Error(`Unknown DEX ${dex}`);\n }\n\n const resetLowerFactor = resetLowerRangeBps.mul(lowerRangeBps).div(FullBPSDecimal);\n const resetUpperFactor = resetUpperRangeBps.mul(upperRangeBps).div(FullBPSDecimal);\n const lowerPositionPrice = lowerResetPrice\n .mul(FullBPSDecimal.sub(lowerRangeBps))\n .div(FullBPSDecimal.sub(resetLowerFactor));\n const upperPositionPrice = upperResetPrice\n .mul(FullBPSDecimal.add(upperRangeBps))\n .div(FullBPSDecimal.add(resetUpperFactor));\n\n const lowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: lowerPositionPrice,\n enabled: true,\n };\n const upperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: upperPositionPrice,\n enabled: true,\n };\n const resetLowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetPriceLower',\n type: 'number',\n value: lowerResetPrice,\n enabled: true,\n };\n const resetUpperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetPriceUpper',\n type: 'number',\n value: upperResetPrice,\n enabled: true,\n };\n\n return [\n lowerBpsRebalanceFieldInfo,\n upperBpsRebalanceFieldInfo,\n resetLowerBpsRebalanceFieldInfo,\n resetUpperBpsRebalanceFieldInfo,\n ];\n}\n\nexport function deserializePricePercentageWithResetRebalanceFromOnchainParams(\n price: Decimal,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const params = readPricePercentageWithResetRebalanceParamsFromStrategy(rebalanceRaw);\n\n const lowerRangeBps = new Decimal(params.find((param) => param.label == 'lowerRangeBps')?.value.toString()!);\n const upperRangeBps = new Decimal(params.find((param) => param.label == 'upperRangeBps')?.value.toString()!);\n const lowerResetRangeBps = new Decimal(\n params.find((param) => param.label == 'resetLowerRangeBps')?.value.toString()!\n );\n const upperResetRangeBps = new Decimal(\n params.find((param) => param.label == 'resetUpperRangeBps')?.value.toString()!\n );\n\n return getPricePercentageWithResetRebalanceFieldInfos(\n price,\n lowerRangeBps,\n upperRangeBps,\n lowerResetRangeBps,\n upperResetRangeBps\n );\n}\n\nexport function deserializePricePercentageWithResetRebalanceWithStateOverride(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n price: Decimal,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const stateFields = readPricePercentageWithResetRebalanceStateFromStrategy(\n dex,\n tokenADecimals,\n tokenBDecimals,\n rebalanceRaw\n );\n\n const fields = deserializePricePercentageWithResetRebalanceFromOnchainParams(price, rebalanceRaw);\n\n return upsertManyRebalanceFieldInfos(fields, stateFields);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { PositionRange, RebalanceFieldInfo, RebalanceFieldsDict } from '../utils/types';
|
|
3
|
+
import { Dex } from '../utils';
|
|
4
|
+
import { RebalanceRaw } from '../kamino-client/types';
|
|
5
|
+
export declare const DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS: Decimal;
|
|
6
|
+
export declare const DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS: Decimal;
|
|
7
|
+
export declare const DEFAULT_DESTINATION_TOKEN: Decimal;
|
|
8
|
+
export declare const TakeProfitRebalanceTypeName = "takeProfit";
|
|
9
|
+
export declare function getTakeProfitRebalanceFieldsInfos(lowerRangePrice: Decimal, upperRangePrice: Decimal, destinationToken: Decimal, enabled?: boolean): RebalanceFieldInfo[];
|
|
10
|
+
export declare function getPositionRangeFromTakeProfitParams(dex: Dex, tokenADecimals: number, tokenBDecimals: number, lowerSqrtPriceX64: Decimal, upperSqrtPriceX64: Decimal): PositionRange;
|
|
11
|
+
export declare function getDefaultTakeProfitRebalanceFieldsInfos(price: Decimal): RebalanceFieldInfo[];
|
|
12
|
+
export declare function readTakeProfitRebalanceParamsFromStrategy(tokenADecimals: number, tokenBDecimals: number, rebalanceRaw: RebalanceRaw): RebalanceFieldsDict;
|
|
13
|
+
export declare function readTakeProfitRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldsDict;
|
|
14
|
+
export declare function deserializeTakeProfitRebalanceFromOnchainParams(tokenADecimals: number, tokenBDecimals: number, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TakeProfitRebalanceTypeName = exports.DEFAULT_DESTINATION_TOKEN = exports.DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS = exports.DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS = void 0;
|
|
7
|
+
exports.getTakeProfitRebalanceFieldsInfos = getTakeProfitRebalanceFieldsInfos;
|
|
8
|
+
exports.getPositionRangeFromTakeProfitParams = getPositionRangeFromTakeProfitParams;
|
|
9
|
+
exports.getDefaultTakeProfitRebalanceFieldsInfos = getDefaultTakeProfitRebalanceFieldsInfos;
|
|
10
|
+
exports.readTakeProfitRebalanceParamsFromStrategy = readTakeProfitRebalanceParamsFromStrategy;
|
|
11
|
+
exports.readTakeProfitRebalanceStateFromStrategy = readTakeProfitRebalanceStateFromStrategy;
|
|
12
|
+
exports.deserializeTakeProfitRebalanceFromOnchainParams = deserializeTakeProfitRebalanceFromOnchainParams;
|
|
13
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
14
|
+
const CreationParameters_1 = require("../utils/CreationParameters");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
const whirlpool_sdk_1 = require("@orca-so/whirlpool-sdk");
|
|
17
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
18
|
+
const raydium_sdk_1 = require("@raydium-io/raydium-sdk");
|
|
19
|
+
const meteora_1 = require("../utils/meteora");
|
|
20
|
+
exports.DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS = new decimal_js_1.default(500);
|
|
21
|
+
exports.DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS = new decimal_js_1.default(500);
|
|
22
|
+
exports.DEFAULT_DESTINATION_TOKEN = new decimal_js_1.default(1);
|
|
23
|
+
exports.TakeProfitRebalanceTypeName = 'takeProfit';
|
|
24
|
+
function getTakeProfitRebalanceFieldsInfos(lowerRangePrice, upperRangePrice, destinationToken, enabled = true) {
|
|
25
|
+
const rebalanceType = {
|
|
26
|
+
label: 'rebalanceType',
|
|
27
|
+
type: 'string',
|
|
28
|
+
value: exports.TakeProfitRebalanceTypeName,
|
|
29
|
+
enabled,
|
|
30
|
+
};
|
|
31
|
+
const lowerRangePriceRebalanceFieldInfo = {
|
|
32
|
+
label: 'rangePriceLower',
|
|
33
|
+
type: 'number',
|
|
34
|
+
value: lowerRangePrice,
|
|
35
|
+
enabled,
|
|
36
|
+
};
|
|
37
|
+
const upperRangePriceRebalanceFieldInfo = {
|
|
38
|
+
label: 'rangePriceUpper',
|
|
39
|
+
type: 'number',
|
|
40
|
+
value: upperRangePrice,
|
|
41
|
+
enabled,
|
|
42
|
+
};
|
|
43
|
+
const destinationTokenRebalanceFieldInfo = {
|
|
44
|
+
label: 'destinationToken',
|
|
45
|
+
type: 'number',
|
|
46
|
+
value: destinationToken,
|
|
47
|
+
enabled,
|
|
48
|
+
};
|
|
49
|
+
return [
|
|
50
|
+
rebalanceType,
|
|
51
|
+
lowerRangePriceRebalanceFieldInfo,
|
|
52
|
+
upperRangePriceRebalanceFieldInfo,
|
|
53
|
+
destinationTokenRebalanceFieldInfo,
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
function getPositionRangeFromTakeProfitParams(dex, tokenADecimals, tokenBDecimals, lowerSqrtPriceX64, upperSqrtPriceX64) {
|
|
57
|
+
if (dex == 'ORCA') {
|
|
58
|
+
const lowerPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
59
|
+
const upperPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
60
|
+
return { lowerPrice, upperPrice };
|
|
61
|
+
}
|
|
62
|
+
else if (dex == 'RAYDIUM') {
|
|
63
|
+
const lowerPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
64
|
+
const upperPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
65
|
+
return { lowerPrice, upperPrice };
|
|
66
|
+
}
|
|
67
|
+
else if (dex == 'METEORA') {
|
|
68
|
+
const lowerPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
69
|
+
const upperPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
70
|
+
return { lowerPrice, upperPrice };
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error(`Unknown DEX ${dex}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function getDefaultTakeProfitRebalanceFieldsInfos(price) {
|
|
77
|
+
const lowerPrice = price.mul(CreationParameters_1.FullBPSDecimal.sub(exports.DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS)).div(CreationParameters_1.FullBPSDecimal);
|
|
78
|
+
const upperPrice = price.mul(CreationParameters_1.FullBPSDecimal.add(exports.DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS)).div(CreationParameters_1.FullBPSDecimal);
|
|
79
|
+
return getTakeProfitRebalanceFieldsInfos(lowerPrice, upperPrice, price);
|
|
80
|
+
}
|
|
81
|
+
function readTakeProfitRebalanceParamsFromStrategy(tokenADecimals, tokenBDecimals, rebalanceRaw) {
|
|
82
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
83
|
+
const params = {};
|
|
84
|
+
params['lowerRangePrice'] = raydium_sdk_1.SqrtPriceMath.sqrtPriceX64ToPrice(new bn_js_1.default((0, utils_1.readBigUint128LE)(paramsBuffer, 0).toString()), tokenADecimals, tokenBDecimals);
|
|
85
|
+
params['upperRangePrice'] = raydium_sdk_1.SqrtPriceMath.sqrtPriceX64ToPrice(new bn_js_1.default((0, utils_1.readBigUint128LE)(paramsBuffer, 16).toString()), tokenADecimals, tokenBDecimals);
|
|
86
|
+
params['destinationToken'] = new decimal_js_1.default(paramsBuffer.readUint8(32));
|
|
87
|
+
return params;
|
|
88
|
+
}
|
|
89
|
+
function readTakeProfitRebalanceStateFromStrategy(rebalanceRaw) {
|
|
90
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
91
|
+
const state = {};
|
|
92
|
+
state['step'] = new decimal_js_1.default(stateBuffer.readUInt8(0));
|
|
93
|
+
return state;
|
|
94
|
+
}
|
|
95
|
+
function deserializeTakeProfitRebalanceFromOnchainParams(tokenADecimals, tokenBDecimals, rebalanceRaw) {
|
|
96
|
+
const params = readTakeProfitRebalanceParamsFromStrategy(tokenADecimals, tokenBDecimals, rebalanceRaw);
|
|
97
|
+
return getTakeProfitRebalanceFieldsInfos(params['lowerRangePrice'], params['upperRangePrice'], params['destinationToken']);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=takeProfitRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"takeProfitRebalance.js","sourceRoot":"","sources":["../../src/rebalance_methods/takeProfitRebalance.ts"],"names":[],"mappings":";;;;;;AAeA,8EAqCC;AAED,oFAsBC;AAED,4FAKC;AAED,8FAqBC;AAED,4FAOC;AAED,0GAYC;AAjID,4DAAiC;AAEjC,oEAA6D;AAC7D,oCAAiD;AACjD,0DAA6D;AAC7D,kDAAuB;AAEvB,yDAAwD;AACxD,8CAAwD;AAE3C,QAAA,kCAAkC,GAAG,IAAI,oBAAO,CAAC,GAAG,CAAC,CAAC;AACtD,QAAA,kCAAkC,GAAG,IAAI,oBAAO,CAAC,GAAG,CAAC,CAAC;AACtD,QAAA,yBAAyB,GAAG,IAAI,oBAAO,CAAC,CAAC,CAAC,CAAC;AAC3C,QAAA,2BAA2B,GAAG,YAAY,CAAC;AAExD,SAAgB,iCAAiC,CAC/C,eAAwB,EACxB,eAAwB,EACxB,gBAAyB,EACzB,UAAmB,IAAI;IAEvB,MAAM,aAAa,GAAuB;QACxC,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,mCAA2B;QAClC,OAAO;KACR,CAAC;IACF,MAAM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ACpD,cAAc,EACd,cAAc,CACf,CAAC;IACF,MAAM,CAAC,iBAAiB,CAAC,GAAG,2BAAa,CAAC,mBAAmB,CAC3D,IAAI,eAAE,CAAC,IAAA,wBAAgB,EAAC,YAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,EACrD,cAAc,EACd,cAAc,CACf,CAAC;IACF,MAAM,CAAC,kBAAkB,CAAC,GAAG,IAAI,oBAAO,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAErE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,wCAAwC,CAAC,YAA0B;IACjF,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,KAAK,GAAwB,EAAE,CAAC;IAEtC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,oBAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,+CAA+C,CAC7D,cAAsB,EACtB,cAAsB,EACtB,YAA0B;IAE1B,MAAM,MAAM,GAAG,yCAAyC,CAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAEvG,OAAO,iCAAiC,CACtC,MAAM,CAAC,iBAAiB,CAAC,EACzB,MAAM,CAAC,iBAAiB,CAAC,EACzB,MAAM,CAAC,kBAAkB,CAAC,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { PositionRange, RebalanceFieldInfo, RebalanceFieldsDict } from '../utils/types';\nimport { FullBPSDecimal } from '../utils/CreationParameters';\nimport { Dex, readBigUint128LE } from '../utils';\nimport { sqrtPriceX64ToPrice } from '@orca-so/whirlpool-sdk';\nimport BN from 'bn.js';\nimport { RebalanceRaw } from '../kamino-client/types';\nimport { SqrtPriceMath } from '@raydium-io/raydium-sdk';\nimport { getPriceFromQ64Price } from '../utils/meteora';\n\nexport const DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS = new Decimal(500);\nexport const DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS = new Decimal(500);\nexport const DEFAULT_DESTINATION_TOKEN = new Decimal(1);\nexport const TakeProfitRebalanceTypeName = 'takeProfit';\n\nexport function getTakeProfitRebalanceFieldsInfos(\n lowerRangePrice: Decimal,\n upperRangePrice: Decimal,\n destinationToken: Decimal,\n enabled: boolean = true\n): RebalanceFieldInfo[] {\n const rebalanceType: RebalanceFieldInfo = {\n label: 'rebalanceType',\n type: 'string',\n value: TakeProfitRebalanceTypeName,\n enabled,\n };\n const lowerRangePriceRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: lowerRangePrice,\n enabled,\n };\n const upperRangePriceRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: upperRangePrice,\n enabled,\n };\n const destinationTokenRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'destinationToken',\n type: 'number',\n value: destinationToken,\n enabled,\n };\n\n return [\n rebalanceType,\n lowerRangePriceRebalanceFieldInfo,\n upperRangePriceRebalanceFieldInfo,\n destinationTokenRebalanceFieldInfo,\n ];\n}\n\nexport function getPositionRangeFromTakeProfitParams(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n lowerSqrtPriceX64: Decimal,\n upperSqrtPriceX64: Decimal\n): PositionRange {\n if (dex == 'ORCA') {\n const lowerPrice = sqrtPriceX64ToPrice(new BN(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n const upperPrice = sqrtPriceX64ToPrice(new BN(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n return { lowerPrice, upperPrice };\n } else if (dex == 'RAYDIUM') {\n const lowerPrice = sqrtPriceX64ToPrice(new BN(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n const upperPrice = sqrtPriceX64ToPrice(new BN(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n return { lowerPrice, upperPrice };\n } else if (dex == 'METEORA') {\n const lowerPrice = getPriceFromQ64Price(new Decimal(lowerSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n const upperPrice = getPriceFromQ64Price(new Decimal(upperSqrtPriceX64.toString()), tokenADecimals, tokenBDecimals);\n return { lowerPrice, upperPrice };\n } else {\n throw new Error(`Unknown DEX ${dex}`);\n }\n}\n\nexport function getDefaultTakeProfitRebalanceFieldsInfos(price: Decimal): RebalanceFieldInfo[] {\n const lowerPrice = price.mul(FullBPSDecimal.sub(DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS)).div(FullBPSDecimal);\n const upperPrice = price.mul(FullBPSDecimal.add(DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS)).div(FullBPSDecimal);\n\n return getTakeProfitRebalanceFieldsInfos(lowerPrice, upperPrice, price);\n}\n\nexport function readTakeProfitRebalanceParamsFromStrategy(\n tokenADecimals: number,\n tokenBDecimals: number,\n rebalanceRaw: RebalanceRaw\n) {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n const params: RebalanceFieldsDict = {};\n\n params['lowerRangePrice'] = SqrtPriceMath.sqrtPriceX64ToPrice(\n new BN(readBigUint128LE(paramsBuffer, 0).toString()),\n tokenADecimals,\n tokenBDecimals\n );\n params['upperRangePrice'] = SqrtPriceMath.sqrtPriceX64ToPrice(\n new BN(readBigUint128LE(paramsBuffer, 16).toString()),\n tokenADecimals,\n tokenBDecimals\n );\n params['destinationToken'] = new Decimal(paramsBuffer.readUint8(32));\n\n return params;\n}\n\nexport function readTakeProfitRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw) {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n const state: RebalanceFieldsDict = {};\n\n state['step'] = new Decimal(stateBuffer.readUInt8(0));\n\n return state;\n}\n\nexport function deserializeTakeProfitRebalanceFromOnchainParams(\n tokenADecimals: number,\n tokenBDecimals: number,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const params = readTakeProfitRebalanceParamsFromStrategy(tokenADecimals, tokenBDecimals, rebalanceRaw);\n\n return getTakeProfitRebalanceFieldsInfos(\n params['lowerRangePrice'],\n params['upperRangePrice'],\n params['destinationToken']\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { RebalanceTypeKind } from '../kamino-client/types';
|
|
3
|
+
import { RebalanceFieldInfo } from '../utils';
|
|
4
|
+
import { RebalanceMethod } from '../utils/CreationParameters';
|
|
5
|
+
export declare function getRebalanceTypeFromRebalanceFields(rebalanceFieldInfos: RebalanceFieldInfo[]): RebalanceTypeKind;
|
|
6
|
+
export declare function rebalanceTypeToRebalanceMethod(rebalanceType: RebalanceTypeKind): RebalanceMethod;
|
|
7
|
+
export declare function getRebalanceMethodFromRebalanceFields(rebalanceFieldInfos: RebalanceFieldInfo[]): RebalanceMethod;
|
|
8
|
+
export declare function upsertRebalanceFieldInfo(rebalanceFieldInfos: RebalanceFieldInfo[], newFieldInfo: RebalanceFieldInfo): RebalanceFieldInfo[];
|
|
9
|
+
export declare function upsertManyRebalanceFieldInfos(rebalanceFieldInfos: RebalanceFieldInfo[], newFieldInfos: RebalanceFieldInfo[]): RebalanceFieldInfo[];
|
|
10
|
+
export declare function extractPricesFromDeserializedState(state: RebalanceFieldInfo[]): [Decimal, Decimal];
|