@meteora-ag/dlmm 1.6.0-rc.23 → 1.6.0-rc.25

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
@@ -13567,7 +13567,7 @@ function createProgram(connection, opt) {
13567
13567
  _anchor.AnchorProvider.defaultOptions()
13568
13568
  );
13569
13569
  return new (0, _anchor.Program)(
13570
- { ...dlmm_default, address: LBCLMM_PROGRAM_IDS[cluster] },
13570
+ { ...dlmm_default, address: _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _44 => _44.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])) },
13571
13571
  provider
13572
13572
  );
13573
13573
  }
@@ -13575,9 +13575,9 @@ function decodeAccount(program, accountName, buffer) {
13575
13575
  return program.coder.accounts.decode(accountName, buffer);
13576
13576
  }
13577
13577
  function getAccountDiscriminator(accountName) {
13578
- return _optionalChain([dlmm_default, 'access', _44 => _44.accounts, 'access', _45 => _45.find, 'call', _46 => _46(
13578
+ return _optionalChain([dlmm_default, 'access', _45 => _45.accounts, 'access', _46 => _46.find, 'call', _47 => _47(
13579
13579
  (acc) => acc.name.toLowerCase() === accountName.toLowerCase()
13580
- ), 'optionalAccess', _47 => _47.discriminator]);
13580
+ ), 'optionalAccess', _48 => _48.discriminator]);
13581
13581
  }
13582
13582
  function capSlippagePercentage(slippage) {
13583
13583
  if (slippage > 100) {
@@ -14124,7 +14124,7 @@ var DLMM = class {
14124
14124
  connection,
14125
14125
  accountsToFetch
14126
14126
  );
14127
- const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _48 => _48[0], 'optionalAccess', _49 => _49.data]);
14127
+ const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _49 => _49[0], 'optionalAccess', _50 => _50.data]);
14128
14128
  if (!lbPairAccountInfoBuffer)
14129
14129
  throw new Error(`LB Pair account ${dlmm.toBase58()} not found`);
14130
14130
  const lbPairAccInfo = decodeAccount(
@@ -14132,7 +14132,7 @@ var DLMM = class {
14132
14132
  "lbPair",
14133
14133
  lbPairAccountInfoBuffer
14134
14134
  );
14135
- const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _50 => _50[1], 'optionalAccess', _51 => _51.data]);
14135
+ const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _51 => _51[1], 'optionalAccess', _52 => _52.data]);
14136
14136
  let binArrayBitMapExtensionAccInfo = null;
14137
14137
  if (binArrayBitMapAccountInfoBuffer) {
14138
14138
  binArrayBitMapExtensionAccInfo = decodeAccount(
@@ -14141,7 +14141,7 @@ var DLMM = class {
14141
14141
  binArrayBitMapAccountInfoBuffer
14142
14142
  );
14143
14143
  }
14144
- const clockAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _52 => _52[2], 'optionalAccess', _53 => _53.data]);
14144
+ const clockAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _53 => _53[2], 'optionalAccess', _54 => _54.data]);
14145
14145
  if (!clockAccountInfoBuffer)
14146
14146
  throw new Error(`Clock account not found`);
14147
14147
  const clock = ClockLayout.decode(clockAccountInfoBuffer);
@@ -14294,14 +14294,14 @@ var DLMM = class {
14294
14294
  accountsToFetch
14295
14295
  );
14296
14296
  const clockAccount = accountsInfo.pop();
14297
- const clockAccountInfoBuffer = _optionalChain([clockAccount, 'optionalAccess', _54 => _54.data]);
14297
+ const clockAccountInfoBuffer = _optionalChain([clockAccount, 'optionalAccess', _55 => _55.data]);
14298
14298
  if (!clockAccountInfoBuffer)
14299
14299
  throw new Error(`Clock account not found`);
14300
14300
  const clock = ClockLayout.decode(clockAccountInfoBuffer);
14301
14301
  const lbPairArraysMap = /* @__PURE__ */ new Map();
