@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,283 @@
|
|
|
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.ExpanderRebalanceTypeName = exports.DefaultSwapUnevenAllowed = exports.DefaultExpansionSizeBPS = exports.DefaultMaxNumberOfExpansions = void 0;
|
|
7
|
+
exports.getExpanderRebalanceFieldInfos = getExpanderRebalanceFieldInfos;
|
|
8
|
+
exports.getPositionRangeFromExpanderParams = getPositionRangeFromExpanderParams;
|
|
9
|
+
exports.getPositionResetRangeFromExpanderParams = getPositionResetRangeFromExpanderParams;
|
|
10
|
+
exports.getDefaultExpanderRebalanceFieldInfos = getDefaultExpanderRebalanceFieldInfos;
|
|
11
|
+
exports.readRawExpanderRebalanceParamsFromStrategy = readRawExpanderRebalanceParamsFromStrategy;
|
|
12
|
+
exports.readExpanderRebalanceParamsFromStrategy = readExpanderRebalanceParamsFromStrategy;
|
|
13
|
+
exports.readRawExpanderRebalanceStateFromStrategy = readRawExpanderRebalanceStateFromStrategy;
|
|
14
|
+
exports.readExpanderRebalanceStateFromStrategy = readExpanderRebalanceStateFromStrategy;
|
|
15
|
+
exports.readExpanderRebalanceFieldInfosFromStrategy = readExpanderRebalanceFieldInfosFromStrategy;
|
|
16
|
+
exports.deserializeExpanderRebalanceWithStateOverride = deserializeExpanderRebalanceWithStateOverride;
|
|
17
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
18
|
+
const CreationParameters_1 = require("../utils/CreationParameters");
|
|
19
|
+
const consts_1 = require("./consts");
|
|
20
|
+
const utils_1 = require("../utils");
|
|
21
|
+
const whirlpool_sdk_1 = require("@orca-so/whirlpool-sdk");
|
|
22
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
23
|
+
const utils_2 = require("./utils");
|
|
24
|
+
const math_utils_1 = require("./math_utils");
|
|
25
|
+
const meteora_1 = require("../utils/meteora");
|
|
26
|
+
exports.DefaultMaxNumberOfExpansions = new decimal_js_1.default(10);
|
|
27
|
+
exports.DefaultExpansionSizeBPS = new decimal_js_1.default(100);
|
|
28
|
+
exports.DefaultSwapUnevenAllowed = new decimal_js_1.default(1);
|
|
29
|
+
exports.ExpanderRebalanceTypeName = 'expander';
|
|
30
|
+
function getExpanderRebalanceFieldInfos(price, lowerPercentageBPS, upperPercentageBPS, resetLowerPercentageBPS, resetUpperPercentageBPS, expansionBPS, maxNumberOfExpansions, swapUnevenAllowed, enabled = true) {
|
|
31
|
+
const rebalanceType = {
|
|
32
|
+
label: consts_1.RebalanceTypeLabelName,
|
|
33
|
+
type: 'string',
|
|
34
|
+
value: exports.ExpanderRebalanceTypeName,
|
|
35
|
+
enabled,
|
|
36
|
+
};
|
|
37
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
38
|
+
label: 'lowerRangeBps',
|
|
39
|
+
type: 'number',
|
|
40
|
+
value: lowerPercentageBPS,
|
|
41
|
+
enabled,
|
|
42
|
+
};
|
|
43
|
+
const upperBpsRebalanceFieldInfo = {
|
|
44
|
+
label: 'upperRangeBps',
|
|
45
|
+
type: 'number',
|
|
46
|
+
value: upperPercentageBPS,
|
|
47
|
+
enabled,
|
|
48
|
+
};
|
|
49
|
+
const resetLowerBpsRebalanceFieldInfo = {
|
|
50
|
+
label: 'resetLowerRangeBps',
|
|
51
|
+
type: 'number',
|
|
52
|
+
value: resetLowerPercentageBPS,
|
|
53
|
+
enabled,
|
|
54
|
+
};
|
|
55
|
+
const resetUpperBpsRebalanceFieldInfo = {
|
|
56
|
+
label: 'resetUpperRangeBps',
|
|
57
|
+
type: 'number',
|
|
58
|
+
value: resetUpperPercentageBPS,
|
|
59
|
+
enabled,
|
|
60
|
+
};
|
|
61
|
+
const expansionBpsRebalanceFieldInfo = {
|
|
62
|
+
label: 'expansionBps',
|
|
63
|
+
type: 'number',
|
|
64
|
+
value: expansionBPS,
|
|
65
|
+
enabled,
|
|
66
|
+
};
|
|
67
|
+
const maxNumberOfExpansionsRebalanceFieldInfo = {
|
|
68
|
+
label: 'maxNumberOfExpansions',
|
|
69
|
+
type: 'number',
|
|
70
|
+
value: maxNumberOfExpansions,
|
|
71
|
+
enabled,
|
|
72
|
+
};
|
|
73
|
+
const swapUnevenAllowedFieldInfo = {
|
|
74
|
+
label: 'swapUnevenAllowed',
|
|
75
|
+
type: 'number',
|
|
76
|
+
value: swapUnevenAllowed,
|
|
77
|
+
enabled,
|
|
78
|
+
};
|
|
79
|
+
const { lowerPrice, upperPrice } = getPositionRangeFromExpanderParams(price, lowerPercentageBPS, upperPercentageBPS);
|
|
80
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
81
|
+
label: 'rangePriceLower',
|
|
82
|
+
type: 'number',
|
|
83
|
+
value: lowerPrice,
|
|
84
|
+
enabled: false,
|
|
85
|
+
};
|
|
86
|
+
const upperRangeRebalanceFieldInfo = {
|
|
87
|
+
label: 'rangePriceUpper',
|
|
88
|
+
type: 'number',
|
|
89
|
+
value: upperPrice,
|
|
90
|
+
enabled: false,
|
|
91
|
+
};
|
|
92
|
+
const { lowerPrice: resetLowerPrice, upperPrice: resetUpperPrice } = getPositionResetRangeFromExpanderParams(price, lowerPercentageBPS, upperPercentageBPS, resetLowerPercentageBPS, resetUpperPercentageBPS);
|
|
93
|
+
const resetLowerRangeRebalanceFieldInfo = {
|
|
94
|
+
label: 'resetPriceLower',
|
|
95
|
+
type: 'number',
|
|
96
|
+
value: resetLowerPrice,
|
|
97
|
+
enabled: false,
|
|
98
|
+
};
|
|
99
|
+
const resetUpperRangeRebalanceFieldInfo = {
|
|
100
|
+
label: 'resetPriceUpper',
|
|
101
|
+
type: 'number',
|
|
102
|
+
value: resetUpperPrice,
|
|
103
|
+
enabled: false,
|
|
104
|
+
};
|
|
105
|
+
return [
|
|
106
|
+
rebalanceType,
|
|
107
|
+
lowerBpsRebalanceFieldInfo,
|
|
108
|
+
upperBpsRebalanceFieldInfo,
|
|
109
|
+
resetLowerBpsRebalanceFieldInfo,
|
|
110
|
+
resetUpperBpsRebalanceFieldInfo,
|
|
111
|
+
expansionBpsRebalanceFieldInfo,
|
|
112
|
+
maxNumberOfExpansionsRebalanceFieldInfo,
|
|
113
|
+
swapUnevenAllowedFieldInfo,
|
|
114
|
+
lowerRangeRebalanceFieldInfo,
|
|
115
|
+
upperRangeRebalanceFieldInfo,
|
|
116
|
+
resetLowerRangeRebalanceFieldInfo,
|
|
117
|
+
resetUpperRangeRebalanceFieldInfo,
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
function getPositionRangeFromExpanderParams(price, lowerPriceDifferenceBPS, upperPriceDifferenceBPS) {
|
|
121
|
+
return (0, math_utils_1.getPriceRangeFromPriceAndDiffBPS)(price, lowerPriceDifferenceBPS, upperPriceDifferenceBPS);
|
|
122
|
+
}
|
|
123
|
+
function getPositionResetRangeFromExpanderParams(price, lowerPriceDifferenceBPS, upperPriceDifferenceBPS, resetLowerPriceDifferenceBPS, resetUpperPriceDifferenceBPS) {
|
|
124
|
+
return (0, math_utils_1.getResetRangeFromPriceAndDiffBPS)(price, lowerPriceDifferenceBPS, upperPriceDifferenceBPS, resetLowerPriceDifferenceBPS, resetUpperPriceDifferenceBPS);
|
|
125
|
+
}
|
|
126
|
+
function getDefaultExpanderRebalanceFieldInfos(price) {
|
|
127
|
+
return getExpanderRebalanceFieldInfos(price, CreationParameters_1.DefaultLowerPercentageBPSDecimal, CreationParameters_1.DefaultUpperPercentageBPSDecimal, CreationParameters_1.DefaultLowerPercentageBPSDecimal, CreationParameters_1.DefaultUpperPercentageBPSDecimal, CreationParameters_1.DefaultLowerPercentageBPSDecimal, exports.DefaultMaxNumberOfExpansions, exports.DefaultSwapUnevenAllowed);
|
|
128
|
+
}
|
|
129
|
+
function readRawExpanderRebalanceParamsFromStrategy(rebalanceRaw) {
|
|
130
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
131
|
+
const params = {};
|
|
132
|
+
params['lowerRangeBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(0));
|
|
133
|
+
params['upperRangeBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(2));
|
|
134
|
+
params['lowerResetRatioBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(4));
|
|
135
|
+
params['upperResetRatioBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(6));
|
|
136
|
+
params['expansionBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(8));
|
|
137
|
+
params['maxNumberOfExpansions'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(10));
|
|
138
|
+
params['swapUnevenAllowed'] = new decimal_js_1.default(paramsBuffer.readUInt8(12));
|
|
139
|
+
return params;
|
|
140
|
+
}
|
|
141
|
+
function readExpanderRebalanceParamsFromStrategy(rebalanceRaw) {
|
|
142
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
143
|
+
const lowerRangeBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(0));
|
|
144
|
+
const upperRangeBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(2));
|
|
145
|
+
const lowerResetRatioBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(4));
|
|
146
|
+
const upperResetRatioBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(6));
|
|
147
|
+
const expansionBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(8));
|
|
148
|
+
const maxNumberOfExpansions = new decimal_js_1.default(paramsBuffer.readUInt16LE(10));
|
|
149
|
+
const swapUnevenAllowed = new decimal_js_1.default(paramsBuffer.readUInt8(12));
|
|
150
|
+
const lowerBpsRebalanceFieldInfo = {
|
|
151
|
+
label: 'lowerRangeBps',
|
|
152
|
+
type: 'number',
|
|
153
|
+
value: lowerRangeBps,
|
|
154
|
+
enabled: true,
|
|
155
|
+
};
|
|
156
|
+
const upperBpsRebalanceFieldInfo = {
|
|
157
|
+
label: 'upperRangeBps',
|
|
158
|
+
type: 'number',
|
|
159
|
+
value: upperRangeBps,
|
|
160
|
+
enabled: true,
|
|
161
|
+
};
|
|
162
|
+
const resetLowerBpsRebalanceFieldInfo = {
|
|
163
|
+
label: 'resetLowerRangeBps',
|
|
164
|
+
type: 'number',
|
|
165
|
+
value: lowerResetRatioBps,
|
|
166
|
+
enabled: true,
|
|
167
|
+
};
|
|
168
|
+
const resetUpperBpsRebalanceFieldInfo = {
|
|
169
|
+
label: 'resetUpperRangeBps',
|
|
170
|
+
type: 'number',
|
|
171
|
+
value: upperResetRatioBps,
|
|
172
|
+
enabled: true,
|
|
173
|
+
};
|
|
174
|
+
const expansionBpsRebalanceFieldInfo = {
|
|
175
|
+
label: 'expansionBps',
|
|
176
|
+
type: 'number',
|
|
177
|
+
value: expansionBps,
|
|
178
|
+
enabled: true,
|
|
179
|
+
};
|
|
180
|
+
const maxNumberOfExpansionsRebalanceFieldInfo = {
|
|
181
|
+
label: 'maxNumberOfExpansions',
|
|
182
|
+
type: 'number',
|
|
183
|
+
value: maxNumberOfExpansions,
|
|
184
|
+
enabled: true,
|
|
185
|
+
};
|
|
186
|
+
const swapUnevenAllowedFieldInfo = {
|
|
187
|
+
label: 'swapUnevenAllowed',
|
|
188
|
+
type: 'number',
|
|
189
|
+
value: swapUnevenAllowed,
|
|
190
|
+
enabled: true,
|
|
191
|
+
};
|
|
192
|
+
return [
|
|
193
|
+
lowerBpsRebalanceFieldInfo,
|
|
194
|
+
upperBpsRebalanceFieldInfo,
|
|
195
|
+
resetLowerBpsRebalanceFieldInfo,
|
|
196
|
+
resetUpperBpsRebalanceFieldInfo,
|
|
197
|
+
expansionBpsRebalanceFieldInfo,
|
|
198
|
+
maxNumberOfExpansionsRebalanceFieldInfo,
|
|
199
|
+
swapUnevenAllowedFieldInfo,
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
function readRawExpanderRebalanceStateFromStrategy(rebalanceRaw) {
|
|
203
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
204
|
+
const state = {};
|
|
205
|
+
state['initialPoolPrice'] = new decimal_js_1.default((0, utils_1.readBigUint128LE)(stateBuffer, 0).toString());
|
|
206
|
+
state['expansionCount'] = new decimal_js_1.default(stateBuffer.readUInt16LE(16));
|
|
207
|
+
return state;
|
|
208
|
+
}
|
|
209
|
+
function readExpanderRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw) {
|
|
210
|
+
const params = readRawExpanderRebalanceParamsFromStrategy(rebalanceRaw);
|
|
211
|
+
const lowerRangeBps = params['lowerRangeBps'];
|
|
212
|
+
const upperRangeBps = params['upperRangeBps'];
|
|
213
|
+
const lowerResetRatioBps = params['lowerResetRatioBps'];
|
|
214
|
+
const upperResetRatioBps = params['upperResetRatioBps'];
|
|
215
|
+
const expansionBps = params['expansionBps'];
|
|
216
|
+
const state = readRawExpanderRebalanceStateFromStrategy(rebalanceRaw);
|
|
217
|
+
const initialPriceX64 = state['initialPoolPrice'];
|
|
218
|
+
const expansionCount = state['expansionCount'];
|
|
219
|
+
let initialPrice;
|
|
220
|
+
if (dex == 'ORCA') {
|
|
221
|
+
initialPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(initialPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
222
|
+
}
|
|
223
|
+
else if (dex == 'RAYDIUM') {
|
|
224
|
+
initialPrice = (0, whirlpool_sdk_1.sqrtPriceX64ToPrice)(new bn_js_1.default(initialPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
225
|
+
}
|
|
226
|
+
else if (dex == 'METEORA') {
|
|
227
|
+
initialPrice = (0, meteora_1.getPriceFromQ64Price)(new decimal_js_1.default(initialPriceX64.toString()), tokenADecimals, tokenBDecimals);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
throw new Error(`Unknown DEX ${dex}`);
|
|
231
|
+
}
|
|
232
|
+
const lowerRangeFactorBPS = lowerRangeBps.add(expansionBps.mul(expansionCount));
|
|
233
|
+
const upperRangeFactorBPS = upperRangeBps.add(expansionBps.mul(expansionCount));
|
|
234
|
+
const { lowerPrice, upperPrice } = (0, math_utils_1.getPriceRangeFromPriceAndDiffBPS)(initialPrice, lowerRangeFactorBPS, upperRangeFactorBPS);
|
|
235
|
+
const { lowerPrice: lowerResetPrice, upperPrice: upperResetPrice } = (0, math_utils_1.getResetRangeFromPriceAndDiffBPS)(initialPrice, lowerRangeFactorBPS, upperRangeFactorBPS, lowerResetRatioBps, upperResetRatioBps);
|
|
236
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
237
|
+
label: 'rangePriceLower',
|
|
238
|
+
type: 'number',
|
|
239
|
+
value: lowerPrice,
|
|
240
|
+
enabled: false,
|
|
241
|
+
};
|
|
242
|
+
const upperRangeRebalanceFieldInfo = {
|
|
243
|
+
label: 'rangePriceUpper',
|
|
244
|
+
type: 'number',
|
|
245
|
+
value: upperPrice,
|
|
246
|
+
enabled: false,
|
|
247
|
+
};
|
|
248
|
+
const resetLowerRangeRebalanceFieldInfo = {
|
|
249
|
+
label: 'resetPriceLower',
|
|
250
|
+
type: 'number',
|
|
251
|
+
value: lowerResetPrice,
|
|
252
|
+
enabled: false,
|
|
253
|
+
};
|
|
254
|
+
const resetUpperRangeRebalanceFieldInfo = {
|
|
255
|
+
label: 'resetPriceUpper',
|
|
256
|
+
type: 'number',
|
|
257
|
+
value: upperResetPrice,
|
|
258
|
+
enabled: false,
|
|
259
|
+
};
|
|
260
|
+
return [
|
|
261
|
+
lowerRangeRebalanceFieldInfo,
|
|
262
|
+
upperRangeRebalanceFieldInfo,
|
|
263
|
+
resetLowerRangeRebalanceFieldInfo,
|
|
264
|
+
resetUpperRangeRebalanceFieldInfo,
|
|
265
|
+
];
|
|
266
|
+
}
|
|
267
|
+
function readExpanderRebalanceFieldInfosFromStrategy(price, rebalanceRaw) {
|
|
268
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
269
|
+
const lowerRangeBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(0));
|
|
270
|
+
const upperRangeBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(2));
|
|
271
|
+
const lowerResetRatioBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(4));
|
|
272
|
+
const upperResetRatioBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(6));
|
|
273
|
+
const expansionBps = new decimal_js_1.default(paramsBuffer.readUInt16LE(8));
|
|
274
|
+
const maxNumberOfExpansions = new decimal_js_1.default(paramsBuffer.readUInt16LE(10));
|
|
275
|
+
const swapUnevenAllowed = new decimal_js_1.default(paramsBuffer.readUInt8(12));
|
|
276
|
+
return getExpanderRebalanceFieldInfos(price, lowerRangeBps, upperRangeBps, lowerResetRatioBps, upperResetRatioBps, expansionBps, maxNumberOfExpansions, swapUnevenAllowed);
|
|
277
|
+
}
|
|
278
|
+
function deserializeExpanderRebalanceWithStateOverride(dex, tokenADecimals, tokenBDecimals, price, rebalanceRaw) {
|
|
279
|
+
const stateFields = readExpanderRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw);
|
|
280
|
+
const fields = readExpanderRebalanceFieldInfosFromStrategy(price, rebalanceRaw);
|
|
281
|
+
return (0, utils_2.upsertManyRebalanceFieldInfos)(fields, stateFields);
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=expanderRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expanderRebalance.js","sourceRoot":"","sources":["../../src/rebalance_methods/expanderRebalance.ts"],"names":[],"mappings":";;;;;;AAiBA,wEA4GC;AAED,gFAMC;AAED,0FAcC;AAED,sFAWC;AAED,gGAaC;AAED,0FA+DC;AAED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AE9G,MAAM,MAAM,GAAG,2CAA2C,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAEhF,OAAO,IAAA,qCAA6B,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { PositionRange, RebalanceFieldInfo, RebalanceFieldsDict } 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 { 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 DefaultMaxNumberOfExpansions = new Decimal(10);\nexport const DefaultExpansionSizeBPS = new Decimal(100);\nexport const DefaultSwapUnevenAllowed = new Decimal(1);\nexport const ExpanderRebalanceTypeName = 'expander';\n\nexport function getExpanderRebalanceFieldInfos(\n price: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal,\n resetLowerPercentageBPS: Decimal,\n resetUpperPercentageBPS: Decimal,\n expansionBPS: Decimal,\n maxNumberOfExpansions: Decimal,\n swapUnevenAllowed: Decimal,\n enabled: boolean = true\n): RebalanceFieldInfo[] {\n const rebalanceType: RebalanceFieldInfo = {\n label: RebalanceTypeLabelName,\n type: 'string',\n value: ExpanderRebalanceTypeName,\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 const expansionBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'expansionBps',\n type: 'number',\n value: expansionBPS,\n enabled,\n };\n const maxNumberOfExpansionsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'maxNumberOfExpansions',\n type: 'number',\n value: maxNumberOfExpansions,\n enabled,\n };\n const swapUnevenAllowedFieldInfo: RebalanceFieldInfo = {\n label: 'swapUnevenAllowed',\n type: 'number',\n value: swapUnevenAllowed,\n enabled,\n };\n\n const { lowerPrice, upperPrice } = getPositionRangeFromExpanderParams(price, lowerPercentageBPS, upperPercentageBPS);\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 } = getPositionResetRangeFromExpanderParams(\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 expansionBpsRebalanceFieldInfo,\n maxNumberOfExpansionsRebalanceFieldInfo,\n swapUnevenAllowedFieldInfo,\n lowerRangeRebalanceFieldInfo,\n upperRangeRebalanceFieldInfo,\n resetLowerRangeRebalanceFieldInfo,\n resetUpperRangeRebalanceFieldInfo,\n ];\n}\n\nexport function getPositionRangeFromExpanderParams(\n price: Decimal,\n lowerPriceDifferenceBPS: Decimal,\n upperPriceDifferenceBPS: Decimal\n): PositionRange {\n return getPriceRangeFromPriceAndDiffBPS(price, lowerPriceDifferenceBPS, upperPriceDifferenceBPS);\n}\n\nexport function getPositionResetRangeFromExpanderParams(\n price: Decimal,\n lowerPriceDifferenceBPS: Decimal,\n upperPriceDifferenceBPS: Decimal,\n resetLowerPriceDifferenceBPS: Decimal,\n resetUpperPriceDifferenceBPS: Decimal\n): PositionRange {\n return getResetRangeFromPriceAndDiffBPS(\n price,\n lowerPriceDifferenceBPS,\n upperPriceDifferenceBPS,\n resetLowerPriceDifferenceBPS,\n resetUpperPriceDifferenceBPS\n );\n}\n\nexport function getDefaultExpanderRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[] {\n return getExpanderRebalanceFieldInfos(\n price,\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal,\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal,\n DefaultLowerPercentageBPSDecimal,\n DefaultMaxNumberOfExpansions,\n DefaultSwapUnevenAllowed\n );\n}\n\nexport function readRawExpanderRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw) {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n const params: RebalanceFieldsDict = {};\n\n params['lowerRangeBps'] = new Decimal(paramsBuffer.readUInt16LE(0));\n params['upperRangeBps'] = new Decimal(paramsBuffer.readUInt16LE(2));\n params['lowerResetRatioBps'] = new Decimal(paramsBuffer.readUInt16LE(4));\n params['upperResetRatioBps'] = new Decimal(paramsBuffer.readUInt16LE(6));\n params['expansionBps'] = new Decimal(paramsBuffer.readUInt16LE(8));\n params['maxNumberOfExpansions'] = new Decimal(paramsBuffer.readUInt16LE(10));\n params['swapUnevenAllowed'] = new Decimal(paramsBuffer.readUInt8(12));\n\n return params;\n}\n\nexport function readExpanderRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[] {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n\n const lowerRangeBps = new Decimal(paramsBuffer.readUInt16LE(0));\n const upperRangeBps = new Decimal(paramsBuffer.readUInt16LE(2));\n const lowerResetRatioBps = new Decimal(paramsBuffer.readUInt16LE(4));\n const upperResetRatioBps = new Decimal(paramsBuffer.readUInt16LE(6));\n const expansionBps = new Decimal(paramsBuffer.readUInt16LE(8));\n const maxNumberOfExpansions = new Decimal(paramsBuffer.readUInt16LE(10));\n const swapUnevenAllowed = new Decimal(paramsBuffer.readUInt8(12));\n\n const lowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lowerRangeBps',\n type: 'number',\n value: lowerRangeBps,\n enabled: true,\n };\n const upperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'upperRangeBps',\n type: 'number',\n value: upperRangeBps,\n enabled: true,\n };\n const resetLowerBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetLowerRangeBps',\n type: 'number',\n value: lowerResetRatioBps,\n enabled: true,\n };\n const resetUpperBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetUpperRangeBps',\n type: 'number',\n value: upperResetRatioBps,\n enabled: true,\n };\n const expansionBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'expansionBps',\n type: 'number',\n value: expansionBps,\n enabled: true,\n };\n const maxNumberOfExpansionsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'maxNumberOfExpansions',\n type: 'number',\n value: maxNumberOfExpansions,\n enabled: true,\n };\n const swapUnevenAllowedFieldInfo: RebalanceFieldInfo = {\n label: 'swapUnevenAllowed',\n type: 'number',\n value: swapUnevenAllowed,\n enabled: true,\n };\n\n return [\n lowerBpsRebalanceFieldInfo,\n upperBpsRebalanceFieldInfo,\n resetLowerBpsRebalanceFieldInfo,\n resetUpperBpsRebalanceFieldInfo,\n expansionBpsRebalanceFieldInfo,\n maxNumberOfExpansionsRebalanceFieldInfo,\n swapUnevenAllowedFieldInfo,\n ];\n}\n\nexport function readRawExpanderRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw) {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n const state: RebalanceFieldsDict = {};\n\n state['initialPoolPrice'] = new Decimal(readBigUint128LE(stateBuffer, 0).toString());\n state['expansionCount'] = new Decimal(stateBuffer.readUInt16LE(16));\n\n return state;\n}\n\nexport function readExpanderRebalanceStateFromStrategy(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const params = readRawExpanderRebalanceParamsFromStrategy(rebalanceRaw);\n\n const lowerRangeBps = params['lowerRangeBps'];\n const upperRangeBps = params['upperRangeBps'];\n const lowerResetRatioBps = params['lowerResetRatioBps'];\n const upperResetRatioBps = params['upperResetRatioBps'];\n const expansionBps = params['expansionBps'];\n\n const state = readRawExpanderRebalanceStateFromStrategy(rebalanceRaw);\n\n const initialPriceX64 = state['initialPoolPrice'];\n const expansionCount = state['expansionCount'];\n\n let initialPrice: Decimal;\n if (dex == 'ORCA') {\n initialPrice = sqrtPriceX64ToPrice(new BN(initialPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else if (dex == 'RAYDIUM') {\n initialPrice = sqrtPriceX64ToPrice(new BN(initialPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else if (dex == 'METEORA') {\n initialPrice = getPriceFromQ64Price(new Decimal(initialPriceX64.toString()), tokenADecimals, tokenBDecimals);\n } else {\n throw new Error(`Unknown DEX ${dex}`);\n }\n\n const lowerRangeFactorBPS = lowerRangeBps.add(expansionBps.mul(expansionCount));\n const upperRangeFactorBPS = upperRangeBps.add(expansionBps.mul(expansionCount));\n\n const { lowerPrice, upperPrice } = getPriceRangeFromPriceAndDiffBPS(\n initialPrice,\n lowerRangeFactorBPS,\n upperRangeFactorBPS\n );\n\n const { lowerPrice: lowerResetPrice, upperPrice: upperResetPrice } = getResetRangeFromPriceAndDiffBPS(\n initialPrice,\n lowerRangeFactorBPS,\n upperRangeFactorBPS,\n lowerResetRatioBps,\n upperResetRatioBps\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\n const resetLowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetPriceLower',\n type: 'number',\n value: lowerResetPrice,\n enabled: false,\n };\n const resetUpperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'resetPriceUpper',\n type: 'number',\n value: upperResetPrice,\n enabled: false,\n };\n\n return [\n lowerRangeRebalanceFieldInfo,\n upperRangeRebalanceFieldInfo,\n resetLowerRangeRebalanceFieldInfo,\n resetUpperRangeRebalanceFieldInfo,\n ];\n}\n\nexport function readExpanderRebalanceFieldInfosFromStrategy(price: Decimal, rebalanceRaw: RebalanceRaw) {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n\n const lowerRangeBps = new Decimal(paramsBuffer.readUInt16LE(0));\n const upperRangeBps = new Decimal(paramsBuffer.readUInt16LE(2));\n const lowerResetRatioBps = new Decimal(paramsBuffer.readUInt16LE(4));\n const upperResetRatioBps = new Decimal(paramsBuffer.readUInt16LE(6));\n const expansionBps = new Decimal(paramsBuffer.readUInt16LE(8));\n const maxNumberOfExpansions = new Decimal(paramsBuffer.readUInt16LE(10));\n const swapUnevenAllowed = new Decimal(paramsBuffer.readUInt8(12));\n\n return getExpanderRebalanceFieldInfos(\n price,\n lowerRangeBps,\n upperRangeBps,\n lowerResetRatioBps,\n upperResetRatioBps,\n expansionBps,\n maxNumberOfExpansions,\n swapUnevenAllowed\n );\n}\n\nexport function deserializeExpanderRebalanceWithStateOverride(\n dex: Dex,\n tokenADecimals: number,\n tokenBDecimals: number,\n price: Decimal,\n rebalanceRaw: RebalanceRaw\n): RebalanceFieldInfo[] {\n const stateFields = readExpanderRebalanceStateFromStrategy(dex, tokenADecimals, tokenBDecimals, rebalanceRaw);\n\n const fields = readExpanderRebalanceFieldInfosFromStrategy(price, rebalanceRaw);\n\n return upsertManyRebalanceFieldInfos(fields, stateFields);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './manualRebalance';
|
|
2
|
+
export * from './pricePercentageRebalance';
|
|
3
|
+
export * from './pricePercentageWithResetRebalance';
|
|
4
|
+
export * from './takeProfitRebalance';
|
|
5
|
+
export * from './driftRebalance';
|
|
6
|
+
export * from './expanderRebalance';
|
|
7
|
+
export * from './periodicRebalance';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./manualRebalance"), exports);
|
|
18
|
+
__exportStar(require("./pricePercentageRebalance"), exports);
|
|
19
|
+
__exportStar(require("./pricePercentageWithResetRebalance"), exports);
|
|
20
|
+
__exportStar(require("./takeProfitRebalance"), exports);
|
|
21
|
+
__exportStar(require("./driftRebalance"), exports);
|
|
22
|
+
__exportStar(require("./expanderRebalance"), exports);
|
|
23
|
+
__exportStar(require("./periodicRebalance"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rebalance_methods/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,6DAA2C;AAC3C,sEAAoD;AACpD,wDAAsC;AACtC,mDAAiC;AACjC,sDAAoC;AACpC,sDAAoC","sourcesContent":["export * from './manualRebalance';\nexport * from './pricePercentageRebalance';\nexport * from './pricePercentageWithResetRebalance';\nexport * from './takeProfitRebalance';\nexport * from './driftRebalance';\nexport * from './expanderRebalance';\nexport * from './periodicRebalance';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { RebalanceFieldInfo } from '../utils/types';
|
|
3
|
+
export declare const ManualRebalanceTypeName = "manual";
|
|
4
|
+
export declare function getManualRebalanceFieldInfos(lowerPrice: Decimal, upperPrice: Decimal, enabled?: boolean): RebalanceFieldInfo[];
|
|
5
|
+
export declare function getDefaultManualRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManualRebalanceTypeName = void 0;
|
|
4
|
+
exports.getManualRebalanceFieldInfos = getManualRebalanceFieldInfos;
|
|
5
|
+
exports.getDefaultManualRebalanceFieldInfos = getDefaultManualRebalanceFieldInfos;
|
|
6
|
+
const CreationParameters_1 = require("../utils/CreationParameters");
|
|
7
|
+
const consts_1 = require("./consts");
|
|
8
|
+
exports.ManualRebalanceTypeName = 'manual';
|
|
9
|
+
function getManualRebalanceFieldInfos(lowerPrice, upperPrice, enabled = true) {
|
|
10
|
+
const rebalanceType = {
|
|
11
|
+
label: consts_1.RebalanceTypeLabelName,
|
|
12
|
+
type: 'string',
|
|
13
|
+
value: exports.ManualRebalanceTypeName,
|
|
14
|
+
enabled,
|
|
15
|
+
};
|
|
16
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
17
|
+
label: 'rangePriceLower',
|
|
18
|
+
type: 'number',
|
|
19
|
+
value: lowerPrice,
|
|
20
|
+
enabled,
|
|
21
|
+
};
|
|
22
|
+
const upperRangeRebalanceFieldInfo = {
|
|
23
|
+
label: 'rangePriceUpper',
|
|
24
|
+
type: 'number',
|
|
25
|
+
value: upperPrice,
|
|
26
|
+
enabled,
|
|
27
|
+
};
|
|
28
|
+
return [rebalanceType, lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];
|
|
29
|
+
}
|
|
30
|
+
function getDefaultManualRebalanceFieldInfos(price) {
|
|
31
|
+
const lowerPrice = price.mul(CreationParameters_1.FullBPSDecimal.sub(CreationParameters_1.DefaultLowerPercentageBPSDecimal)).div(CreationParameters_1.FullBPSDecimal);
|
|
32
|
+
const upperPrice = price.mul(CreationParameters_1.FullBPSDecimal.add(CreationParameters_1.DefaultUpperPercentageBPSDecimal)).div(CreationParameters_1.FullBPSDecimal);
|
|
33
|
+
return getManualRebalanceFieldInfos(lowerPrice, upperPrice);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=manualRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manualRebalance.js","sourceRoot":"","sources":["../../src/rebalance_methods/manualRebalance.ts"],"names":[],"mappings":";;;AAWA,oEAwBC;AAED,kFAKC;AAxCD,oEAIqC;AACrC,qCAAkD;AAErC,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AAEhD,SAAgB,4BAA4B,CAC1C,UAAmB,EACnB,UAAmB,EACnB,UAAmB,IAAI;IAEvB,MAAM,aAAa,GAAuB;QACxC,KAAK,EAAE,+BAAsB;QAC7B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,+BAAuB;QAC9B,OAAO;KACR,CAAC;IACF,MAAM,4BAA4B,GAAuB;QACvD,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,UAAU;QACjB,OAAO;KACR,CAAC;IACF,MAAM,4BAA4B,GAAuB;QACvD,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,UAAU;QACjB,OAAO;KACR,CAAC;IACF,OAAO,CAAC,aAAa,EAAE,4BAA4B,EAAE,4BAA4B,CAAC,CAAC;AACrF,CAAC;AAED,SAAgB,mCAAmC,CAAC,KAAc;IAChE,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,mCAAc,CAAC,GAAG,CAAC,qDAAgC,CAAC,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IACvG,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,mCAAc,CAAC,GAAG,CAAC,qDAAgC,CAAC,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IAEvG,OAAO,4BAA4B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { RebalanceFieldInfo } from '../utils/types';\nimport {\n DefaultLowerPercentageBPSDecimal,\n DefaultUpperPercentageBPSDecimal,\n FullBPSDecimal,\n} from '../utils/CreationParameters';\nimport { RebalanceTypeLabelName } from './consts';\n\nexport const ManualRebalanceTypeName = 'manual';\n\nexport function getManualRebalanceFieldInfos(\n lowerPrice: Decimal,\n upperPrice: Decimal,\n enabled: boolean = true\n): RebalanceFieldInfo[] {\n const rebalanceType: RebalanceFieldInfo = {\n label: RebalanceTypeLabelName,\n type: 'string',\n value: ManualRebalanceTypeName,\n enabled,\n };\n const lowerRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceLower',\n type: 'number',\n value: lowerPrice,\n enabled,\n };\n const upperRangeRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'rangePriceUpper',\n type: 'number',\n value: upperPrice,\n enabled,\n };\n return [rebalanceType, lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];\n}\n\nexport function getDefaultManualRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[] {\n const lowerPrice = price.mul(FullBPSDecimal.sub(DefaultLowerPercentageBPSDecimal)).div(FullBPSDecimal);\n const upperPrice = price.mul(FullBPSDecimal.add(DefaultUpperPercentageBPSDecimal)).div(FullBPSDecimal);\n\n return getManualRebalanceFieldInfos(lowerPrice, upperPrice);\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { PositionRange } from '../utils';
|
|
3
|
+
export declare function getPriceRangeFromPriceAndDiffBPS(price: Decimal, lowerDiffBPS: Decimal, upperDiffBPS: Decimal): PositionRange;
|
|
4
|
+
export declare function getResetRangeFromPriceAndDiffBPS(price: Decimal, lowerDiffBPS: Decimal, upperDiffBPS: Decimal, resetLowerDiffBPS: Decimal, resetUpperDiffBPS: Decimal): PositionRange;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPriceRangeFromPriceAndDiffBPS = getPriceRangeFromPriceAndDiffBPS;
|
|
4
|
+
exports.getResetRangeFromPriceAndDiffBPS = getResetRangeFromPriceAndDiffBPS;
|
|
5
|
+
const CreationParameters_1 = require("../utils/CreationParameters");
|
|
6
|
+
function getPriceRangeFromPriceAndDiffBPS(price, lowerDiffBPS, upperDiffBPS) {
|
|
7
|
+
const lowerPrice = price.mul(CreationParameters_1.FullBPSDecimal.sub(lowerDiffBPS)).div(CreationParameters_1.FullBPSDecimal);
|
|
8
|
+
const upperPrice = price.mul(CreationParameters_1.FullBPSDecimal.add(upperDiffBPS)).div(CreationParameters_1.FullBPSDecimal);
|
|
9
|
+
return { lowerPrice, upperPrice };
|
|
10
|
+
}
|
|
11
|
+
function getResetRangeFromPriceAndDiffBPS(price, lowerDiffBPS, upperDiffBPS, resetLowerDiffBPS, resetUpperDiffBPS) {
|
|
12
|
+
const resetLowerFactor = resetLowerDiffBPS.mul(lowerDiffBPS).div(CreationParameters_1.FullBPSDecimal);
|
|
13
|
+
const resetUpperFactor = resetUpperDiffBPS.mul(upperDiffBPS).div(CreationParameters_1.FullBPSDecimal);
|
|
14
|
+
const resetLowerPrice = price.mul(CreationParameters_1.FullBPSDecimal.sub(resetLowerFactor)).div(CreationParameters_1.FullBPSDecimal);
|
|
15
|
+
const resetUpperPrice = price.mul(CreationParameters_1.FullBPSDecimal.add(resetUpperFactor)).div(CreationParameters_1.FullBPSDecimal);
|
|
16
|
+
return { lowerPrice: resetLowerPrice, upperPrice: resetUpperPrice };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=math_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math_utils.js","sourceRoot":"","sources":["../../src/rebalance_methods/math_utils.ts"],"names":[],"mappings":";;AAIA,4EASC;AAED,4EAYC;AA1BD,oEAA6D;AAG7D,SAAgB,gCAAgC,CAC9C,KAAc,EACd,YAAqB,EACrB,YAAqB;IAErB,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,mCAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IACnF,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,mCAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IAEnF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AACpC,CAAC;AAED,SAAgB,gCAAgC,CAC9C,KAAc,EACd,YAAqB,EACrB,YAAqB,EACrB,iBAA0B,EAC1B,iBAA0B;IAE1B,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IACjF,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IACjF,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,mCAAc,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IAC5F,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,mCAAc,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,mCAAc,CAAC,CAAC;IAC5F,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { FullBPSDecimal } from '../utils/CreationParameters';\nimport { PositionRange } from '../utils';\n\nexport function getPriceRangeFromPriceAndDiffBPS(\n price: Decimal,\n lowerDiffBPS: Decimal,\n upperDiffBPS: Decimal\n): PositionRange {\n const lowerPrice = price.mul(FullBPSDecimal.sub(lowerDiffBPS)).div(FullBPSDecimal);\n const upperPrice = price.mul(FullBPSDecimal.add(upperDiffBPS)).div(FullBPSDecimal);\n\n return { lowerPrice, upperPrice };\n}\n\nexport function getResetRangeFromPriceAndDiffBPS(\n price: Decimal,\n lowerDiffBPS: Decimal,\n upperDiffBPS: Decimal,\n resetLowerDiffBPS: Decimal,\n resetUpperDiffBPS: Decimal\n): PositionRange {\n const resetLowerFactor = resetLowerDiffBPS.mul(lowerDiffBPS).div(FullBPSDecimal);\n const resetUpperFactor = resetUpperDiffBPS.mul(upperDiffBPS).div(FullBPSDecimal);\n const resetLowerPrice = price.mul(FullBPSDecimal.sub(resetLowerFactor)).div(FullBPSDecimal);\n const resetUpperPrice = price.mul(FullBPSDecimal.add(resetUpperFactor)).div(FullBPSDecimal);\n return { lowerPrice: resetLowerPrice, upperPrice: resetUpperPrice };\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { PositionRange, RebalanceFieldInfo, RebalanceFieldsDict } from '../utils/types';
|
|
3
|
+
import { RebalanceRaw } from '../kamino-client/types';
|
|
4
|
+
export declare const DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE: Decimal;
|
|
5
|
+
export declare const DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE: Decimal;
|
|
6
|
+
export declare const DEFAULT_REBALANCE_PERIOD: Decimal;
|
|
7
|
+
export declare const PeriodicRebalanceTypeName = "periodicRebalance";
|
|
8
|
+
export declare function getPeriodicRebalanceRebalanceFieldInfos(price: Decimal, period: Decimal, // seconds
|
|
9
|
+
lowerRangeBps: Decimal, upperRangeBps: Decimal, enabled?: boolean): RebalanceFieldInfo[];
|
|
10
|
+
export declare function getPositionRangeFromPeriodicRebalanceParams(price: Decimal, lowerPercentageBPS: Decimal, upperPercentageBPS: Decimal): PositionRange;
|
|
11
|
+
export declare function getDefaultPeriodicRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[];
|
|
12
|
+
export declare function readPeriodicRebalanceRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldsDict;
|
|
13
|
+
export declare function readPeriodicRebalanceRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldsDict;
|
|
14
|
+
export declare function deserializePeriodicRebalanceFromOnchainParams(price: Decimal, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
@@ -0,0 +1,92 @@
|
|
|
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.PeriodicRebalanceTypeName = exports.DEFAULT_REBALANCE_PERIOD = exports.DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE = exports.DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE = void 0;
|
|
7
|
+
exports.getPeriodicRebalanceRebalanceFieldInfos = getPeriodicRebalanceRebalanceFieldInfos;
|
|
8
|
+
exports.getPositionRangeFromPeriodicRebalanceParams = getPositionRangeFromPeriodicRebalanceParams;
|
|
9
|
+
exports.getDefaultPeriodicRebalanceFieldInfos = getDefaultPeriodicRebalanceFieldInfos;
|
|
10
|
+
exports.readPeriodicRebalanceRebalanceParamsFromStrategy = readPeriodicRebalanceRebalanceParamsFromStrategy;
|
|
11
|
+
exports.readPeriodicRebalanceRebalanceStateFromStrategy = readPeriodicRebalanceRebalanceStateFromStrategy;
|
|
12
|
+
exports.deserializePeriodicRebalanceFromOnchainParams = deserializePeriodicRebalanceFromOnchainParams;
|
|
13
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
14
|
+
const consts_1 = require("./consts");
|
|
15
|
+
const math_utils_1 = require("./math_utils");
|
|
16
|
+
exports.DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE = new decimal_js_1.default(500);
|
|
17
|
+
exports.DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE = new decimal_js_1.default(500);
|
|
18
|
+
exports.DEFAULT_REBALANCE_PERIOD = new decimal_js_1.default(3600 * 24 * 3); // 3 days
|
|
19
|
+
exports.PeriodicRebalanceTypeName = 'periodicRebalance';
|
|
20
|
+
function getPeriodicRebalanceRebalanceFieldInfos(price, period, // seconds
|
|
21
|
+
lowerRangeBps, upperRangeBps, enabled = true) {
|
|
22
|
+
const rebalanceType = {
|
|
23
|
+
label: consts_1.RebalanceTypeLabelName,
|
|
24
|
+
type: 'string',
|
|
25
|
+
value: exports.PeriodicRebalanceTypeName,
|
|
26
|
+
enabled,
|
|
27
|
+
};
|
|
28
|
+
const periodRebalanceFieldInfo = {
|
|
29
|
+
label: 'period',
|
|
30
|
+
type: 'number',
|
|
31
|
+
value: period,
|
|
32
|
+
enabled,
|
|
33
|
+
};
|
|
34
|
+
const lowerRangeBpsRebalanceFieldInfo = {
|
|
35
|
+
label: 'lowerRangeBps',
|
|
36
|
+
type: 'number',
|
|
37
|
+
value: lowerRangeBps,
|
|
38
|
+
enabled,
|
|
39
|
+
};
|
|
40
|
+
const upperRangeBpsRebalanceFieldInfo = {
|
|
41
|
+
label: 'upperRangeBps',
|
|
42
|
+
type: 'number',
|
|
43
|
+
value: upperRangeBps,
|
|
44
|
+
enabled,
|
|
45
|
+
};
|
|
46
|
+
const { lowerPrice, upperPrice } = getPositionRangeFromPeriodicRebalanceParams(price, lowerRangeBps, upperRangeBps);
|
|
47
|
+
const lowerRangeRebalanceFieldInfo = {
|
|
48
|
+
label: 'rangePriceLower',
|
|
49
|
+
type: 'number',
|
|
50
|
+
value: lowerPrice,
|
|
51
|
+
enabled: false,
|
|
52
|
+
};
|
|
53
|
+
const upperRangeRebalanceFieldInfo = {
|
|
54
|
+
label: 'rangePriceUpper',
|
|
55
|
+
type: 'number',
|
|
56
|
+
value: upperPrice,
|
|
57
|
+
enabled: false,
|
|
58
|
+
};
|
|
59
|
+
return [
|
|
60
|
+
rebalanceType,
|
|
61
|
+
periodRebalanceFieldInfo,
|
|
62
|
+
lowerRangeBpsRebalanceFieldInfo,
|
|
63
|
+
upperRangeBpsRebalanceFieldInfo,
|
|
64
|
+
lowerRangeRebalanceFieldInfo,
|
|
65
|
+
upperRangeRebalanceFieldInfo,
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
function getPositionRangeFromPeriodicRebalanceParams(price, lowerPercentageBPS, upperPercentageBPS) {
|
|
69
|
+
return (0, math_utils_1.getPriceRangeFromPriceAndDiffBPS)(price, lowerPercentageBPS, upperPercentageBPS);
|
|
70
|
+
}
|
|
71
|
+
function getDefaultPeriodicRebalanceFieldInfos(price) {
|
|
72
|
+
return getPeriodicRebalanceRebalanceFieldInfos(price, exports.DEFAULT_REBALANCE_PERIOD, exports.DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE, exports.DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE);
|
|
73
|
+
}
|
|
74
|
+
function readPeriodicRebalanceRebalanceParamsFromStrategy(rebalanceRaw) {
|
|
75
|
+
const paramsBuffer = Buffer.from(rebalanceRaw.params);
|
|
76
|
+
const params = {};
|
|
77
|
+
params['period'] = new decimal_js_1.default(paramsBuffer.readBigUInt64LE(0).toString());
|
|
78
|
+
params['lowerRangeBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(8));
|
|
79
|
+
params['upperRangeBps'] = new decimal_js_1.default(paramsBuffer.readUInt16LE(10));
|
|
80
|
+
return params;
|
|
81
|
+
}
|
|
82
|
+
function readPeriodicRebalanceRebalanceStateFromStrategy(rebalanceRaw) {
|
|
83
|
+
const stateBuffer = Buffer.from(rebalanceRaw.state);
|
|
84
|
+
const state = {};
|
|
85
|
+
state['lastRebalanceTimestamp'] = new decimal_js_1.default(stateBuffer.readBigUInt64LE(0).toString());
|
|
86
|
+
return state;
|
|
87
|
+
}
|
|
88
|
+
function deserializePeriodicRebalanceFromOnchainParams(price, rebalanceRaw) {
|
|
89
|
+
const params = readPeriodicRebalanceRebalanceParamsFromStrategy(rebalanceRaw);
|
|
90
|
+
return getPeriodicRebalanceRebalanceFieldInfos(price, params['period'], params['lowerRangeBps'], params['upperRangeBps']);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=periodicRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"periodicRebalance.js","sourceRoot":"","sources":["../../src/reb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AAwB,EAAE,CAAC;IAEtC,KAAK,CAAC,wBAAwB,CAAC,GAAG,IAAI,oBAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEzF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,6CAA6C,CAAC,KAAc,EAAE,YAA0B;IACtG,MAAM,MAAM,GAAG,gDAAgD,CAAC,YAAY,CAAC,CAAC;IAE9E,OAAO,uCAAuC,CAC5C,KAAK,EACL,MAAM,CAAC,QAAQ,CAAC,EAChB,MAAM,CAAC,eAAe,CAAC,EACvB,MAAM,CAAC,eAAe,CAAC,CACxB,CAAC;AACJ,CAAC","sourcesContent":["import Decimal from 'decimal.js';\nimport { PositionRange, RebalanceFieldInfo, RebalanceFieldsDict } from '../utils/types';\nimport { RebalanceRaw } from '../kamino-client/types';\nimport { RebalanceTypeLabelName } from './consts';\nimport { getPriceRangeFromPriceAndDiffBPS } from './math_utils';\n\nexport const DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE = new Decimal(500);\nexport const DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE = new Decimal(500);\nexport const DEFAULT_REBALANCE_PERIOD = new Decimal(3600 * 24 * 3); // 3 days\nexport const PeriodicRebalanceTypeName = 'periodicRebalance';\n\nexport function getPeriodicRebalanceRebalanceFieldInfos(\n price: Decimal,\n period: Decimal, // seconds\n lowerRangeBps: Decimal,\n upperRangeBps: Decimal,\n enabled: boolean = true\n): RebalanceFieldInfo[] {\n const rebalanceType: RebalanceFieldInfo = {\n label: RebalanceTypeLabelName,\n type: 'string',\n value: PeriodicRebalanceTypeName,\n enabled,\n };\n const periodRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'period',\n type: 'number',\n value: period,\n enabled,\n };\n const lowerRangeBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'lowerRangeBps',\n type: 'number',\n value: lowerRangeBps,\n enabled,\n };\n const upperRangeBpsRebalanceFieldInfo: RebalanceFieldInfo = {\n label: 'upperRangeBps',\n type: 'number',\n value: upperRangeBps,\n enabled,\n };\n\n const { lowerPrice, upperPrice } = getPositionRangeFromPeriodicRebalanceParams(price, lowerRangeBps, upperRangeBps);\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 periodRebalanceFieldInfo,\n lowerRangeBpsRebalanceFieldInfo,\n upperRangeBpsRebalanceFieldInfo,\n lowerRangeRebalanceFieldInfo,\n upperRangeRebalanceFieldInfo,\n ];\n}\n\nexport function getPositionRangeFromPeriodicRebalanceParams(\n price: Decimal,\n lowerPercentageBPS: Decimal,\n upperPercentageBPS: Decimal\n): PositionRange {\n return getPriceRangeFromPriceAndDiffBPS(price, lowerPercentageBPS, upperPercentageBPS);\n}\n\nexport function getDefaultPeriodicRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[] {\n return getPeriodicRebalanceRebalanceFieldInfos(\n price,\n DEFAULT_REBALANCE_PERIOD,\n DEFAULT_LOWER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE,\n DEFAULT_UPPER_RANGE_PRICE_DIFF_BPS_PERIODIC_REBALANCE\n );\n}\n\nexport function readPeriodicRebalanceRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw) {\n const paramsBuffer = Buffer.from(rebalanceRaw.params);\n const params: RebalanceFieldsDict = {};\n\n params['period'] = new Decimal(paramsBuffer.readBigUInt64LE(0).toString());\n params['lowerRangeBps'] = new Decimal(paramsBuffer.readUInt16LE(8));\n params['upperRangeBps'] = new Decimal(paramsBuffer.readUInt16LE(10));\n\n return params;\n}\n\nexport function readPeriodicRebalanceRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw) {\n const stateBuffer = Buffer.from(rebalanceRaw.state);\n const state: RebalanceFieldsDict = {};\n\n state['lastRebalanceTimestamp'] = new Decimal(stateBuffer.readBigUInt64LE(0).toString());\n\n return state;\n}\n\nexport function deserializePeriodicRebalanceFromOnchainParams(price: Decimal, rebalanceRaw: RebalanceRaw) {\n const params = readPeriodicRebalanceRebalanceParamsFromStrategy(rebalanceRaw);\n\n return getPeriodicRebalanceRebalanceFieldInfos(\n price,\n params['period'],\n params['lowerRangeBps'],\n params['upperRangeBps']\n );\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 PricePercentageRebalanceTypeName = "pricePercentage";
|
|
6
|
+
export declare function getPricePercentageRebalanceFieldInfos(poolPrice: Decimal, lowerPercentageBPS: Decimal, upperPercentageBPS: Decimal, enabled?: boolean): RebalanceFieldInfo[];
|
|
7
|
+
export declare function getPositionRangeFromPercentageRebalanceParams(price: Decimal, lowerPercentageBPS: Decimal, upperPercentageBPS: Decimal): PositionRange;
|
|
8
|
+
export declare function getDefaultPricePercentageRebalanceFieldInfos(price: Decimal): RebalanceFieldInfo[];
|
|
9
|
+
export declare function readPricePercentageRebalanceParamsFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
10
|
+
export declare function readRawPricePercentageRebalanceStateFromStrategy(rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
11
|
+
export declare function readPricePercentageRebalanceStateFromStrategy(dex: Dex, tokenADecimals: number, tokenBDecimals: number, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
12
|
+
export declare function deserializePricePercentageRebalanceFromOnchainParams(price: Decimal, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|
|
13
|
+
export declare function deserializePricePercentageRebalanceWithStateOverride(dex: Dex, tokenADecimals: number, tokenBDecimals: number, price: Decimal, rebalanceRaw: RebalanceRaw): RebalanceFieldInfo[];
|