@meteora-ag/dlmm 1.6.0-rc.21 → 1.6.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +214 -94
- package/dist/index.js +2105 -1831
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2406 -2132
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { Program, BN as BN$1, IdlAccounts, ProgramAccount, IdlTypes, EventParser
|
|
|
3
3
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
4
4
|
import { PublicKey, Connection, AccountMeta, Keypair, TransactionInstruction, Cluster, Transaction } from '@solana/web3.js';
|
|
5
5
|
import Decimal from 'decimal.js';
|
|
6
|
+
import { IdlDiscriminator } from '@coral-xyz/anchor/dist/cjs/idl';
|
|
6
7
|
import { Mint } from '@solana/spl-token';
|
|
7
8
|
import { AllAccountsMap } from '@coral-xyz/anchor/dist/cjs/program/namespace/types';
|
|
8
9
|
import BN from 'bn.js';
|
|
9
|
-
import { IdlDiscriminator } from '@coral-xyz/anchor/dist/cjs/idl';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
@@ -9126,6 +9126,13 @@ type LbClmm = {
|
|
|
9126
9126
|
];
|
|
9127
9127
|
};
|
|
9128
9128
|
|
|
9129
|
+
declare function buildBitFlagAndNegateStrategyParameters(x0: BN, y0: BN, deltaX: BN, deltaY: BN): {
|
|
9130
|
+
bitFlag: number;
|
|
9131
|
+
x0: BN;
|
|
9132
|
+
y0: BN;
|
|
9133
|
+
deltaX: BN;
|
|
9134
|
+
deltaY: BN;
|
|
9135
|
+
};
|
|
9129
9136
|
interface AmountIntoBin {
|
|
9130
9137
|
binId: BN;
|
|
9131
9138
|
amountX: BN;
|
|
@@ -9405,6 +9412,13 @@ interface TInitializePositionAndAddLiquidityParamsByStrategy {
|
|
|
9405
9412
|
user: PublicKey;
|
|
9406
9413
|
slippage?: number;
|
|
9407
9414
|
}
|
|
9415
|
+
interface InitializeMultiplePositionAndAddLiquidityByStrategyResponse {
|
|
9416
|
+
instructionsByPositions: {
|
|
9417
|
+
positionKeypair: Keypair;
|
|
9418
|
+
initializePositionIx: TransactionInstruction;
|
|
9419
|
+
addLiquidityIxs: TransactionInstruction[][];
|
|
9420
|
+
}[];
|
|
9421
|
+
}
|
|
9408
9422
|
interface TInitializeMultiplePositionAndAddLiquidityParamsByStrategy {
|
|
9409
9423
|
totalXAmount: BN$1;
|
|
9410
9424
|
totalYAmount: BN$1;
|
|
@@ -9637,31 +9651,6 @@ interface RebalancePositionBinArrayRentalCostQuote {
|
|
|
9637
9651
|
bitmapExtensionCost: number;
|
|
9638
9652
|
}
|
|
9639
9653
|
|
|
9640
|
-
/** private */
|
|
9641
|
-
declare function derivePresetParameterWithIndex(index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9642
|
-
declare function deriveLbPairWithPresetParamWithIndexKey(presetParameterKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9643
|
-
/**
|
|
9644
|
-
*
|
|
9645
|
-
* @deprecated Use derivePresetParameter2
|
|
9646
|
-
*/
|
|
9647
|
-
declare function derivePresetParameter(binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9648
|
-
declare function derivePresetParameter2(binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9649
|
-
declare function deriveLbPair2(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9650
|
-
/**
|
|
9651
|
-
*
|
|
9652
|
-
* @deprecated Use deriveLbPair2
|
|
9653
|
-
*/
|
|
9654
|
-
declare function deriveLbPair(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9655
|
-
declare function deriveCustomizablePermissionlessLbPair(tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9656
|
-
declare function derivePermissionLbPair(baseKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9657
|
-
declare function deriveOracle(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9658
|
-
declare function derivePosition(lbPair: PublicKey, base: PublicKey, lowerBinId: BN$1, width: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9659
|
-
declare function deriveBinArray(lbPair: PublicKey, index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9660
|
-
declare function deriveReserve(token: PublicKey, lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9661
|
-
declare function deriveTokenBadge(mint: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9662
|
-
declare function deriveEventAuthority(programId: PublicKey): [PublicKey, number];
|
|
9663
|
-
declare function deriveRewardVault(lbPair: PublicKey, rewardIndex: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9664
|
-
|
|
9665
9654
|
/** private */
|
|
9666
9655
|
declare function isOverflowDefaultBinArrayBitmap(binArrayIndex: BN$1): boolean;
|
|
9667
9656
|
declare function deriveBinArrayBitmapExtension(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
@@ -9703,6 +9692,94 @@ declare function updateBinArray(activeId: BN$1, clock: Clock, allRewardInfos: Re
|
|
|
9703
9692
|
}[];
|
|
9704
9693
|
};
|
|
9705
9694
|
|
|
9695
|
+
/** private */
|
|
9696
|
+
declare function derivePresetParameterWithIndex(index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9697
|
+
declare function deriveLbPairWithPresetParamWithIndexKey(presetParameterKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9698
|
+
/**
|
|
9699
|
+
*
|
|
9700
|
+
* @deprecated Use derivePresetParameter2
|
|
9701
|
+
*/
|
|
9702
|
+
declare function derivePresetParameter(binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9703
|
+
declare function derivePresetParameter2(binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9704
|
+
declare function deriveLbPair2(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9705
|
+
/**
|
|
9706
|
+
*
|
|
9707
|
+
* @deprecated Use deriveLbPair2
|
|
9708
|
+
*/
|
|
9709
|
+
declare function deriveLbPair(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9710
|
+
declare function deriveCustomizablePermissionlessLbPair(tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9711
|
+
declare function derivePermissionLbPair(baseKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9712
|
+
declare function deriveOracle(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9713
|
+
declare function derivePosition(lbPair: PublicKey, base: PublicKey, lowerBinId: BN$1, width: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9714
|
+
declare function deriveBinArray(lbPair: PublicKey, index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9715
|
+
declare function deriveReserve(token: PublicKey, lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9716
|
+
declare function deriveTokenBadge(mint: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9717
|
+
declare function deriveEventAuthority(programId: PublicKey): [PublicKey, number];
|
|
9718
|
+
declare function deriveRewardVault(lbPair: PublicKey, rewardIndex: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9719
|
+
declare function derivePlaceHolderAccountMeta(programId: PublicKey): AccountMeta;
|
|
9720
|
+
|
|
9721
|
+
declare function getBaseFee(binStep: number, sParameter: sParameters): BN$1;
|
|
9722
|
+
declare function getVariableFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9723
|
+
declare function getTotalFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9724
|
+
declare function computeFee(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1): BN$1;
|
|
9725
|
+
declare function computeFeeFromAmount(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmountWithFees: BN$1): BN$1;
|
|
9726
|
+
declare function computeProtocolFee(feeAmount: BN$1, sParameter: sParameters): BN$1;
|
|
9727
|
+
declare function swapExactOutQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, outAmount: BN$1, swapForY: boolean): {
|
|
9728
|
+
amountIn: BN$1;
|
|
9729
|
+
amountOut: BN$1;
|
|
9730
|
+
fee: BN$1;
|
|
9731
|
+
protocolFee: BN$1;
|
|
9732
|
+
};
|
|
9733
|
+
declare function swapExactInQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1, swapForY: boolean): {
|
|
9734
|
+
amountIn: BN$1;
|
|
9735
|
+
amountOut: BN$1;
|
|
9736
|
+
fee: BN$1;
|
|
9737
|
+
protocolFee: BN$1;
|
|
9738
|
+
};
|
|
9739
|
+
|
|
9740
|
+
/**
|
|
9741
|
+
* It fetches the pool account from the AMM program, and returns the mint addresses for the two tokens
|
|
9742
|
+
* @param {Connection} connection - Connection - The connection to the Solana cluster
|
|
9743
|
+
* @param {string} poolAddress - The address of the pool account.
|
|
9744
|
+
* @returns The tokenAMint and tokenBMint addresses for the pool.
|
|
9745
|
+
*/
|
|
9746
|
+
declare function getTokensMintFromPoolAddress(connection: Connection, poolAddress: string, opt?: {
|
|
9747
|
+
cluster?: Cluster;
|
|
9748
|
+
programId?: PublicKey;
|
|
9749
|
+
}): Promise<{
|
|
9750
|
+
tokenXMint: PublicKey;
|
|
9751
|
+
tokenYMint: PublicKey;
|
|
9752
|
+
}>;
|
|
9753
|
+
declare function getTokenProgramId(lbPairState: LbPair): {
|
|
9754
|
+
tokenXProgram: PublicKey;
|
|
9755
|
+
tokenYProgram: PublicKey;
|
|
9756
|
+
};
|
|
9757
|
+
|
|
9758
|
+
/**
|
|
9759
|
+
* Given a strategy type and amounts of X and Y, returns the distribution of liquidity.
|
|
9760
|
+
* @param activeId The bin id of the active bin.
|
|
9761
|
+
* @param binStep The step size of each bin.
|
|
9762
|
+
* @param minBinId The min bin id.
|
|
9763
|
+
* @param maxBinId The max bin id.
|
|
9764
|
+
* @param amountX The amount of X token to deposit.
|
|
9765
|
+
* @param amountY The amount of Y token to deposit.
|
|
9766
|
+
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
9767
|
+
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
9768
|
+
* @param strategyType The strategy type.
|
|
9769
|
+
* @param mintX The mint info of X token. Get from DLMM instance.
|
|
9770
|
+
* @param mintY The mint info of Y token. Get from DLMM instance.
|
|
9771
|
+
* @param clock The clock info. Get from DLMM instance.
|
|
9772
|
+
* @returns The distribution of liquidity.
|
|
9773
|
+
*/
|
|
9774
|
+
declare function toAmountsBothSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amountX: BN$1, amountY: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, strategyType: StrategyType, mintX: Mint, mintY: Mint, clock: Clock): {
|
|
9775
|
+
binId: number;
|
|
9776
|
+
amountX: BN$1;
|
|
9777
|
+
amountY: BN$1;
|
|
9778
|
+
}[];
|
|
9779
|
+
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9780
|
+
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9781
|
+
declare function toStrategyParameters({ maxBinId, minBinId, strategyType, singleSidedX, }: StrategyParameters): ProgramStrategyParameter;
|
|
9782
|
+
|
|
9706
9783
|
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
9707
9784
|
/** private */
|
|
9708
9785
|
declare function toWeightDistribution(amountX: BN$1, amountY: BN$1, distributions: {
|
|
@@ -9771,25 +9848,6 @@ declare function fromWeightDistributionToAmount(amountX: BN$1, amountY: BN$1, di
|
|
|
9771
9848
|
amountY: BN$1;
|
|
9772
9849
|
}[];
|
|
9773
9850
|
|
|
9774
|
-
declare function getBaseFee(binStep: number, sParameter: sParameters): BN$1;
|
|
9775
|
-
declare function getVariableFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9776
|
-
declare function getTotalFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9777
|
-
declare function computeFee(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1): BN$1;
|
|
9778
|
-
declare function computeFeeFromAmount(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmountWithFees: BN$1): BN$1;
|
|
9779
|
-
declare function computeProtocolFee(feeAmount: BN$1, sParameter: sParameters): BN$1;
|
|
9780
|
-
declare function swapExactOutQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, outAmount: BN$1, swapForY: boolean): {
|
|
9781
|
-
amountIn: BN$1;
|
|
9782
|
-
amountOut: BN$1;
|
|
9783
|
-
fee: BN$1;
|
|
9784
|
-
protocolFee: BN$1;
|
|
9785
|
-
};
|
|
9786
|
-
declare function swapExactInQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1, swapForY: boolean): {
|
|
9787
|
-
amountIn: BN$1;
|
|
9788
|
-
amountOut: BN$1;
|
|
9789
|
-
fee: BN$1;
|
|
9790
|
-
protocolFee: BN$1;
|
|
9791
|
-
};
|
|
9792
|
-
|
|
9793
9851
|
/**
|
|
9794
9852
|
* Distribute totalAmount to all bid side bins according to given distributions.
|
|
9795
9853
|
* @param activeId active bin id
|
|
@@ -9855,49 +9913,6 @@ declare function autoFillXByWeight(activeId: number, binStep: number, amountY: B
|
|
|
9855
9913
|
weight: number;
|
|
9856
9914
|
}[]): BN$1;
|
|
9857
9915
|
|
|
9858
|
-
/**
|
|
9859
|
-
* Given a strategy type and amounts of X and Y, returns the distribution of liquidity.
|
|
9860
|
-
* @param activeId The bin id of the active bin.
|
|
9861
|
-
* @param binStep The step size of each bin.
|
|
9862
|
-
* @param minBinId The min bin id.
|
|
9863
|
-
* @param maxBinId The max bin id.
|
|
9864
|
-
* @param amountX The amount of X token to deposit.
|
|
9865
|
-
* @param amountY The amount of Y token to deposit.
|
|
9866
|
-
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
9867
|
-
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
9868
|
-
* @param strategyType The strategy type.
|
|
9869
|
-
* @param mintX The mint info of X token. Get from DLMM instance.
|
|
9870
|
-
* @param mintY The mint info of Y token. Get from DLMM instance.
|
|
9871
|
-
* @param clock The clock info. Get from DLMM instance.
|
|
9872
|
-
* @returns The distribution of liquidity.
|
|
9873
|
-
*/
|
|
9874
|
-
declare function toAmountsBothSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amountX: BN$1, amountY: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, strategyType: StrategyType, mintX: Mint, mintY: Mint, clock: Clock): {
|
|
9875
|
-
binId: number;
|
|
9876
|
-
amountX: BN$1;
|
|
9877
|
-
amountY: BN$1;
|
|
9878
|
-
}[];
|
|
9879
|
-
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9880
|
-
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9881
|
-
declare function toStrategyParameters({ maxBinId, minBinId, strategyType, singleSidedX, }: StrategyParameters): ProgramStrategyParameter;
|
|
9882
|
-
|
|
9883
|
-
/**
|
|
9884
|
-
* It fetches the pool account from the AMM program, and returns the mint addresses for the two tokens
|
|
9885
|
-
* @param {Connection} connection - Connection - The connection to the Solana cluster
|
|
9886
|
-
* @param {string} poolAddress - The address of the pool account.
|
|
9887
|
-
* @returns The tokenAMint and tokenBMint addresses for the pool.
|
|
9888
|
-
*/
|
|
9889
|
-
declare function getTokensMintFromPoolAddress(connection: Connection, poolAddress: string, opt?: {
|
|
9890
|
-
cluster?: Cluster;
|
|
9891
|
-
programId?: PublicKey;
|
|
9892
|
-
}): Promise<{
|
|
9893
|
-
tokenXMint: PublicKey;
|
|
9894
|
-
tokenYMint: PublicKey;
|
|
9895
|
-
}>;
|
|
9896
|
-
declare function getTokenProgramId(lbPairState: LbPair): {
|
|
9897
|
-
tokenXProgram: PublicKey;
|
|
9898
|
-
tokenYProgram: PublicKey;
|
|
9899
|
-
};
|
|
9900
|
-
|
|
9901
9916
|
declare function chunks<T>(array: T[], size: number): T[][];
|
|
9902
9917
|
declare function range<T>(min: number, max: number, mapfn: (i: number) => T): T[];
|
|
9903
9918
|
declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
|
|
@@ -10005,7 +10020,78 @@ type Opt = {
|
|
|
10005
10020
|
declare function createProgram(connection: Connection, opt?: Opt): Program<LbClmm>;
|
|
10006
10021
|
declare function decodeAccount<T extends LbPair | BinArrayBitmapExtension | BinArray | PositionV2 | Position | PresetParameter | PresetParameter2>(program: Program<LbClmm>, accountName: AccountName, buffer: Buffer): T;
|
|
10007
10022
|
declare function getAccountDiscriminator(accountName: AccountName): IdlDiscriminator;
|
|
10023
|
+
/**
|
|
10024
|
+
* Caps a slippage percentage to be between 0 and 100.
|
|
10025
|
+
* @param slippage The slippage percentage to be capped.
|
|
10026
|
+
* @returns The capped slippage percentage.
|
|
10027
|
+
*/
|
|
10008
10028
|
declare function capSlippagePercentage(slippage: number): number;
|
|
10029
|
+
/**
|
|
10030
|
+
* Given a slippage percentage and a bin step, calculate the maximum number of bins
|
|
10031
|
+
* that the user is willing to allow the active bin to drift from the target price.
|
|
10032
|
+
* If the slippage percentage is 0 or null, return the maxActiveBinSlippage instead.
|
|
10033
|
+
*
|
|
10034
|
+
* @param slippagePercentage The slippage percentage in basis points.
|
|
10035
|
+
* @param binStep The bin step of the pair.
|
|
10036
|
+
* @param maxActiveBinSlippage The maximum number of bins that the active bin can drift.
|
|
10037
|
+
* @returns The maximum number of bins that the user is willing to allow the active bin to drift.
|
|
10038
|
+
*/
|
|
10039
|
+
declare function getAndCapMaxActiveBinSlippage(slippagePercentage: number, binStep: number, maxActiveBinSlippage: number): number;
|
|
10040
|
+
/**
|
|
10041
|
+
* Calculates the number of bins in a given range.
|
|
10042
|
+
*
|
|
10043
|
+
* @param minBinId The minimum bin id of the range.
|
|
10044
|
+
* @param maxBinId The maximum bin id of the range.
|
|
10045
|
+
* @returns The number of bins in the range.
|
|
10046
|
+
*/
|
|
10047
|
+
declare function getBinCount(minBinId: number, maxBinId: number): number;
|
|
10048
|
+
/**
|
|
10049
|
+
* Calculates the maximum amount of tokens after applying slippage to the given amount.
|
|
10050
|
+
*
|
|
10051
|
+
* @param amount The amount of tokens before slippage.
|
|
10052
|
+
* @param slippage The percentage of slippage to apply.
|
|
10053
|
+
* @returns The maximum amount of tokens after applying slippage. If the slippage is 100%, the maximum amount is U64_MAX.
|
|
10054
|
+
*
|
|
10055
|
+
**/
|
|
10056
|
+
declare function getSlippageMaxAmount(amount: BN$1, slippage: number): BN$1;
|
|
10057
|
+
/**
|
|
10058
|
+
* Calculates the minimum amount of tokens after applying slippage to the given amount.
|
|
10059
|
+
*
|
|
10060
|
+
* @param amount The amount of tokens before slippage.
|
|
10061
|
+
* @param slippage The percentage of slippage to apply.
|
|
10062
|
+
* @returns The minimum amount of tokens after applying slippage.
|
|
10063
|
+
*/
|
|
10064
|
+
declare function getSlippageMinAmount(amount: BN$1, slippage: number): BN$1;
|
|
10065
|
+
/**
|
|
10066
|
+
* Calculates the number of positions required to cover a range of bins.
|
|
10067
|
+
*
|
|
10068
|
+
* @param binCount The number of bins in the range.
|
|
10069
|
+
* @returns The number of positions required to cover the range of bins.
|
|
10070
|
+
*/
|
|
10071
|
+
declare function getPositionCountByBinCount(binCount: number): number;
|
|
10072
|
+
/**
|
|
10073
|
+
* Adjusts the liquidity parameters to reset uninvolved liquidity based on delta IDs.
|
|
10074
|
+
*
|
|
10075
|
+
* This function modifies the provided liquidity strategy parameters by resetting
|
|
10076
|
+
* the x0, y0, deltaX, and deltaY values when certain conditions regarding the
|
|
10077
|
+
* minDeltaId and maxDeltaId are met. If the maxDeltaId is less than or equal
|
|
10078
|
+
* to the end of the bid side delta ID, x0 and deltaX are set to zero. If the
|
|
10079
|
+
* minDeltaId is greater than or equal to the start of the ask side delta ID,
|
|
10080
|
+
* y0 and deltaY are set to zero.
|
|
10081
|
+
*
|
|
10082
|
+
* @param minDeltaId - The minimum delta ID.
|
|
10083
|
+
* @param maxDeltaId - The maximum delta ID.
|
|
10084
|
+
* @param favorXInActiveId - A boolean indicating if X is favored in the active bin.
|
|
10085
|
+
* @param params - The liquidity strategy parameters containing x0, y0, deltaX, and deltaY.
|
|
10086
|
+
* @returns An object containing the adjusted x0, y0, deltaX, and deltaY values.
|
|
10087
|
+
*/
|
|
10088
|
+
declare function resetUninvolvedLiquidityParams(minDeltaId: BN$1, maxDeltaId: BN$1, favorXInActiveId: boolean, params: LiquidityStrategyParameters): {
|
|
10089
|
+
x0: BN$1;
|
|
10090
|
+
y0: BN$1;
|
|
10091
|
+
deltaX: BN$1;
|
|
10092
|
+
deltaY: BN$1;
|
|
10093
|
+
};
|
|
10094
|
+
declare function chunkDepositWithRebalanceEndpoint(dlmm: DLMM, strategy: StrategyParameters, slippagePercentage: number, maxActiveBinSlippage: number, position: PublicKey, positionMinBinId: number, positionMaxBinId: number, liquidityStrategyParameters: LiquidityStrategyParameters, owner: PublicKey, payer: PublicKey, simulateCU: boolean): Promise<TransactionInstruction[][]>;
|
|
10009
10095
|
|
|
10010
10096
|
declare class DLMM {
|
|
10011
10097
|
pubkey: PublicKey;
|
|
@@ -10379,6 +10465,33 @@ declare class DLMM {
|
|
|
10379
10465
|
* - `version`: The version of the position (in this case, `Position.V2`)
|
|
10380
10466
|
*/
|
|
10381
10467
|
getPosition(positionPubKey: PublicKey): Promise<LbPosition>;
|
|
10468
|
+
/**
|
|
10469
|
+
* Creates multiple positions and adds liquidity by strategy without chainsaw issues.
|
|
10470
|
+
* @param positionKeypairGenerator A function that generates a specified number of keypairs.
|
|
10471
|
+
* @param totalXAmount The total amount of token X to be added.
|
|
10472
|
+
* @param totalYAmount The total amount of token Y to be added.
|
|
10473
|
+
* @param strategy The strategy for adding liquidity.
|
|
10474
|
+
* @param owner The owner of the position.
|
|
10475
|
+
* @param payer The payer of the transaction.
|
|
10476
|
+
* @param slippagePercentage The slippage percentage for adding liquidity.
|
|
10477
|
+
* @returns An object with two properties: `initPositionIxs` and `addLiquidityIxs`.
|
|
10478
|
+
*/
|
|
10479
|
+
initializeMultiplePositionAndAddLiquidityByStrategy(positionKeypairGenerator: (count: number) => Promise<Keypair[]>, totalXAmount: BN$1, totalYAmount: BN$1, strategy: StrategyParameters, owner: PublicKey, payer: PublicKey, slippagePercentage: number): Promise<InitializeMultiplePositionAndAddLiquidityByStrategyResponse>;
|
|
10480
|
+
/**
|
|
10481
|
+
* Adds liquidity to an existing position using a specified strategy, allowing for chunkable transactions.
|
|
10482
|
+
* If adding liquidity to bin out of position range, it will automatically expand. The limitation is 70 bins.
|
|
10483
|
+
*
|
|
10484
|
+
* @param {TInitializePositionAndAddLiquidityParamsByStrategy} params - The parameters required for adding liquidity.
|
|
10485
|
+
* @param {PublicKey} params.positionPubKey - The public key of the position to which liquidity is being added.
|
|
10486
|
+
* @param {BN} params.totalXAmount - The total amount of token X to be added as liquidity.
|
|
10487
|
+
* @param {BN} params.totalYAmount - The total amount of token Y to be added as liquidity.
|
|
10488
|
+
* @param {StrategyParameters} params.strategy - The strategy parameters for adding liquidity.
|
|
10489
|
+
* @param {PublicKey} params.user - The public key of the user adding liquidity.
|
|
10490
|
+
* @param {number} params.slippage - The slippage percentage allowed for the transaction.
|
|
10491
|
+
*
|
|
10492
|
+
* @returns {Promise<Transaction[]>} A promise that resolves to an array of transactions for adding liquidity.
|
|
10493
|
+
*/
|
|
10494
|
+
addLiquidityByStrategyChunkable({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction[]>;
|
|
10382
10495
|
/**
|
|
10383
10496
|
* The function `initializePositionAndAddLiquidityByStrategy` function is used to initializes a position and adds liquidity
|
|
10384
10497
|
* @param {TInitializePositionAndAddLiquidityParamsByStrategy}
|
|
@@ -10407,7 +10520,7 @@ declare class DLMM {
|
|
|
10407
10520
|
*/
|
|
10408
10521
|
initializePositionAndAddLiquidityByWeight({ positionPubKey, totalXAmount, totalYAmount, xYAmountDistribution, user, slippage, }: TInitializePositionAndAddLiquidityParams): Promise<Transaction | Transaction[]>;
|
|
10409
10522
|
/**
|
|
10410
|
-
* The `addLiquidityByStrategy` function is used to add liquidity to existing position
|
|
10523
|
+
* The `addLiquidityByStrategy` function is used to add liquidity to existing position
|
|
10411
10524
|
* @param {TInitializePositionAndAddLiquidityParamsByStrategy}
|
|
10412
10525
|
* - `positionPubKey`: The public key of the position account. (usually use `new Keypair()`)
|
|
10413
10526
|
* - `totalXAmount`: The total amount of token X to be added to the liquidity pool.
|
|
@@ -10415,9 +10528,10 @@ declare class DLMM {
|
|
|
10415
10528
|
* - `strategy`: The strategy parameters to be used for the liquidity pool (Can use `calculateStrategyParameter` to calculate).
|
|
10416
10529
|
* - `user`: The public key of the user account.
|
|
10417
10530
|
* - `slippage`: The slippage percentage to be used for the liquidity pool.
|
|
10418
|
-
* @returns {Promise<Transaction
|
|
10531
|
+
* @returns {Promise<Transaction>} The function `addLiquidityByWeight` returns a `Promise` that resolves to either a single
|
|
10532
|
+
* `Transaction` object
|
|
10419
10533
|
*/
|
|
10420
|
-
addLiquidityByStrategy({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction
|
|
10534
|
+
addLiquidityByStrategy({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction>;
|
|
10421
10535
|
/**
|
|
10422
10536
|
* @deprecated Use `addLiquidityByStrategy` instead which support both token and token2022.
|
|
10423
10537
|
* The `addLiquidityByWeight` function is used to add liquidity to existing position
|
|
@@ -10732,7 +10846,10 @@ declare class DLMM {
|
|
|
10732
10846
|
*
|
|
10733
10847
|
* @returns An object containing the instructions to initialize new bin arrays and the instruction to rebalance the position.
|
|
10734
10848
|
*/
|
|
10735
|
-
rebalancePosition(rebalancePositionResponse: RebalancePositionResponse, maxActiveBinSlippage: BN$1, rentPayer?: PublicKey, slippage?: number): Promise<
|
|
10849
|
+
rebalancePosition(rebalancePositionResponse: RebalancePositionResponse, maxActiveBinSlippage: BN$1, rentPayer?: PublicKey, slippage?: number): Promise<{
|
|
10850
|
+
initBinArrayInstructions: TransactionInstruction[];
|
|
10851
|
+
rebalancePositionInstruction: TransactionInstruction[];
|
|
10852
|
+
}>;
|
|
10736
10853
|
/**
|
|
10737
10854
|
* Create an extended empty position.
|
|
10738
10855
|
*
|
|
@@ -10758,7 +10875,10 @@ declare class DLMM {
|
|
|
10758
10875
|
static updateReference(activeId: number, vParameter: vParameters, sParameter: sParameters, currentTimestamp: number): void;
|
|
10759
10876
|
private createClaimBuildMethod;
|
|
10760
10877
|
private createClaimSwapFeeMethod;
|
|
10761
|
-
|
|
10878
|
+
getPotentialToken2022IxDataAndAccounts(actionType: ActionType, rewardIndex?: number): {
|
|
10879
|
+
slices: RemainingAccountsInfoSlice[];
|
|
10880
|
+
accounts: AccountMeta[];
|
|
10881
|
+
};
|
|
10762
10882
|
}
|
|
10763
10883
|
|
|
10764
10884
|
var address = "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo";
|
|
@@ -21655,4 +21775,4 @@ declare const MAX_EXTRA_BIN_ARRAYS = 3;
|
|
|
21655
21775
|
declare const U64_MAX: BN$1;
|
|
21656
21776
|
declare const MAX_BINS_PER_POSITION: BN$1;
|
|
21657
21777
|
|
|
21658
|
-
export { ADMIN, AccountName, ActionType, ActivationType, AmountIntoBin, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_FEE, BIN_ARRAY_BITMAP_FEE_BN, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, BIN_ARRAY_FEE_BN, BidAskParameters, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, CreateRebalancePositionParams, DEFAULT_BIN_PER_POSITION, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, ExtendedPositionBinData, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, ILM_BASE, InitCustomizablePermissionlessPairIx, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, LiquidityStrategyParameterBuilder, LiquidityStrategyParameters, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BINS_PER_POSITION, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_CLAIM_ALL_ALLOWED, MAX_EXTRA_BIN_ARRAYS, MAX_FEE_RATE, MAX_RESIZE_LENGTH, MEMO_PROGRAM_ID, Network, Opt, POOL_FEE, POOL_FEE_BN, POSITION_BIN_DATA_SIZE, POSITION_FEE, POSITION_FEE_BN, POSITION_MAX_LENGTH, POSITION_MIN_SIZE, PRECISION, PairLockInfo, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionLockInfo, PositionV2, PositionVersion, PresetParameter, PresetParameter2, ProgramStrategyParameter, ProgramStrategyType, RebalanceAddLiquidityParam, RebalancePosition, RebalancePositionBinArrayRentalCostQuote, RebalancePositionResponse, RebalanceRemoveLiquidityParam, RebalanceWithDeposit, RebalanceWithWithdraw, RemainingAccountInfo, RemainingAccountsInfoSlice, ResizeSide, ResizeSideEnum, RewardInfo, RewardInfos, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityCostBreakdown, SeedLiquidityResponse, SeedLiquiditySingleBinResponse, SimulateRebalanceResp, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializeMultiplePositionAndAddLiquidityParamsByStrategy, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TOKEN_ACCOUNT_FEE, TOKEN_ACCOUNT_FEE_BN, TQuoteCreatePositionParams, TokenReserve, U64_MAX, UserFeeInfo, UserRewardInfo, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, buildLiquidityStrategyParameters, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, capSlippagePercentage, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, createProgram, decodeAccount, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveEventAuthority, deriveLbPair, deriveLbPair2, deriveLbPairWithPresetParamWithIndexKey, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, derivePresetParameterWithIndex, deriveReserve, deriveRewardVault, deriveTokenBadge, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getAccountDiscriminator, getAmountInBinsAskSide, getAmountInBinsBidSide, getAutoFillAmountByRebalancedPosition, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getBinIdIndexInBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getLiquidityStrategyParameterBuilder, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getRebalanceBinArrayIndexesAndBitmapCoverage, getTokenBalance, getTokenDecimals, getTokenProgramId, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, sParameters, suggestBalancedXParametersFromY, suggestBalancedYParametersFromX, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountIntoBins, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, updateBinArray, vParameters, wrapSOLInstruction };
|
|
21778
|
+
export { ADMIN, AccountName, ActionType, ActivationType, AmountIntoBin, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_FEE, BIN_ARRAY_BITMAP_FEE_BN, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, BIN_ARRAY_FEE_BN, BidAskParameters, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, CreateRebalancePositionParams, DEFAULT_BIN_PER_POSITION, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, ExtendedPositionBinData, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, ILM_BASE, InitCustomizablePermissionlessPairIx, InitPermissionPairIx, InitializeMultiplePositionAndAddLiquidityByStrategyResponse, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, LiquidityStrategyParameterBuilder, LiquidityStrategyParameters, MAX_ACTIVE_BIN_SLIPPAGE, MAX_BINS_PER_POSITION, MAX_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_CLAIM_ALL_ALLOWED, MAX_EXTRA_BIN_ARRAYS, MAX_FEE_RATE, MAX_RESIZE_LENGTH, MEMO_PROGRAM_ID, Network, Opt, POOL_FEE, POOL_FEE_BN, POSITION_BIN_DATA_SIZE, POSITION_FEE, POSITION_FEE_BN, POSITION_MAX_LENGTH, POSITION_MIN_SIZE, PRECISION, PairLockInfo, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionLockInfo, PositionV2, PositionVersion, PresetParameter, PresetParameter2, ProgramStrategyParameter, ProgramStrategyType, RebalanceAddLiquidityParam, RebalancePosition, RebalancePositionBinArrayRentalCostQuote, RebalancePositionResponse, RebalanceRemoveLiquidityParam, RebalanceWithDeposit, RebalanceWithWithdraw, RemainingAccountInfo, RemainingAccountsInfoSlice, ResizeSide, ResizeSideEnum, RewardInfo, RewardInfos, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityCostBreakdown, SeedLiquidityResponse, SeedLiquiditySingleBinResponse, SimulateRebalanceResp, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializeMultiplePositionAndAddLiquidityParamsByStrategy, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TOKEN_ACCOUNT_FEE, TOKEN_ACCOUNT_FEE_BN, TQuoteCreatePositionParams, TokenReserve, U64_MAX, UserFeeInfo, UserRewardInfo, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, buildBitFlagAndNegateStrategyParameters, buildLiquidityStrategyParameters, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, capSlippagePercentage, chunkDepositWithRebalanceEndpoint, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, createProgram, decodeAccount, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveEventAuthority, deriveLbPair, deriveLbPair2, deriveLbPairWithPresetParamWithIndexKey, deriveOracle, derivePermissionLbPair, derivePlaceHolderAccountMeta, derivePosition, derivePresetParameter, derivePresetParameter2, derivePresetParameterWithIndex, deriveReserve, deriveRewardVault, deriveTokenBadge, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getAccountDiscriminator, getAmountInBinsAskSide, getAmountInBinsBidSide, getAndCapMaxActiveBinSlippage, getAutoFillAmountByRebalancedPosition, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinCount, getBinFromBinArray, getBinIdIndexInBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getLiquidityStrategyParameterBuilder, getOrCreateATAInstruction, getOutAmount, getPositionCountByBinCount, getPriceOfBinByBinId, getRebalanceBinArrayIndexesAndBitmapCoverage, getSlippageMaxAmount, getSlippageMinAmount, getTokenBalance, getTokenDecimals, getTokenProgramId, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, resetUninvolvedLiquidityParams, sParameters, suggestBalancedXParametersFromY, suggestBalancedYParametersFromX, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountIntoBins, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, updateBinArray, vParameters, wrapSOLInstruction };
|