@meteora-ag/dlmm 1.3.6-rc.0 → 1.3.6
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 +30 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8108,15 +8108,13 @@ var DLMM = class {
|
|
|
8108
8108
|
for (let i = 0; i < binArrayPubkeyArrayV2.length; i++) {
|
|
8109
8109
|
const binArrayPubkey = binArrayPubkeyArrayV2[i];
|
|
8110
8110
|
const binArrayAccInfoBufferV2 = binArraysAccInfo[i];
|
|
8111
|
-
if (
|
|
8112
|
-
|
|
8113
|
-
|
|
8111
|
+
if (binArrayAccInfoBufferV2) {
|
|
8112
|
+
const binArrayAccInfo = program.coder.accounts.decode(
|
|
8113
|
+
"binArray",
|
|
8114
|
+
binArrayAccInfoBufferV2.data
|
|
8114
8115
|
);
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
binArrayAccInfoBufferV2.data
|
|
8118
|
-
);
|
|
8119
|
-
positionBinArraysMapV2.set(binArrayPubkey.toBase58(), binArrayAccInfo);
|
|
8116
|
+
positionBinArraysMapV2.set(binArrayPubkey.toBase58(), binArrayAccInfo);
|
|
8117
|
+
}
|
|
8120
8118
|
}
|
|
8121
8119
|
const lbPairArraysMapV2 = /* @__PURE__ */ new Map();
|
|
8122
8120
|
for (let i = binArrayPubkeyArrayV2.length; i < binArraysAccInfo.length; i++) {
|
|
@@ -8213,7 +8211,7 @@ var DLMM = class {
|
|
|
8213
8211
|
amount: reserveYBalance,
|
|
8214
8212
|
decimal: quoteTokenDecimal
|
|
8215
8213
|
};
|
|
8216
|
-
const positionData = await DLMM.processPosition(
|
|
8214
|
+
const positionData = !!lowerBinArray && !!upperBinArray ? await DLMM.processPosition(
|
|
8217
8215
|
program,
|
|
8218
8216
|
1 /* V2 */,
|
|
8219
8217
|
lbPairAcc,
|
|
@@ -8224,7 +8222,21 @@ var DLMM = class {
|
|
|
8224
8222
|
lowerBinArray,
|
|
8225
8223
|
upperBinArray,
|
|
8226
8224
|
feeOwner
|
|
8227
|
-
)
|
|
8225
|
+
) : {
|
|
8226
|
+
totalXAmount: "0",
|
|
8227
|
+
totalYAmount: "0",
|
|
8228
|
+
positionBinData: [],
|
|
8229
|
+
lastUpdatedAt: new (0, _anchor.BN)(0),
|
|
8230
|
+
upperBinId,
|
|
8231
|
+
lowerBinId,
|
|
8232
|
+
feeX: new (0, _anchor.BN)(0),
|
|
8233
|
+
feeY: new (0, _anchor.BN)(0),
|
|
8234
|
+
rewardOne: new (0, _anchor.BN)(0),
|
|
8235
|
+
rewardTwo: new (0, _anchor.BN)(0),
|
|
8236
|
+
feeOwner,
|
|
8237
|
+
totalClaimedFeeXAmount: new (0, _anchor.BN)(0),
|
|
8238
|
+
totalClaimedFeeYAmount: new (0, _anchor.BN)(0)
|
|
8239
|
+
};
|
|
8228
8240
|
if (positionData) {
|
|
8229
8241
|
positionsMap.set(lbPair.toBase58(), {
|
|
8230
8242
|
publicKey: lbPair,
|
|
@@ -9725,35 +9737,8 @@ var DLMM = class {
|
|
|
9725
9737
|
}) {
|
|
9726
9738
|
const lowerBinIdToRemove = Math.min(...binIds);
|
|
9727
9739
|
const upperBinIdToRemove = Math.max(...binIds);
|
|
9728
|
-
const
|
|
9729
|
-
|
|
9730
|
-
const [positionAccInfo, lbPairAccInfo, upperBinArrayInfoAcc, lowerBinArrayInfoAcc] = await this.program.provider.connection.getMultipleAccountsInfo([
|
|
9731
|
-
position,
|
|
9732
|
-
this.pubkey,
|
|
9733
|
-
upperBinArrayPubKey,
|
|
9734
|
-
lowerBinArrayPubKey
|
|
9735
|
-
]);
|
|
9736
|
-
const { lbPair, owner, feeOwner, upperBinId: positionUpperBinId, lowerBinId: positionLowerBinId } = this.program.coder.accounts.decode(
|
|
9737
|
-
"positionV2",
|
|
9738
|
-
positionAccInfo.data
|
|
9739
|
-
);
|
|
9740
|
-
const { reserveX, reserveY, tokenXMint, tokenYMint } = this.program.coder.accounts.decode(
|
|
9741
|
-
"lbPair",
|
|
9742
|
-
lbPairAccInfo.data
|
|
9743
|
-
);
|
|
9744
|
-
const upperBinArray = this.program.coder.accounts.decode("binArray", upperBinArrayInfoAcc.data);
|
|
9745
|
-
const lowerBinArray = this.program.coder.accounts.decode("binArray", lowerBinArrayInfoAcc.data);
|
|
9746
|
-
const bins = await this.getBins(
|
|
9747
|
-
this.pubkey,
|
|
9748
|
-
positionLowerBinId,
|
|
9749
|
-
positionUpperBinId,
|
|
9750
|
-
this.tokenX.decimal,
|
|
9751
|
-
this.tokenY.decimal,
|
|
9752
|
-
lowerBinArray,
|
|
9753
|
-
upperBinArray
|
|
9754
|
-
);
|
|
9755
|
-
const positionHasNoLiquidity = bins.every(({ supply }) => supply.isZero());
|
|
9756
|
-
if (positionHasNoLiquidity) {
|
|
9740
|
+
const { lbPair, owner, feeOwner, lowerBinId: positionLowerBinId, liquidityShares } = await this.program.account.positionV2.fetch(position);
|
|
9741
|
+
if (liquidityShares.every((share) => share.isZero())) {
|
|
9757
9742
|
throw new Error("No liquidity to remove");
|
|
9758
9743
|
}
|
|
9759
9744
|
const lowerBinArrayIndex = binIdToBinArrayIndex(new (0, _anchor.BN)(positionLowerBinId));
|
|
@@ -9816,8 +9801,8 @@ var DLMM = class {
|
|
|
9816
9801
|
lbPair: this.pubkey,
|
|
9817
9802
|
sender: user,
|
|
9818
9803
|
position,
|
|
9819
|
-
reserveX,
|
|
9820
|
-
reserveY,
|
|
9804
|
+
reserveX: this.lbPair.reserveX,
|
|
9805
|
+
reserveY: this.lbPair.reserveY,
|
|
9821
9806
|
tokenProgram: _spltoken.TOKEN_PROGRAM_ID,
|
|
9822
9807
|
tokenXMint: this.tokenX.publicKey,
|
|
9823
9808
|
tokenYMint: this.tokenY.publicKey,
|
|
@@ -9879,10 +9864,10 @@ var DLMM = class {
|
|
|
9879
9864
|
lbPair,
|
|
9880
9865
|
userTokenX,
|
|
9881
9866
|
userTokenY,
|
|
9882
|
-
reserveX,
|
|
9883
|
-
reserveY,
|
|
9884
|
-
tokenXMint,
|
|
9885
|
-
tokenYMint,
|
|
9867
|
+
reserveX: this.lbPair.reserveX,
|
|
9868
|
+
reserveY: this.lbPair.reserveY,
|
|
9869
|
+
tokenXMint: this.tokenX.publicKey,
|
|
9870
|
+
tokenYMint: this.tokenY.publicKey,
|
|
9886
9871
|
binArrayLower,
|
|
9887
9872
|
binArrayUpper,
|
|
9888
9873
|
binArrayBitmapExtension,
|