@meteora-ag/dlmm 1.5.0-rc.5 → 1.5.0-rc.6
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 +2 -2
- package/dist/index.js +46 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20805,11 +20805,11 @@ declare const SIMULATION_USER: PublicKey;
|
|
|
20805
20805
|
declare const PRECISION = 18446744073709552000;
|
|
20806
20806
|
declare const MAX_CLAIM_ALL_ALLOWED = 2;
|
|
20807
20807
|
declare const MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = 26;
|
|
20808
|
-
declare const MAX_BIN_PER_TX = 69;
|
|
20809
20808
|
declare const MAX_ACTIVE_BIN_SLIPPAGE = 3;
|
|
20810
20809
|
declare const ILM_BASE: PublicKey;
|
|
20811
20810
|
declare const MAX_EXTRA_BIN_ARRAYS = 3;
|
|
20812
20811
|
declare const U64_MAX: BN;
|
|
20812
|
+
declare const MAX_BINS_PER_POSITION: string;
|
|
20813
20813
|
|
|
20814
20814
|
var address = "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo";
|
|
20815
20815
|
var metadata = {
|
|
@@ -31258,4 +31258,4 @@ var dlmm = {
|
|
|
31258
31258
|
constants: constants
|
|
31259
31259
|
};
|
|
31260
31260
|
|
|
31261
|
-
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, dlmm as 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,
|
|
31261
|
+
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, dlmm as 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, RemainingAccountInfo, RemainingAccountsInfoSlice, ResizeSide, ResizeSideEnum, 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, 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, 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, vParameters, wrapSOLInstruction };
|
package/dist/index.js
CHANGED
|
@@ -10520,13 +10520,15 @@ var SIMULATION_USER = new (0, _web3js.PublicKey)(
|
|
|
10520
10520
|
var PRECISION = 18446744073709552e3;
|
|
10521
10521
|
var MAX_CLAIM_ALL_ALLOWED = 2;
|
|
10522
10522
|
var MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = 26;
|
|
10523
|
-
var MAX_BIN_PER_TX = 69;
|
|
10524
10523
|
var MAX_ACTIVE_BIN_SLIPPAGE = 3;
|
|
10525
10524
|
var ILM_BASE = new (0, _web3js.PublicKey)(
|
|
10526
10525
|
"MFGQxwAmB91SwuYX36okv2Qmdc9aMuHTwWGUrp4AtB1"
|
|
10527
10526
|
);
|
|
10528
10527
|
var MAX_EXTRA_BIN_ARRAYS = 3;
|
|
10529
10528
|
var U64_MAX = new (0, _anchor.BN)("18446744073709551615");
|
|
10529
|
+
var MAX_BINS_PER_POSITION = _optionalChain([dlmm_zc_default, 'access', _26 => _26.constants, 'access', _27 => _27.find, 'call', _28 => _28(
|
|
10530
|
+
({ name }) => name == "POSITION_MAX_LENGTH"
|
|
10531
|
+
), 'optionalAccess', _29 => _29.value]);
|
|
10530
10532
|
|
|
10531
10533
|
// src/dlmm/error.ts
|
|
10532
10534
|
|
|
@@ -10542,7 +10544,7 @@ var DLMMError = class extends Error {
|
|
|
10542
10544
|
const anchorError = _anchor.AnchorError.parse(
|
|
10543
10545
|
JSON.parse(JSON.stringify(error)).logs
|
|
10544
10546
|
);
|
|
10545
|
-
if (_optionalChain([anchorError, 'optionalAccess',
|
|
10547
|
+
if (_optionalChain([anchorError, 'optionalAccess', _30 => _30.program, 'access', _31 => _31.toBase58, 'call', _32 => _32()]) === LBCLMM_PROGRAM_IDS["mainnet-beta"]) {
|
|
10546
10548
|
_errorCode = anchorError.error.errorCode.number;
|
|
10547
10549
|
_errorName = anchorError.error.errorCode.code;
|
|
10548
10550
|
_errorMessage = anchorError.error.errorMessage;
|
|
@@ -11810,11 +11812,11 @@ var getSimulationComputeUnits = async (connection, instructions, payer, lookupTa
|
|
|
11810
11812
|
sigVerify: false,
|
|
11811
11813
|
commitment
|
|
11812
11814
|
});
|
|
11813
|
-
if (_optionalChain([rpcResponse, 'optionalAccess',
|
|
11814
|
-
const logs = _optionalChain([rpcResponse, 'access',
|
|
11815
|
+
if (_optionalChain([rpcResponse, 'optionalAccess', _33 => _33.value, 'optionalAccess', _34 => _34.err])) {
|
|
11816
|
+
const logs = _optionalChain([rpcResponse, 'access', _35 => _35.value, 'access', _36 => _36.logs, 'optionalAccess', _37 => _37.join, 'call', _38 => _38("\n \u2022 ")]) || "No logs available";
|
|
11815
11817
|
throw new Error(
|
|
11816
11818
|
`Transaction simulation failed:
|
|
11817
|
-
\u2022${logs}` + JSON.stringify(_optionalChain([rpcResponse, 'optionalAccess',
|
|
11819
|
+
\u2022${logs}` + JSON.stringify(_optionalChain([rpcResponse, 'optionalAccess', _39 => _39.value, 'optionalAccess', _40 => _40.err]))
|
|
11818
11820
|
);
|
|
11819
11821
|
}
|
|
11820
11822
|
return rpcResponse.value.unitsConsumed || null;
|
|
@@ -12990,7 +12992,7 @@ async function getTokenBalance(conn, tokenAccount) {
|
|
|
12990
12992
|
var parseLogs = (eventParser, logs) => {
|
|
12991
12993
|
if (!logs.length)
|
|
12992
12994
|
throw new Error("No logs found");
|
|
12993
|
-
for (const event of _optionalChain([eventParser, 'optionalAccess',
|
|
12995
|
+
for (const event of _optionalChain([eventParser, 'optionalAccess', _41 => _41.parseLogs, 'call', _42 => _42(logs)])) {
|
|
12994
12996
|
return event.data;
|
|
12995
12997
|
}
|
|
12996
12998
|
throw new Error("No events found");
|
|
@@ -13074,7 +13076,7 @@ var getEstimatedComputeUnitIxWithBuffer = async (connection, instructions, feePa
|
|
|
13074
13076
|
return _web3js.ComputeBudgetProgram.setComputeUnitLimit({ units });
|
|
13075
13077
|
};
|
|
13076
13078
|
function createProgram(connection, opt) {
|
|
13077
|
-
const cluster = _optionalChain([opt, 'optionalAccess',
|
|
13079
|
+
const cluster = _optionalChain([opt, 'optionalAccess', _43 => _43.cluster]) || "mainnet-beta";
|
|
13078
13080
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
13079
13081
|
connection,
|
|
13080
13082
|
{},
|
|
@@ -13089,9 +13091,9 @@ function decodeAccount(program, accountName, buffer) {
|
|
|
13089
13091
|
return program.coder.accounts.decode(accountName, buffer);
|
|
13090
13092
|
}
|
|
13091
13093
|
function getAccountDiscriminator(accountName) {
|
|
13092
|
-
return _optionalChain([dlmm_zc_default, 'access',
|
|
13094
|
+
return _optionalChain([dlmm_zc_default, 'access', _44 => _44.accounts, 'access', _45 => _45.find, 'call', _46 => _46(
|
|
13093
13095
|
(acc) => acc.name.toLowerCase() === accountName.toLowerCase()
|
|
13094
|
-
), 'optionalAccess',
|
|
13096
|
+
), 'optionalAccess', _47 => _47.discriminator]);
|
|
13095
13097
|
}
|
|
13096
13098
|
|
|
13097
13099
|
// src/dlmm/helpers/accountFilters.ts
|
|
@@ -13514,7 +13516,7 @@ var DLMM = class {
|
|
|
13514
13516
|
connection,
|
|
13515
13517
|
accountsToFetch
|
|
13516
13518
|
);
|
|
13517
|
-
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
13519
|
+
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _48 => _48[0], 'optionalAccess', _49 => _49.data]);
|
|
13518
13520
|
if (!lbPairAccountInfoBuffer)
|
|
13519
13521
|
throw new Error(`LB Pair account ${dlmm.toBase58()} not found`);
|
|
13520
13522
|
const lbPairAccInfo = decodeAccount(
|
|
@@ -13522,7 +13524,7 @@ var DLMM = class {
|
|
|
13522
13524
|
"lbPair",
|
|
13523
13525
|
lbPairAccountInfoBuffer
|
|
13524
13526
|
);
|
|
13525
|
-
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
13527
|
+
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _50 => _50[1], 'optionalAccess', _51 => _51.data]);
|
|
13526
13528
|
let binArrayBitMapExtensionAccInfo = null;
|
|
13527
13529
|
if (binArrayBitMapAccountInfoBuffer) {
|
|
13528
13530
|
binArrayBitMapExtensionAccInfo = decodeAccount(
|
|
@@ -13531,7 +13533,7 @@ var DLMM = class {
|
|
|
13531
13533
|
binArrayBitMapAccountInfoBuffer
|
|
13532
13534
|
);
|
|
13533
13535
|
}
|
|
13534
|
-
const clockAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
13536
|
+
const clockAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _52 => _52[2], 'optionalAccess', _53 => _53.data]);
|
|
13535
13537
|
if (!clockAccountInfoBuffer)
|
|
13536
13538
|
throw new Error(`Clock account not found`);
|
|
13537
13539
|
const clock = ClockLayout.decode(clockAccountInfoBuffer);
|
|
@@ -13684,14 +13686,14 @@ var DLMM = class {
|
|
|
13684
13686
|
accountsToFetch
|
|
13685
13687
|
);
|
|
13686
13688
|
const clockAccount = accountsInfo.pop();
|
|
13687
|
-
const clockAccountInfoBuffer = _optionalChain([clockAccount, 'optionalAccess',
|
|
13689
|
+
const clockAccountInfoBuffer = _optionalChain([clockAccount, 'optionalAccess', _54 => _54.data]);
|
|
13688
13690
|
if (!clockAccountInfoBuffer)
|
|
13689
13691
|
throw new Error(`Clock account not found`);
|
|
13690
13692
|
const clock = ClockLayout.decode(clockAccountInfoBuffer);
|
|
13691
13693
|
const lbPairArraysMap = /* @__PURE__ */ new Map();
|
|
13692
13694
|
for (let i = 0; i < dlmmList.length; i++) {
|
|
13693
13695
|
const lbPairPubKey = dlmmList[i];
|
|
13694
|
-
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
13696
|
+
const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _55 => _55[i], 'optionalAccess', _56 => _56.data]);
|
|
13695
13697
|
if (!lbPairAccountInfoBuffer)
|
|
13696
13698
|
throw new Error(`LB Pair account ${lbPairPubKey.toBase58()} not found`);
|
|
13697
13699
|
const lbPairAccInfo = decodeAccount(
|
|
@@ -13705,7 +13707,7 @@ var DLMM = class {
|
|
|
13705
13707
|
for (let i = dlmmList.length; i < accountsInfo.length; i++) {
|
|
13706
13708
|
const index = i - dlmmList.length;
|
|
13707
13709
|
const lbPairPubkey = dlmmList[index];
|
|
13708
|
-
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access',
|
|
13710
|
+
const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _57 => _57[i], 'optionalAccess', _58 => _58.data]);
|
|
13709
13711
|
if (binArrayBitMapAccountInfoBuffer) {
|
|
13710
13712
|
const binArrayBitMapExtensionAccInfo = decodeAccount(
|
|
13711
13713
|
program,
|
|
@@ -14035,8 +14037,8 @@ var DLMM = class {
|
|
|
14035
14037
|
const { mintX, mintY, rewardMint0, rewardMint1 } = lbPairMintMap.get(
|
|
14036
14038
|
lbPair.toBase58()
|
|
14037
14039
|
);
|
|
14038
|
-
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
14039
|
-
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
14040
|
+
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _59 => _59.get, 'call', _60 => _60(lbPair.toBase58()), 'optionalAccess', _61 => _61.reserveX]), () => ( BigInt(0)));
|
|
14041
|
+
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _62 => _62.get, 'call', _63 => _63(lbPair.toBase58()), 'optionalAccess', _64 => _64.reserveY]), () => ( BigInt(0)));
|
|
14040
14042
|
const { tokenXProgram, tokenYProgram } = getTokenProgramId(lbPairAcc);
|
|
14041
14043
|
const tokenX = {
|
|
14042
14044
|
publicKey: lbPairAcc.tokenXMint,
|
|
@@ -14074,7 +14076,7 @@ var DLMM = class {
|
|
|
14074
14076
|
tokenX,
|
|
14075
14077
|
tokenY,
|
|
14076
14078
|
lbPairPositionsData: [
|
|
14077
|
-
..._nullishCoalesce(_optionalChain([positionsMap, 'access',
|
|
14079
|
+
..._nullishCoalesce(_optionalChain([positionsMap, 'access', _65 => _65.get, 'call', _66 => _66(lbPair.toBase58()), 'optionalAccess', _67 => _67.lbPairPositionsData]), () => ( [])),
|
|
14078
14080
|
{
|
|
14079
14081
|
publicKey: positionPubkey,
|
|
14080
14082
|
positionData,
|
|
@@ -14417,7 +14419,9 @@ var DLMM = class {
|
|
|
14417
14419
|
tokenBadgeX,
|
|
14418
14420
|
tokenBadgeY
|
|
14419
14421
|
]);
|
|
14420
|
-
const presetParameterState = await program.account.presetParameter2.fetch(
|
|
14422
|
+
const presetParameterState = await program.account.presetParameter2.fetch(
|
|
14423
|
+
presetParameter
|
|
14424
|
+
);
|
|
14421
14425
|
const existsPool = await this.getPairPubkeyIfExists(
|
|
14422
14426
|
connection,
|
|
14423
14427
|
tokenX,
|
|
@@ -14651,7 +14655,7 @@ var DLMM = class {
|
|
|
14651
14655
|
swapForY,
|
|
14652
14656
|
new (0, _anchor.BN)(activeIdToLoop),
|
|
14653
14657
|
this.lbPair,
|
|
14654
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
14658
|
+
_nullishCoalesce(_optionalChain([this, 'access', _68 => _68.binArrayBitmapExtension, 'optionalAccess', _69 => _69.account]), () => ( null))
|
|
14655
14659
|
);
|
|
14656
14660
|
if (binArrayIndex === null)
|
|
14657
14661
|
shouldStop = true;
|
|
@@ -14982,8 +14986,8 @@ var DLMM = class {
|
|
|
14982
14986
|
position,
|
|
14983
14987
|
this.tokenX.mint,
|
|
14984
14988
|
this.tokenY.mint,
|
|
14985
|
-
_optionalChain([this, 'access',
|
|
14986
|
-
_optionalChain([this, 'access',
|
|
14989
|
+
_optionalChain([this, 'access', _70 => _70.rewards, 'access', _71 => _71[0], 'optionalAccess', _72 => _72.mint]),
|
|
14990
|
+
_optionalChain([this, 'access', _73 => _73.rewards, 'access', _74 => _74[1], 'optionalAccess', _75 => _75.mint]),
|
|
14987
14991
|
positionBinArraysMapV2
|
|
14988
14992
|
),
|
|
14989
14993
|
version: position.version()
|
|
@@ -15036,7 +15040,9 @@ var DLMM = class {
|
|
|
15036
15040
|
lowerBinArrayIndex.add(new (0, _anchor.BN)(1))
|
|
15037
15041
|
);
|
|
15038
15042
|
const binArraysCount = (await this.binArraysToBeCreate(lowerBinArrayIndex, upperBinArrayIndex)).length;
|
|
15039
|
-
const positionCount = Math.ceil(
|
|
15043
|
+
const positionCount = Math.ceil(
|
|
15044
|
+
(maxBinId - minBinId + 1) / Number(MAX_BINS_PER_POSITION)
|
|
15045
|
+
);
|
|
15040
15046
|
const binArrayCost = binArraysCount * BIN_ARRAY_FEE;
|
|
15041
15047
|
const positionCost = positionCount * POSITION_FEE;
|
|
15042
15048
|
return {
|
|
@@ -15276,8 +15282,8 @@ var DLMM = class {
|
|
|
15276
15282
|
position,
|
|
15277
15283
|
this.tokenX.mint,
|
|
15278
15284
|
this.tokenY.mint,
|
|
15279
|
-
_optionalChain([this, 'access',
|
|
15280
|
-
_optionalChain([this, 'access',
|
|
15285
|
+
_optionalChain([this, 'access', _76 => _76.rewards, 'access', _77 => _77[0], 'optionalAccess', _78 => _78.mint]),
|
|
15286
|
+
_optionalChain([this, 'access', _79 => _79.rewards, 'access', _80 => _80[1], 'optionalAccess', _81 => _81.mint]),
|
|
15281
15287
|
binArrayMap
|
|
15282
15288
|
),
|
|
15283
15289
|
version: position.version()
|
|
@@ -15474,7 +15480,7 @@ var DLMM = class {
|
|
|
15474
15480
|
const initPositionIxs = [];
|
|
15475
15481
|
const addLiquidityIxs = [];
|
|
15476
15482
|
for (let i = 0; i < chunkedPositionBinRange.length; i++) {
|
|
15477
|
-
const positionKeypair = await _asyncNullishCoalesce(await _optionalChain([customKeyPairGenerator, 'optionalCall',
|
|
15483
|
+
const positionKeypair = await _asyncNullishCoalesce(await _optionalChain([customKeyPairGenerator, 'optionalCall', _82 => _82()]), async () => ( _web3js.Keypair.generate()));
|
|
15478
15484
|
positionKeypairs.push(positionKeypair);
|
|
15479
15485
|
const { lowerBinId, upperBinId } = chunkedPositionBinRange[i];
|
|
15480
15486
|
let width = upperBinId - lowerBinId + 1;
|
|
@@ -16104,7 +16110,9 @@ var DLMM = class {
|
|
|
16104
16110
|
slippage
|
|
16105
16111
|
}) {
|
|
16106
16112
|
const maxActiveBinSlippage = slippage ? Math.ceil(slippage / (this.lbPair.binStep / 100)) : MAX_ACTIVE_BIN_SLIPPAGE;
|
|
16107
|
-
const positionAccount = await this.program.account.positionV2.fetch(
|
|
16113
|
+
const positionAccount = await this.program.account.positionV2.fetch(
|
|
16114
|
+
positionPubKey
|
|
16115
|
+
);
|
|
16108
16116
|
const { lowerBinId, upperBinId, binIds } = this.processXYAmountDistribution(xYAmountDistribution);
|
|
16109
16117
|
if (lowerBinId < positionAccount.lowerBinId)
|
|
16110
16118
|
throw new Error(
|
|
@@ -16624,7 +16632,7 @@ var DLMM = class {
|
|
|
16624
16632
|
swapForY,
|
|
16625
16633
|
activeId,
|
|
16626
16634
|
this.lbPair,
|
|
16627
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
16635
|
+
_nullishCoalesce(_optionalChain([this, 'access', _83 => _83.binArrayBitmapExtension, 'optionalAccess', _84 => _84.account]), () => ( null)),
|
|
16628
16636
|
binArrays
|
|
16629
16637
|
);
|
|
16630
16638
|
if (binArrayAccountToSwap == null) {
|
|
@@ -16689,7 +16697,7 @@ var DLMM = class {
|
|
|
16689
16697
|
swapForY,
|
|
16690
16698
|
activeId,
|
|
16691
16699
|
this.lbPair,
|
|
16692
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
16700
|
+
_nullishCoalesce(_optionalChain([this, 'access', _85 => _85.binArrayBitmapExtension, 'optionalAccess', _86 => _86.account]), () => ( null)),
|
|
16693
16701
|
binArrays
|
|
16694
16702
|
);
|
|
16695
16703
|
if (binArrayAccountToSwap == null) {
|
|
@@ -16786,7 +16794,7 @@ var DLMM = class {
|
|
|
16786
16794
|
swapForY,
|
|
16787
16795
|
activeId,
|
|
16788
16796
|
this.lbPair,
|
|
16789
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
16797
|
+
_nullishCoalesce(_optionalChain([this, 'access', _87 => _87.binArrayBitmapExtension, 'optionalAccess', _88 => _88.account]), () => ( null)),
|
|
16790
16798
|
binArrays
|
|
16791
16799
|
);
|
|
16792
16800
|
if (binArrayAccountToSwap == null) {
|
|
@@ -16874,7 +16882,7 @@ var DLMM = class {
|
|
|
16874
16882
|
swapForY,
|
|
16875
16883
|
activeId,
|
|
16876
16884
|
this.lbPair,
|
|
16877
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
16885
|
+
_nullishCoalesce(_optionalChain([this, 'access', _89 => _89.binArrayBitmapExtension, 'optionalAccess', _90 => _90.account]), () => ( null)),
|
|
16878
16886
|
binArrays
|
|
16879
16887
|
);
|
|
16880
16888
|
if (binArrayAccountToSwap == null) {
|
|
@@ -18217,7 +18225,7 @@ var DLMM = class {
|
|
|
18217
18225
|
swapForY,
|
|
18218
18226
|
new (0, _anchor.BN)(activeBinId),
|
|
18219
18227
|
this.lbPair,
|
|
18220
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
18228
|
+
_nullishCoalesce(_optionalChain([this, 'access', _91 => _91.binArrayBitmapExtension, 'optionalAccess', _92 => _92.account]), () => ( null))
|
|
18221
18229
|
);
|
|
18222
18230
|
if (toBinArrayIndex === null)
|
|
18223
18231
|
return true;
|
|
@@ -18254,7 +18262,7 @@ var DLMM = class {
|
|
|
18254
18262
|
swapForY,
|
|
18255
18263
|
new (0, _anchor.BN)(activeBinId),
|
|
18256
18264
|
this.lbPair,
|
|
18257
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
18265
|
+
_nullishCoalesce(_optionalChain([this, 'access', _93 => _93.binArrayBitmapExtension, 'optionalAccess', _94 => _94.account]), () => ( null))
|
|
18258
18266
|
);
|
|
18259
18267
|
const marketPriceBinArrayIndex = binIdToBinArrayIndex(
|
|
18260
18268
|
new (0, _anchor.BN)(marketPriceBinId)
|
|
@@ -18290,7 +18298,7 @@ var DLMM = class {
|
|
|
18290
18298
|
let binArrayBitmapExtension = null;
|
|
18291
18299
|
if (binArrayBitMapExtensionPubkey) {
|
|
18292
18300
|
binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
|
|
18293
|
-
if (!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
18301
|
+
if (!_optionalChain([binArrayAccounts, 'optionalAccess', _95 => _95[0]])) {
|
|
18294
18302
|
const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
18295
18303
|
binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
|
|
18296
18304
|
funder: owner,
|
|
@@ -18299,10 +18307,10 @@ var DLMM = class {
|
|
|
18299
18307
|
preInstructions.push(initializeBitmapExtensionIx);
|
|
18300
18308
|
}
|
|
18301
18309
|
}
|
|
18302
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
18310
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _96 => _96[1]])) {
|
|
18303
18311
|
fromBinArray = fromBinArrayPubkey;
|
|
18304
18312
|
}
|
|
18305
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
18313
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _97 => _97[2]]) && !!toBinArrayIndex) {
|
|
18306
18314
|
toBinArray = toBinArrayPubkey;
|
|
18307
18315
|
}
|
|
18308
18316
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -18808,7 +18816,7 @@ var DLMM = class {
|
|
|
18808
18816
|
);
|
|
18809
18817
|
})
|
|
18810
18818
|
);
|
|
18811
|
-
const version = _nullishCoalesce(_optionalChain([binArrays, 'access',
|
|
18819
|
+
const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _98 => _98.find, 'call', _99 => _99((binArray) => binArray != null), 'optionalAccess', _100 => _100.version]), () => ( 1));
|
|
18812
18820
|
return Array.from(
|
|
18813
18821
|
enumerateBins(
|
|
18814
18822
|
binsById,
|
|
@@ -29612,5 +29620,5 @@ var src_default = DLMM;
|
|
|
29612
29620
|
|
|
29613
29621
|
|
|
29614
29622
|
|
|
29615
|
-
exports.ADMIN = ADMIN; exports.ActionType = ActionType; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_FEE = BIN_ARRAY_BITMAP_FEE; exports.BIN_ARRAY_BITMAP_FEE_BN = BIN_ARRAY_BITMAP_FEE_BN; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BIN_ARRAY_FEE_BN = BIN_ARRAY_FEE_BN; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DEFAULT_BIN_PER_POSITION = DEFAULT_BIN_PER_POSITION; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = dlmm_default; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.
|
|
29623
|
+
exports.ADMIN = ADMIN; exports.ActionType = ActionType; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_FEE = BIN_ARRAY_BITMAP_FEE; exports.BIN_ARRAY_BITMAP_FEE_BN = BIN_ARRAY_BITMAP_FEE_BN; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BIN_ARRAY_FEE_BN = BIN_ARRAY_FEE_BN; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DEFAULT_BIN_PER_POSITION = DEFAULT_BIN_PER_POSITION; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = dlmm_default; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BINS_PER_POSITION = MAX_BINS_PER_POSITION; 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_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_EXTRA_BIN_ARRAYS = MAX_EXTRA_BIN_ARRAYS; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.MAX_RESIZE_LENGTH = MAX_RESIZE_LENGTH; exports.MEMO_PROGRAM_ID = MEMO_PROGRAM_ID; exports.Network = Network; exports.POOL_FEE = POOL_FEE; exports.POOL_FEE_BN = POOL_FEE_BN; exports.POSITION_BIN_DATA_SIZE = POSITION_BIN_DATA_SIZE; exports.POSITION_FEE = POSITION_FEE; exports.POSITION_FEE_BN = POSITION_FEE_BN; exports.POSITION_MAX_LENGTH = POSITION_MAX_LENGTH; exports.POSITION_MIN_SIZE = POSITION_MIN_SIZE; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionVersion = PositionVersion; exports.ResizeSide = ResizeSide; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.TOKEN_ACCOUNT_FEE = TOKEN_ACCOUNT_FEE; exports.TOKEN_ACCOUNT_FEE_BN = TOKEN_ACCOUNT_FEE_BN; exports.U64_MAX = U64_MAX; 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.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.createProgram = createProgram; exports.decodeAccount = decodeAccount; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveEventAuthority = deriveEventAuthority; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveLbPairWithPresetParamWithIndexKey = deriveLbPairWithPresetParamWithIndexKey; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.derivePresetParameterWithIndex = derivePresetParameterWithIndex; exports.deriveReserve = deriveReserve; exports.deriveRewardVault = deriveRewardVault; exports.deriveTokenBadge = deriveTokenBadge; exports.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getAccountDiscriminator = getAccountDiscriminator; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinFromBinArray = getBinFromBinArray; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgramId = getTokenProgramId; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.range = range; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
29616
29624
|
//# sourceMappingURL=index.js.map
|