@meteora-ag/dlmm 1.4.6 → 1.4.7-rc.1
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 +26 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14265,10 +14265,10 @@ var DLMM = class {
|
|
|
14265
14265
|
} else {
|
|
14266
14266
|
const createPositionOwnerTokenXIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
14267
14267
|
payer,
|
|
14268
|
+
positionOwnerTokenX,
|
|
14268
14269
|
positionOwner,
|
|
14269
14270
|
this.lbPair.tokenXMint,
|
|
14270
|
-
this.tokenX.owner
|
|
14271
|
-
positionOwnerTokenX
|
|
14271
|
+
this.tokenX.owner
|
|
14272
14272
|
);
|
|
14273
14273
|
preInstructions.push(createPositionOwnerTokenXIx);
|
|
14274
14274
|
const transferIx = _spltoken.createTransferCheckedInstruction.call(void 0,
|
|
@@ -14571,12 +14571,17 @@ var DLMM = class {
|
|
|
14571
14571
|
this.lbPair,
|
|
14572
14572
|
_nullishCoalesce(_optionalChain([this, 'access', _94 => _94.binArrayBitmapExtension, 'optionalAccess', _95 => _95.account]), () => ( null))
|
|
14573
14573
|
);
|
|
14574
|
-
const
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
this.
|
|
14574
|
+
const marketPriceBinArrayIndex = findNextBinArrayIndexWithLiquidity(
|
|
14575
|
+
swapForY,
|
|
14576
|
+
new (0, _anchor.BN)(marketPriceBinId),
|
|
14577
|
+
this.lbPair,
|
|
14578
|
+
_nullishCoalesce(_optionalChain([this, 'access', _96 => _96.binArrayBitmapExtension, 'optionalAccess', _97 => _97.account]), () => ( null))
|
|
14578
14579
|
);
|
|
14579
|
-
accountsToFetch
|
|
14580
|
+
const accountsToFetch = [];
|
|
14581
|
+
const binArrayBitMapExtensionPubkey = isOverflowDefaultBinArrayBitmap(
|
|
14582
|
+
new (0, _anchor.BN)(marketPriceBinArrayIndex)
|
|
14583
|
+
) ? deriveBinArrayBitmapExtension(this.pubkey, this.program.programId)[0] : null;
|
|
14584
|
+
binArrayBitMapExtensionPubkey && accountsToFetch.push(binArrayBitMapExtensionPubkey);
|
|
14580
14585
|
const [fromBinArrayPubkey] = deriveBinArray(
|
|
14581
14586
|
this.pubkey,
|
|
14582
14587
|
fromBinArrayIndex,
|
|
@@ -14597,16 +14602,25 @@ var DLMM = class {
|
|
|
14597
14602
|
const binArrayAccounts = await this.program.provider.connection.getMultipleAccountsInfo(
|
|
14598
14603
|
accountsToFetch
|
|
14599
14604
|
);
|
|
14605
|
+
const preInstructions = [];
|
|
14600
14606
|
let fromBinArray = null;
|
|
14601
14607
|
let toBinArray = null;
|
|
14602
14608
|
let binArrayBitmapExtension = null;
|
|
14603
|
-
if (
|
|
14609
|
+
if (binArrayBitMapExtensionPubkey) {
|
|
14604
14610
|
binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
|
|
14611
|
+
if (!_optionalChain([binArrayAccounts, 'optionalAccess', _98 => _98[0]])) {
|
|
14612
|
+
const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accounts({
|
|
14613
|
+
binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
|
|
14614
|
+
funder: owner,
|
|
14615
|
+
lbPair: this.pubkey
|
|
14616
|
+
}).instruction();
|
|
14617
|
+
preInstructions.push(initializeBitmapExtensionIx);
|
|
14618
|
+
}
|
|
14605
14619
|
}
|
|
14606
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
14620
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _99 => _99[1]])) {
|
|
14607
14621
|
fromBinArray = fromBinArrayPubkey;
|
|
14608
14622
|
}
|
|
14609
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
14623
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _100 => _100[2]]) && !!toBinArrayIndex) {
|
|
14610
14624
|
toBinArray = toBinArrayPubkey;
|
|
14611
14625
|
}
|
|
14612
14626
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -14615,7 +14629,7 @@ var DLMM = class {
|
|
|
14615
14629
|
binArrayBitmapExtension,
|
|
14616
14630
|
fromBinArray,
|
|
14617
14631
|
toBinArray
|
|
14618
|
-
}).transaction();
|
|
14632
|
+
}).preInstructions(preInstructions).transaction();
|
|
14619
14633
|
return new (0, _web3js.Transaction)({
|
|
14620
14634
|
feePayer: owner,
|
|
14621
14635
|
blockhash,
|
|
@@ -14946,7 +14960,7 @@ var DLMM = class {
|
|
|
14946
14960
|
);
|
|
14947
14961
|
})
|
|
14948
14962
|
);
|
|
14949
|
-
const version = _nullishCoalesce(_optionalChain([binArrays, 'access',
|
|
14963
|
+
const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _101 => _101.find, 'call', _102 => _102((binArray) => binArray != null), 'optionalAccess', _103 => _103.version]), () => ( 1));
|
|
14950
14964
|
return Array.from(
|
|
14951
14965
|
enumerateBins(
|
|
14952
14966
|
binsById,
|