@meteora-ag/dlmm 1.9.1 → 1.9.2

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
@@ -17017,18 +17017,59 @@ var DLMM = class {
17017
17017
  baseFeePowerFactor: baseFeePowerFactor.toNumber(),
17018
17018
  padding: Array(63).fill(0)
17019
17019
  };
17020
+ const preInstructions = [];
17020
17021
  const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
17021
17022
  tokenX,
17022
17023
  creatorKey,
17023
17024
  true,
17024
17025
  tokenXAccount.owner
17025
17026
  );
17027
+ const createUserTokenXIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
17028
+ creatorKey,
17029
+ userTokenX,
17030
+ creatorKey,
17031
+ tokenX,
17032
+ tokenXAccount.owner
17033
+ );
17034
+ preInstructions.push(createUserTokenXIx);
17026
17035
  const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0,
17027
17036
  tokenY,
17028
17037
  creatorKey,
17029
17038
  true,
17030
17039
  tokenYAccount.owner
17031
17040
  );
17041
+ const createUserTokenYIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
17042
+ creatorKey,
17043
+ userTokenY,
17044
+ creatorKey,
17045
+ tokenY,
17046
+ tokenYAccount.owner
17047
+ );
17048
+ preInstructions.push(createUserTokenYIx);
17049
+ const postInstructions = [];
17050
+ if ((tokenX.equals(_spltoken.NATIVE_MINT) || tokenY.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([opt, 'optionalAccess', _69 => _69.skipSolWrappingOperation])) {
17051
+ const wrapAmount = BigInt(1);
17052
+ if (tokenX.equals(_spltoken.NATIVE_MINT)) {
17053
+ const wrapSOLIxX = wrapSOLInstruction(
17054
+ creatorKey,
17055
+ userTokenX,
17056
+ wrapAmount
17057
+ );
17058
+ preInstructions.push(...wrapSOLIxX);
17059
+ }
17060
+ if (tokenY.equals(_spltoken.NATIVE_MINT)) {
17061
+ const wrapSOLIxY = wrapSOLInstruction(
17062
+ creatorKey,
17063
+ userTokenY,
17064
+ wrapAmount
17065
+ );
17066
+ preInstructions.push(...wrapSOLIxY);
17067
+ }
17068
+ const unwrapSOLIx = await unwrapSOLInstruction(creatorKey);
17069
+ if (unwrapSOLIx) {
17070
+ postInstructions.push(unwrapSOLIx);
17071
+ }
17072
+ }
17032
17073
  return program.methods.initializeCustomizablePermissionlessLbPair2(ixData).accountsPartial({
17033
17074
  tokenBadgeX: tokenBadgeXAccount ? tokenBadgeX : program.programId,
17034
17075
  tokenBadgeY: tokenBadgeYAccount ? tokenBadgeY : program.programId,
@@ -17045,7 +17086,7 @@ var DLMM = class {
17045
17086
  funder: creatorKey,
17046
17087
  tokenProgramX: tokenXAccount.owner,
17047
17088
  tokenProgramY: tokenYAccount.owner
17048
- }).transaction();
17089
+ }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
17049
17090
  }