14302
14302
  for (let i = 0; i < dlmmList.length; i++) {
14303
14303
  const lbPairPubKey = dlmmList[i];
14304
- const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _55 => _55[i], 'optionalAccess', _56 => _56.data]);
14304
+ const lbPairAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _56 => _56[i], 'optionalAccess', _57 => _57.data]);
14305
14305
  if (!lbPairAccountInfoBuffer)
14306
14306
  throw new Error(`LB Pair account ${lbPairPubKey.toBase58()} not found`);
14307
14307
  const lbPairAccInfo = decodeAccount(
@@ -14315,7 +14315,7 @@ var DLMM = class {
14315
14315
  for (let i = dlmmList.length; i < accountsInfo.length; i++) {
14316
14316
  const index = i - dlmmList.length;
14317
14317
  const lbPairPubkey = dlmmList[index];
14318
- const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _57 => _57[i], 'optionalAccess', _58 => _58.data]);
14318
+ const binArrayBitMapAccountInfoBuffer = _optionalChain([accountsInfo, 'access', _58 => _58[i], 'optionalAccess', _59 => _59.data]);
14319
14319
  if (binArrayBitMapAccountInfoBuffer) {
14320
14320
  const binArrayBitMapExtensionAccInfo = decodeAccount(
14321
14321
  program,
@@ -14645,8 +14645,8 @@ var DLMM = class {
14645
14645
  const { mintX, mintY, rewardMint0, rewardMint1 } = lbPairMintMap.get(
14646
14646
  lbPair.toBase58()
14647
14647
  );
14648
- const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _59 => _59.get, 'call', _60 => _60(lbPair.toBase58()), 'optionalAccess', _61 => _61.reserveX]), () => ( BigInt(0)));
14649
- const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _62 => _62.get, 'call', _63 => _63(lbPair.toBase58()), 'optionalAccess', _64 => _64.reserveY]), () => ( BigInt(0)));
14648
+ const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _60 => _60.get, 'call', _61 => _61(lbPair.toBase58()), 'optionalAccess', _62 => _62.reserveX]), () => ( BigInt(0)));
14649
+ const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _63 => _63.get, 'call', _64 => _64(lbPair.toBase58()), 'optionalAccess', _65 => _65.reserveY]), () => ( BigInt(0)));
14650
14650
  const { tokenXProgram, tokenYProgram } = getTokenProgramId(lbPairAcc);
