@meteora-ag/dlmm 1.4.10 → 1.4.11-rc.0

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.d.ts CHANGED
@@ -8268,7 +8268,7 @@ declare class DLMM {
8268
8268
  claimSwapFee({ owner, position, }: {
8269
8269
  owner: PublicKey;
8270
8270
  position: LbPosition;
8271
- }): Promise<Transaction>;
8271
+ }): Promise<Transaction | null>;
8272
8272
  /**
8273
8273
  * The `claimAllSwapFee` function to claim swap fees for multiple positions owned by a specific owner.
8274
8274
  * @param
package/dist/index.js CHANGED
@@ -10183,15 +10183,6 @@ function getBinArrayAccountMetasCoverage(lowerBinId, upperBinId, lbPair, program
10183
10183
  }
10184
10184
  );
10185
10185
  }
10186
- function getPositionLowerUpperBinIdWithLiquidity(position) {
10187
- const binWithLiquidity = position.positionBinData.filter(
10188
- (b) => !new (0, _bnjs2.default)(b.binLiquidity).isZero()
10189
- );
10190
- return binWithLiquidity.length > 0 ? {
10191
- lowerBinId: new (0, _bnjs2.default)(binWithLiquidity[0].binId),
10192
- upperBinId: new (0, _bnjs2.default)(binWithLiquidity[binWithLiquidity.length - 1].binId)
10193
- } : null;
10194
- }
10195
10186
 
10196
10187
  // src/dlmm/index.ts
10197
10188
 
@@ -13739,6 +13730,8 @@ var DLMM = class {
13739
13730
  position
13740
13731
  }) {
13741
13732
  const claimFeeTx = await this.createClaimSwapFeeMethod({ owner, position });
13733
+ if (!claimFeeTx)
13734
+ return null;
13742
13735
  const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
13743
13736
  const setCUIx = await getEstimatedComputeUnitIxWithBuffer(
13744
13737
  this.program.provider.connection,
@@ -13771,7 +13764,7 @@ var DLMM = class {
13771
13764
  position
13772
13765
  });
13773
13766
  })
13774
- )).flat();
13767
+ )).flat().filter(Boolean);
13775
13768
  const chunkedClaimAllTx = chunks(claimAllTxs, MAX_CLAIM_ALL_ALLOWED);
13776
13769
  if (chunkedClaimAllTx.length === 0)
13777
13770
  return [];
@@ -15034,15 +15027,10 @@ var DLMM = class {
15034
15027
  owner,
15035
15028
  position
15036
15029
  }) {
15037
- const maybeClaimableBinRange = getPositionLowerUpperBinIdWithLiquidity(
15038
- position.positionData
15039
- );
15040
- if (!maybeClaimableBinRange)
15041
- return [];
15042
- const { lowerBinId, upperBinId } = maybeClaimableBinRange;
15030
+ const { lowerBinId, upperBinId } = position.positionData;
15043
15031
  const binArrayAccountsMeta = getBinArrayAccountMetasCoverage(
15044
- lowerBinId,
15045
- upperBinId,
15032
+ new (0, _anchor.BN)(lowerBinId),
15033
+ new (0, _anchor.BN)(upperBinId),
15046
15034
  this.pubkey,
15047
15035
  this.program.programId
15048
15036
  );
@@ -15060,7 +15048,7 @@ var DLMM = class {
15060
15048
  );
15061
15049
  ix && preInstructions.push(ix);
15062
15050
  const { slices, accounts: transferHookAccounts } = this.getPotentialToken2022IxDataAndAccounts(1 /* Reward */, i);
15063
- const claimTransaction = await this.program.methods.claimReward2(new (0, _anchor.BN)(i), lowerBinId.toNumber(), upperBinId.toNumber(), {
15051
+ const claimTransaction = await this.program.methods.claimReward2(new (0, _anchor.BN)(i), lowerBinId, upperBinId, {
15064
15052
  slices
15065
15053
  }).accounts({
15066
15054
  lbPair: this.pubkey,
@@ -15080,15 +15068,10 @@ var DLMM = class {
15080
15068
  owner,
15081
15069
  position
15082
15070
  }) {
15083
- const maybeClaimableBinRange = getPositionLowerUpperBinIdWithLiquidity(
15084
- position.positionData
15085
- );
15086
- if (!maybeClaimableBinRange)
15087
- return;
15088
- const { lowerBinId, upperBinId } = maybeClaimableBinRange;
15071
+ const { lowerBinId, upperBinId } = position.positionData;
15089
15072
  const binArrayAccountsMeta = getBinArrayAccountMetasCoverage(
15090
- lowerBinId,
15091
- upperBinId,
15073
+ new (0, _anchor.BN)(lowerBinId),
15074
+ new (0, _anchor.BN)(upperBinId),
15092
15075
  this.pubkey,
15093
15076
  this.program.programId
15094
15077
  );
@@ -15125,7 +15108,7 @@ var DLMM = class {
15125
15108
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
15126
15109
  }
15127
15110
  const { slices, accounts: transferHookAccounts } = this.getPotentialToken2022IxDataAndAccounts(0 /* Liquidity */);
15128
- const claimFeeTx = await this.program.methods.claimFee2(lowerBinId.toNumber(), upperBinId.toNumber(), {
15111
+ const claimFeeTx = await this.program.methods.claimFee2(lowerBinId, upperBinId, {
15129
15112
  slices
15130
15113
  }).accounts({
15131
15114
  lbPair: this.pubkey,