@meteora-ag/dlmm 1.0.32 → 1.0.33
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 +22 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8524,7 +8524,7 @@ var DLMM = class {
|
|
|
8524
8524
|
bps,
|
|
8525
8525
|
shouldClaimAndClose = false
|
|
8526
8526
|
}) {
|
|
8527
|
-
const { lbPair, lowerBinId, feeOwner } = await this.program.account.positionV2.fetch(position);
|
|
8527
|
+
const { lbPair, lowerBinId, owner, feeOwner } = await this.program.account.positionV2.fetch(position);
|
|
8528
8528
|
const { reserveX, reserveY, tokenXMint, tokenYMint } = await this.program.account.lbPair.fetch(lbPair);
|
|
8529
8529
|
const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(lowerBinId));
|
|
8530
8530
|
const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _anchor.BN)(1));
|
|
@@ -8544,8 +8544,22 @@ var DLMM = class {
|
|
|
8544
8544
|
const walletToReceiveFee = feeOwner.equals(_web3js.PublicKey.default) ? user : feeOwner;
|
|
8545
8545
|
const [
|
|
8546
8546
|
{ ataPubKey: userTokenX, ix: createPayerTokenXIx },
|
|
8547
|
-
{ ataPubKey: userTokenY, ix: createPayerTokenYIx }
|
|
8547
|
+
{ ataPubKey: userTokenY, ix: createPayerTokenYIx },
|
|
8548
|
+
{ ataPubKey: feeOwnerTokenX, ix: createFeeOwnerTokenXIx },
|
|
8549
|
+
{ ataPubKey: feeOwnerTokenY, ix: createFeeOwnerTokenYIx }
|
|
8548
8550
|
] = await Promise.all([
|
|
8551
|
+
getOrCreateATAInstruction(
|
|
8552
|
+
this.program.provider.connection,
|
|
8553
|
+
this.tokenX.publicKey,
|
|
8554
|
+
owner,
|
|
8555
|
+
user
|
|
8556
|
+
),
|
|
8557
|
+
getOrCreateATAInstruction(
|
|
8558
|
+
this.program.provider.connection,
|
|
8559
|
+
this.tokenY.publicKey,
|
|
8560
|
+
owner,
|
|
8561
|
+
user
|
|
8562
|
+
),
|
|
8549
8563
|
getOrCreateATAInstruction(
|
|
8550
8564
|
this.program.provider.connection,
|
|
8551
8565
|
this.tokenX.publicKey,
|
|
@@ -8561,6 +8575,10 @@ var DLMM = class {
|
|
|
8561
8575
|
]);
|
|
8562
8576
|
createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
|
|
8563
8577
|
createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
|
|
8578
|
+
if (!walletToReceiveFee.equals(owner)) {
|
|
8579
|
+
createFeeOwnerTokenXIx && preInstructions.push(createFeeOwnerTokenXIx);
|
|
8580
|
+
createFeeOwnerTokenYIx && preInstructions.push(createFeeOwnerTokenYIx);
|
|
8581
|
+
}
|
|
8564
8582
|
const secondTransactionsIx = [];
|
|
8565
8583
|
const postInstructions = [];
|
|
8566
8584
|
if (shouldClaimAndClose) {
|
|
@@ -8575,8 +8593,8 @@ var DLMM = class {
|
|
|
8575
8593
|
tokenProgram: _spltoken.TOKEN_PROGRAM_ID,
|
|
8576
8594
|
tokenXMint: this.tokenX.publicKey,
|
|
8577
8595
|
tokenYMint: this.tokenY.publicKey,
|
|
8578
|
-
userTokenX,
|
|
8579
|
-
userTokenY
|
|
8596
|
+
userTokenX: feeOwnerTokenX,
|
|
8597
|
+
userTokenY: feeOwnerTokenY
|
|
8580
8598
|
}).instruction();
|
|
8581
8599
|
postInstructions.push(claimSwapFeeIx);
|
|
8582
8600
|
for (let i = 0; i < 2; i++) {
|