@meteora-ag/dlmm 1.0.24 → 1.0.25-rc1
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 +44 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8991,7 +8991,8 @@ var DLMM = class {
|
|
|
8991
8991
|
position
|
|
8992
8992
|
}) {
|
|
8993
8993
|
const preInstructions = [];
|
|
8994
|
-
const
|
|
8994
|
+
const pairTokens = [this.tokenX.publicKey, this.tokenY.publicKey];
|
|
8995
|
+
const tokensInvolved = [...pairTokens];
|
|
8995
8996
|
for (let i = 0; i < 2; i++) {
|
|
8996
8997
|
const rewardMint = this.lbPair.rewardInfos[i].mint;
|
|
8997
8998
|
if (!tokensInvolved.some((pubkey) => rewardMint.equals(pubkey)) && !rewardMint.equals(_web3js.PublicKey.default)) {
|
|
@@ -8999,13 +9000,22 @@ var DLMM = class {
|
|
|
8999
9000
|
}
|
|
9000
9001
|
}
|
|
9001
9002
|
const createATAAccAndIx = await Promise.all(
|
|
9002
|
-
tokensInvolved.map(
|
|
9003
|
-
(
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9003
|
+
tokensInvolved.map((token) => {
|
|
9004
|
+
if (!position.positionData.feeOwner.equals(_web3js.PublicKey.default) && pairTokens.some((t) => t.equals(token))) {
|
|
9005
|
+
return getOrCreateATAInstruction(
|
|
9006
|
+
this.program.provider.connection,
|
|
9007
|
+
token,
|
|
9008
|
+
position.positionData.feeOwner,
|
|
9009
|
+
owner
|
|
9010
|
+
);
|
|
9011
|
+
} else {
|
|
9012
|
+
return getOrCreateATAInstruction(
|
|
9013
|
+
this.program.provider.connection,
|
|
9014
|
+
token,
|
|
9015
|
+
owner
|
|
9016
|
+
);
|
|
9017
|
+
}
|
|
9018
|
+
})
|
|
9009
9019
|
);
|
|
9010
9020
|
createATAAccAndIx.forEach(({ ix }) => ix && preInstructions.push(ix));
|
|
9011
9021
|
const claimAllSwapFeeTxs = await this.createClaimSwapFeeMethod({
|
|
@@ -9057,21 +9067,39 @@ var DLMM = class {
|
|
|
9057
9067
|
positions
|
|
9058
9068
|
}) {
|
|
9059
9069
|
const preInstructions = [];
|
|
9060
|
-
const
|
|
9070
|
+
const pairsToken = [this.tokenX.publicKey, this.tokenY.publicKey];
|
|
9071
|
+
const tokensInvolved = [...pairsToken];
|
|
9061
9072
|
for (let i = 0; i < 2; i++) {
|
|
9062
9073
|
const rewardMint = this.lbPair.rewardInfos[i].mint;
|
|
9063
9074
|
if (!tokensInvolved.some((pubkey) => rewardMint.equals(pubkey)) && !rewardMint.equals(_web3js.PublicKey.default)) {
|
|
9064
9075
|
tokensInvolved.push(this.lbPair.rewardInfos[i].mint);
|
|
9065
9076
|
}
|
|
9066
9077
|
}
|
|
9067
|
-
const
|
|
9068
|
-
|
|
9069
|
-
(
|
|
9070
|
-
this.program.provider.connection,
|
|
9071
|
-
token,
|
|
9072
|
-
owner
|
|
9073
|
-
)
|
|
9078
|
+
const customFeeOwners = [
|
|
9079
|
+
...new Set(
|
|
9080
|
+
positions.filter((p) => !p.positionData.feeOwner.equals(_web3js.PublicKey.default)).map((p) => p.positionData.feeOwner)
|
|
9074
9081
|
)
|
|
9082
|
+
];
|
|
9083
|
+
const createATAAccAndIx = await Promise.all(
|
|
9084
|
+
tokensInvolved.map((token) => {
|
|
9085
|
+
if (customFeeOwners.length > 0 && pairsToken.some((p) => p.equals(token))) {
|
|
9086
|
+
return customFeeOwners.map(
|
|
9087
|
+
(customOwner) => getOrCreateATAInstruction(
|
|
9088
|
+
this.program.provider.connection,
|
|
9089
|
+
token,
|
|
9090
|
+
customOwner,
|
|
9091
|
+
owner
|
|
9092
|
+
)
|
|
9093
|
+
);
|
|
9094
|
+
}
|
|
9095
|
+
return [
|
|
9096
|
+
getOrCreateATAInstruction(
|
|
9097
|
+
this.program.provider.connection,
|
|
9098
|
+
token,
|
|
9099
|
+
owner
|
|
9100
|
+
)
|
|
9101
|
+
];
|
|
9102
|
+
}).flat()
|
|
9075
9103
|
);
|
|
9076
9104
|
createATAAccAndIx.forEach(({ ix }) => ix && preInstructions.push(ix));
|
|
9077
9105
|
const claimAllSwapFeeTxs = (await Promise.all(
|