@meteora-ag/dlmm 1.5.0 → 1.5.1-test.2

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 CHANGED
@@ -10359,11 +10359,10 @@ var DLMM = class {
10359
10359
  */
10360
10360
  static async create(connection, dlmm, opt) {
10361
10361
  const cluster = _optionalChain([opt, 'optionalAccess', _38 => _38.cluster]) || "mainnet-beta";
10362
- const provider = new (0, _anchor.AnchorProvider)(
10363
- connection,
10364
- {},
10365
- _anchor.AnchorProvider.defaultOptions()
10366
- );
10362
+ const provider = new (0, _anchor.AnchorProvider)(connection, {}, {
10363
+ ..._anchor.AnchorProvider.defaultOptions(),
10364
+ commitment: "confirmed"
10365
+ });
10367
10366
  const program = new (0, _anchor.Program)(
10368
10367
  IDL,
10369
10368
  _nullishCoalesce(_optionalChain([opt, 'optionalAccess', _39 => _39.programId]), () => ( LBCLMM_PROGRAM_IDS[cluster])),
@@ -11345,7 +11344,9 @@ var DLMM = class {
11345
11344
  tokenBadgeX,
11346
11345
  tokenBadgeY
11347
11346
  ]);
11348
- const presetParameterState = await program.account.presetParameter2.fetch(presetParameter);
11347
+ const presetParameterState = await program.account.presetParameter2.fetch(
11348
+ presetParameter
11349
+ );
11349
11350
  const existsPool = await this.getPairPubkeyIfExists(
11350
11351
  connection,
11351
11352
  tokenX,
@@ -12545,7 +12546,9 @@ var DLMM = class {
12545
12546
  slippage
12546
12547
  }) {
12547
12548
  const maxActiveBinSlippage = slippage ? Math.ceil(slippage / (this.lbPair.binStep / 100)) : MAX_ACTIVE_BIN_SLIPPAGE;
12548
- const positionAccount = await this.program.account.positionV2.fetch(positionPubKey);
12549
+ const positionAccount = await this.program.account.positionV2.fetch(
12550
+ positionPubKey
12551
+ );
12549
12552
  const { lowerBinId, upperBinId, binIds } = this.processXYAmountDistribution(xYAmountDistribution);
12550
12553
  if (lowerBinId < positionAccount.lowerBinId)
12551
12554
  throw new Error(
@@ -12989,11 +12992,21 @@ var DLMM = class {
12989
12992
  owner,
12990
12993
  position
12991
12994
  }) {
12995
+ const preInstructions = [];
12996
+ console.log(
12997
+ position.positionData.feeX.toString(),
12998
+ position.positionData.feeY.toString()
12999
+ );
13000
+ if (!position.positionData.feeX.isZero() || !position.positionData.feeY.isZero()) {
13001
+ const claimIx = await this.createClaimSwapFeeMethod({ owner, position });
13002
+ preInstructions.push(...claimIx.instructions);
13003
+ console.log("\u{1F680} ~ DLMM ~ claimIx:", claimIx);
13004
+ }
12992
13005
  const closePositionIx = await this.program.methods.closePosition2().accounts({
12993
13006
  rentReceiver: owner,
12994
13007
  position: position.publicKey,
12995
13008
  sender: owner
12996
- }).instruction();
13009
+ }).preInstructions(preInstructions).instruction();
12997
13010
  const setCUIx = await getEstimatedComputeUnitIxWithBuffer(
12998
13011
  this.program.provider.connection,
12999
13012
  [closePositionIx],