@meteora-ag/dlmm 1.6.0-rc.9 → 1.6.0-sam.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/dist/index.d.ts +414 -96
- package/dist/index.js +3299 -2415
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3527 -2643
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _coral_xyz_anchor from '@coral-xyz/anchor';
|
|
2
2
|
import { Program, BN as BN$1, IdlAccounts, ProgramAccount, IdlTypes, EventParser } from '@coral-xyz/anchor';
|
|
3
3
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
4
|
-
import { PublicKey, Connection, AccountMeta, Keypair, TransactionInstruction, Cluster, Transaction } from '@solana/web3.js';
|
|
4
|
+
import { PublicKey, Connection, AccountMeta, Keypair, TransactionInstruction, Cluster, AccountInfo, 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,21 @@ 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[];
|
|
9129
9144
|
interface SimulateWithdrawResult {
|
|
9130
9145
|
liquidityAndFeeXWithdrawn: BN;
|
|
9131
9146
|
liquidityAndFeeYWithdrawn: BN;
|
|
@@ -9210,6 +9225,43 @@ interface SimulateRebalanceResp {
|
|
|
9210
9225
|
withdrawParams: RebalanceRemoveLiquidityParam[];
|
|
9211
9226
|
rentalCostLamports: BN;
|
|
9212
9227
|
}
|
|
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;
|
|
9213
9265
|
|
|
9214
9266
|
interface BinAndAmount {
|
|
9215
9267
|
binId: number;
|
|
@@ -9360,6 +9412,14 @@ interface TInitializePositionAndAddLiquidityParamsByStrategy {
|
|
|
9360
9412
|
user: PublicKey;
|
|
9361
9413
|
slippage?: number;
|
|
9362
9414
|
}
|
|
9415
|
+
interface InitializeMultiplePositionAndAddLiquidityByStrategyResponse {
|
|
9416
|
+
instructionsByPositions: {
|
|
9417
|
+
positionKeypair: Keypair;
|
|
9418
|
+
initializePositionIx: TransactionInstruction;
|
|
9419
|
+
initializeAtaIxs: TransactionInstruction[];
|
|
9420
|
+
addLiquidityIxs: TransactionInstruction[][];
|
|
9421
|
+
}[];
|
|
9422
|
+
}
|
|
9363
9423
|
interface TInitializeMultiplePositionAndAddLiquidityParamsByStrategy {
|
|
9364
9424
|
totalXAmount: BN$1;
|
|
9365
9425
|
totalYAmount: BN$1;
|
|
@@ -9585,31 +9645,12 @@ interface RebalancePositionResponse {
|
|
|
9585
9645
|
rebalancePosition: RebalancePosition;
|
|
9586
9646
|
simulationResult: SimulateRebalanceResp;
|
|
9587
9647
|
}
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
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];
|
|
9648
|
+
interface RebalancePositionBinArrayRentalCostQuote {
|
|
9649
|
+
binArrayExistence: Set<string>;
|
|
9650
|
+
binArrayCount: number;
|
|
9651
|
+
binArrayCost: number;
|
|
9652
|
+
bitmapExtensionCost: number;
|
|
9653
|
+
}
|
|
9613
9654
|
|
|
9614
9655
|
/** private */
|
|
9615
9656
|
declare function isOverflowDefaultBinArrayBitmap(binArrayIndex: BN$1): boolean;
|
|
@@ -9652,6 +9693,238 @@ declare function updateBinArray(activeId: BN$1, clock: Clock, allRewardInfos: Re
|
|
|
9652
9693
|
}[];
|
|
9653
9694
|
};
|
|
9654
9695
|
|
|
9696
|
+
/** private */
|
|
9697
|
+
declare function derivePresetParameterWithIndex(index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9698
|
+
declare function deriveLbPairWithPresetParamWithIndexKey(presetParameterKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9699
|
+
/**
|
|
9700
|
+
*
|
|
9701
|
+
* @deprecated Use derivePresetParameter2
|
|
9702
|
+
*/
|
|
9703
|
+
declare function derivePresetParameter(binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9704
|
+
declare function derivePresetParameter2(binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9705
|
+
declare function deriveLbPair2(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, baseFactor: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9706
|
+
/**
|
|
9707
|
+
*
|
|
9708
|
+
* @deprecated Use deriveLbPair2
|
|
9709
|
+
*/
|
|
9710
|
+
declare function deriveLbPair(tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9711
|
+
declare function deriveCustomizablePermissionlessLbPair(tokenX: PublicKey, tokenY: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9712
|
+
declare function derivePermissionLbPair(baseKey: PublicKey, tokenX: PublicKey, tokenY: PublicKey, binStep: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9713
|
+
declare function deriveOracle(lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9714
|
+
declare function derivePosition(lbPair: PublicKey, base: PublicKey, lowerBinId: BN$1, width: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9715
|
+
declare function deriveBinArray(lbPair: PublicKey, index: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9716
|
+
declare function deriveReserve(token: PublicKey, lbPair: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9717
|
+
declare function deriveTokenBadge(mint: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
9718
|
+
declare function deriveEventAuthority(programId: PublicKey): [PublicKey, number];
|
|
9719
|
+
declare function deriveRewardVault(lbPair: PublicKey, rewardIndex: BN$1, programId: PublicKey): [PublicKey, number];
|
|
9720
|
+
declare function derivePlaceHolderAccountMeta(programId: PublicKey): AccountMeta;
|
|
9721
|
+
|
|
9722
|
+
declare function getBaseFee(binStep: number, sParameter: sParameters): BN$1;
|
|
9723
|
+
declare function getVariableFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9724
|
+
declare function getTotalFee(binStep: number, sParameter: sParameters, vParameter: vParameters): BN$1;
|
|
9725
|
+
declare function computeFee(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1): BN$1;
|
|
9726
|
+
declare function computeFeeFromAmount(binStep: number, sParameter: sParameters, vParameter: vParameters, inAmountWithFees: BN$1): BN$1;
|
|
9727
|
+
declare function computeProtocolFee(feeAmount: BN$1, sParameter: sParameters): BN$1;
|
|
9728
|
+
declare function swapExactOutQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, outAmount: BN$1, swapForY: boolean): {
|
|
9729
|
+
amountIn: BN$1;
|
|
9730
|
+
amountOut: BN$1;
|
|
9731
|
+
fee: BN$1;
|
|
9732
|
+
protocolFee: BN$1;
|
|
9733
|
+
};
|
|
9734
|
+
declare function swapExactInQuoteAtBin(bin: Bin, binStep: number, sParameter: sParameters, vParameter: vParameters, inAmount: BN$1, swapForY: boolean): {
|
|
9735
|
+
amountIn: BN$1;
|
|
9736
|
+
amountOut: BN$1;
|
|
9737
|
+
fee: BN$1;
|
|
9738
|
+
protocolFee: BN$1;
|
|
9739
|
+
};
|
|
9740
|
+
|
|
9741
|
+
/**
|
|
9742
|
+
* It fetches the pool account from the AMM program, and returns the mint addresses for the two tokens
|
|
9743
|
+
* @param {Connection} connection - Connection - The connection to the Solana cluster
|
|
9744
|
+
* @param {string} poolAddress - The address of the pool account.
|
|
9745
|
+
* @returns The tokenAMint and tokenBMint addresses for the pool.
|
|
9746
|
+
*/
|
|
9747
|
+
declare function getTokensMintFromPoolAddress(connection: Connection, poolAddress: string, opt?: {
|
|
9748
|
+
cluster?: Cluster;
|
|
9749
|
+
programId?: PublicKey;
|
|
9750
|
+
}): Promise<{
|
|
9751
|
+
tokenXMint: PublicKey;
|
|
9752
|
+
tokenYMint: PublicKey;
|
|
9753
|
+
}>;
|
|
9754
|
+
declare function getTokenProgramId(lbPairState: LbPair): {
|
|
9755
|
+
tokenXProgram: PublicKey;
|
|
9756
|
+
tokenYProgram: PublicKey;
|
|
9757
|
+
};
|
|
9758
|
+
|
|
9759
|
+
interface IPosition {
|
|
9760
|
+
address(): PublicKey;
|
|
9761
|
+
lowerBinId(): BN;
|
|
9762
|
+
upperBinId(): BN;
|
|
9763
|
+
liquidityShares(): BN[];
|
|
9764
|
+
rewardInfos(): UserRewardInfo[];
|
|
9765
|
+
feeInfos(): UserFeeInfo[];
|
|
9766
|
+
lastUpdatedAt(): BN;
|
|
9767
|
+
lbPair(): PublicKey;
|
|
9768
|
+
totalClaimedFeeXAmount(): BN;
|
|
9769
|
+
totalClaimedFeeYAmount(): BN;
|
|
9770
|
+
totalClaimedRewards(): BN[];
|
|
9771
|
+
operator(): PublicKey;
|
|
9772
|
+
lockReleasePoint(): BN;
|
|
9773
|
+
feeOwner(): PublicKey;
|
|
9774
|
+
owner(): PublicKey;
|
|
9775
|
+
getBinArrayIndexesCoverage(): BN[];
|
|
9776
|
+
getBinArrayKeysCoverage(programId: PublicKey): PublicKey[];
|
|
9777
|
+
version(): PositionVersion;
|
|
9778
|
+
width(): BN;
|
|
9779
|
+
}
|
|
9780
|
+
interface CombinedPositionBinData {
|
|
9781
|
+
liquidityShares: BN[];
|
|
9782
|
+
rewardInfos: UserRewardInfo[];
|
|
9783
|
+
feeInfos: UserFeeInfo[];
|
|
9784
|
+
}
|
|
9785
|
+
declare function wrapPosition(program: Program<LbClmm>, key: PublicKey, account: AccountInfo<Buffer>): IPosition;
|
|
9786
|
+
declare class PositionV2Wrapper implements IPosition {
|
|
9787
|
+
positionAddress: PublicKey;
|
|
9788
|
+
inner: PositionV2;
|
|
9789
|
+
extended: ExtendedPositionBinData[];
|
|
9790
|
+
combinedPositionBinData: CombinedPositionBinData;
|
|
9791
|
+
constructor(positionAddress: PublicKey, inner: PositionV2, extended: ExtendedPositionBinData[], combinedPositionBinData: CombinedPositionBinData);
|
|
9792
|
+
address(): PublicKey;
|
|
9793
|
+
totalClaimedRewards(): BN[];
|
|
9794
|
+
feeOwner(): PublicKey;
|
|
9795
|
+
lockReleasePoint(): BN;
|
|
9796
|
+
operator(): PublicKey;
|
|
9797
|
+
totalClaimedFeeYAmount(): BN;
|
|
9798
|
+
totalClaimedFeeXAmount(): BN;
|
|
9799
|
+
lbPair(): PublicKey;
|
|
9800
|
+
lowerBinId(): BN;
|
|
9801
|
+
upperBinId(): BN;
|
|
9802
|
+
liquidityShares(): BN[];
|
|
9803
|
+
rewardInfos(): UserRewardInfo[];
|
|
9804
|
+
feeInfos(): UserFeeInfo[];
|
|
9805
|
+
lastUpdatedAt(): BN;
|
|
9806
|
+
getBinArrayIndexesCoverage(): BN[];
|
|
9807
|
+
getBinArrayKeysCoverage(programId: PublicKey): PublicKey[];
|
|
9808
|
+
version(): PositionVersion;
|
|
9809
|
+
owner(): PublicKey;
|
|
9810
|
+
width(): BN;
|
|
9811
|
+
}
|
|
9812
|
+
|
|
9813
|
+
declare function getBinArrayIndexesCoverage(lowerBinId: BN, upperBinId: BN): BN[];
|
|
9814
|
+
declare function getBinArrayKeysCoverage(lowerBinId: BN, upperBinId: BN, lbPair: PublicKey, programId: PublicKey): PublicKey[];
|
|
9815
|
+
declare function getBinArrayAccountMetasCoverage(lowerBinId: BN, upperBinId: BN, lbPair: PublicKey, programId: PublicKey): AccountMeta[];
|
|
9816
|
+
declare function getPositionLowerUpperBinIdWithLiquidity(position: PositionData): {
|
|
9817
|
+
lowerBinId: BN;
|
|
9818
|
+
upperBinId: BN;
|
|
9819
|
+
} | null;
|
|
9820
|
+
declare function isPositionNoFee(position: PositionData): boolean;
|
|
9821
|
+
declare function isPositionNoReward(position: PositionData): boolean;
|
|
9822
|
+
/**
|
|
9823
|
+
* Divides a range of bin IDs into chunks, each with a maximum length defined by POSITION_MAX_LENGTH,
|
|
9824
|
+
* and returns an array of objects representing the lower and upper bin IDs for each chunk.
|
|
9825
|
+
*
|
|
9826
|
+
* @param {number} minBinId - The starting bin ID of the range.
|
|
9827
|
+
* @param {number} maxBinId - The ending bin ID of the range.
|
|
9828
|
+
* @returns {{ lowerBinId: number; upperBinId: number }[]} An array of objects, each containing a
|
|
9829
|
+
* 'lowerBinId' and 'upperBinId', representing the range of bin IDs in each chunk.
|
|
9830
|
+
*/
|
|
9831
|
+
declare function chunkBinRangeIntoExtendedPositions(minBinId: number, maxBinId: number): {
|
|
9832
|
+
lowerBinId: number;
|
|
9833
|
+
upperBinId: number;
|
|
9834
|
+
}[];
|
|
9835
|
+
/**
|
|
9836
|
+
* Divides a range of bin IDs into chunks, each with a length defined by DEFAULT_BIN_PER_POSITION,
|
|
9837
|
+
* and returns an array of objects representing the lower and upper bin IDs for each chunk.
|
|
9838
|
+
* Mainly used for chunking bin range to execute multiple add/remove liquidity, claim fee/reward
|
|
9839
|
+
*
|
|
9840
|
+
* @param {number} minBinId - The starting bin ID of the range.
|
|
9841
|
+
* @param {number} maxBinId - The ending bin ID of the range.
|
|
9842
|
+
* @returns {{ lowerBinId: number; upperBinId: number }[]} An array of objects, each containing a
|
|
9843
|
+
* 'lowerBinId' and 'upperBinId', representing the range of bin IDs in each chunk.
|
|
9844
|
+
*/
|
|
9845
|
+
declare function chunkBinRange(minBinId: number, maxBinId: number): {
|
|
9846
|
+
lowerBinId: number;
|
|
9847
|
+
upperBinId: number;
|
|
9848
|
+
}[];
|
|
9849
|
+
declare function chunkPositionBinRange(position: LbPosition, minBinId: number, maxBinId: number): {
|
|
9850
|
+
minBinId: number;
|
|
9851
|
+
maxBinId: number;
|
|
9852
|
+
amountX: BN;
|
|
9853
|
+
amountY: BN;
|
|
9854
|
+
feeXAmount: BN;
|
|
9855
|
+
feeYAmount: BN;
|
|
9856
|
+
rewardAmounts: BN[];
|
|
9857
|
+
}[];
|
|
9858
|
+
declare function calculatePositionSize(binCount: BN): BN;
|
|
9859
|
+
/**
|
|
9860
|
+
* Get the minimum balance required to pay for the rent exemption of a
|
|
9861
|
+
* position with the given bin count.
|
|
9862
|
+
*
|
|
9863
|
+
* @param connection The connection to the Solana RPC node.
|
|
9864
|
+
* @param binCount The number of bins in the position.
|
|
9865
|
+
* @returns The minimum balance required to pay for the rent exemption.
|
|
9866
|
+
*/
|
|
9867
|
+
declare function getPositionRentExemption(connection: Connection, binCount: BN): Promise<number>;
|
|
9868
|
+
/**
|
|
9869
|
+
* Calculate the minimum lamports required to expand a position to a given
|
|
9870
|
+
* width.
|
|
9871
|
+
*
|
|
9872
|
+
* The function takes into account the current width of the position and the
|
|
9873
|
+
* width to expand to. If the expanded width is less than or equal to the
|
|
9874
|
+
* default bin count per position, the function returns 0.
|
|
9875
|
+
*
|
|
9876
|
+
* @param currentMinBinId The current minimum bin ID of the position.
|
|
9877
|
+
* @param currentMaxBinId The current maximum bin ID of the position.
|
|
9878
|
+
* @param connection The connection to the Solana RPC node.
|
|
9879
|
+
* @param binCountToExpand The number of bins to expand the position by.
|
|
9880
|
+
* @returns The minimum lamports required to expand the position to the given
|
|
9881
|
+
* width.
|
|
9882
|
+
*/
|
|
9883
|
+
declare function getPositionExpandRentExemption(currentMinBinId: BN, currentMaxBinId: BN, connection: Connection, binCountToExpand: BN): Promise<number>;
|
|
9884
|
+
/**
|
|
9885
|
+
* Calculate the number of extended bins in a position.
|
|
9886
|
+
*
|
|
9887
|
+
* @param minBinId The minimum bin ID of the position.
|
|
9888
|
+
* @param maxBinId The maximum bin ID of the position.
|
|
9889
|
+
* @returns The number of extended bins in the position. If the position width is
|
|
9890
|
+
* less than or equal to the default bin count per position, returns 0.
|
|
9891
|
+
*/
|
|
9892
|
+
declare function getExtendedPositionBinCount(minBinId: BN, maxBinId: BN): BN;
|
|
9893
|
+
/**
|
|
9894
|
+
* Decode the extended position data.
|
|
9895
|
+
*
|
|
9896
|
+
* @param base The base position with the base data.
|
|
9897
|
+
* @param program The program that the position is associated with.
|
|
9898
|
+
* @param bytes The buffer of bytes to decode.
|
|
9899
|
+
* @returns The decoded extended position data.
|
|
9900
|
+
*/
|
|
9901
|
+
declare function decodeExtendedPosition(base: PositionV2, program: Program<LbClmm>, bytes: Buffer): ExtendedPositionBinData[];
|
|
9902
|
+
|
|
9903
|
+
/**
|
|
9904
|
+
* Given a strategy type and amounts of X and Y, returns the distribution of liquidity.
|
|
9905
|
+
* @param activeId The bin id of the active bin.
|
|
9906
|
+
* @param binStep The step size of each bin.
|
|
9907
|
+
* @param minBinId The min bin id.
|
|
9908
|
+
* @param maxBinId The max bin id.
|
|
9909
|
+
* @param amountX The amount of X token to deposit.
|
|
9910
|
+
* @param amountY The amount of Y token to deposit.
|
|
9911
|
+
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
9912
|
+
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
9913
|
+
* @param strategyType The strategy type.
|
|
9914
|
+
* @param mintX The mint info of X token. Get from DLMM instance.
|
|
9915
|
+
* @param mintY The mint info of Y token. Get from DLMM instance.
|
|
9916
|
+
* @param clock The clock info. Get from DLMM instance.
|
|
9917
|
+
* @returns The distribution of liquidity.
|
|
9918
|
+
*/
|
|
9919
|
+
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): {
|
|
9920
|
+
binId: number;
|
|
9921
|
+
amountX: BN$1;
|
|
9922
|
+
amountY: BN$1;
|
|
9923
|
+
}[];
|
|
9924
|
+
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9925
|
+
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN$1, amountXInActiveBin: BN$1, amountYInActiveBin: BN$1, minBinId: number, maxBinId: number, strategyType: StrategyType): BN$1;
|
|
9926
|
+
declare function toStrategyParameters({ maxBinId, minBinId, strategyType, singleSidedX, }: StrategyParameters): ProgramStrategyParameter;
|
|
9927
|
+
|
|
9655
9928
|
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
9656
9929
|
/** private */
|
|
9657
9930
|
declare function toWeightDistribution(amountX: BN$1, amountY: BN$1, distributions: {
|
|
@@ -9720,25 +9993,6 @@ declare function fromWeightDistributionToAmount(amountX: BN$1, amountY: BN$1, di
|
|
|
9720
9993
|
amountY: BN$1;
|
|
9721
9994
|
}[];
|
|
9722
9995
|
|
|
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
|
-
|
|
9742
9996
|
/**
|
|
9743
9997
|
* Distribute totalAmount to all bid side bins according to given distributions.
|
|
9744
9998
|
* @param activeId active bin id
|
|
@@ -9804,49 +10058,6 @@ declare function autoFillXByWeight(activeId: number, binStep: number, amountY: B
|
|
|
9804
10058
|
weight: number;
|
|
9805
10059
|
}[]): BN$1;
|
|
9806
10060
|
|
|
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
|
-
|
|
9850
10061
|
declare function chunks<T>(array: T[], size: number): T[][];
|
|
9851
10062
|
declare function range<T>(min: number, max: number, mapfn: (i: number) => T): T[];
|
|
9852
10063
|
declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
|
|
@@ -9954,7 +10165,78 @@ type Opt = {
|
|
|
9954
10165
|
declare function createProgram(connection: Connection, opt?: Opt): Program<LbClmm>;
|
|
9955
10166
|
declare function decodeAccount<T extends LbPair | BinArrayBitmapExtension | BinArray | PositionV2 | Position | PresetParameter | PresetParameter2>(program: Program<LbClmm>, accountName: AccountName, buffer: Buffer): T;
|
|
9956
10167
|
declare function getAccountDiscriminator(accountName: AccountName): IdlDiscriminator;
|
|
10168
|
+
/**
|
|
10169
|
+
* Caps a slippage percentage to be between 0 and 100.
|
|
10170
|
+
* @param slippage The slippage percentage to be capped.
|
|
10171
|
+
* @returns The capped slippage percentage.
|
|
10172
|
+
*/
|
|
9957
10173
|
declare function capSlippagePercentage(slippage: number): number;
|
|
10174
|
+
/**
|
|
10175
|
+
* Given a slippage percentage and a bin step, calculate the maximum number of bins
|
|
10176
|
+
* that the user is willing to allow the active bin to drift from the target price.
|
|
10177
|
+
* If the slippage percentage is 0 or null, return the maxActiveBinSlippage instead.
|
|
10178
|
+
*
|
|
10179
|
+
* @param slippagePercentage The slippage percentage in basis points.
|
|
10180
|
+
* @param binStep The bin step of the pair.
|
|
10181
|
+
* @param maxActiveBinSlippage The maximum number of bins that the active bin can drift.
|
|
10182
|
+
* @returns The maximum number of bins that the user is willing to allow the active bin to drift.
|
|
10183
|
+
*/
|
|
10184
|
+
declare function getAndCapMaxActiveBinSlippage(slippagePercentage: number, binStep: number, maxActiveBinSlippage: number): number;
|
|
10185
|
+
/**
|
|
10186
|
+
* Calculates the number of bins in a given range.
|
|
10187
|
+
*
|
|
10188
|
+
* @param minBinId The minimum bin id of the range.
|
|
10189
|
+
* @param maxBinId The maximum bin id of the range.
|
|
10190
|
+
* @returns The number of bins in the range.
|
|
10191
|
+
*/
|
|
10192
|
+
declare function getBinCount(minBinId: number, maxBinId: number): number;
|
|
10193
|
+
/**
|
|
10194
|
+
* Calculates the maximum amount of tokens after applying slippage to the given amount.
|
|
10195
|
+
*
|
|
10196
|
+
* @param amount The amount of tokens before slippage.
|
|
10197
|
+
* @param slippage The percentage of slippage to apply.
|
|
10198
|
+
* @returns The maximum amount of tokens after applying slippage. If the slippage is 100%, the maximum amount is U64_MAX.
|
|
10199
|
+
*
|
|
10200
|
+
**/
|
|
10201
|
+
declare function getSlippageMaxAmount(amount: BN$1, slippage: number): BN$1;
|
|
10202
|
+
/**
|
|
10203
|
+
* Calculates the minimum amount of tokens after applying slippage to the given amount.
|
|
10204
|
+
*
|
|
10205
|
+
* @param amount The amount of tokens before slippage.
|
|
10206
|
+
* @param slippage The percentage of slippage to apply.
|
|
10207
|
+
* @returns The minimum amount of tokens after applying slippage.
|
|
10208
|
+
*/
|
|
10209
|
+
declare function getSlippageMinAmount(amount: BN$1, slippage: number): BN$1;
|
|
10210
|
+
/**
|
|
10211
|
+
* Calculates the number of positions required to cover a range of bins.
|
|
10212
|
+
*
|
|
10213
|
+
* @param binCount The number of bins in the range.
|
|
10214
|
+
* @returns The number of positions required to cover the range of bins.
|
|
10215
|
+
*/
|
|
10216
|
+
declare function getPositionCountByBinCount(binCount: number): number;
|
|
10217
|
+
/**
|
|
10218
|
+
* Adjusts the liquidity parameters to reset uninvolved liquidity based on delta IDs.
|
|
10219
|
+
*
|
|
10220
|
+
* This function modifies the provided liquidity strategy parameters by resetting
|
|
10221
|
+
* the x0, y0, deltaX, and deltaY values when certain conditions regarding the
|
|
10222
|
+
* minDeltaId and maxDeltaId are met. If the maxDeltaId is less than or equal
|
|
10223
|
+
* to the end of the bid side delta ID, x0 and deltaX are set to zero. If the
|
|
10224
|
+
* minDeltaId is greater than or equal to the start of the ask side delta ID,
|
|
10225
|
+
* y0 and deltaY are set to zero.
|
|
10226
|
+
*
|
|
10227
|
+
* @param minDeltaId - The minimum delta ID.
|
|
10228
|
+
* @param maxDeltaId - The maximum delta ID.
|
|
10229
|
+
* @param favorXInActiveId - A boolean indicating if X is favored in the active bin.
|
|
10230
|
+
* @param params - The liquidity strategy parameters containing x0, y0, deltaX, and deltaY.
|
|
10231
|
+
* @returns An object containing the adjusted x0, y0, deltaX, and deltaY values.
|
|
10232
|
+
*/
|
|
10233
|
+
declare function resetUninvolvedLiquidityParams(minDeltaId: BN$1, maxDeltaId: BN$1, favorXInActiveId: boolean, params: LiquidityStrategyParameters): {
|
|
10234
|
+
x0: BN$1;
|
|
10235
|
+
y0: BN$1;
|
|
10236
|
+
deltaX: BN$1;
|
|
10237
|
+
deltaY: BN$1;
|
|
10238
|
+
};
|
|
10239
|
+
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[][]>;
|
|
9958
10240
|
|
|
9959
10241
|
declare class DLMM {
|
|
9960
10242
|
pubkey: PublicKey;
|
|
@@ -10300,6 +10582,10 @@ declare class DLMM {
|
|
|
10300
10582
|
binArrayCost: Decimal;
|
|
10301
10583
|
}>;
|
|
10302
10584
|
quoteCreatePosition({ strategy }: TQuoteCreatePositionParams): Promise<{
|
|
10585
|
+
positionCount: number;
|
|
10586
|
+
positionCost: number;
|
|
10587
|
+
positionReallocCost: number;
|
|
10588
|
+
bitmapExtensionCost: number;
|
|
10303
10589
|
binArraysCount: number;
|
|
10304
10590
|
binArrayCost: number;
|
|
10305
10591
|
transactionCount: number;
|
|
@@ -10328,6 +10614,33 @@ declare class DLMM {
|
|
|
10328
10614
|
* - `version`: The version of the position (in this case, `Position.V2`)
|
|
10329
10615
|
*/
|
|
10330
10616
|
getPosition(positionPubKey: PublicKey): Promise<LbPosition>;
|
|
10617
|
+
/**
|
|
10618
|
+
* Creates multiple positions and adds liquidity by strategy without chainsaw issues.
|
|
10619
|
+
* @param positionKeypairGenerator A function that generates a specified number of keypairs.
|
|
10620
|
+
* @param totalXAmount The total amount of token X to be added.
|
|
10621
|
+
* @param totalYAmount The total amount of token Y to be added.
|
|
10622
|
+
* @param strategy The strategy for adding liquidity.
|
|
10623
|
+
* @param owner The owner of the position.
|
|
10624
|
+
* @param payer The payer of the transaction.
|
|
10625
|
+
* @param slippagePercentage The slippage percentage for adding liquidity.
|
|
10626
|
+
* @returns An object with two properties: `initPositionIxs` and `addLiquidityIxs`.
|
|
10627
|
+
*/
|
|
10628
|
+
initializeMultiplePositionAndAddLiquidityByStrategy(positionKeypairGenerator: (count: number) => Promise<Keypair[]>, totalXAmount: BN$1, totalYAmount: BN$1, strategy: StrategyParameters, owner: PublicKey, payer: PublicKey, slippagePercentage: number): Promise<InitializeMultiplePositionAndAddLiquidityByStrategyResponse>;
|
|
10629
|
+
/**
|
|
10630
|
+
* Adds liquidity to an existing position using a specified strategy, allowing for chunkable transactions.
|
|
10631
|
+
* If adding liquidity to bin out of position range, it will automatically expand. The limitation is 70 bins.
|
|
10632
|
+
*
|
|
10633
|
+
* @param {TInitializePositionAndAddLiquidityParamsByStrategy} params - The parameters required for adding liquidity.
|
|
10634
|
+
* @param {PublicKey} params.positionPubKey - The public key of the position to which liquidity is being added.
|
|
10635
|
+
* @param {BN} params.totalXAmount - The total amount of token X to be added as liquidity.
|
|
10636
|
+
* @param {BN} params.totalYAmount - The total amount of token Y to be added as liquidity.
|
|
10637
|
+
* @param {StrategyParameters} params.strategy - The strategy parameters for adding liquidity.
|
|
10638
|
+
* @param {PublicKey} params.user - The public key of the user adding liquidity.
|
|
10639
|
+
* @param {number} params.slippage - The slippage percentage allowed for the transaction.
|
|
10640
|
+
*
|
|
10641
|
+
* @returns {Promise<Transaction[]>} A promise that resolves to an array of transactions for adding liquidity.
|
|
10642
|
+
*/
|
|
10643
|
+
addLiquidityByStrategyChunkable({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction[]>;
|
|
10331
10644
|
/**
|
|
10332
10645
|
* The function `initializePositionAndAddLiquidityByStrategy` function is used to initializes a position and adds liquidity
|
|
10333
10646
|
* @param {TInitializePositionAndAddLiquidityParamsByStrategy}
|
|
@@ -10356,7 +10669,7 @@ declare class DLMM {
|
|
|
10356
10669
|
*/
|
|
10357
10670
|
initializePositionAndAddLiquidityByWeight({ positionPubKey, totalXAmount, totalYAmount, xYAmountDistribution, user, slippage, }: TInitializePositionAndAddLiquidityParams): Promise<Transaction | Transaction[]>;
|
|
10358
10671
|
/**
|
|
10359
|
-
* The `addLiquidityByStrategy` function is used to add liquidity to existing position
|
|
10672
|
+
* The `addLiquidityByStrategy` function is used to add liquidity to existing position
|
|
10360
10673
|
* @param {TInitializePositionAndAddLiquidityParamsByStrategy}
|
|
10361
10674
|
* - `positionPubKey`: The public key of the position account. (usually use `new Keypair()`)
|
|
10362
10675
|
* - `totalXAmount`: The total amount of token X to be added to the liquidity pool.
|
|
@@ -10364,9 +10677,10 @@ declare class DLMM {
|
|
|
10364
10677
|
* - `strategy`: The strategy parameters to be used for the liquidity pool (Can use `calculateStrategyParameter` to calculate).
|
|
10365
10678
|
* - `user`: The public key of the user account.
|
|
10366
10679
|
* - `slippage`: The slippage percentage to be used for the liquidity pool.
|
|
10367
|
-
* @returns {Promise<Transaction
|
|
10680
|
+
* @returns {Promise<Transaction>} The function `addLiquidityByWeight` returns a `Promise` that resolves to either a single
|
|
10681
|
+
* `Transaction` object
|
|
10368
10682
|
*/
|
|
10369
|
-
addLiquidityByStrategy({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction
|
|
10683
|
+
addLiquidityByStrategy({ positionPubKey, totalXAmount, totalYAmount, strategy, user, slippage, }: TInitializePositionAndAddLiquidityParamsByStrategy): Promise<Transaction>;
|
|
10370
10684
|
/**
|
|
10371
10685
|
* @deprecated Use `addLiquidityByStrategy` instead which support both token and token2022.
|
|
10372
10686
|
* The `addLiquidityByWeight` function is used to add liquidity to existing position
|
|
@@ -10658,8 +10972,9 @@ declare class DLMM {
|
|
|
10658
10972
|
* @returns The transaction to execute this instruction.
|
|
10659
10973
|
*/
|
|
10660
10974
|
increasePositionLength(position: PublicKey, side: ResizeSide, length: BN$1, funder: PublicKey, allowParallelExecution?: boolean): Promise<Transaction[]>;
|
|
10661
|
-
simulateRebalancePositionWithBalancedStrategy(positionAddress: PublicKey, positionData: PositionData, strategy: StrategyType, topUpAmountX: BN$1, topUpAmountY: BN$1, xWithdrawBps: BN$1, yWithdrawBps: BN$1): Promise<RebalancePositionResponse>;
|
|
10975
|
+
simulateRebalancePositionWithBalancedStrategy(positionAddress: PublicKey, positionData: PositionData, strategy: StrategyType, topUpAmountX: BN$1, topUpAmountY: BN$1, xWithdrawBps: BN$1, yWithdrawBps: BN$1): Promise<RebalancePositionResponse & RebalancePositionBinArrayRentalCostQuote>;
|
|
10662
10976
|
private simulateRebalancePositionWithStrategy;
|
|
10977
|
+
private quoteBinArrayAccountsRentalCost;
|
|
10663
10978
|
/**
|
|
10664
10979
|
* 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.
|
|
10665
10980
|
*
|
|
@@ -10670,7 +10985,7 @@ declare class DLMM {
|
|
|
10670
10985
|
* @param deposits An array of RebalanceWithDeposit objects representing the deposits to simulate.
|
|
10671
10986
|
* @param withdraws An array of RebalanceWithWithdraw objects representing the withdraws to simulate.
|
|
10672
10987
|
*/
|
|
10673
|
-
simulateRebalancePosition(positionAddress: PublicKey, positionData: PositionData, shouldClaimFee: boolean, shouldClaimReward: boolean, deposits: RebalanceWithDeposit[], withdraws: RebalanceWithWithdraw[]): Promise<RebalancePositionResponse>;
|
|
10988
|
+
simulateRebalancePosition(positionAddress: PublicKey, positionData: PositionData, shouldClaimFee: boolean, shouldClaimReward: boolean, deposits: RebalanceWithDeposit[], withdraws: RebalanceWithWithdraw[]): Promise<RebalancePositionResponse & RebalancePositionBinArrayRentalCostQuote>;
|
|
10674
10989
|
/**
|
|
10675
10990
|
* Rebalances a position and claim rewards if specified.
|
|
10676
10991
|
*
|
|
@@ -10709,7 +11024,10 @@ declare class DLMM {
|
|
|
10709
11024
|
static updateReference(activeId: number, vParameter: vParameters, sParameter: sParameters, currentTimestamp: number): void;
|
|
10710
11025
|
private createClaimBuildMethod;
|
|
10711
11026
|
private createClaimSwapFeeMethod;
|
|
10712
|
-
|
|
11027
|
+
getPotentialToken2022IxDataAndAccounts(actionType: ActionType, rewardIndex?: number): {
|
|
11028
|
+
slices: RemainingAccountsInfoSlice[];
|
|
11029
|
+
accounts: AccountMeta[];
|
|
11030
|
+
};
|
|
10713
11031
|
}
|
|
10714
11032
|
|
|
10715
11033
|
var address = "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo";
|
|
@@ -21606,4 +21924,4 @@ declare const MAX_EXTRA_BIN_ARRAYS = 3;
|
|
|
21606
21924
|
declare const U64_MAX: BN$1;
|
|
21607
21925
|
declare const MAX_BINS_PER_POSITION: BN$1;
|
|
21608
21926
|
|
|
21609
|
-
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 };
|
|
21927
|
+
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, IPosition, 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, PositionV2Wrapper, 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, calculatePositionSize, calculateSpotDistribution, capSlippagePercentage, chunkBinRange, chunkBinRangeIntoExtendedPositions, chunkDepositWithRebalanceEndpoint, chunkPositionBinRange, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, createProgram, decodeAccount, decodeExtendedPosition, 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, getBinArrayAccountMetasCoverage, getBinArrayIndexesCoverage, getBinArrayKeysCoverage, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinCount, getBinFromBinArray, getBinIdIndexInBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getExtendedPositionBinCount, getLiquidityStrategyParameterBuilder, getOrCreateATAInstruction, getOutAmount, getPositionCountByBinCount, getPositionExpandRentExemption, getPositionLowerUpperBinIdWithLiquidity, getPositionRentExemption, getPriceOfBinByBinId, getRebalanceBinArrayIndexesAndBitmapCoverage, getSlippageMaxAmount, getSlippageMinAmount, getTokenBalance, getTokenDecimals, getTokenProgramId, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, isPositionNoFee, isPositionNoReward, parseLogs, range, resetUninvolvedLiquidityParams, sParameters, suggestBalancedXParametersFromY, suggestBalancedYParametersFromX, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountIntoBins, toAmountsBothSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, updateBinArray, vParameters, wrapPosition, wrapSOLInstruction };
|