@meteora-ag/dlmm 1.6.0-rc.24 → 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 +29 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
14649
|
-
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
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',
|
|
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,
|
|
@@ -15258,13 +15258,12 @@ var DLMM = class {
|
|
|
15258
15258
|
const binArraysPubkey = /* @__PURE__ */ new Set();
|
|
15259
15259
|
let shouldStop = false;
|
|
15260
15260
|
let activeIdToLoop = this.lbPair.activeId;
|
|
15261
|
-
console.log(this.program.programId.toBase58());
|
|
15262
15261
|
while (!shouldStop) {
|
|
15263
15262
|
const binArrayIndex = findNextBinArrayIndexWithLiquidity(
|
|
15264
15263
|
swapForY,
|
|
15265
15264
|
new (0, _anchor.BN)(activeIdToLoop),
|
|
15266
15265
|
this.lbPair,
|
|
15267
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
15266
|
+
_nullishCoalesce(_optionalChain([this, 'access', _69 => _69.binArrayBitmapExtension, 'optionalAccess', _70 => _70.account]), () => ( null))
|
|
15268
15267
|
);
|
|
15269
15268
|
if (binArrayIndex === null)
|
|
15270
15269
|
shouldStop = true;
|
|
@@ -15284,10 +15283,10 @@ var DLMM = class {
|
|
|
15284
15283
|
const accountsToFetch = Array.from(binArraysPubkey).map(
|
|
15285
15284
|
(pubkey) => new (0, _web3js.PublicKey)(pubkey)
|
|
15286
15285
|
);
|
|
15287
|
-
const binArraysAccInfoBuffer =
|
|
15286
|
+
const binArraysAccInfoBuffer = await chunkedGetMultipleAccountInfos(
|
|
15288
15287
|
this.program.provider.connection,
|
|
15289
15288
|
accountsToFetch
|
|
15290
|
-
)
|
|
15289
|
+
);
|
|
15291
15290
|
const binArrays = await Promise.all(
|
|
15292
15291
|
binArraysAccInfoBuffer.map(async (accInfo, idx) => {
|
|
15293
15292
|
const account = decodeAccount(
|
|
@@ -15595,8 +15594,8 @@ var DLMM = class {
|
|
|
15595
15594
|
position,
|
|
15596
15595
|
this.tokenX.mint,
|
|
15597
15596
|
this.tokenY.mint,
|
|
15598
|
-
_optionalChain([this, 'access',
|
|
15599
|
-
_optionalChain([this, 'access',
|
|
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]),
|
|
15600
15599
|
positionBinArraysMapV2
|
|
15601
15600
|
),
|
|
15602
15601
|
version: position.version()
|
|
@@ -15749,8 +15748,8 @@ var DLMM = class {
|
|
|
15749
15748
|
position,
|
|
15750
15749
|
this.tokenX.mint,
|
|
15751
15750
|
this.tokenY.mint,
|
|
15752
|
-
_optionalChain([this, 'access',
|
|
15753
|
-
_optionalChain([this, 'access',
|
|
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]),
|
|
15754
15753
|
binArrayMap
|
|
15755
15754
|
),
|
|
15756
15755
|
version: position.version()
|
|
@@ -16924,7 +16923,7 @@ var DLMM = class {
|
|
|
16924
16923
|
swapForY,
|
|
16925
16924
|
activeId,
|
|
16926
16925
|
this.lbPair,
|
|
16927
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
16926
|
+
_nullishCoalesce(_optionalChain([this, 'access', _83 => _83.binArrayBitmapExtension, 'optionalAccess', _84 => _84.account]), () => ( null)),
|
|
16928
16927
|
binArrays
|
|
16929
16928
|
);
|
|
16930
16929
|
if (binArrayAccountToSwap == null) {
|
|
@@ -16989,7 +16988,7 @@ var DLMM = class {
|
|
|
16989
16988
|
swapForY,
|
|
16990
16989
|
activeId,
|
|
16991
16990
|
this.lbPair,
|
|
16992
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
16991
|
+
_nullishCoalesce(_optionalChain([this, 'access', _85 => _85.binArrayBitmapExtension, 'optionalAccess', _86 => _86.account]), () => ( null)),
|
|
16993
16992
|
binArrays
|
|
16994
16993
|
);
|
|
16995
16994
|
if (binArrayAccountToSwap == null) {
|
|
@@ -17086,7 +17085,7 @@ var DLMM = class {
|
|
|
17086
17085
|
swapForY,
|
|
17087
17086
|
activeId,
|
|
17088
17087
|
this.lbPair,
|
|
17089
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
17088
|
+
_nullishCoalesce(_optionalChain([this, 'access', _87 => _87.binArrayBitmapExtension, 'optionalAccess', _88 => _88.account]), () => ( null)),
|
|
17090
17089
|
binArrays
|
|
17091
17090
|
);
|
|
17092
17091
|
if (binArrayAccountToSwap == null) {
|
|
@@ -17174,7 +17173,7 @@ var DLMM = class {
|
|
|
17174
17173
|
swapForY,
|
|
17175
17174
|
activeId,
|
|
17176
17175
|
this.lbPair,
|
|
17177
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
17176
|
+
_nullishCoalesce(_optionalChain([this, 'access', _89 => _89.binArrayBitmapExtension, 'optionalAccess', _90 => _90.account]), () => ( null)),
|
|
17178
17177
|
binArrays
|
|
17179
17178
|
);
|
|
17180
17179
|
if (binArrayAccountToSwap == null) {
|
|
@@ -18520,7 +18519,7 @@ var DLMM = class {
|
|
|
18520
18519
|
swapForY,
|
|
18521
18520
|
new (0, _anchor.BN)(activeBinId),
|
|
18522
18521
|
this.lbPair,
|
|
18523
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
18522
|
+
_nullishCoalesce(_optionalChain([this, 'access', _91 => _91.binArrayBitmapExtension, 'optionalAccess', _92 => _92.account]), () => ( null))
|
|
18524
18523
|
);
|
|
18525
18524
|
if (toBinArrayIndex === null)
|
|
18526
18525
|
return true;
|
|
@@ -18557,7 +18556,7 @@ var DLMM = class {
|
|
|
18557
18556
|
swapForY,
|
|
18558
18557
|
new (0, _anchor.BN)(activeBinId),
|
|
18559
18558
|
this.lbPair,
|
|
18560
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
18559
|
+
_nullishCoalesce(_optionalChain([this, 'access', _93 => _93.binArrayBitmapExtension, 'optionalAccess', _94 => _94.account]), () => ( null))
|
|
18561
18560
|
);
|
|
18562
18561
|
const marketPriceBinArrayIndex = binIdToBinArrayIndex(
|
|
18563
18562
|
new (0, _anchor.BN)(marketPriceBinId)
|
|
@@ -18593,7 +18592,7 @@ var DLMM = class {
|
|
|
18593
18592
|
let binArrayBitmapExtension = null;
|
|
18594
18593
|
if (binArrayBitMapExtensionPubkey) {
|
|
18595
18594
|
binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
|
|
18596
|
-
if (!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
18595
|
+
if (!_optionalChain([binArrayAccounts, 'optionalAccess', _95 => _95[0]])) {
|
|
18597
18596
|
const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
18598
18597
|
binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
|
|
18599
18598
|
funder: owner,
|
|
@@ -18602,10 +18601,10 @@ var DLMM = class {
|
|
|
18602
18601
|
preInstructions.push(initializeBitmapExtensionIx);
|
|
18603
18602
|
}
|
|
18604
18603
|
}
|
|
18605
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
18604
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _96 => _96[1]])) {
|
|
18606
18605
|
fromBinArray = fromBinArrayPubkey;
|
|
18607
18606
|
}
|
|
18608
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
18607
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _97 => _97[2]]) && !!toBinArrayIndex) {
|
|
18609
18608
|
toBinArray = toBinArrayPubkey;
|
|
18610
18609
|
}
|
|
18611
18610
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -19511,7 +19510,7 @@ var DLMM = class {
|
|
|
19511
19510
|
);
|
|
19512
19511
|
})
|
|
19513
19512
|
);
|
|
19514
|
-
const version = _nullishCoalesce(_optionalChain([binArrays, 'access',
|
|
19513
|
+
const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _98 => _98.find, 'call', _99 => _99((binArray) => binArray != null), 'optionalAccess', _100 => _100.version]), () => ( 1));
|
|
19515
19514
|
return Array.from(
|
|
19516
19515
|
enumerateBins(
|
|
19517
19516
|
binsById,
|