17050
17091
  /**
17051
17092
  * Create a new customizable permissionless pair. Support only token program.
@@ -17069,6 +17110,7 @@ var DLMM = class {
17069
17110
  tokenY,
17070
17111
  program.programId
17071
17112
  );
17113
+ const [tokenXAccount, tokenYAccount] = await connection.getMultipleAccountsInfo([tokenX, tokenY]);
17072
17114
  const [reserveX] = deriveReserve(tokenX, lbPair, program.programId);
17073
17115
  const [reserveY] = deriveReserve(tokenY, lbPair, program.programId);
17074
17116
  const [oracle] = deriveOracle(lbPair, program.programId);
@@ -17095,8 +17137,59 @@ var DLMM = class {
17095
17137
  creatorPoolOnOffControl: creatorPoolOnOffControl ? creatorPoolOnOffControl : false,
17096
17138
  padding: Array(63).fill(0)
17097
17139
  };
17098
- const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenX, creatorKey);
17099
- const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenY, creatorKey);
17140
+ const preInstructions = [];
17141
+ const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
17142
+ tokenX,
17143
+ creatorKey,
17144
+ true,
17145
+ tokenXAccount.owner
17146
+ );
17147
+ const createUserTokenXIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
17148
+ creatorKey,
17149
+ userTokenX,
17150
+ creatorKey,
17151
+ tokenX,
17152
+ tokenXAccount.owner
17153
+ );
17154
+ preInstructions.push(createUserTokenXIx);
17155
+ const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0,
17156
+ tokenY,
17157
+ creatorKey,
17158
+ true,
17159
+ tokenYAccount.owner
17160
+ );
17161
+ const createUserTokenYIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
17162
+ creatorKey,
17163
+ userTokenY,
17164
+ creatorKey,
17165
+ tokenY,
17166
+ tokenYAccount.owner
17167
+ );
17168
+ preInstructions.push(createUserTokenYIx);
17169
+ const postInstructions = [];
17170
+ if ((tokenX.equals(_spltoken.NATIVE_MINT) || tokenY.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([opt, 'optionalAccess', _70 => _70.skipSolWrappingOperation])) {
17171
+ const wrapAmount = BigInt(1);
17172
+ if (tokenX.equals(_spltoken.NATIVE_MINT)) {
17173
+ const wrapSOLIxX = wrapSOLInstruction(
17174
+ creatorKey,
17175
+ userTokenX,
17176
+ wrapAmount
17177
+ );
17178
+ preInstructions.push(...wrapSOLIxX);
17179
+ }
17180
+ if (tokenY.equals(_spltoken.NATIVE_MINT)) {
17181
+ const wrapSOLIxY = wrapSOLInstruction(
17182
+ creatorKey,
17183
+ userTokenY,
17184
+ wrapAmount
17185
+ );
17186
+ preInstructions.push(...wrapSOLIxY);
17187
+ }
17188
+ const unwrapSOLIx = await unwrapSOLInstruction(creatorKey);
17189
+ if (unwrapSOLIx) {
17190
+ postInstructions.push(unwrapSOLIx);
17191
+ }
17192
+ }
17100
17193
  return program.methods.initializeCustomizablePermissionlessLbPair(ixData).accountsPartial({
17101
17194
  lbPair,
17102
17195
  reserveX,
@@ -17109,7 +17202,7 @@ var DLMM = class {
17109
17202
  userTokenX,
17110
17203
  userTokenY,
17111
17204
  funder: creatorKey
17112
- }).transaction();
17205
+ }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
17113
17206
  }
17114
17207
  /**
17115
17208
  * Create a new liquidity pair. Support only token program.
@@ -17205,8 +17298,8 @@ var DLMM = class {
17205
17298
  new (0, _anchor.BN)(presetParameterState.baseFactor),
17206
17299
  new (0, _anchor.BN)(presetParameterState.baseFeePowerFactor),
17207
17300
  {
17208
- cluster: _optionalChain([opt, 'optionalAccess', _69 => _69.cluster]),
17209
- programId: _optionalChain([opt, 'optionalAccess', _70 => _70.programId])
17301
+ cluster: _optionalChain([opt, 'optionalAccess', _71 => _71.cluster]),
17302
+ programId: _optionalChain([opt, 'optionalAccess', _72 => _72.programId])
17210
17303
  }
17211
17304
  );
17212
17305
  if (existsPool) {
@@ -17434,7 +17527,7 @@ var DLMM = class {
17434
17527
  swapForY,
17435
17528
  new (0, _anchor.BN)(activeIdToLoop),
17436
17529
  this.lbPair,
17437
- _nullishCoalesce(_optionalChain([this, 'access', _71 => _71.binArrayBitmapExtension, 'optionalAccess', _72 => _72.account]), () => ( null))
17530
+ _nullishCoalesce(_optionalChain([this, 'access', _73 => _73.binArrayBitmapExtension, 'optionalAccess', _74 => _74.account]), () => ( null))
17438
17531
  );
17439
17532
  if (binArrayIndex === null)
17440
17533
  shouldStop = true;
@@ -17765,8 +17858,8 @@ var DLMM = class {
17765
17858
  position,
17766
17859
  this.tokenX.mint,
17767
17860
  this.tokenY.mint,
17768
- _optionalChain([this, 'access', _73 => _73.rewards, 'access', _74 => _74[0], 'optionalAccess', _75 => _75.mint]),
17769
- _optionalChain([this, 'access', _76 => _76.rewards, 'access', _77 => _77[1], 'optionalAccess', _78 => _78.mint]),
17861
+ _optionalChain([this, 'access', _75 => _75.rewards, 'access', _76 => _76[0], 'optionalAccess', _77 => _77.mint]),
17862
+ _optionalChain([this, 'access', _78 => _78.rewards, 'access', _79 => _79[1], 'optionalAccess', _80 => _80.mint]),
17770
17863
  positionBinArraysMapV2
17771
17864
  ),
17772
17865
  version: position.version()
@@ -17954,8 +18047,8 @@ var DLMM = class {
17954
18047
  position,
17955
18048
  this.tokenX.mint,
17956
18049
  this.tokenY.mint,
17957
- _optionalChain([this, 'access', _79 => _79.rewards, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.mint]),
17958
- _optionalChain([this, 'access', _82 => _82.rewards, 'access', _83 => _83[1], 'optionalAccess', _84 => _84.mint]),
18050
+ _optionalChain([this, 'access', _81 => _81.rewards, 'access', _82 => _82[0], 'optionalAccess', _83 => _83.mint]),
18051
+ _optionalChain([this, 'access', _84 => _84.rewards, 'access', _85 => _85[1], 'optionalAccess', _86 => _86.mint]),
17959
18052
  binArrayMap
17960
18053
  ),
17961
18054
  version: position.version()
@@ -17980,7 +18073,7 @@ var DLMM = class {
17980
18073
  );
17981
18074
  const { minBinId, maxBinId } = strategy;
17982
18075
  const binCount = getBinCount(minBinId, maxBinId);
17983
- const defaultAltAddressString = _nullishCoalesce(altAddress, () => ( ALT_ADDRESS[_optionalChain([this, 'access', _85 => _85.opt, 'optionalAccess', _86 => _86.cluster])]));
18076
+ const defaultAltAddressString = _nullishCoalesce(altAddress, () => ( ALT_ADDRESS[_optionalChain([this, 'access', _87 => _87.opt, 'optionalAccess', _88 => _88.cluster])]));
17984
18077
  if (defaultAltAddressString) {
17985
18078
  altAddress = new (0, _web3js.PublicKey)(defaultAltAddressString);
17986
18079
  }
@@ -18043,7 +18136,7 @@ var DLMM = class {
18043
18136
  owner,
18044
18137
  payer,
18045
18138
  true,
18046
- _optionalChain([this, 'access', _87 => _87.opt, 'optionalAccess', _88 => _88.skipSolWrappingOperation])
18139
+ _optionalChain([this, 'access', _89 => _89.opt, 'optionalAccess', _90 => _90.skipSolWrappingOperation])
18047
18140
  );
18048
18141
  for (const instructions of addLiquidityIxs) {
18049
18142
  const txIxs = [];
@@ -18165,7 +18258,7 @@ var DLMM = class {
18165
18258
  owner,
18166
18259
  payer,
18167
18260
  false,
18168
- _optionalChain([this, 'access', _89 => _89.opt, 'optionalAccess', _90 => _90.skipSolWrappingOperation])
18261
+ _optionalChain([this, 'access', _91 => _91.opt, 'optionalAccess', _92 => _92.skipSolWrappingOperation])
18169
18262
  );
18170
18263
  instructionsByPositions.push({
18171
18264
  positionKeypair: position,
@@ -18229,7 +18322,7 @@ var DLMM = class {
18229
18322
  user,
18230
18323
  user,
18231
18324
  true,
18232
- _optionalChain([this, 'access', _91 => _91.opt, 'optionalAccess', _92 => _92.skipSolWrappingOperation])
18325
+ _optionalChain([this, 'access', _93 => _93.opt, 'optionalAccess', _94 => _94.skipSolWrappingOperation])
18233
18326
  );
18234
18327
  const latestBlockhashInfo = await this.program.provider.connection.getLatestBlockhash();
18235
18328
  return chunkedAddLiquidityIx.map((ixs) => {
@@ -18304,7 +18397,7 @@ var DLMM = class {
18304
18397
  ]);
18305
18398
  createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
18306
18399
  createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
18307
- if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _93 => _93.opt, 'optionalAccess', _94 => _94.skipSolWrappingOperation])) {
18400
+ if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _95 => _95.opt, 'optionalAccess', _96 => _96.skipSolWrappingOperation])) {
18308
18401
  const wrapSOLIx = wrapSOLInstruction(
18309
18402
  user,
18310
18403
  userTokenX,
@@ -18312,7 +18405,7 @@ var DLMM = class {
18312
18405
  );
18313
18406
  preInstructions.push(...wrapSOLIx);
18314
18407
  }
18315
- if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _95 => _95.opt, 'optionalAccess', _96 => _96.skipSolWrappingOperation])) {
18408
+ if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _97 => _97.opt, 'optionalAccess', _98 => _98.skipSolWrappingOperation])) {
18316
18409
  const wrapSOLIx = wrapSOLInstruction(
18317
18410
  user,
18318
18411
  userTokenY,
@@ -18324,7 +18417,7 @@ var DLMM = class {
18324
18417
  if ([
18325
18418
  this.tokenX.publicKey.toBase58(),
18326
18419
  this.tokenY.publicKey.toBase58()
18327
- ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _97 => _97.opt, 'optionalAccess', _98 => _98.skipSolWrappingOperation])) {
18420
+ ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _99 => _99.opt, 'optionalAccess', _100 => _100.skipSolWrappingOperation])) {
18328
18421
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
18329
18422
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
18330
18423
  }
@@ -18458,7 +18551,7 @@ var DLMM = class {
18458
18551
  ]);
18459
18552
  createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
18460
18553
  createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
18461
- if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _99 => _99.opt, 'optionalAccess', _100 => _100.skipSolWrappingOperation])) {
18554
+ if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _101 => _101.opt, 'optionalAccess', _102 => _102.skipSolWrappingOperation])) {
18462
18555
  const wrapSOLIx = wrapSOLInstruction(
18463
18556
  user,
18464
18557
  userTokenX,
@@ -18466,7 +18559,7 @@ var DLMM = class {
18466
18559
  );
18467
18560
  preInstructions.push(...wrapSOLIx);
18468
18561
  }
18469
- if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _101 => _101.opt, 'optionalAccess', _102 => _102.skipSolWrappingOperation])) {
18562
+ if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _103 => _103.opt, 'optionalAccess', _104 => _104.skipSolWrappingOperation])) {
18470
18563
  const wrapSOLIx = wrapSOLInstruction(
18471
18564
  user,
18472
18565
  userTokenY,
@@ -18478,7 +18571,7 @@ var DLMM = class {
18478
18571
  if ([
18479
18572
  this.tokenX.publicKey.toBase58(),
18480
18573
  this.tokenY.publicKey.toBase58()
18481
- ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _103 => _103.opt, 'optionalAccess', _104 => _104.skipSolWrappingOperation])) {
18574
+ ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _105 => _105.opt, 'optionalAccess', _106 => _106.skipSolWrappingOperation])) {
18482
18575
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
18483
18576
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
18484
18577
  }
@@ -18662,7 +18755,7 @@ var DLMM = class {
18662
18755
  ]);
18663
18756
  createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
18664
18757
  createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
18665
- if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _105 => _105.opt, 'optionalAccess', _106 => _106.skipSolWrappingOperation])) {
18758
+ if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _107 => _107.opt, 'optionalAccess', _108 => _108.skipSolWrappingOperation])) {
18666
18759
  const wrapSOLIx = wrapSOLInstruction(
18667
18760
  user,
18668
18761
  userTokenX,
@@ -18670,7 +18763,7 @@ var DLMM = class {
18670
18763
  );
18671
18764
  preInstructions.push(...wrapSOLIx);
18672
18765
  }
18673
- if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _107 => _107.opt, 'optionalAccess', _108 => _108.skipSolWrappingOperation])) {
18766
+ if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _109 => _109.opt, 'optionalAccess', _110 => _110.skipSolWrappingOperation])) {
18674
18767
  const wrapSOLIx = wrapSOLInstruction(
18675
18768
  user,
18676
18769
  userTokenY,
@@ -18682,7 +18775,7 @@ var DLMM = class {
18682
18775
  if ([
18683
18776
  this.tokenX.publicKey.toBase58(),
18684
18777
  this.tokenY.publicKey.toBase58()
18685
- ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _109 => _109.opt, 'optionalAccess', _110 => _110.skipSolWrappingOperation])) {
18778
+ ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _111 => _111.opt, 'optionalAccess', _112 => _112.skipSolWrappingOperation])) {
18686
18779
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
18687
18780
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
18688
18781
  }
@@ -18830,7 +18923,7 @@ var DLMM = class {
18830
18923
  ]);
18831
18924
  createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
18832
18925
  createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
18833
- if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _111 => _111.opt, 'optionalAccess', _112 => _112.skipSolWrappingOperation])) {
18926
+ if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _113 => _113.opt, 'optionalAccess', _114 => _114.skipSolWrappingOperation])) {
18834
18927
  const wrapSOLIx = wrapSOLInstruction(
18835
18928
  user,
18836
18929
  userTokenX,
@@ -18838,7 +18931,7 @@ var DLMM = class {
18838
18931
  );
18839
18932
  preInstructions.push(...wrapSOLIx);
18840
18933
  }
18841
- if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _113 => _113.opt, 'optionalAccess', _114 => _114.skipSolWrappingOperation])) {
18934
+ if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _115 => _115.opt, 'optionalAccess', _116 => _116.skipSolWrappingOperation])) {
18842
18935
  const wrapSOLIx = wrapSOLInstruction(
18843
18936
  user,
18844
18937
  userTokenY,
@@ -18850,7 +18943,7 @@ var DLMM = class {
18850
18943
  if ([
18851
18944
  this.tokenX.publicKey.toBase58(),
18852
18945
  this.tokenY.publicKey.toBase58()
18853
- ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _115 => _115.opt, 'optionalAccess', _116 => _116.skipSolWrappingOperation])) {
18946
+ ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _117 => _117.opt, 'optionalAccess', _118 => _118.skipSolWrappingOperation])) {
18854
18947
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
18855
18948
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
18856
18949
  }
@@ -19127,7 +19220,7 @@ var DLMM = class {
19127
19220
  if ([
19128
19221
  this.tokenX.publicKey.toBase58(),
19129
19222
  this.tokenY.publicKey.toBase58()
19130
- ].includes(_spltoken.NATIVE_MINT.toBase58()) && (!skipUnwrapSOL || !_optionalChain([this, 'access', _117 => _117.opt, 'optionalAccess', _118 => _118.skipSolWrappingOperation]))) {
19223
+ ].includes(_spltoken.NATIVE_MINT.toBase58()) && (!skipUnwrapSOL || !_optionalChain([this, 'access', _119 => _119.opt, 'optionalAccess', _120 => _120.skipSolWrappingOperation]))) {
19131
19224
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19132
19225
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19133
19226
  }
@@ -19282,7 +19375,7 @@ var DLMM = class {
19282
19375
  swapForY,
19283
19376
  activeId,
19284
19377
  this.lbPair,
19285
- _nullishCoalesce(_optionalChain([this, 'access', _119 => _119.binArrayBitmapExtension, 'optionalAccess', _120 => _120.account]), () => ( null)),
19378
+ _nullishCoalesce(_optionalChain([this, 'access', _121 => _121.binArrayBitmapExtension, 'optionalAccess', _122 => _122.account]), () => ( null)),
19286
19379
  binArrays
19287
19380
  );
19288
19381
  if (binArrayAccountToSwap == null) {
@@ -19347,7 +19440,7 @@ var DLMM = class {
19347
19440
  swapForY,
19348
19441
  activeId,
19349
19442
  this.lbPair,
19350
- _nullishCoalesce(_optionalChain([this, 'access', _121 => _121.binArrayBitmapExtension, 'optionalAccess', _122 => _122.account]), () => ( null)),
19443
+ _nullishCoalesce(_optionalChain([this, 'access', _123 => _123.binArrayBitmapExtension, 'optionalAccess', _124 => _124.account]), () => ( null)),
19351
19444
  binArrays
19352
19445
  );
19353
19446
  if (binArrayAccountToSwap == null) {
@@ -19444,7 +19537,7 @@ var DLMM = class {
19444
19537
  swapForY,
19445
19538
  activeId,
19446
19539
  this.lbPair,
19447
- _nullishCoalesce(_optionalChain([this, 'access', _123 => _123.binArrayBitmapExtension, 'optionalAccess', _124 => _124.account]), () => ( null)),
19540
+ _nullishCoalesce(_optionalChain([this, 'access', _125 => _125.binArrayBitmapExtension, 'optionalAccess', _126 => _126.account]), () => ( null)),
19448
19541
  binArrays
19449
19542
  );
19450
19543
  if (binArrayAccountToSwap == null) {
@@ -19532,7 +19625,7 @@ var DLMM = class {
19532
19625
  swapForY,
19533
19626
  activeId,
19534
19627
  this.lbPair,
19535
- _nullishCoalesce(_optionalChain([this, 'access', _125 => _125.binArrayBitmapExtension, 'optionalAccess', _126 => _126.account]), () => ( null)),
19628
+ _nullishCoalesce(_optionalChain([this, 'access', _127 => _127.binArrayBitmapExtension, 'optionalAccess', _128 => _128.account]), () => ( null)),
19536
19629
  binArrays
19537
19630
  );
19538
19631
  if (binArrayAccountToSwap == null) {
@@ -19614,7 +19707,7 @@ var DLMM = class {
19614
19707
  ]);
19615
19708
  createInTokenAccountIx && preInstructions.push(createInTokenAccountIx);
19616
19709
  createOutTokenAccountIx && preInstructions.push(createOutTokenAccountIx);
19617
- if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _127 => _127.opt, 'optionalAccess', _128 => _128.skipSolWrappingOperation])) {
19710
+ if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _129 => _129.opt, 'optionalAccess', _130 => _130.skipSolWrappingOperation])) {
19618
19711
  const wrapSOLIx = wrapSOLInstruction(
19619
19712
  user,
19620
19713
  userTokenIn,
@@ -19624,7 +19717,7 @@ var DLMM = class {
19624
19717
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19625
19718
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19626
19719
  }
19627
- if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _129 => _129.opt, 'optionalAccess', _130 => _130.skipSolWrappingOperation])) {
19720
+ if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _131 => _131.opt, 'optionalAccess', _132 => _132.skipSolWrappingOperation])) {
19628
19721
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19629
19722
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19630
19723
  }
@@ -19707,7 +19800,7 @@ var DLMM = class {
19707
19800
  ]);
19708
19801
  createInTokenAccountIx && preInstructions.push(createInTokenAccountIx);
19709
19802
  createOutTokenAccountIx && preInstructions.push(createOutTokenAccountIx);
19710
- if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _131 => _131.opt, 'optionalAccess', _132 => _132.skipSolWrappingOperation])) {
19803
+ if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _133 => _133.opt, 'optionalAccess', _134 => _134.skipSolWrappingOperation])) {
19711
19804
  const wrapSOLIx = wrapSOLInstruction(
19712
19805
  user,
19713
19806
  userTokenIn,
@@ -19717,7 +19810,7 @@ var DLMM = class {
19717
19810
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19718
19811
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19719
19812
  }
19720
- if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _133 => _133.opt, 'optionalAccess', _134 => _134.skipSolWrappingOperation])) {
19813
+ if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _135 => _135.opt, 'optionalAccess', _136 => _136.skipSolWrappingOperation])) {
19721
19814
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19722
19815
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19723
19816
  }
@@ -19809,7 +19902,7 @@ var DLMM = class {
19809
19902
  ]);
19810
19903
  createInTokenAccountIx && preInstructions.push(createInTokenAccountIx);
19811
19904
  createOutTokenAccountIx && preInstructions.push(createOutTokenAccountIx);
19812
- if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _135 => _135.opt, 'optionalAccess', _136 => _136.skipSolWrappingOperation])) {
19905
+ if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _137 => _137.opt, 'optionalAccess', _138 => _138.skipSolWrappingOperation])) {
19813
19906
  const wrapSOLIx = wrapSOLInstruction(
19814
19907
  user,
19815
19908
  userTokenIn,
@@ -19819,7 +19912,7 @@ var DLMM = class {
19819
19912
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19820
19913
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19821
19914
  }
19822
- if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _137 => _137.opt, 'optionalAccess', _138 => _138.skipSolWrappingOperation])) {
19915
+ if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _139 => _139.opt, 'optionalAccess', _140 => _140.skipSolWrappingOperation])) {
19823
19916
  const closeWrappedSOLIx = await unwrapSOLInstruction(user);
19824
19917
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
19825
19918
  }
@@ -20878,7 +20971,7 @@ var DLMM = class {
20878
20971
  swapForY,
20879
20972
  new (0, _anchor.BN)(activeBinId),
20880
20973
  this.lbPair,
20881
- _nullishCoalesce(_optionalChain([this, 'access', _139 => _139.binArrayBitmapExtension, 'optionalAccess', _140 => _140.account]), () => ( null))
20974
+ _nullishCoalesce(_optionalChain([this, 'access', _141 => _141.binArrayBitmapExtension, 'optionalAccess', _142 => _142.account]), () => ( null))
20882
20975
  );
20883
20976
  if (toBinArrayIndex === null)
20884
20977
  return true;
@@ -20915,7 +21008,7 @@ var DLMM = class {
20915
21008
  swapForY,
20916
21009
  new (0, _anchor.BN)(activeBinId),
20917
21010
  this.lbPair,
20918
- _nullishCoalesce(_optionalChain([this, 'access', _141 => _141.binArrayBitmapExtension, 'optionalAccess', _142 => _142.account]), () => ( null))
21011
+ _nullishCoalesce(_optionalChain([this, 'access', _143 => _143.binArrayBitmapExtension, 'optionalAccess', _144 => _144.account]), () => ( null))
20919
21012
  );
20920
21013
  const marketPriceBinArrayIndex = binIdToBinArrayIndex(
20921
21014
  new (0, _anchor.BN)(marketPriceBinId)
@@ -20951,7 +21044,7 @@ var DLMM = class {
20951
21044
  let binArrayBitmapExtension = null;
20952
21045
  if (binArrayBitMapExtensionPubkey) {
20953
21046
  binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
20954
- if (!_optionalChain([binArrayAccounts, 'optionalAccess', _143 => _143[0]])) {
21047
+ if (!_optionalChain([binArrayAccounts, 'optionalAccess', _145 => _145[0]])) {
20955
21048
  const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
20956
21049
  binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
20957
21050
  funder: owner,
@@ -20960,10 +21053,10 @@ var DLMM = class {
20960
21053
  preInstructions.push(initializeBitmapExtensionIx);
20961
21054
  }
20962
21055
  }
20963
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _144 => _144[1]])) {
21056
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _146 => _146[1]])) {
20964
21057
  fromBinArray = fromBinArrayPubkey;
20965
21058
  }
20966
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _145 => _145[2]]) && !!toBinArrayIndex) {
21059
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _147 => _147[2]]) && !!toBinArrayIndex) {
20967
21060
  toBinArray = toBinArrayPubkey;
20968
21061
  }
20969
21062
  const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
@@ -21409,7 +21502,7 @@ var DLMM = class {
21409
21502
  slippage
21410
21503
  );
21411
21504
  const postInstructions = [];
21412
- if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountXDeposited.gtn(0) && !_optionalChain([this, 'access', _146 => _146.opt, 'optionalAccess', _147 => _147.skipSolWrappingOperation])) {
21505
+ if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountXDeposited.gtn(0) && !_optionalChain([this, 'access', _148 => _148.opt, 'optionalAccess', _149 => _149.skipSolWrappingOperation])) {
21413
21506
  const wrapSOLIx = wrapSOLInstruction(
21414
21507
  owner,
21415
21508
  userTokenX,
@@ -21417,7 +21510,7 @@ var DLMM = class {
21417
21510
  );
21418
21511
  preInstructions.push(...wrapSOLIx);
21419
21512
  }
21420
- if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountYDeposited.gtn(0) && !_optionalChain([this, 'access', _148 => _148.opt, 'optionalAccess', _149 => _149.skipSolWrappingOperation])) {
21513
+ if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountYDeposited.gtn(0) && !_optionalChain([this, 'access', _150 => _150.opt, 'optionalAccess', _151 => _151.skipSolWrappingOperation])) {
21421
21514
  const wrapSOLIx = wrapSOLInstruction(
21422
21515
  owner,
21423
21516
  userTokenY,
@@ -21425,7 +21518,7 @@ var DLMM = class {
21425
21518
  );
21426
21519
  preInstructions.push(...wrapSOLIx);
21427
21520
  }
21428
- if ((this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) || this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([this, 'access', _150 => _150.opt, 'optionalAccess', _151 => _151.skipSolWrappingOperation])) {
21521
+ if ((this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) || this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([this, 'access', _152 => _152.opt, 'optionalAccess', _153 => _153.skipSolWrappingOperation])) {
21429
21522
  const closeWrappedSOLIx = await unwrapSOLInstruction(owner);
21430
21523
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
21431
21524
  }
@@ -21871,7 +21964,7 @@ var DLMM = class {
21871
21964
  );
21872
21965
  })
21873
21966
  );
21874
- const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _152 => _152.find, 'call', _153 => _153((binArray) => binArray != null), 'optionalAccess', _154 => _154.version]), () => ( 1));
21967
+ const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _154 => _154.find, 'call', _155 => _155((binArray) => binArray != null), 'optionalAccess', _156 => _156.version]), () => ( 1));
21875
21968
  return Array.from(
21876
21969
  enumerateBins(
21877
21970
  binsById,
@@ -22066,7 +22159,7 @@ var DLMM = class {
22066
22159
  if ([
22067
22160
  this.tokenX.publicKey.toBase58(),
22068
22161
  this.tokenY.publicKey.toBase58()
22069
- ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _155 => _155.opt, 'optionalAccess', _156 => _156.skipSolWrappingOperation])) {
22162
+ ].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _157 => _157.opt, 'optionalAccess', _158 => _158.skipSolWrappingOperation])) {
22070
22163
  const closeWrappedSOLIx = await unwrapSOLInstruction(owner);
22071
22164
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
22072
22165
  }