@meteora-ag/dlmm 1.3.9-rc.1 → 1.3.9

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.js CHANGED
@@ -6484,9 +6484,6 @@ var PairType = /* @__PURE__ */ ((PairType2) => {
6484
6484
  return PairType2;
6485
6485
  })(PairType || {});
6486
6486
  var Strategy = {
6487
- SpotOneSide: { spotOneSide: {} },
6488
- CurveOneSide: { curveOneSide: {} },
6489
- BidAskOneSide: { bidAskOneSide: {} },
6490
6487
  SpotBalanced: { spotBalanced: {} },
6491
6488
  CurveBalanced: { curveBalanced: {} },
6492
6489
  BidAskBalanced: { bidAskBalanced: {} },
@@ -6495,15 +6492,12 @@ var Strategy = {
6495
6492
  BidAskImBalanced: { bidAskImBalanced: {} }
6496
6493
  };
6497
6494
  var StrategyType = /* @__PURE__ */ ((StrategyType2) => {
6498
- StrategyType2[StrategyType2["SpotOneSide"] = 0] = "SpotOneSide";
6499
- StrategyType2[StrategyType2["CurveOneSide"] = 1] = "CurveOneSide";
6500
- StrategyType2[StrategyType2["BidAskOneSide"] = 2] = "BidAskOneSide";
6501
- StrategyType2[StrategyType2["SpotImBalanced"] = 3] = "SpotImBalanced";
6502
- StrategyType2[StrategyType2["CurveImBalanced"] = 4] = "CurveImBalanced";
6503
- StrategyType2[StrategyType2["BidAskImBalanced"] = 5] = "BidAskImBalanced";
6504
- StrategyType2[StrategyType2["SpotBalanced"] = 6] = "SpotBalanced";
6505
- StrategyType2[StrategyType2["CurveBalanced"] = 7] = "CurveBalanced";
6506
- StrategyType2[StrategyType2["BidAskBalanced"] = 8] = "BidAskBalanced";
6495
+ StrategyType2[StrategyType2["SpotImBalanced"] = 0] = "SpotImBalanced";
6496
+ StrategyType2[StrategyType2["CurveImBalanced"] = 1] = "CurveImBalanced";
6497
+ StrategyType2[StrategyType2["BidAskImBalanced"] = 2] = "BidAskImBalanced";
6498
+ StrategyType2[StrategyType2["SpotBalanced"] = 3] = "SpotBalanced";
6499
+ StrategyType2[StrategyType2["CurveBalanced"] = 4] = "CurveBalanced";
6500
+ StrategyType2[StrategyType2["BidAskBalanced"] = 5] = "BidAskBalanced";
6507
6501
  return StrategyType2;
6508
6502
  })(StrategyType || {});
6509
6503
  var ActivationType = /* @__PURE__ */ ((ActivationType2) => {
@@ -7055,53 +7049,10 @@ function toWeightBidAsk(minBinId, maxBinId, activeId) {
7055
7049
  }
7056
7050
  return distributions;
7057
7051
  }
7058
- function toAmountsOneSideByStrategy(activeId, binStep, minBinId, maxBinId, amount, strategyType, depositForY) {
7059
- let weights = [];
7060
- switch (strategyType) {
7061
- case 6 /* SpotBalanced */:
7062
- case 7 /* CurveBalanced */:
7063
- case 8 /* BidAskBalanced */:
7064
- case 3 /* SpotImBalanced */:
7065
- case 4 /* CurveImBalanced */:
7066
- case 5 /* BidAskImBalanced */: {
7067
- throw "Invalid Strategy Parameters";
7068
- }
7069
- case 0 /* SpotOneSide */: {
7070
- weights = toWeightSpotBalanced(minBinId, maxBinId);
7071
- break;
7072
- }
7073
- case 1 /* CurveOneSide */: {
7074
- if (depositForY) {
7075
- weights = toWeightAscendingOrder(minBinId, maxBinId);
7076
- } else {
7077
- weights = toWeightDecendingOrder(minBinId, maxBinId);
7078
- }
7079
- break;
7080
- }
7081
- case 2 /* BidAskOneSide */: {
7082
- if (depositForY) {
7083
- weights = toWeightDecendingOrder(minBinId, maxBinId);
7084
- } else {
7085
- weights = toWeightAscendingOrder(minBinId, maxBinId);
7086
- }
7087
- break;
7088
- }
7089
- }
7090
- if (depositForY) {
7091
- return toAmountBidSide(activeId, amount, weights);
7092
- } else {
7093
- return toAmountAskSide(activeId, binStep, amount, weights);
7094
- }
7095
- }
7096
7052
  function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amountX, amountY, amountXInActiveBin, amountYInActiveBin, strategyType) {
7097
7053
  const isSingleSideX = amountY.isZero();
7098
7054
  switch (strategyType) {
7099
- case 0 /* SpotOneSide */:
7100
- case 1 /* CurveOneSide */:
7101
- case 2 /* BidAskOneSide */: {
7102
- throw "Invalid Strategy Parameters";
7103
- }
7104
- case 3 /* SpotImBalanced */: {
7055
+ case 0 /* SpotImBalanced */: {
7105
7056
  if (activeId < minBinId || activeId > maxBinId) {
7106
7057
  const weights = toWeightSpotBalanced(minBinId, maxBinId);
7107
7058
  return toAmountBothSide(
@@ -7173,7 +7124,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
7173
7124
  }
7174
7125
  return amountsInBin;
7175
7126
  }
7176
- case 4 /* CurveImBalanced */: {
7127
+ case 1 /* CurveImBalanced */: {
7177
7128
  if (activeId < minBinId) {
7178
7129
  let weights = toWeightDecendingOrder(minBinId, maxBinId);
7179
7130
  return toAmountBothSide(
@@ -7257,7 +7208,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
7257
7208
  }
7258
7209
  return amountsInBin;
7259
7210
  }
7260
- case 5 /* BidAskImBalanced */: {
7211
+ case 2 /* BidAskImBalanced */: {
7261
7212
  if (activeId < minBinId) {
7262
7213
  const weights = toWeightAscendingOrder(minBinId, maxBinId);
7263
7214
  return toAmountBothSide(
@@ -7341,7 +7292,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
7341
7292
  }
7342
7293
  return amountsInBin;
7343
7294
  }
7344
- case 6 /* SpotBalanced */: {
7295
+ case 3 /* SpotBalanced */: {
7345
7296
  let weights = toWeightSpotBalanced(minBinId, maxBinId);
7346
7297
  return toAmountBothSide(
7347
7298
  activeId,
@@ -7353,7 +7304,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
7353
7304
  weights
7354
7305
  );
7355
7306
  }
7356
- case 7 /* CurveBalanced */: {
7307
+ case 4 /* CurveBalanced */: {
7357
7308
  let weights = toWeightCurve(minBinId, maxBinId, activeId);
7358
7309
  return toAmountBothSide(
7359
7310
  activeId,
@@ -7365,7 +7316,7 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
7365
7316
  weights
7366
7317
  );
7367
7318
  }
7368
- case 8 /* BidAskBalanced */: {
7319
+ case 5 /* BidAskBalanced */: {
7369
7320
  let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
7370
7321
  return toAmountBothSide(
7371
7322
  activeId,
@@ -7381,15 +7332,12 @@ function toAmountsBothSideByStrategy(activeId, binStep, minBinId, maxBinId, amou
7381
7332
  }
7382
7333
  function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amountYInActiveBin, minBinId, maxBinId, strategyType) {
7383
7334
  switch (strategyType) {
7384
- case 0 /* SpotOneSide */:
7385
- case 1 /* CurveOneSide */:
7386
- case 2 /* BidAskOneSide */:
7387
- case 3 /* SpotImBalanced */:
7388
- case 4 /* CurveImBalanced */:
7389
- case 5 /* BidAskImBalanced */: {
7335
+ case 0 /* SpotImBalanced */:
7336
+ case 1 /* CurveImBalanced */:
7337
+ case 2 /* BidAskImBalanced */: {
7390
7338
  throw "Invalid Strategy Parameters";
7391
7339
  }
7392
- case 6 /* SpotBalanced */: {
7340
+ case 3 /* SpotBalanced */: {
7393
7341
  let weights = toWeightSpotBalanced(minBinId, maxBinId);
7394
7342
  return autoFillYByWeight(
7395
7343
  activeId,
@@ -7400,7 +7348,7 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
7400
7348
  weights
7401
7349
  );
7402
7350
  }
7403
- case 7 /* CurveBalanced */: {
7351
+ case 4 /* CurveBalanced */: {
7404
7352
  let weights = toWeightCurve(minBinId, maxBinId, activeId);
7405
7353
  return autoFillYByWeight(
7406
7354
  activeId,
@@ -7411,7 +7359,7 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
7411
7359
  weights
7412
7360
  );
7413
7361
  }
7414
- case 8 /* BidAskBalanced */: {
7362
+ case 5 /* BidAskBalanced */: {
7415
7363
  let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
7416
7364
  return autoFillYByWeight(
7417
7365
  activeId,
@@ -7426,15 +7374,12 @@ function autoFillYByStrategy(activeId, binStep, amountX, amountXInActiveBin, amo
7426
7374
  }
7427
7375
  function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amountYInActiveBin, minBinId, maxBinId, strategyType) {
7428
7376
  switch (strategyType) {
7429
- case 0 /* SpotOneSide */:
7430
- case 1 /* CurveOneSide */:
7431
- case 2 /* BidAskOneSide */:
7432
- case 3 /* SpotImBalanced */:
7433
- case 4 /* CurveImBalanced */:
7434
- case 5 /* BidAskImBalanced */: {
7377
+ case 0 /* SpotImBalanced */:
7378
+ case 1 /* CurveImBalanced */:
7379
+ case 2 /* BidAskImBalanced */: {
7435
7380
  throw "Invalid Strategy Parameters";
7436
7381
  }
7437
- case 6 /* SpotBalanced */: {
7382
+ case 3 /* SpotBalanced */: {
7438
7383
  let weights = toWeightSpotBalanced(minBinId, maxBinId);
7439
7384
  return autoFillXByWeight(
7440
7385
  activeId,
@@ -7445,7 +7390,7 @@ function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amo
7445
7390
  weights
7446
7391
  );
7447
7392
  }
7448
- case 7 /* CurveBalanced */: {
7393
+ case 4 /* CurveBalanced */: {
7449
7394
  let weights = toWeightCurve(minBinId, maxBinId, activeId);
7450
7395
  return autoFillXByWeight(
7451
7396
  activeId,
@@ -7456,7 +7401,7 @@ function autoFillXByStrategy(activeId, binStep, amountY, amountXInActiveBin, amo
7456
7401
  weights
7457
7402
  );
7458
7403
  }
7459
- case 8 /* BidAskBalanced */: {
7404
+ case 5 /* BidAskBalanced */: {
7460
7405
  let weights = toWeightBidAsk(minBinId, maxBinId, activeId);
7461
7406
  return autoFillXByWeight(
7462
7407
  activeId,
@@ -7477,31 +7422,7 @@ function toStrategyParameters({
7477
7422
  }) {
7478
7423
  const parameters = [singleSidedX ? 1 : 0, ...new Array(63).fill(0)];
7479
7424
  switch (strategyType) {
7480
- case 0 /* SpotOneSide */: {
7481
- return {
7482
- minBinId,
7483
- maxBinId,
7484
- strategyType: { spotOneSide: {} },
7485
- parameteres: Buffer.from(parameters).toJSON().data
7486
- };
7487
- }
7488
- case 1 /* CurveOneSide */: {
7489
- return {
7490
- minBinId,
7491
- maxBinId,
7492
- strategyType: { curveOneSide: {} },
7493
- parameteres: Buffer.from(parameters).toJSON().data
7494
- };
7495
- }
7496
- case 2 /* BidAskOneSide */: {
7497
- return {
7498
- minBinId,
7499
- maxBinId,
7500
- strategyType: { bidAskOneSide: {} },
7501
- parameteres: Buffer.from(parameters).toJSON().data
7502
- };
7503
- }
7504
- case 6 /* SpotBalanced */: {
7425
+ case 3 /* SpotBalanced */: {
7505
7426
  return {
7506
7427
  minBinId,
7507
7428
  maxBinId,
@@ -7509,7 +7430,7 @@ function toStrategyParameters({
7509
7430
  parameteres: Buffer.from(parameters).toJSON().data
7510
7431
  };
7511
7432
  }
7512
- case 7 /* CurveBalanced */: {
7433
+ case 4 /* CurveBalanced */: {
7513
7434
  return {
7514
7435
  minBinId,
7515
7436
  maxBinId,
@@ -7517,7 +7438,7 @@ function toStrategyParameters({
7517
7438
  parameteres: Buffer.from(parameters).toJSON().data
7518
7439
  };
7519
7440
  }
7520
- case 8 /* BidAskBalanced */: {
7441
+ case 5 /* BidAskBalanced */: {
7521
7442
  return {
7522
7443
  minBinId,
7523
7444
  maxBinId,
@@ -7525,7 +7446,7 @@ function toStrategyParameters({
7525
7446
  parameteres: Buffer.from(parameters).toJSON().data
7526
7447
  };
7527
7448
  }
7528
- case 3 /* SpotImBalanced */: {
7449
+ case 0 /* SpotImBalanced */: {
7529
7450
  return {
7530
7451
  minBinId,
7531
7452
  maxBinId,
@@ -7533,7 +7454,7 @@ function toStrategyParameters({
7533
7454
  parameteres: Buffer.from(parameters).toJSON().data
7534
7455
  };
7535
7456
  }
7536
- case 4 /* CurveImBalanced */: {
7457
+ case 1 /* CurveImBalanced */: {
7537
7458
  return {
7538
7459
  minBinId,
7539
7460
  maxBinId,
@@ -7541,7 +7462,7 @@ function toStrategyParameters({
7541
7462
  parameteres: Buffer.from(parameters).toJSON().data
7542
7463
  };
7543
7464
  }
7544
- case 5 /* BidAskImBalanced */: {
7465
+ case 2 /* BidAskImBalanced */: {
7545
7466
  return {
7546
7467
  minBinId,
7547
7468
  maxBinId,
@@ -7563,7 +7484,7 @@ async function getTokensMintFromPoolAddress(connection, poolAddress, opt) {
7563
7484
  );
7564
7485
  const program = new (0, _anchor.Program)(
7565
7486
  IDL,
7566
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _21 => _21.programId]), () => ( LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _22 => _22.cluster]), () => ( "mainnet-beta"))])),
7487
+ LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _21 => _21.cluster]), () => ( "mainnet-beta"))],
7567
7488
  provider
7568
7489
  );
7569
7490
  const poolAccount = await program.account.lbPair.fetchNullable(
@@ -7641,7 +7562,7 @@ async function getTokenBalance(conn, tokenAccount) {
7641
7562
  var parseLogs = (eventParser, logs) => {
7642
7563
  if (!logs.length)
7643
7564
  throw new Error("No logs found");
7644
- for (const event of _optionalChain([eventParser, 'optionalAccess', _23 => _23.parseLogs, 'call', _24 => _24(logs)])) {
7565
+ for (const event of _optionalChain([eventParser, 'optionalAccess', _22 => _22.parseLogs, 'call', _23 => _23(logs)])) {
7645
7566
  return event.data;
7646
7567
  }
7647
7568
  throw new Error("No events found");
@@ -7756,13 +7677,13 @@ var DLMM = class {
7756
7677
  );
7757
7678
  const program = new (0, _anchor.Program)(
7758
7679
  IDL,
7759
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _25 => _25.programId]), () => ( LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _26 => _26.cluster]), () => ( "mainnet-beta"))])),
7680
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _24 => _24.programId]), () => ( LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _25 => _25.cluster]), () => ( "mainnet-beta"))])),
7760
7681
  provider
7761
7682
  );
7762
7683
  return program.account.lbPair.all();
7763
7684
  }
7764
7685
  static async getPairPubkeyIfExists(connection, tokenX, tokenY, binStep, baseFactor, opt) {
7765
- const cluster = _optionalChain([opt, 'optionalAccess', _27 => _27.cluster]) || "mainnet-beta";
7686
+ const cluster = _optionalChain([opt, 'optionalAccess', _26 => _26.cluster]) || "mainnet-beta";
7766
7687
  const provider = new (0, _anchor.AnchorProvider)(
7767
7688
  connection,
7768
7689
  {},
@@ -7770,7 +7691,7 @@ var DLMM = class {
7770
7691
  );
7771
7692
  const program = new (0, _anchor.Program)(
7772
7693
  IDL,
7773
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _28 => _28.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7694
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _27 => _27.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7774
7695
  provider
7775
7696
  );
7776
7697
  try {
@@ -7809,7 +7730,7 @@ var DLMM = class {
7809
7730
  * @returns The `create` function returns a `Promise` that resolves to a `DLMM` object.
7810
7731
  */
7811
7732
  static async create(connection, dlmm, opt) {
7812
- const cluster = _optionalChain([opt, 'optionalAccess', _29 => _29.cluster]) || "mainnet-beta";
7733
+ const cluster = _optionalChain([opt, 'optionalAccess', _28 => _28.cluster]) || "mainnet-beta";
7813
7734
  const provider = new (0, _anchor.AnchorProvider)(
7814
7735
  connection,
7815
7736
  {},
@@ -7817,7 +7738,7 @@ var DLMM = class {
7817
7738
  );
7818
7739
  const program = new (0, _anchor.Program)(
7819
7740
  IDL,
7820
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _30 => _30.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7741
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _29 => _29.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7821
7742
  provider
7822
7743
  );
7823
7744
  const binArrayBitMapExtensionPubkey = deriveBinArrayBitmapExtension(
@@ -7833,14 +7754,14 @@ var DLMM = class {
7833
7754
  connection,
7834
7755
  accountsToFetch
7835
7756
  );
7836
- const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _31 => _31[0], 'optionalAccess', _32 => _32.data]);
7757
+ const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _30 => _30[0], 'optionalAccess', _31 => _31.data]);
7837
7758
  if (!lbPairAccountInfoBuffer)
7838
7759
  throw new Error(`LB Pair account ${dlmm.toBase58()} not found`);
7839
7760
  const lbPairAccInfo = program.coder.accounts.decode(
7840
7761
  "lbPair",
7841
7762
  lbPairAccountInfoBuffer
7842
7763
  );
7843
- const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _33 => _33[1], 'optionalAccess', _34 => _34.data]);
7764
+ const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _32 => _32[1], 'optionalAccess', _33 => _33.data]);
7844
7765
  let binArrayBitMapExtensionAccInfo = null;
7845
7766
  if (binArrayBitMapAccountInfoBuffer) {
7846
7767
  binArrayBitMapExtensionAccInfo = program.coder.accounts.decode(
@@ -7848,7 +7769,7 @@ var DLMM = class {
7848
7769
  binArrayBitMapAccountInfoBuffer
7849
7770
  );
7850
7771
  }
7851
- const clockAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _35 => _35[2], 'optionalAccess', _36 => _36.data]);
7772
+ const clockAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _34 => _34[2], 'optionalAccess', _35 => _35.data]);
7852
7773
  if (!clockAccountInfoBuffer)
7853
7774
  throw new Error(`Clock account not found`);
7854
7775
  const clock = ClockLayout.decode(clockAccountInfoBuffer);
@@ -7909,7 +7830,7 @@ var DLMM = class {
7909
7830
  * objects.
7910
7831
  */
7911
7832
  static async createMultiple(connection, dlmmList, opt) {
7912
- const cluster = _optionalChain([opt, 'optionalAccess', _37 => _37.cluster]) || "mainnet-beta";
7833
+ const cluster = _optionalChain([opt, 'optionalAccess', _36 => _36.cluster]) || "mainnet-beta";
7913
7834
  const provider = new (0, _anchor.AnchorProvider)(
7914
7835
  connection,
7915
7836
  {},
@@ -7917,7 +7838,7 @@ var DLMM = class {
7917
7838
  );
7918
7839
  const program = new (0, _anchor.Program)(
7919
7840
  IDL,
7920
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _38 => _38.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7841
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _37 => _37.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7921
7842
  provider
7922
7843
  );
7923
7844
  const binArrayBitMapExtensions = dlmmList.map(
@@ -7933,14 +7854,14 @@ var DLMM = class {
7933
7854
  accountsToFetch
7934
7855
  );
7935
7856
  const clockAccount = accountsInfo.pop();
7936
- const clockAccountInfoBuffer = _optionalChain([clockAccount, 'optionalAccess', _39 => _39.data]);
7857
+ const clockAccountInfoBuffer = _optionalChain([clockAccount, 'optionalAccess', _38 => _38.data]);
7937
7858
  if (!clockAccountInfoBuffer)
7938
7859
  throw new Error(`Clock account not found`);
7939
7860
  const clock = ClockLayout.decode(clockAccountInfoBuffer);
7940
7861
  const lbPairArraysMap = /* @__PURE__ */ new Map();
7941
7862
  for (let i = 0; i < dlmmList.length; i++) {
7942
7863
  const lbPairPubKey = dlmmList[i];
7943
- const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _40 => _40[i], 'optionalAccess', _41 => _41.data]);
7864
+ const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _39 => _39[i], 'optionalAccess', _40 => _40.data]);
7944
7865
  if (!lbPairAccountInfoBuffer)
7945
7866
  throw new Error(`LB Pair account ${lbPairPubKey.toBase58()} not found`);
7946
7867
  const binArrayAccInfo = program.coder.accounts.decode(
@@ -7953,7 +7874,7 @@ var DLMM = class {
7953
7874
  for (let i = dlmmList.length; i < accountsInfo.length; i++) {
7954
7875
  const index = i - dlmmList.length;
7955
7876
  const lbPairPubkey = dlmmList[index];
7956
- const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _42 => _42[i], 'optionalAccess', _43 => _43.data]);
7877
+ const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _41 => _41[i], 'optionalAccess', _42 => _42.data]);
7957
7878
  if (binArrayBitMapAccountInfoBuffer) {
7958
7879
  const binArrayBitMapExtensionAccInfo = program.coder.accounts.decode(
7959
7880
  "binArrayBitmapExtension",
@@ -8037,7 +7958,7 @@ var DLMM = class {
8037
7958
  );
8038
7959
  const program = new (0, _anchor.Program)(
8039
7960
  IDL,
8040
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _44 => _44.programId]), () => ( LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _45 => _45.cluster]), () => ( "mainnet-beta"))])),
7961
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _43 => _43.programId]), () => ( LBCLMM_PROGRAM_IDS[_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _44 => _44.cluster]), () => ( "mainnet-beta"))])),
8041
7962
  provider
8042
7963
  );
8043
7964
  const presetParameter = await program.account.presetParameter.all();
@@ -8055,7 +7976,7 @@ var DLMM = class {
8055
7976
  * Pair account, and the value is an object of PositionInfo
8056
7977
  */
8057
7978
  static async getAllLbPairPositionsByUser(connection, userPubKey, opt) {
8058
- const cluster = _optionalChain([opt, 'optionalAccess', _46 => _46.cluster]) || "mainnet-beta";
7979
+ const cluster = _optionalChain([opt, 'optionalAccess', _45 => _45.cluster]) || "mainnet-beta";
8059
7980
  const provider = new (0, _anchor.AnchorProvider)(
8060
7981
  connection,
8061
7982
  {},
@@ -8063,7 +7984,7 @@ var DLMM = class {
8063
7984
  );
8064
7985
  const program = new (0, _anchor.Program)(
8065
7986
  IDL,
8066
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _47 => _47.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
7987
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _46 => _46.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
8067
7988
  provider
8068
7989
  );
8069
7990
  const positionsV2 = await program.account.positionV2.all([
@@ -8197,8 +8118,8 @@ var DLMM = class {
8197
8118
  getTokenDecimals(program.provider.connection, lbPairAcc.tokenXMint),
8198
8119
  getTokenDecimals(program.provider.connection, lbPairAcc.tokenYMint)
8199
8120
  ]);
8200
- const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access', _48 => _48.get, 'call', _49 => _49(lbPair.toBase58()), 'optionalAccess', _50 => _50.reserveX]), () => ( BigInt(0)));
8201
- const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access', _51 => _51.get, 'call', _52 => _52(lbPair.toBase58()), 'optionalAccess', _53 => _53.reserveY]), () => ( BigInt(0)));
8121
+ const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access', _47 => _47.get, 'call', _48 => _48(lbPair.toBase58()), 'optionalAccess', _49 => _49.reserveX]), () => ( BigInt(0)));
8122
+ const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMapV2, 'access', _50 => _50.get, 'call', _51 => _51(lbPair.toBase58()), 'optionalAccess', _52 => _52.reserveY]), () => ( BigInt(0)));
8202
8123
  const tokenX = {
8203
8124
  publicKey: lbPairAcc.tokenXMint,
8204
8125
  reserve: lbPairAcc.reserveX,
@@ -8244,7 +8165,7 @@ var DLMM = class {
8244
8165
  tokenX,
8245
8166
  tokenY,
8246
8167
  lbPairPositionsData: [
8247
- ..._nullishCoalesce(_optionalChain([positionsMap, 'access', _54 => _54.get, 'call', _55 => _55(lbPair.toBase58()), 'optionalAccess', _56 => _56.lbPairPositionsData]), () => ( [])),
8168
+ ..._nullishCoalesce(_optionalChain([positionsMap, 'access', _53 => _53.get, 'call', _54 => _54(lbPair.toBase58()), 'optionalAccess', _55 => _55.lbPairPositionsData]), () => ( [])),
8248
8169
  {
8249
8170
  publicKey: positionPubKey,
8250
8171
  positionData,
@@ -8273,7 +8194,7 @@ var DLMM = class {
8273
8194
  );
8274
8195
  const program = new (0, _anchor.Program)(
8275
8196
  IDL,
8276
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _57 => _57.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
8197
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _56 => _56.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
8277
8198
  provider
8278
8199
  );
8279
8200
  const [lbPair] = derivePermissionLbPair(
@@ -8322,7 +8243,7 @@ var DLMM = class {
8322
8243
  );
8323
8244
  const program = new (0, _anchor.Program)(
8324
8245
  IDL,
8325
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _58 => _58.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
8246
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _57 => _57.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
8326
8247
  provider
8327
8248
  );
8328
8249
  const [lbPair] = deriveCustomizablePermissionlessLbPair(
@@ -8370,7 +8291,7 @@ var DLMM = class {
8370
8291
  );
8371
8292
  const program = new (0, _anchor.Program)(
8372
8293
  IDL,
8373
- _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _59 => _59.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
8294
+ _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _58 => _58.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
8374
8295
  provider
8375
8296
  );
8376
8297
  const existsPool = await this.getPairPubkeyIfExists(
@@ -8506,7 +8427,7 @@ var DLMM = class {
8506
8427
  swapForY,
8507
8428
  new (0, _anchor.BN)(activeIdToLoop),
8508
8429
  this.lbPair,
8509
- _nullishCoalesce(_optionalChain([this, 'access', _60 => _60.binArrayBitmapExtension, 'optionalAccess', _61 => _61.account]), () => ( null))
8430
+ _nullishCoalesce(_optionalChain([this, 'access', _59 => _59.binArrayBitmapExtension, 'optionalAccess', _60 => _60.account]), () => ( null))
8510
8431
  );
8511
8432
  if (binArrayIndex === null)
8512
8433
  shouldStop = true;
@@ -9993,7 +9914,7 @@ var DLMM = class {
9993
9914
  swapForY,
9994
9915
  activeId,
9995
9916
  this.lbPair,
9996
- _nullishCoalesce(_optionalChain([this, 'access', _62 => _62.binArrayBitmapExtension, 'optionalAccess', _63 => _63.account]), () => ( null)),
9917
+ _nullishCoalesce(_optionalChain([this, 'access', _61 => _61.binArrayBitmapExtension, 'optionalAccess', _62 => _62.account]), () => ( null)),
9997
9918
  binArrays
9998
9919
  );
9999
9920
  if (binArrayAccountToSwap == null) {
@@ -10098,7 +10019,7 @@ var DLMM = class {
10098
10019
  swapForY,
10099
10020
  activeId,
10100
10021
  this.lbPair,
10101
- _nullishCoalesce(_optionalChain([this, 'access', _64 => _64.binArrayBitmapExtension, 'optionalAccess', _65 => _65.account]), () => ( null)),
10022
+ _nullishCoalesce(_optionalChain([this, 'access', _63 => _63.binArrayBitmapExtension, 'optionalAccess', _64 => _64.account]), () => ( null)),
10102
10023
  binArrays
10103
10024
  );
10104
10025
  if (binArrayAccountToSwap == null) {
@@ -11277,7 +11198,7 @@ var DLMM = class {
11277
11198
  swapForY,
11278
11199
  new (0, _anchor.BN)(activeBinId),
11279
11200
  this.lbPair,
11280
- _nullishCoalesce(_optionalChain([this, 'access', _66 => _66.binArrayBitmapExtension, 'optionalAccess', _67 => _67.account]), () => ( null))
11201
+ _nullishCoalesce(_optionalChain([this, 'access', _65 => _65.binArrayBitmapExtension, 'optionalAccess', _66 => _66.account]), () => ( null))
11281
11202
  );
11282
11203
  if (toBinArrayIndex === null)
11283
11204
  return true;
@@ -11314,7 +11235,7 @@ var DLMM = class {
11314
11235
  swapForY,
11315
11236
  new (0, _anchor.BN)(activeBinId),
11316
11237
  this.lbPair,
11317
- _nullishCoalesce(_optionalChain([this, 'access', _68 => _68.binArrayBitmapExtension, 'optionalAccess', _69 => _69.account]), () => ( null))
11238
+ _nullishCoalesce(_optionalChain([this, 'access', _67 => _67.binArrayBitmapExtension, 'optionalAccess', _68 => _68.account]), () => ( null))
11318
11239
  );
11319
11240
  const accountsToFetch = [];
11320
11241
  const [binArrayBitMapExtensionPubkey] = deriveBinArrayBitmapExtension(
@@ -11345,13 +11266,13 @@ var DLMM = class {
11345
11266
  let fromBinArray = null;
11346
11267
  let toBinArray = null;
11347
11268
  let binArrayBitmapExtension = null;
11348
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _70 => _70[0]])) {
11269
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _69 => _69[0]])) {
11349
11270
  binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
11350
11271
  }
11351
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _71 => _71[1]])) {
11272
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _70 => _70[1]])) {
11352
11273
  fromBinArray = fromBinArrayPubkey;
11353
11274
  }
11354
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _72 => _72[2]]) && !!toBinArrayIndex) {
11275
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _71 => _71[2]]) && !!toBinArrayIndex) {
11355
11276
  toBinArray = toBinArrayPubkey;
11356
11277
  }
11357
11278
  const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
@@ -11827,7 +11748,7 @@ var DLMM = class {
11827
11748
  const [lowerBinId2] = getBinArrayLowerUpperBinId(index);
11828
11749
  return bins.map((b, i) => [lowerBinId2.toNumber() + i, b]);
11829
11750
  }));
11830
- const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _73 => _73.find, 'call', _74 => _74((binArray) => binArray != null), 'optionalAccess', _75 => _75.version]), () => ( 1));
11751
+ const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _72 => _72.find, 'call', _73 => _73((binArray) => binArray != null), 'optionalAccess', _74 => _74.version]), () => ( 1));
11831
11752
  return Array.from(enumerateBins(
11832
11753
  binsById,
11833
11754
  lowerBinId,
@@ -12120,6 +12041,5 @@ var src_default = DLMM;
12120
12041
 
12121
12042
 
12122
12043
 
12123
-
12124
- exports.ADMIN = ADMIN; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; 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.PairStatus = PairStatus; 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.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; 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.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; 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.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.toAmountsOneSideByStrategy = toAmountsOneSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
12044
+ exports.ADMIN = ADMIN; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; 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.PairStatus = PairStatus; 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.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; 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.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; 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.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;
12125
12045
  //# sourceMappingURL=index.js.map