@meteora-ag/dlmm 1.3.1 → 1.3.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 +31 -5
- package/dist/index.js +517 -306
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +738 -527
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -5411,6 +5411,10 @@ interface BinLiquidity {
|
|
|
5411
5411
|
price: string;
|
|
5412
5412
|
pricePerToken: string;
|
|
5413
5413
|
}
|
|
5414
|
+
declare namespace BinLiquidity {
|
|
5415
|
+
function fromBin(bin: Bin, binId: number, binStep: number, baseTokenDecimal: number, quoteTokenDecimal: number, version: number): BinLiquidity;
|
|
5416
|
+
function empty(binId: number, binStep: number, baseTokenDecimal: number, quoteTokenDecimal: number, version: number): BinLiquidity;
|
|
5417
|
+
}
|
|
5414
5418
|
interface SwapQuote {
|
|
5415
5419
|
consumedInAmount: BN;
|
|
5416
5420
|
outAmount: BN;
|
|
@@ -5724,7 +5728,7 @@ declare class DLMM {
|
|
|
5724
5728
|
* @returns an object with two properties: "activeBin" and "bins". The value of "activeBin" is the
|
|
5725
5729
|
* active bin ID of the lbPair, and the value of "bins" is an array of BinLiquidity objects.
|
|
5726
5730
|
*/
|
|
5727
|
-
getBinsBetweenLowerAndUpperBound(lowerBinId: number, upperBinId: number,
|
|
5731
|
+
getBinsBetweenLowerAndUpperBound(lowerBinId: number, upperBinId: number, lowerBinArray?: BinArray, upperBinArray?: BinArray): Promise<{
|
|
5728
5732
|
activeBin: number;
|
|
5729
5733
|
bins: BinLiquidity[];
|
|
5730
5734
|
}>;
|
|
@@ -6007,19 +6011,21 @@ declare class DLMM {
|
|
|
6007
6011
|
/**
|
|
6008
6012
|
* The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
|
|
6009
6013
|
* @param
|
|
6010
|
-
* - `
|
|
6014
|
+
* - `payer`: The public key of the tx payer.
|
|
6011
6015
|
* - `base`: Base key
|
|
6012
6016
|
* - `seedAmount`: Token X lamport amount to be seeded to the pool.
|
|
6013
6017
|
* - `price`: TokenX/TokenY Price in UI format
|
|
6014
6018
|
* - `roundingUp`: Whether to round up the price
|
|
6019
|
+
* - `positionOwner`: The owner of the position
|
|
6015
6020
|
* - `feeOwner`: Position fee owner
|
|
6016
6021
|
* - `operator`: Operator of the position. Operator able to manage the position on behalf of the position owner. However, liquidity withdrawal issue by the operator can only send to the position owner.
|
|
6017
6022
|
* - `lockReleasePoint`: The lock release point of the position.
|
|
6023
|
+
* - `shouldSeedPositionOwner` (optional): Whether to send 1 lamport amount of token X to the position owner to prove ownership.
|
|
6018
6024
|
*
|
|
6019
6025
|
* The returned instructions need to be executed sequentially if it was separated into multiple transactions.
|
|
6020
6026
|
* @returns {Promise<TransactionInstruction[]>}
|
|
6021
6027
|
*/
|
|
6022
|
-
seedLiquiditySingleBin(
|
|
6028
|
+
seedLiquiditySingleBin(payer: PublicKey, base: PublicKey, seedAmount: BN, price: number, roundingUp: boolean, positionOwner: PublicKey, feeOwner: PublicKey, operator: PublicKey, lockReleasePoint: BN, shouldSeedPositionOwner?: boolean): Promise<TransactionInstruction[]>;
|
|
6023
6029
|
/**
|
|
6024
6030
|
* Initializes bin arrays for the given bin array indexes if it wasn't initialized.
|
|
6025
6031
|
*
|
|
@@ -6140,6 +6146,7 @@ declare function getBinArraysRequiredByPositionRange(pair: PublicKey, fromBinId:
|
|
|
6140
6146
|
key: PublicKey;
|
|
6141
6147
|
index: BN;
|
|
6142
6148
|
}[];
|
|
6149
|
+
declare function enumerateBins(binsById: Map<number, Bin>, lowerBinId: number, upperBinId: number, binStep: number, baseTokenDecimal: number, quoteTokenDecimal: number, version: number): Generator<BinLiquidity, void, unknown>;
|
|
6143
6150
|
|
|
6144
6151
|
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
6145
6152
|
/** private */
|
|
@@ -6394,6 +6401,7 @@ declare function getTokensMintFromPoolAddress(connection: Connection, poolAddres
|
|
|
6394
6401
|
}>;
|
|
6395
6402
|
|
|
6396
6403
|
declare function chunks<T>(array: T[], size: number): T[][];
|
|
6404
|
+
declare function range<T>(min: number, max: number, mapfn: (i: number) => T): T[];
|
|
6397
6405
|
declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
|
|
6398
6406
|
parameters: {
|
|
6399
6407
|
baseFactor: number;
|
|
@@ -6470,7 +6478,25 @@ declare const parseLogs: <T>(eventParser: EventParser, logs: string[]) => T;
|
|
|
6470
6478
|
declare const wrapSOLInstruction: (from: PublicKey, to: PublicKey, amount: bigint) => TransactionInstruction[];
|
|
6471
6479
|
declare const unwrapSOLInstruction: (owner: PublicKey, allowOwnerOffCurve?: boolean) => Promise<TransactionInstruction>;
|
|
6472
6480
|
declare function chunkedGetMultipleAccountInfos(connection: Connection, pks: PublicKey[], chunkSize?: number): Promise<_solana_web3_js.AccountInfo<Buffer>[]>;
|
|
6473
|
-
|
|
6481
|
+
/**
|
|
6482
|
+
* Gets the estimated compute unit usage with a buffer.
|
|
6483
|
+
* @param connection A Solana connection object.
|
|
6484
|
+
* @param instructions The instructions of the transaction to simulate.
|
|
6485
|
+
* @param feePayer The public key of the fee payer.
|
|
6486
|
+
* @param buffer The buffer to add to the estimated compute unit usage. Max value is 1. Default value is 0.1 if not provided, and will be capped between 50k - 200k.
|
|
6487
|
+
* @returns The estimated compute unit usage with the buffer.
|
|
6488
|
+
*/
|
|
6489
|
+
declare const getEstimatedComputeUnitUsageWithBuffer: (connection: Connection, instructions: TransactionInstruction[], feePayer: PublicKey, buffer?: number) => Promise<number>;
|
|
6490
|
+
/**
|
|
6491
|
+
* Gets the estimated compute unit usage with a buffer and converts it to a SetComputeUnitLimit instruction.
|
|
6492
|
+
* If the estimated compute unit usage cannot be retrieved, returns a SetComputeUnitLimit instruction with the fallback unit.
|
|
6493
|
+
* @param connection A Solana connection object.
|
|
6494
|
+
* @param instructions The instructions of the transaction to simulate.
|
|
6495
|
+
* @param feePayer The public key of the fee payer.
|
|
6496
|
+
* @param buffer The buffer to add to the estimated compute unit usage. Max value is 1. Default value is 0.1 if not provided, and will be capped between 50k - 200k.
|
|
6497
|
+
* @returns A SetComputeUnitLimit instruction with the estimated compute unit usage.
|
|
6498
|
+
*/
|
|
6499
|
+
declare const getEstimatedComputeUnitIxWithBuffer: (connection: Connection, instructions: TransactionInstruction[], feePayer: PublicKey, buffer?: number) => Promise<TransactionInstruction>;
|
|
6474
6500
|
|
|
6475
6501
|
type Codes = (typeof IDL.errors)[number]["code"];
|
|
6476
6502
|
declare class DLMMError extends Error {
|
|
@@ -6520,4 +6546,4 @@ declare const MAX_BIN_PER_TX = 69;
|
|
|
6520
6546
|
declare const MAX_ACTIVE_BIN_SLIPPAGE = 3;
|
|
6521
6547
|
declare const ILM_BASE: PublicKey;
|
|
6522
6548
|
|
|
6523
|
-
export { ADMIN, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, 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_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_BIN_PER_TX, MAX_CLAIM_ALL_ALLOWED, MAX_FEE_RATE, Network, POSITION_FEE, PRECISION, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionV2, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityResponse, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks,
|
|
6549
|
+
export { ADMIN, ActivationType, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, Clock, ClockLayout, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, DlmmSdkError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, 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_BIN_ARRAY_SIZE, MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX, MAX_BIN_PER_POSITION, MAX_BIN_PER_TX, MAX_CLAIM_ALL_ALLOWED, MAX_FEE_RATE, Network, POSITION_FEE, PRECISION, PairStatus, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionV2, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityResponse, Strategy, StrategyParameters, StrategyType, SwapExactOutParams, SwapFee, SwapParams, SwapQuote, SwapQuoteExactOut, SwapWithPriceImpactParams, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveCustomizablePermissionlessLbPair, deriveLbPair, deriveLbPair2, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, deriveReserve, enumerateBins, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinArraysRequiredByPositionRange, getBinFromBinArray, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, range, sParameters, swapExactInQuoteAtBin, swapExactOutQuoteAtBin, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toAmountsOneSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
|