@meteora-ag/dlmm 1.0.37 → 1.0.38
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 +14 -1
- package/dist/index.js +54 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5858,6 +5858,19 @@ declare function toStrategyParameters(strategyParameters: StrategyParameters): {
|
|
|
5858
5858
|
parameteres: number[];
|
|
5859
5859
|
};
|
|
5860
5860
|
|
|
5861
|
+
/**
|
|
5862
|
+
* It fetches the pool account from the AMM program, and returns the mint addresses for the two tokens
|
|
5863
|
+
* @param {Connection} connection - Connection - The connection to the Solana cluster
|
|
5864
|
+
* @param {string} poolAddress - The address of the pool account.
|
|
5865
|
+
* @returns The tokenAMint and tokenBMint addresses for the pool.
|
|
5866
|
+
*/
|
|
5867
|
+
declare function getTokensMintFromPoolAddress(connection: Connection, poolAddress: string, opt?: {
|
|
5868
|
+
cluster?: Cluster;
|
|
5869
|
+
}): Promise<{
|
|
5870
|
+
tokenXMint: PublicKey;
|
|
5871
|
+
tokenYMint: PublicKey;
|
|
5872
|
+
}>;
|
|
5873
|
+
|
|
5861
5874
|
declare function chunks<T>(array: T[], size: number): T[][];
|
|
5862
5875
|
declare function chunkedFetchMultiplePoolAccount(program: ClmmProgram, pks: PublicKey[], chunkSize?: number): Promise<{
|
|
5863
5876
|
parameters: {
|
|
@@ -5976,4 +5989,4 @@ declare const MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = 26;
|
|
|
5976
5989
|
declare const MAX_BIN_PER_TX = 69;
|
|
5977
5990
|
declare const MAX_ACTIVE_BIN_SLIPPAGE = 3;
|
|
5978
5991
|
|
|
5979
|
-
export { ADMIN, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, 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, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionV2, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityResponse, Strategy, StrategyParameters, StrategyType, SwapFee, SwapParams, SwapQuote, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeBudgetIx, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveLbPair, deriveLbPair2, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, deriveReserve, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinFromBinArray, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, sParameters, swapQuoteAtBin, swapQuoteAtBinWithCap, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toAmountsOneSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
|
|
5992
|
+
export { ADMIN, BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, BIN_ARRAY_FEE, Bin, BinAndAmount, BinArray, BinArrayAccount, BinArrayBitmapExtension, BinArrayBitmapExtensionAccount, BinLiquidity, BinLiquidityDistribution, BinLiquidityReduction, BitmapType, ClmmProgram, CompressedBinDepositAmount, CompressedBinDepositAmounts, DLMMError, EXTENSION_BINARRAY_BITMAP_SIZE, EmissionRate, FEE_PRECISION, FeeInfo, GetOrCreateATAResponse, IAccountsCache, IDL, InitPermissionPairIx, LBCLMM_PROGRAM_IDS, LMRewards, LbClmm, LbPair, LbPairAccount, LbPosition, LiquidityOneSideParameter, 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, PairType, Position, PositionBinData, PositionData, PositionInfo, PositionV2, PositionVersion, ProgramStrategyParameter, ProgramStrategyType, SCALE, SCALE_OFFSET, SIMULATION_USER, SeedLiquidityResponse, Strategy, StrategyParameters, StrategyType, SwapFee, SwapParams, SwapQuote, TInitializePositionAndAddLiquidityParams, TInitializePositionAndAddLiquidityParamsByStrategy, TQuoteCreatePositionParams, TokenReserve, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, binIdToBinArrayIndex, calculateBidAskDistribution, calculateNormalDistribution, calculateSpotDistribution, chunkedFetchMultipleBinArrayBitmapExtensionAccount, chunkedFetchMultiplePoolAccount, chunkedGetMultipleAccountInfos, chunks, computeBudgetIx, computeFee, computeFeeFromAmount, computeProtocolFee, DLMM as default, deriveBinArray, deriveBinArrayBitmapExtension, deriveLbPair, deriveLbPair2, deriveOracle, derivePermissionLbPair, derivePosition, derivePresetParameter, derivePresetParameter2, deriveReserve, findNextBinArrayIndexWithLiquidity, findNextBinArrayWithLiquidity, fromWeightDistributionToAmount, fromWeightDistributionToAmountOneSide, getBaseFee, getBinArrayLowerUpperBinId, getBinFromBinArray, getOrCreateATAInstruction, getOutAmount, getPriceOfBinByBinId, getTokenBalance, getTokenDecimals, getTokensMintFromPoolAddress, getTotalFee, getVariableFee, isBinIdWithinBinArray, isOverflowDefaultBinArrayBitmap, parseLogs, sParameters, swapQuoteAtBin, swapQuoteAtBinWithCap, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toAmountsOneSideByStrategy, toStrategyParameters, toWeightDistribution, unwrapSOLInstruction, vParameters, wrapSOLInstruction };
|
package/dist/index.js
CHANGED
|
@@ -6761,6 +6761,31 @@ function toStrategyParameters(strategyParameters) {
|
|
|
6761
6761
|
}
|
|
6762
6762
|
}
|
|
6763
6763
|
|
|
6764
|
+
// src/dlmm/helpers/lbPair.ts
|
|
6765
|
+
|
|
6766
|
+
|
|
6767
|
+
async function getTokensMintFromPoolAddress(connection, poolAddress, opt) {
|
|
6768
|
+
const provider = new (0, _anchor.AnchorProvider)(
|
|
6769
|
+
connection,
|
|
6770
|
+
{},
|
|
6771
|
+
_anchor.AnchorProvider.defaultOptions()
|
|
6772
|
+
);
|
|
6773
|
+
const program = new (0, _anchor.Program)(
|
|
6774
|
+
IDL,
|
|
6775
|
+
LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _18 => _18.cluster]), () => ( "mainnet-beta"))],
|
|
6776
|
+
provider
|
|
6777
|
+
);
|
|
6778
|
+
const poolAccount = await program.account.lbPair.fetchNullable(
|
|
6779
|
+
new (0, _web3js.PublicKey)(poolAddress)
|
|
6780
|
+
);
|
|
6781
|
+
if (!poolAccount)
|
|
6782
|
+
return;
|
|
6783
|
+
return {
|
|
6784
|
+
tokenXMint: poolAccount.tokenXMint,
|
|
6785
|
+
tokenYMint: poolAccount.tokenYMint
|
|
6786
|
+
};
|
|
6787
|
+
}
|
|
6788
|
+
|
|
6764
6789
|
// src/dlmm/helpers/index.ts
|
|
6765
6790
|
function chunks(array, size) {
|
|
6766
6791
|
return Array.apply(0, new Array(Math.ceil(array.length / size))).map(
|
|
@@ -6821,7 +6846,7 @@ async function getTokenBalance(conn, tokenAccount) {
|
|
|
6821
6846
|
var parseLogs = (eventParser, logs) => {
|
|
6822
6847
|
if (!logs.length)
|
|
6823
6848
|
throw new Error("No logs found");
|
|
6824
|
-
for (const event of _optionalChain([eventParser, 'optionalAccess',
|
|
6849
|
+
for (const event of _optionalChain([eventParser, 'optionalAccess', _19 => _19.parseLogs, 'call', _20 => _20(logs)])) {
|
|
6825
6850
|
return event.data;
|
|
6826
6851
|
}
|
|
6827
6852
|
throw new Error("No events found");
|
|
@@ -6917,13 +6942,13 @@ var DLMM = class {
|
|
|
6917
6942
|
);
|
|
6918
6943
|
const program = new (0, _anchor.Program)(
|
|
6919
6944
|
IDL,
|
|
6920
|
-
LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess',
|
|
6945
|
+
LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _21 => _21.cluster]), () => ( "mainnet-beta"))],
|
|
6921
6946
|
provider
|
|
6922
6947
|
);
|
|
6923
6948
|
return program.account.lbPair.all();
|
|
6924
6949
|
}
|
|
6925
6950
|
static async getPairPubkeyIfExists(connection, tokenX, tokenY, binStep, baseFactor, opt) {
|
|
6926
|
-
const cluster = _optionalChain([opt, 'optionalAccess',
|
|
6951
|
+
const cluster = _optionalChain([opt, 'optionalAccess', _22 => _22.cluster]) || "mainnet-beta";
|
|
6927
6952
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
6928
6953
|
connection,
|
|
6929
6954
|
{},
|
|
@@ -6966,7 +6991,7 @@ var DLMM = class {
|
|
|
6966
6991
|
* @returns The `create` function returns a `Promise` that resolves to a `DLMM` object.
|
|
6967
6992
|
*/
|
|
6968
6993
|
static async create(connection, dlmm, opt) {
|
|
6969
|
-
const cluster = _optionalChain([opt, 'optionalAccess',
|
|
6994
|
+
const cluster = _optionalChain([opt, 'optionalAccess', _23 => _23.cluster]) || "mainnet-beta";
|
|
6970
6995
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
6971
6996
|
connection,
|
|
6972
6997
|
{},
|
|
@@ -6982,14 +7007,14 @@ var DLMM = class {
|
|
|
6982
7007
|
connection,
|
|
6983
7008
|
accountsToFetch
|
|
6984
7009
|
);
|
|
6985
|
-
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
7010
|
+
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _24 => _24[0], 'optionalAccess', _25 => _25.data]);
|
|
6986
7011
|
if (!lbPairAccountInfoBuffer)
|
|
6987
7012
|
throw new Error(`LB Pair account ${dlmm.toBase58()} not found`);
|
|
6988
7013
|
const lbPairAccInfo = program.coder.accounts.decode(
|
|
6989
7014
|
"lbPair",
|
|
6990
7015
|
lbPairAccountInfoBuffer
|
|
6991
7016
|
);
|
|
6992
|
-
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
7017
|
+
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _26 => _26[1], 'optionalAccess', _27 => _27.data]);
|
|
6993
7018
|
let binArrayBitMapExtensionAccInfo = null;
|
|
6994
7019
|
if (binArrayBitMapAccountInfoBuffer) {
|
|
6995
7020
|
binArrayBitMapExtensionAccInfo = program.coder.accounts.decode(
|
|
@@ -7053,7 +7078,7 @@ var DLMM = class {
|
|
|
7053
7078
|
* objects.
|
|
7054
7079
|
*/
|
|
7055
7080
|
static async createMultiple(connection, dlmmList, opt) {
|
|
7056
|
-
const cluster = _optionalChain([opt, 'optionalAccess',
|
|
7081
|
+
const cluster = _optionalChain([opt, 'optionalAccess', _28 => _28.cluster]) || "mainnet-beta";
|
|
7057
7082
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
7058
7083
|
connection,
|
|
7059
7084
|
{},
|
|
@@ -7071,7 +7096,7 @@ var DLMM = class {
|
|
|
7071
7096
|
const lbPairArraysMap = /* @__PURE__ */ new Map();
|
|
7072
7097
|
for (let i = 0; i < dlmmList.length; i++) {
|
|
7073
7098
|
const lbPairPubKey = dlmmList[i];
|
|
7074
|
-
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
7099
|
+
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _29 => _29[i], 'optionalAccess', _30 => _30.data]);
|
|
7075
7100
|
if (!lbPairAccountInfoBuffer)
|
|
7076
7101
|
throw new Error(`LB Pair account ${lbPairPubKey.toBase58()} not found`);
|
|
7077
7102
|
const binArrayAccInfo = program.coder.accounts.decode(
|
|
@@ -7084,7 +7109,7 @@ var DLMM = class {
|
|
|
7084
7109
|
for (let i = dlmmList.length; i < accountsInfo.length; i++) {
|
|
7085
7110
|
const index = i - dlmmList.length;
|
|
7086
7111
|
const lbPairPubkey = dlmmList[index];
|
|
7087
|
-
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
7112
|
+
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _31 => _31[i], 'optionalAccess', _32 => _32.data]);
|
|
7088
7113
|
if (binArrayBitMapAccountInfoBuffer) {
|
|
7089
7114
|
const binArrayBitMapExtensionAccInfo = program.coder.accounts.decode(
|
|
7090
7115
|
"binArrayBitmapExtension",
|
|
@@ -7167,7 +7192,7 @@ var DLMM = class {
|
|
|
7167
7192
|
);
|
|
7168
7193
|
const program = new (0, _anchor.Program)(
|
|
7169
7194
|
IDL,
|
|
7170
|
-
LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess',
|
|
7195
|
+
LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _33 => _33.cluster]), () => ( "mainnet-beta"))],
|
|
7171
7196
|
provider
|
|
7172
7197
|
);
|
|
7173
7198
|
const presetParameter = await program.account.presetParameter.all();
|
|
@@ -7185,7 +7210,7 @@ var DLMM = class {
|
|
|
7185
7210
|
* Pair account, and the value is an object of PositionInfo
|
|
7186
7211
|
*/
|
|
7187
7212
|
static async getAllLbPairPositionsByUser(connection, userPubKey, opt) {
|
|
7188
|
-
const cluster = _optionalChain([opt, 'optionalAccess',
|
|
7213
|
+
const cluster = _optionalChain([opt, 'optionalAccess', _34 => _34.cluster]) || "mainnet-beta";
|
|
7189
7214
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
7190
7215
|
connection,
|
|
7191
7216
|
{},
|
|
@@ -7420,8 +7445,8 @@ var DLMM = class {
|
|
|
7420
7445
|
const { mintXDecimal, mintYDecimal } = lbPairMintMap.get(
|
|
7421
7446
|
lbPair.toBase58()
|
|
7422
7447
|
);
|
|
7423
|
-
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
7424
|
-
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
7448
|
+
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _35 => _35.get, 'call', _36 => _36(lbPair.toBase58()), 'optionalAccess', _37 => _37.reserveX]), () => ( BigInt(0)));
|
|
7449
|
+
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _38 => _38.get, 'call', _39 => _39(lbPair.toBase58()), 'optionalAccess', _40 => _40.reserveY]), () => ( BigInt(0)));
|
|
7425
7450
|
const tokenX = {
|
|
7426
7451
|
publicKey: lbPairAcc.tokenXMint,
|
|
7427
7452
|
reserve: lbPairAcc.reserveX,
|
|
@@ -7453,7 +7478,7 @@ var DLMM = class {
|
|
|
7453
7478
|
tokenX,
|
|
7454
7479
|
tokenY,
|
|
7455
7480
|
lbPairPositionsData: [
|
|
7456
|
-
..._nullishCoalesce(_optionalChain([positionsMap, 'access',
|
|
7481
|
+
..._nullishCoalesce(_optionalChain([positionsMap, 'access', _41 => _41.get, 'call', _42 => _42(lbPair.toBase58()), 'optionalAccess', _43 => _43.lbPairPositionsData]), () => ( [])),
|
|
7457
7482
|
{
|
|
7458
7483
|
publicKey: positionPubKey,
|
|
7459
7484
|
positionData,
|
|
@@ -7489,8 +7514,8 @@ var DLMM = class {
|
|
|
7489
7514
|
getTokenDecimals(program.provider.connection, lbPairAcc.tokenXMint),
|
|
7490
7515
|
getTokenDecimals(program.provider.connection, lbPairAcc.tokenYMint)
|
|
7491
7516
|
]);
|
|
7492
|
-
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access',
|
|
7493
|
-
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access',
|
|
7517
|
+
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access', _44 => _44.get, 'call', _45 => _45(lbPair.toBase58()), 'optionalAccess', _46 => _46.reserveX]), () => ( BigInt(0)));
|
|
7518
|
+
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access', _47 => _47.get, 'call', _48 => _48(lbPair.toBase58()), 'optionalAccess', _49 => _49.reserveY]), () => ( BigInt(0)));
|
|
7494
7519
|
const tokenX = {
|
|
7495
7520
|
publicKey: lbPairAcc.tokenXMint,
|
|
7496
7521
|
reserve: lbPairAcc.reserveX,
|
|
@@ -7522,7 +7547,7 @@ var DLMM = class {
|
|
|
7522
7547
|
tokenX,
|
|
7523
7548
|
tokenY,
|
|
7524
7549
|
lbPairPositionsData: [
|
|
7525
|
-
..._nullishCoalesce(_optionalChain([positionsMap, 'access',
|
|
7550
|
+
..._nullishCoalesce(_optionalChain([positionsMap, 'access', _50 => _50.get, 'call', _51 => _51(lbPair.toBase58()), 'optionalAccess', _52 => _52.lbPairPositionsData]), () => ( [])),
|
|
7526
7551
|
{
|
|
7527
7552
|
publicKey: positionPubKey,
|
|
7528
7553
|
positionData,
|
|
@@ -7535,7 +7560,7 @@ var DLMM = class {
|
|
|
7535
7560
|
return positionsMap;
|
|
7536
7561
|
}
|
|
7537
7562
|
static async migratePosition(connection, positions, newPositions, walletPubkey, opt) {
|
|
7538
|
-
const cluster = _optionalChain([opt, 'optionalAccess',
|
|
7563
|
+
const cluster = _optionalChain([opt, 'optionalAccess', _53 => _53.cluster]) || "mainnet-beta";
|
|
7539
7564
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
7540
7565
|
connection,
|
|
7541
7566
|
{},
|
|
@@ -7774,7 +7799,7 @@ var DLMM = class {
|
|
|
7774
7799
|
swapForY,
|
|
7775
7800
|
new (0, _anchor.BN)(activeIdToLoop),
|
|
7776
7801
|
this.lbPair,
|
|
7777
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
7802
|
+
_nullishCoalesce(_optionalChain([this, 'access', _54 => _54.binArrayBitmapExtension, 'optionalAccess', _55 => _55.account]), () => ( null))
|
|
7778
7803
|
);
|
|
7779
7804
|
if (binArrayIndex === null)
|
|
7780
7805
|
shouldStop = true;
|
|
@@ -9210,7 +9235,7 @@ var DLMM = class {
|
|
|
9210
9235
|
swapForY,
|
|
9211
9236
|
activeId,
|
|
9212
9237
|
this.lbPair,
|
|
9213
|
-
_optionalChain([this, 'access',
|
|
9238
|
+
_optionalChain([this, 'access', _56 => _56.binArrayBitmapExtension, 'optionalAccess', _57 => _57.account]),
|
|
9214
9239
|
binArrays
|
|
9215
9240
|
);
|
|
9216
9241
|
if (binArrayAccountToSwap == null) {
|
|
@@ -9317,7 +9342,7 @@ var DLMM = class {
|
|
|
9317
9342
|
swapForY,
|
|
9318
9343
|
activeId,
|
|
9319
9344
|
this.lbPair,
|
|
9320
|
-
_optionalChain([this, 'access',
|
|
9345
|
+
_optionalChain([this, 'access', _58 => _58.binArrayBitmapExtension, 'optionalAccess', _59 => _59.account]),
|
|
9321
9346
|
binArrays
|
|
9322
9347
|
);
|
|
9323
9348
|
if (binArrayAccountToSwap == null) {
|
|
@@ -10059,7 +10084,7 @@ var DLMM = class {
|
|
|
10059
10084
|
swapForY,
|
|
10060
10085
|
new (0, _anchor.BN)(activeBinId),
|
|
10061
10086
|
this.lbPair,
|
|
10062
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
10087
|
+
_nullishCoalesce(_optionalChain([this, 'access', _60 => _60.binArrayBitmapExtension, 'optionalAccess', _61 => _61.account]), () => ( null))
|
|
10063
10088
|
);
|
|
10064
10089
|
if (toBinArrayIndex === null)
|
|
10065
10090
|
return true;
|
|
@@ -10096,7 +10121,7 @@ var DLMM = class {
|
|
|
10096
10121
|
swapForY,
|
|
10097
10122
|
new (0, _anchor.BN)(activeBinId),
|
|
10098
10123
|
this.lbPair,
|
|
10099
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
10124
|
+
_nullishCoalesce(_optionalChain([this, 'access', _62 => _62.binArrayBitmapExtension, 'optionalAccess', _63 => _63.account]), () => ( null))
|
|
10100
10125
|
);
|
|
10101
10126
|
const accountsToFetch = [];
|
|
10102
10127
|
const [binArrayBitMapExtensionPubkey] = deriveBinArrayBitmapExtension(
|
|
@@ -10127,13 +10152,13 @@ var DLMM = class {
|
|
|
10127
10152
|
let fromBinArray = null;
|
|
10128
10153
|
let toBinArray = null;
|
|
10129
10154
|
let binArrayBitmapExtension = null;
|
|
10130
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
10155
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _64 => _64[0]])) {
|
|
10131
10156
|
binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
|
|
10132
10157
|
}
|
|
10133
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
10158
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _65 => _65[1]])) {
|
|
10134
10159
|
fromBinArray = fromBinArrayPubkey;
|
|
10135
10160
|
}
|
|
10136
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
10161
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _66 => _66[2]]) && !!toBinArrayIndex) {
|
|
10137
10162
|
toBinArray = toBinArrayPubkey;
|
|
10138
10163
|
}
|
|
10139
10164
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -10745,7 +10770,7 @@ var DLMMError = class extends Error {
|
|
|
10745
10770
|
const anchorError = _anchor.AnchorError.parse(
|
|
10746
10771
|
JSON.parse(JSON.stringify(error)).logs
|
|
10747
10772
|
);
|
|
10748
|
-
if (_optionalChain([anchorError, 'optionalAccess',
|
|
10773
|
+
if (_optionalChain([anchorError, 'optionalAccess', _67 => _67.program, 'access', _68 => _68.toBase58, 'call', _69 => _69()]) === LBCLMM_PROGRAM_IDS["mainnet-beta"]) {
|
|
10749
10774
|
_errorCode = anchorError.error.errorCode.number;
|
|
10750
10775
|
_errorName = anchorError.error.errorCode.code;
|
|
10751
10776
|
_errorMessage = anchorError.error.errorMessage;
|
|
@@ -10850,5 +10875,6 @@ var src_default = DLMM;
|
|
|
10850
10875
|
|
|
10851
10876
|
|
|
10852
10877
|
|
|
10853
|
-
|
|
10878
|
+
|
|
10879
|
+
exports.ADMIN = ADMIN; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BitmapType = BitmapType; exports.DLMMError = DLMMError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BIN_ARRAY_SIZE = MAX_BIN_ARRAY_SIZE; exports.MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX; exports.MAX_BIN_PER_POSITION = MAX_BIN_PER_POSITION; exports.MAX_BIN_PER_TX = MAX_BIN_PER_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.POSITION_FEE = POSITION_FEE; exports.PRECISION = PRECISION; exports.PairType = PairType; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeBudgetIx = computeBudgetIx; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.deriveReserve = deriveReserve; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinFromBinArray = getBinFromBinArray; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.swapQuoteAtBin = swapQuoteAtBin; exports.swapQuoteAtBinWithCap = swapQuoteAtBinWithCap; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toAmountsOneSideByStrategy = toAmountsOneSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
10854
10880
|
//# sourceMappingURL=index.js.map
|