@meteora-ag/dlmm 1.6.0-rc.22 → 1.6.0-rc.4
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 +97 -265
- package/dist/index.js +2639 -3324
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2790 -3475
- 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';
|
|
7
6
|
import { Mint } from '@solana/spl-token';
|
|
8
7
|
import { AllAccountsMap } from '@coral-xyz/anchor/dist/cjs/program/namespace/types';
|
|
9
8
|
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,21 +9126,6 @@ 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
|
-
};
|
|
9136
|
-
interface AmountIntoBin {
|
|
9137
|
-
binId: BN;
|
|
9138
|
-
amountX: BN;
|
|
9139
|
-
amountY: BN;
|
|
9140
|
-
}
|
|
9141
|
-
declare function getAmountInBinsBidSide(activeId: BN, minDeltaId: BN, maxDeltaId: BN, deltaY: BN, y0: BN): AmountIntoBin[];
|
|
9142
|
-
declare function getAmountInBinsAskSide(activeId: BN, binStep: BN, minDeltaId: BN, maxDeltaId: BN, deltaX: BN, x0: BN): AmountIntoBin[];
|
|
9143
|
-
declare function toAmountIntoBins(activeId: BN, minDeltaId: BN, maxDeltaId: BN, deltaX: BN, deltaY: BN, x0: BN, y0: BN, binStep: BN, favorXInActiveBin: boolean): AmountIntoBin[];
|
|
9144
9129
|
interface SimulateWithdrawResult {
|
|
9145
9130
|
liquidityAndFeeXWithdrawn: BN;
|
|
9146
9131
|
liquidityAndFeeYWithdrawn: BN;
|
|
@@ -9225,43 +9210,6 @@ interface SimulateRebalanceResp {
|
|
|
9225
9210
|
withdrawParams: RebalanceRemoveLiquidityParam[];
|
|
9226
9211
|
rentalCostLamports: BN;
|
|
9227
9212
|
}
|
|
9228
|
-
declare function getRebalanceBinArrayIndexesAndBitmapCoverage(adds: RebalanceAddLiquidityParam[], removes: RebalanceRemoveLiquidityParam[], activeId: number, pairAddress: PublicKey, programId: PublicKey): {
|
|
9229
|
-
binArrayIndexes: BN[];
|
|
9230
|
-
binArrayBitmap: PublicKey;
|
|
9231
|
-
};
|
|
9232
|
-
|
|
9233
|
-
interface LiquidityStrategyParameters {
|
|
9234
|
-
x0: BN;
|
|
9235
|
-
y0: BN;
|
|
9236
|
-
deltaX: BN;
|
|
9237
|
-
deltaY: BN;
|
|
9238
|
-
}
|
|
9239
|
-
interface BidAskParameters {
|
|
9240
|
-
base: BN;
|
|
9241
|
-
delta: BN;
|
|
9242
|
-
}
|
|
9243
|
-
interface LiquidityStrategyParameterBuilder {
|
|
9244
|
-
findXParameters(amountX: BN, minDeltaId: BN, maxDeltaId: BN, binStep: BN, activeId: BN): BidAskParameters;
|
|
9245
|
-
findYParameters(amountY: BN, minDeltaId: BN, maxDeltaId: BN, activeId: BN): BidAskParameters;
|
|
9246
|
-
suggestBalancedXParametersFromY(activeId: BN, binStep: BN, favorXInActiveBin: boolean, minDeltaId: BN, maxDeltaId: BN, amountY: BN): BidAskParameters & {
|
|
9247
|
-
amountX: BN;
|
|
9248
|
-
};
|
|
9249
|
-
suggestBalancedYParametersFromX(activeId: BN, binStep: BN, favorXInActiveBin: boolean, minDeltaId: BN, maxDeltaId: BN, amountXInQuoteValue: BN): BidAskParameters & {
|
|
9250
|
-
amountY: BN;
|
|
9251
|
-
};
|
|
9252
|
-
}
|
|
9253
|
-
declare function getLiquidityStrategyParameterBuilder(strategyType: StrategyType): LiquidityStrategyParameterBuilder;
|
|
9254
|
-
declare function suggestBalancedXParametersFromY(y0: BN, deltaY: BN, minDeltaId: BN, maxDeltaId: BN, activeId: BN, binStep: BN, favorXInActiveBin: boolean, builder: LiquidityStrategyParameterBuilder): BidAskParameters & {
|
|
9255
|
-
amountX: BN;
|
|
9256
|
-
};
|
|
9257
|
-
declare function getAutoFillAmountByRebalancedPosition(rebalancePosition: RebalancePosition, strategyType: StrategyType): {
|
|
9258
|
-
amount: BN;
|
|
9259
|
-
isBidSide: boolean;
|
|
9260
|
-
};
|
|
9261
|
-
declare function suggestBalancedYParametersFromX(x0: BN, deltaX: BN, minDeltaId: BN, maxDeltaId: BN, activeId: BN, binStep: BN, favorXInActiveBin: boolean, builder: LiquidityStrategyParameterBuilder): BidAskParameters & {
|
|
9262
|
-
amountY: BN;
|
|
9263
|
-
};
|
|
9264
|
-
declare function buildLiquidityStrategyParameters(amountX: BN, amountY: BN, minDeltaId: BN, maxDeltaId: BN, binStep: BN, favorXInActiveId: boolean, activeId: BN, strategyParameterBuilder: LiquidityStrategyParameterBuilder): LiquidityStrategyParameters;
|
|
9265
9213
|
|
|
9266
9214
|
interface BinAndAmount {
|
|
9267
9215
|
binId: number;
|
|
@@ -9412,13 +9360,6 @@ interface TInitializePositionAndAddLiquidityParamsByStrategy {
|
|
|
9412
9360
|
user: PublicKey;
|
|
9413
9361
|
slippage?: number;
|
|
9414
9362
|
}
|
|
9415
|
-
interface InitializeMultiplePositionAndAddLiquidityByStrategyResponse {
|
|
9416
|
-
instructionsByPositions: {
|
|
9417
|
-
positionKeypair: Keypair;
|
|
9418
|
-
initializePositionIx: TransactionInstruction;
|
|
9419
|
-
addLiquidityIxs: TransactionInstruction[][];
|
|
9420
|
-
}[];
|
|
9421
|
-
}
|
|
9422
9363
|
interface TInitializeMultiplePositionAndAddLiquidityParamsByStrategy {
|
|
9423
9364
|
totalXAmount: BN$1;
|
|
9424
9365
|
totalYAmount: BN$1;
|
|
@@ -9644,12 +9585,31 @@ interface RebalancePositionResponse {
|
|
|
9644
9585
|
rebalancePosition: RebalancePosition;
|
|
9645
9586
|
simulationResult: SimulateRebalanceResp;
|
|
9646
9587
|
}
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9588
|
+
|
|
9589
|
+
/** private */
|
|
9590
|
+
declare function derivePresetParameterWithIndex(index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9591
|
+
declare function deriveLbPairWithPresetParamWithIndexKey(presetParameterKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9592
|
+
/**
|
|
9593
|
+
*
|
|
9594
|
+
* @deprecated Use derivePresetParameter2
|
|
9595
|
+
*/
|
|
9596
|
+
declare function derivePresetParameter(binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9597
|
+
declare function derivePresetParameter2(binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9598
|
+
declare function deriveLbPair2(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9599
|
+
/**
|
|
9600
|
+
*
|
|
9601
|
+
* @deprecated Use deriveLbPair2
|
|
9602
|
+
*/
|
|
9603
|
+
declare function deriveLbPair(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9604
|
+
declare function deriveCustomizablePermissionlessLbPair(tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9605
|
+
declare function derivePermissionLbPair(baseKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9606
|
+
declare function deriveOracle(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9607
|
+
declare function derivePosition(lbPair: PublicKey, base: PublicKey, lowerBinId: BN$1, width: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9608
|
+
declare function deriveBinArray(lbPair: PublicKey, index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9609
|
+
declare function deriveReserve(token: PublicKey, lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9610
|
+
declare function deriveTokenBadge(mint: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9611
|
+
declare function deriveEventAuthority(programId: PublicKey): [PublicKey, number];
|
|
9612
|
+
declare function deriveRewardVault(lbPair: PublicKey, rewardIndex: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9653
9613
|
|
|
9654
9614
|
/** private */
|
|
9655
9615
|
declare function isOverflowDefaultBinArrayBitmap(binArrayIndex: BN$1): boolean;
|
|
@@ -9692,94 +9652,6 @@ declare function updateBinArray(activeId: BN$1, clock: Clock, allRewardInfos: Re
|
|
|
9692
9652
|
}[];
|
|
9693
9653
|
};
|
|
9694
9654
|
|
|
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
|
-
|
|
9783
9655
|
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
9784
9656
|
/** private */
|
|
9785
9657
|
declare function toWeightDistribution(amountX: BN$1, amountY: BN$1, distributions: {
|
|
@@ -9848,6 +9720,25 @@ declare function fromWeightDistributionToAmount(amountX: BN$1, amountY: BN$1, di
|
|
|
9848
9720
|
amountY: BN$1;
|
|
9849
9721
|
}[];
|
|
9850
9722
|
|
|
9723
|
+
declare function getBaseFee(binStep: number, sParameter: sParameters): BN$1;
|
|
9724
|
+
declare function getVariableFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9725
|
+
declare function getTotalFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9726
|
+
declare function computeFee(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1): BN$1;
|
|
9727
|
+
declare function computeFeeFromAmount(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmountWithFees: BN$1): BN$1;
|
|
9728
|
+
declare function computeProtocolFee(feeAmount: BN$1, sParameter: sParameters): BN$1;
|
|
9729
|
+
declare function swapExactOutQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, outAmount: BN$1, swapForY: boolean): {
|
|
9730
|
+
amountIn: BN$1;
|
|
9731
|
+
amountOut: BN$1;
|
|
9732
|
+
fee: BN$1;
|
|
9733
|
+
protocolFee: BN$1;
|
|
9734
|
+
};
|
|
9735
|
+
declare function swapExactInQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1, swapForY: boolean): {
|
|
9736
|
+
amountIn: BN$1;
|
|
9737
|
+
amountOut: BN$1;
|
|
9738
|
+
fee: BN$1;
|
|
9739
|
+
protocolFee: BN$1;
|
|
9740
|
+
};
|
|
9741
|
+
|
|
9851
9742
|
/**
|
|
9852
9743
|
* Distribute totalAmount to all bid side bins according to given distributions.
|
|
9853
9744
|
* @param activeId active bin id
|
|
@@ -9913,6 +9804,49 @@ declare function autoFillXByWeight(activeId: number, binStep: number, amountY: B
|
|
|
9913
9804
|
weight: number;
|
|
9914
9805
|
}[]): BN$1;
|
|
9915
9806
|
|
|
9807
|
+
/**
|
|
9808
|
+
* Given a strategy type and amounts of X and Y, returns the distribution of liquidity.
|
|
9809
|
+
* @param activeId The bin id of the active bin.
|
|
9810
|
+
* @param binStep The step size of each bin.
|
|
9811
|
+
* @param minBinId The min bin id.
|
|
9812
|
+
* @param maxBinId The max bin id.
|
|
9813
|
+
* @param amountX The amount of X token to deposit.
|
|
9814
|
+
* @param amountY The amount of Y token to deposit.
|
|
9815
|
+
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
9816
|
+
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
9817
|
+
* @param strategyType The strategy type.
|
|
9818
|
+
* @param mintX The mint info of X token. Get from DLMM instance.
|
|
9819
|
+
* @param mintY The mint info of Y token. Get from DLMM instance.
|
|
9820
|
+
* @param clock The clock info. Get from DLMM instance.
|
|
9821
|
+
* @returns The distribution of liquidity.
|
|
9822
|
+
*/
|
|
9823
|
+
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): {
|
|
9824
|
+
binId: number;
|
|
9825
|
+
amountX: BN$1;
|
|
9826
|
+
amountY: BN$1;
|
|
9827
|
+
}[];
|
|
9828
|
+
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9829
|
+
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9830
|
+
declare function toStrategyParameters({ maxBinId, minBinId, strategyType, singleSidedX, }: StrategyParameters): ProgramStrategyParameter;
|
|
9831
|
+
|
|
9832
|
+
/**
|
|
9833
|
+
* It fetches the pool account from the AMM program, and returns the mint addresses for the two tokens
|
|
9834
|
+
* @param {Connection} connection - Connection - The connection to the Solana cluster
|
|
9835
|
+
* @param {string} poolAddress - The address of the pool account.
|
|
9836
|
+
* @returns The tokenAMint and tokenBMint addresses for the pool.
|
|
9837
|
+
*/
|
|
9838
|
+
declare function getTokensMintFromPoolAddress(connection: Connection, poolAddress: string, opt?: {
|
|
9839
|
+
cluster?: Cluster;
|
|
9840
|
+
programId?: PublicKey;
|
|
9841
|
+
}): Promise<{
|
|
9842
|
+
tokenXMint: PublicKey;
|
|
9843
|
+
tokenYMint: PublicKey;
|
|
9844
|
+
}>;
|
|
9845
|
+
declare function getTokenProgramId(lbPairState: LbPair): {
|
|
9846
|
+
tokenXProgram: PublicKey;
|
|
9847
|
+
tokenYProgram: PublicKey;
|
|
9848
|
+
};
|
|
9849
|
+
|
|
9916
9850
|
declare function chunks<T>(array: T[], size: number): T[][];
|
|
9917
9851
|
declare function range<T>(min: number, max: number, mapfn: (i: number) => T): T[];
|
|
9918
9852
|
declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
|
|
@@ -10020,78 +9954,7 @@ type Opt = {
|
|
|
10020
9954
|
declare function createProgram(connection: Connection, opt?: Opt): Program<LbClmm>;
|
|
10021
9955
|
declare function decodeAccount<T extends LbPair | BinArrayBitmapExtension | BinArray | PositionV2 | Position | PresetParameter | PresetParameter2>(program: Program<LbClmm>, accountName: AccountName, buffer: Buffer): T;
|
|
10022
9956
|
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
|
-
*/
|
|
10028
9957
|
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[][]>;
|
|
10095
9958
|
|
|
10096
9959
|
declare class DLMM {
|
|
10097
9960
|
pubkey: PublicKey;
|
|
@@ -10439,7 +10302,8 @@ declare class DLMM {
|
|
|
10439
10302
|
quoteCreatePosition({ strategy }: TQuoteCreatePositionParams): Promise<{
|
|
10440
10303
|
binArraysCount: number;
|
|
10441
10304
|
binArrayCost: number;
|
|
10442
|
-
|
|
10305
|
+
positionCount: number;
|
|
10306
|
+
positionCost: number;
|
|
10443
10307
|
}>;
|
|
10444
10308
|
/**
|
|
10445
10309
|
* Creates an empty position and initializes the corresponding bin arrays if needed.
|
|
@@ -10465,33 +10329,6 @@ declare class DLMM {
|
|
|
10465
10329
|
* - `version`: The version of the position (in this case, `Position.V2`)
|
|
10466
10330
|
*/
|
|
10467
10331
|
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[]>;
|
|
10495
10332
|
/**
|
|
10496
10333
|
* The function `initializePositionAndAddLiquidityByStrategy` function is used to initializes a position and adds liquidity
|
|
10497
10334
|
* @param {TInitializePositionAndAddLiquidityParamsByStrategy}
|
|
@@ -10520,7 +10357,7 @@ declare class DLMM {
|
|
|
10520
10357
|
*/
|
|
10521
10358
|
initializePositionAndAddLiquidityByWeight({ positionPubKey, totalXAmount, totalYAmount, xYAmountDistribution, user, slippage, }: TInitializePositionAndAddLiquidityParams): Promise<Transaction | Transaction[]>;
|
|
10522
10359
|
/**
|
|
10523
|
-
* The `addLiquidityByStrategy` function is used to add liquidity to existing position
|
|
10360
|
+
* The `addLiquidityByStrategy` function is used to add liquidity to existing position. It will chunk the bin range into multiple add liquidity transactions if it exceed max size.
|
|
10524
10361
|
* @param {TInitializePositionAndAddLiquidityParamsByStrategy}
|
|
10525
10362
|
* - `positionPubKey`: The public key of the position account. (usually use `new Keypair()`)
|
|
10526
10363
|
* - `totalXAmount`: The total amount of token X to be added to the liquidity pool.
|
|
@@ -10528,10 +10365,9 @@ declare class DLMM {
|
|
|
10528
10365
|
* - `strategy`: The strategy parameters to be used for the liquidity pool (Can use `calculateStrategyParameter` to calculate).
|
|
10529
10366
|
* - `user`: The public key of the user account.
|
|
10530
10367
|
* - `slippage`: The slippage percentage to be used for the liquidity pool.
|
|
10531
|
-
* @returns {Promise<Transaction>} The function `
|
|
10532
|
-
* `Transaction` object
|
|
10368
|
+
* @returns {Promise<Transaction[]>} The function `addLiquidityByStrategy` returns a `Promise` that resolves to an array of transactions
|
|
10533
10369
|
*/
|
|
10534
|
-
addLiquidityByStrategy({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction>;
|
|
10370
|
+
addLiquidityByStrategy({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction[]>;
|
|
10535
10371
|
/**
|
|
10536
10372
|
* @deprecated Use `addLiquidityByStrategy` instead which support both token and token2022.
|
|
10537
10373
|
* The `addLiquidityByWeight` function is used to add liquidity to existing position
|
|
@@ -10823,9 +10659,8 @@ declare class DLMM {
|
|
|
10823
10659
|
* @returns The transaction to execute this instruction.
|
|
10824
10660
|
*/
|
|
10825
10661
|
increasePositionLength(position: PublicKey, side: ResizeSide, length: BN$1, funder: PublicKey, allowParallelExecution?: boolean): Promise<Transaction[]>;
|
|
10826
|
-
simulateRebalancePositionWithBalancedStrategy(positionAddress: PublicKey, positionData: PositionData, strategy: StrategyType, topUpAmountX: BN$1, topUpAmountY: BN$1, xWithdrawBps: BN$1, yWithdrawBps: BN$1): Promise<RebalancePositionResponse
|
|
10662
|
+
simulateRebalancePositionWithBalancedStrategy(positionAddress: PublicKey, positionData: PositionData, strategy: StrategyType, topUpAmountX: BN$1, topUpAmountY: BN$1, xWithdrawBps: BN$1, yWithdrawBps: BN$1): Promise<RebalancePositionResponse>;
|
|
10827
10663
|
private simulateRebalancePositionWithStrategy;
|
|
10828
|
-
private quoteBinArrayAccountsRentalCost;
|
|
10829
10664
|
/**
|
|
10830
10665
|
* Simulates a rebalance operation on a position without actually executing it. It's recommended to use simulateRebalancePositionWithXStrategy instead unless you know what you're doing.
|
|
10831
10666
|
*
|
|
@@ -10836,7 +10671,7 @@ declare class DLMM {
|
|
|
10836
10671
|
* @param deposits An array of RebalanceWithDeposit objects representing the deposits to simulate.
|
|
10837
10672
|
* @param withdraws An array of RebalanceWithWithdraw objects representing the withdraws to simulate.
|
|
10838
10673
|
*/
|
|
10839
|
-
simulateRebalancePosition(positionAddress: PublicKey, positionData: PositionData, shouldClaimFee: boolean, shouldClaimReward: boolean, deposits: RebalanceWithDeposit[], withdraws: RebalanceWithWithdraw[]): Promise<RebalancePositionResponse
|
|
10674
|
+
simulateRebalancePosition(positionAddress: PublicKey, positionData: PositionData, shouldClaimFee: boolean, shouldClaimReward: boolean, deposits: RebalanceWithDeposit[], withdraws: RebalanceWithWithdraw[]): Promise<RebalancePositionResponse>;
|
|
10840
10675
|
/**
|
|
10841
10676
|
* Rebalances a position and claim rewards if specified.
|
|
10842
10677
|
*
|
|
@@ -10875,10 +10710,7 @@ declare class DLMM {
|
|
|
10875
10710
|
static updateReference(activeId: number, vParameter: vParameters, sParameter: sParameters, currentTimestamp: number): void;
|
|
10876
10711
|
private createClaimBuildMethod;
|
|
10877
10712
|
private createClaimSwapFeeMethod;
|
|
10878
|
-
getPotentialToken2022IxDataAndAccounts
|
|
10879
|
-
slices: RemainingAccountsInfoSlice[];
|
|
10880
|
-
accounts: AccountMeta[];
|
|
10881
|
-
};
|
|
10713
|
+
private getPotentialToken2022IxDataAndAccounts;
|
|
10882
10714
|
}
|
|
10883
10715
|
|
|
10884
10716
|
var address = "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo";
|
|
@@ -21775,4 +21607,4 @@ declare const MAX_EXTRA_BIN_ARRAYS = 3;
|
|
|
21775
21607
|
declare const U64_MAX: BN$1;
|
|
21776
21608
|
declare const MAX_BINS_PER_POSITION: BN$1;
|
|
21777
21609
|
|
|
21778
|
-
export { ADMIN, AccountName, ActionType, ActivationType,
|
|
21610
|
+
export { ADMIN, AccountName, ActionType, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_FEE, BIN_ARRAY_BITMAP_FEE_BN, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, BIN_ARRAY_FEE_BN, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, 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, 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, RebalancePositionResponse, RebalanceRemoveLiquidityParam, RemainingAccountInfo, RemainingAccountsInfoSlice, ResizeSide, ResizeSideEnum, RewardInfo, RewardInfos, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityCostBreakdown, SeedLiquidityResponse, SeedLiquiditySingleBinResponse, 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, 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, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getBinIdIndexInBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokenProgramId, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, sParameters, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, updateBinArray, vParameters, wrapSOLInstruction };
|