14651
14651
  const tokenX = {
14652
14652
  publicKey: lbPairAcc.tokenXMint,
@@ -14684,7 +14684,7 @@ var DLMM = class {
14684
14684
  tokenX,
14685
14685
  tokenY,
14686
14686
  lbPairPositionsData: [
14687
- ..._nullishCoalesce(_optionalChain([positionsMap, 'access', _65 => _65.get, 'call', _66 => _66(lbPair.toBase58()), 'optionalAccess', _67 => _67.lbPairPositionsData]), () => ( [])),
14687
+ ..._nullishCoalesce(_optionalChain([positionsMap, 'access', _66 => _66.get, 'call', _67 => _67(lbPair.toBase58()), 'optionalAccess', _68 => _68.lbPairPositionsData]), () => ( [])),
14688
14688
  {
14689
14689
  publicKey: positionPubkey,
14690
14690
  positionData,
@@ -15263,7 +15263,7 @@ var DLMM = class {
15263
15263
  swapForY,
15264
15264
  new (0, _anchor.BN)(activeIdToLoop),
15265
15265
  this.lbPair,
15266
- _nullishCoalesce(_optionalChain([this, 'access', _68 => _68.binArrayBitmapExtension, 'optionalAccess', _69 => _69.account]), () => ( null))
15266
+ _nullishCoalesce(_optionalChain([this, 'access', _69 => _69.binArrayBitmapExtension, 'optionalAccess', _70 => _70.account]), () => ( null))
15267
15267
  );
15268
15268
  if (binArrayIndex === null)
15269
15269
  shouldStop = true;
@@ -15283,10 +15283,10 @@ var DLMM = class {
15283
15283
  const accountsToFetch = Array.from(binArraysPubkey).map(
15284
15284
  (pubkey) => new (0, _web3js.PublicKey)(pubkey)
15285
15285
  );
15286
- const binArraysAccInfoBuffer = (await chunkedGetMultipleAccountInfos(
15286
+ const binArraysAccInfoBuffer = await chunkedGetMultipleAccountInfos(
15287
15287
  this.program.provider.connection,
15288
15288
  accountsToFetch
15289
- )).filter(Boolean);
15289
+ );
15290
15290
  const binArrays = await Promise.all(
15291
15291
  binArraysAccInfoBuffer.map(async (accInfo, idx) => {
15292
15292
  const account = decodeAccount(
@@ -15594,8 +15594,8 @@ var DLMM = class {
15594
15594
  position,
15595
15595
  this.tokenX.mint,
15596
15596
  this.tokenY.mint,
15597
- _optionalChain([this, 'access', _70 => _70.rewards, 'access', _71 => _71[0], 'optionalAccess', _72 => _72.mint]),
15598
- _optionalChain([this, 'access', _73 => _73.rewards, 'access', _74 => _74[1], 'optionalAccess', _75 => _75.mint]),
15597
+ _optionalChain([this, 'access', _71 => _71.rewards, 'access', _72 => _72[0], 'optionalAccess', _73 => _73.mint]),
15598
+ _optionalChain([this, 'access', _74 => _74.rewards, 'access', _75 => _75[1], 'optionalAccess', _76 => _76.mint]),
15599
15599
  positionBinArraysMapV2
15600
15600
  ),
15601
15601
  version: position.version()
@@ -15748,8 +15748,8 @@ var DLMM = class {
15748
15748
  position,
15749
15749
  this.tokenX.mint,
15750
15750
  this.tokenY.mint,
15751
- _optionalChain([this, 'access', _76 => _76.rewards, 'access', _77 => _77[0], 'optionalAccess', _78 => _78.mint]),
15752
- _optionalChain([this, 'access', _79 => _79.rewards, 'access', _80 => _80[1], 'optionalAccess', _81 => _81.mint]),
15751
+ _optionalChain([this, 'access', _77 => _77.rewards, 'access', _78 => _78[0], 'optionalAccess', _79 => _79.mint]),
15752
+ _optionalChain([this, 'access', _80 => _80.rewards, 'access', _81 => _81[1], 'optionalAccess', _82 => _82.mint]),
15753
15753
  binArrayMap
15754
15754
  ),
15755
15755
  version: position.version()
@@ -16923,7 +16923,7 @@ var DLMM = class {
16923
16923
  swapForY,
16924
16924
  activeId,
16925
16925
  this.lbPair,
16926
- _nullishCoalesce(_optionalChain([this, 'access', _82 => _82.binArrayBitmapExtension, 'optionalAccess', _83 => _83.account]), () => ( null)),
16926
+ _nullishCoalesce(_optionalChain([this, 'access', _83 => _83.binArrayBitmapExtension, 'optionalAccess', _84 => _84.account]), () => ( null)),
16927
16927
  binArrays
16928
16928
  );
16929
16929
  if (binArrayAccountToSwap == null) {
@@ -16988,7 +16988,7 @@ var DLMM = class {
16988
16988
  swapForY,
16989
16989
  activeId,
16990
16990
  this.lbPair,
16991
- _nullishCoalesce(_optionalChain([this, 'access', _84 => _84.binArrayBitmapExtension, 'optionalAccess', _85 => _85.account]), () => ( null)),
16991
+ _nullishCoalesce(_optionalChain([this, 'access', _85 => _85.binArrayBitmapExtension, 'optionalAccess', _86 => _86.account]), () => ( null)),
16992
16992
  binArrays
16993
16993
  );
16994
16994
  if (binArrayAccountToSwap == null) {
@@ -17085,7 +17085,7 @@ var DLMM = class {
17085
17085
  swapForY,
17086
17086
  activeId,
17087
17087
  this.lbPair,
17088
- _nullishCoalesce(_optionalChain([this, 'access', _86 => _86.binArrayBitmapExtension, 'optionalAccess', _87 => _87.account]), () => ( null)),
17088
+ _nullishCoalesce(_optionalChain([this, 'access', _87 => _87.binArrayBitmapExtension, 'optionalAccess', _88 => _88.account]), () => ( null)),
17089
17089
  binArrays
17090
17090
  );
17091
17091
  if (binArrayAccountToSwap == null) {
@@ -17173,7 +17173,7 @@ var DLMM = class {
17173
17173
  swapForY,
17174
17174
  activeId,
17175
17175
  this.lbPair,
17176
- _nullishCoalesce(_optionalChain([this, 'access', _88 => _88.binArrayBitmapExtension, 'optionalAccess', _89 => _89.account]), () => ( null)),
17176
+ _nullishCoalesce(_optionalChain([this, 'access', _89 => _89.binArrayBitmapExtension, 'optionalAccess', _90 => _90.account]), () => ( null)),
17177
17177
  binArrays
17178
17178
  );
17179
17179
  if (binArrayAccountToSwap == null) {
@@ -18519,7 +18519,7 @@ var DLMM = class {
18519
18519
  swapForY,
18520
18520
  new (0, _anchor.BN)(activeBinId),
18521
18521
  this.lbPair,
18522
- _nullishCoalesce(_optionalChain([this, 'access', _90 => _90.binArrayBitmapExtension, 'optionalAccess', _91 => _91.account]), () => ( null))
18522
+ _nullishCoalesce(_optionalChain([this, 'access', _91 => _91.binArrayBitmapExtension, 'optionalAccess', _92 => _92.account]), () => ( null))
18523
18523
  );
18524
18524
  if (toBinArrayIndex === null)
18525
18525
  return true;
@@ -18556,7 +18556,7 @@ var DLMM = class {
18556
18556
  swapForY,
18557
18557
  new (0, _anchor.BN)(activeBinId),
18558
18558
  this.lbPair,
18559
- _nullishCoalesce(_optionalChain([this, 'access', _92 => _92.binArrayBitmapExtension, 'optionalAccess', _93 => _93.account]), () => ( null))
18559
+ _nullishCoalesce(_optionalChain([this, 'access', _93 => _93.binArrayBitmapExtension, 'optionalAccess', _94 => _94.account]), () => ( null))
18560
18560
  );
18561
18561
  const marketPriceBinArrayIndex = binIdToBinArrayIndex(
18562
18562
  new (0, _anchor.BN)(marketPriceBinId)
@@ -18592,7 +18592,7 @@ var DLMM = class {
18592
18592
  let binArrayBitmapExtension = null;
18593
18593
  if (binArrayBitMapExtensionPubkey) {
18594
18594
  binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
18595
- if (!_optionalChain([binArrayAccounts, 'optionalAccess', _94 => _94[0]])) {
18595
+ if (!_optionalChain([binArrayAccounts, 'optionalAccess', _95 => _95[0]])) {
18596
18596
  const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
18597
18597
  binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
18598
18598
  funder: owner,
@@ -18601,10 +18601,10 @@ var DLMM = class {
18601
18601
  preInstructions.push(initializeBitmapExtensionIx);
18602
18602
  }
18603
18603
  }
18604
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _95 => _95[1]])) {
18604
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _96 => _96[1]])) {
18605
18605
  fromBinArray = fromBinArrayPubkey;
18606
18606
  }
18607
- if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _96 => _96[2]]) && !!toBinArrayIndex) {
18607
+ if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _97 => _97[2]]) && !!toBinArrayIndex) {
18608
18608
  toBinArray = toBinArrayPubkey;
18609
18609
  }
18610
18610
  const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
@@ -19510,7 +19510,7 @@ var DLMM = class {
19510
19510
  );
19511
19511
  })
19512
19512
  );
19513
- const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _97 => _97.find, 'call', _98 => _98((binArray) => binArray != null), 'optionalAccess', _99 => _99.version]), () => ( 1));
19513
+ const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _98 => _98.find, 'call', _99 => _99((binArray) => binArray != null), 'optionalAccess', _100 => _100.version]), () => ( 1));
19514
19514
  return Array.from(
19515
19515
  enumerateBins(
19516
19516
  binsById,