@hawksightco/hawk-sdk 1.3.236 → 1.3.238

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.
@@ -77,7 +77,7 @@ function mapOldStrategyTypeToNew(oldStrategyType) {
77
77
  // Handle the old enum values (0-8) and map them to the new simplified enum
78
78
  switch (oldStrategyType) {
79
79
  case 0: // SpotOneSide
80
- case 3: // SpotBalanced
80
+ case 3: // SpotBalanced
81
81
  case 6: // SpotImBalanced
82
82
  return StrategyType.Spot;
83
83
  case 1: // CurveOneSide
@@ -111,7 +111,7 @@ class MeteoraDlmmIxGenerator {
111
111
  * @returns TransactionInstruction for initializing the position
112
112
  */
113
113
  initializePosition(_a) {
114
- return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, lowerBinId, width }) {
114
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, lowerBinId, width, }) {
115
115
  // Initialize anchor
116
116
  anchor_1.Anchor.initialize(connection);
117
117
  // Generate user PDA
@@ -125,7 +125,7 @@ class MeteoraDlmmIxGenerator {
125
125
  // meteoraDynamicCpi will prepend userPda and authority
126
126
  const meteoraIx = new web3.TransactionInstruction({
127
127
  data: Buffer.concat([
128
- Buffer.from(util.sighash("initialize_position")),
128
+ Buffer.from(util.sighash('initialize_position')),
129
129
  lowerBinIdBuffer,
130
130
  widthBuffer,
131
131
  ]),
@@ -134,7 +134,11 @@ class MeteoraDlmmIxGenerator {
134
134
  { pubkey: position, isSigner: true, isWritable: true }, // position (Mutable, Signer)
135
135
  { pubkey: lbPair, isSigner: false, isWritable: false }, // lbPair
136
136
  { pubkey: userPda, isSigner: false, isWritable: false }, // owner (Signer - signed by IYF Main)
137
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false }, // systemProgram
137
+ {
138
+ pubkey: web3.SystemProgram.programId,
139
+ isSigner: false,
140
+ isWritable: false,
141
+ }, // systemProgram
138
142
  { pubkey: web3.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }, // rent
139
143
  { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false }, // eventAuthority (PDA)
140
144
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false }, // program
@@ -149,7 +153,7 @@ class MeteoraDlmmIxGenerator {
149
153
  });
150
154
  }
151
155
  initializePositionAutomation(connection_1, _a) {
152
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, lowerBinId, upperBinId }) {
156
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, lowerBinId, upperBinId, }) {
153
157
  // Initialize anchor
154
158
  anchor_1.Anchor.initialize(connection);
155
159
  // Generate user pda
@@ -157,9 +161,8 @@ class MeteoraDlmmIxGenerator {
157
161
  // Generate instruction
158
162
  const width = upperBinId - lowerBinId + 1;
159
163
  // @ts-ignore
160
- const iyfExtensionIx = yield anchor_1.Anchor.instance().iyfExtension
161
- .methods
162
- .meteoraDlmmInitializePositionAutomation(lowerBinId, width)
164
+ const iyfExtensionIx = yield anchor_1.Anchor.instance()
165
+ .iyfExtension.methods.meteoraDlmmInitializePositionAutomation(lowerBinId, width)
163
166
  .accounts({
164
167
  farm: addresses_1.USDC_FARM,
165
168
  userPda,
@@ -181,24 +184,30 @@ class MeteoraDlmmIxGenerator {
181
184
  }
182
185
  return meta;
183
186
  });
184
- return this.ix.iyfMain.iyfExtensionExecute(connection, { userWallet, iyfExtensionIx });
187
+ return this.ix.iyfMain.iyfExtensionExecute(connection, {
188
+ userWallet,
189
+ iyfExtensionIx,
190
+ });
185
191
  });
186
192
  }
187
193
  initializePositionRelativeAutomation(connection_1, _a) {
188
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, width, useFuelAccount }) {
194
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, width, useFuelAccount, }) {
189
195
  // Initialize anchor
190
196
  anchor_1.Anchor.initialize(connection);
191
197
  // Width > 70 is invalid (will error on-chain)
192
198
  if (width > 70) {
193
- throw new Error("Width exceeds maximum allowed 70 bins");
199
+ throw new Error('Width exceeds maximum allowed 70 bins');
194
200
  }
195
201
  // Generate user pda
196
202
  const userPda = (0, functions_1.generateUserPda)(userWallet);
197
203
  // Generate instruction
198
- return this.ix.iyfMain.iyfExtensionExecuteV2(connection, { userPda, authority: addresses_1.HS_AUTHORITY, ix: new web3.TransactionInstruction({
204
+ return this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
205
+ userPda,
206
+ authority: addresses_1.HS_AUTHORITY,
207
+ ix: new web3.TransactionInstruction({
199
208
  data: Buffer.concat([
200
- Buffer.from(util.sighash("meteora_dlmm_initialize_position_relative_automation")),
201
- new bn_js_1.default(relativeLowerBinId).toTwos(16).toArrayLike(Buffer, "le", 2),
209
+ Buffer.from(util.sighash('meteora_dlmm_initialize_position_relative_automation')),
210
+ new bn_js_1.default(relativeLowerBinId).toTwos(16).toArrayLike(Buffer, 'le', 2),
202
211
  Buffer.from([width]),
203
212
  ]),
204
213
  keys: [
@@ -206,14 +215,35 @@ class MeteoraDlmmIxGenerator {
206
215
  { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: false },
207
216
  { pubkey: position, isSigner: true, isWritable: true },
208
217
  { pubkey: lbPair, isSigner: false, isWritable: true },
209
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false },
210
- { pubkey: web3.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
211
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: true },
218
+ {
219
+ pubkey: web3.SystemProgram.programId,
220
+ isSigner: false,
221
+ isWritable: false,
222
+ },
223
+ {
224
+ pubkey: web3.SYSVAR_RENT_PUBKEY,
225
+ isSigner: false,
226
+ isWritable: false,
227
+ },
228
+ {
229
+ pubkey: METEORA_EVENT_AUTHORITY,
230
+ isSigner: false,
231
+ isWritable: true,
232
+ },
212
233
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: true },
213
- ...useFuelAccount ? [{ pubkey: (0, functions_1.generateFuelAccount)(userWallet), isSigner: false, isWritable: true }] : [],
234
+ ...(useFuelAccount
235
+ ? [
236
+ {
237
+ pubkey: (0, functions_1.generateFuelAccount)(userWallet),
238
+ isSigner: false,
239
+ isWritable: true,
240
+ },
241
+ ]
242
+ : []),
214
243
  ],
215
244
  programId: addresses_1.IYF_EXTENSION,
216
- }) });
245
+ }),
246
+ });
217
247
  });
218
248
  }
219
249
  /**
@@ -298,34 +328,39 @@ class MeteoraDlmmIxGenerator {
298
328
  checkLowerRange.writeInt32LE((_d = checkRange === null || checkRange === void 0 ? void 0 : checkRange.lowerRange) !== null && _d !== void 0 ? _d : 0, 0);
299
329
  const checkUpperRange = Buffer.alloc(4);
300
330
  checkUpperRange.writeInt32LE((_e = checkRange === null || checkRange === void 0 ? void 0 : checkRange.upperRange) !== null && _e !== void 0 ? _e : 0, 0);
301
- const optionalTokenXAmountBuffer = optionalTokenXAmount ? Buffer.concat([
302
- Buffer.from([1]),
303
- Buffer.from(optionalTokenXAmount.toArrayLike(Buffer, "le", 8)),
304
- ]) : Buffer.from([0]);
305
- const optionalTokenYAmountBuffer = optionalTokenYAmount ? Buffer.concat([
306
- Buffer.from([1]),
307
- Buffer.from(optionalTokenYAmount.toArrayLike(Buffer, "le", 8)),
308
- ]) : Buffer.from([0]);
331
+ const optionalTokenXAmountBuffer = optionalTokenXAmount
332
+ ? Buffer.concat([
333
+ Buffer.from([1]),
334
+ Buffer.from(optionalTokenXAmount.toArrayLike(Buffer, 'le', 8)),
335
+ ])
336
+ : Buffer.from([0]);
337
+ const optionalTokenYAmountBuffer = optionalTokenYAmount
338
+ ? Buffer.concat([
339
+ Buffer.from([1]),
340
+ Buffer.from(optionalTokenYAmount.toArrayLike(Buffer, 'le', 8)),
341
+ ])
342
+ : Buffer.from([0]);
309
343
  const remainingAccountsInfoSerializedWithLength = Buffer.concat([
310
344
  remainingAccountsInfoLength,
311
- remainingAccountsInfoSerialized
345
+ remainingAccountsInfoSerialized,
312
346
  ]);
313
347
  // Use Anchor to serialize the instruction (ensures proper Borsh serialization)
314
348
  // @ts-ignore
315
349
  const depositIx = new web3.TransactionInstruction({
316
350
  data: Buffer.concat([
317
- Buffer.from(util.sighash("meteora_dlmm_deposit_relative_automation")),
351
+ Buffer.from(util.sighash('meteora_dlmm_deposit_relative_automation')),
318
352
  relativeLowerRange,
319
353
  relativeUpperRange,
320
354
  Buffer.from([strategyType]),
321
355
  optionalTokenXAmountBuffer,
322
356
  optionalTokenYAmountBuffer,
323
- Buffer.from(!!checkRange ?
324
- Buffer.concat([
357
+ Buffer.from(!!checkRange
358
+ ? Buffer.concat([
325
359
  Buffer.from([1]),
326
360
  checkLowerRange,
327
- checkUpperRange
328
- ]) : Buffer.from([0])),
361
+ checkUpperRange,
362
+ ])
363
+ : Buffer.from([0])),
329
364
  remainingAccountsInfoSerializedWithLength,
330
365
  ]),
331
366
  keys: [
@@ -341,18 +376,26 @@ class MeteoraDlmmIxGenerator {
341
376
  { pubkey: tokenYMint, isSigner: false, isWritable: false },
342
377
  { pubkey: tokenXProgram, isSigner: false, isWritable: false },
343
378
  { pubkey: tokenYProgram, isSigner: false, isWritable: false },
344
- { pubkey: actualBinArrayBitmapExtension, isSigner: false, isWritable: true },
379
+ {
380
+ pubkey: actualBinArrayBitmapExtension,
381
+ isSigner: false,
382
+ isWritable: true,
383
+ },
345
384
  { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: true },
346
385
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: true },
347
386
  ...remainingAccounts,
348
387
  ],
349
388
  programId: addresses_1.IYF_EXTENSION,
350
389
  });
351
- return this.ix.iyfMain.iyfExtensionExecuteV2(connection, { userPda, authority: addresses_1.HS_AUTHORITY, ix: depositIx });
390
+ return this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
391
+ userPda,
392
+ authority: addresses_1.HS_AUTHORITY,
393
+ ix: depositIx,
394
+ });
352
395
  });
353
396
  }
354
397
  redepositAutomation(connection_1, _a) {
355
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, relativeUpperBinId, strategyType, checkRange }) {
398
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, relativeUpperBinId, strategyType, checkRange, }) {
356
399
  // Initialize anchor
357
400
  anchor_1.Anchor.initialize(connection);
358
401
  // Meteora utility function
@@ -376,7 +419,7 @@ class MeteoraDlmmIxGenerator {
376
419
  const expectedMinBinId = activeBinId + relativeLowerBinId;
377
420
  const expectedMaxBinId = activeBinId + relativeUpperBinId;
378
421
  if (expectedMaxBinId < expectedMinBinId) {
379
- throw new Error("Invalid bin range");
422
+ throw new Error('Invalid bin range');
380
423
  }
381
424
  // get min and max bin +- 3
382
425
  // this is to ensure that we allow for some buffer
@@ -386,7 +429,9 @@ class MeteoraDlmmIxGenerator {
386
429
  // it will handle overlapping tick arrays
387
430
  // if lower is 1 2 3 4 5 6 7 and upper is 3 4 5 6 7 8 9
388
431
  // we want to merge it to 1 2 3 4 5 6 7 8 9
389
- const tickArrays = [...new Set([...lowerTickArrays, ...upperTickArrays])];
432
+ const tickArrays = [
433
+ ...new Set([...lowerTickArrays, ...upperTickArrays]),
434
+ ];
390
435
  // comment out for reference
391
436
  // const lowerBinArrayIndex = fn.binIdToBinArrayIndex(MAX_BIN_ARRAY_SIZE, new BN(activeBinId - relativeLowerBinId));
392
437
  // const binArrayLower = fn.deriveBinArray(lbPair, lowerBinArrayIndex);
@@ -403,9 +448,8 @@ class MeteoraDlmmIxGenerator {
403
448
  return this.ix.iyfMain.iyfExtensionExecute(connection, {
404
449
  userWallet,
405
450
  // @ts-ignore
406
- iyfExtensionIx: yield anchor_1.Anchor.instance().iyfExtension
407
- .methods
408
- .meteoraDlmmRedepositAutomation(relativeLowerBinId, relativeUpperBinId, mapOldStrategyTypeToNew(strategyType), _checkRange)
451
+ iyfExtensionIx: yield anchor_1.Anchor.instance()
452
+ .iyfExtension.methods.meteoraDlmmRedepositAutomation(relativeLowerBinId, relativeUpperBinId, mapOldStrategyTypeToNew(strategyType), _checkRange)
409
453
  .accounts({
410
454
  farm: addresses_1.USDC_FARM,
411
455
  userPda,
@@ -436,7 +480,7 @@ class MeteoraDlmmIxGenerator {
436
480
  });
437
481
  }
438
482
  redepositAutomation2(connection_1, _a) {
439
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, relativeUpperBinId, strategyType, checkRange, targetActiveBin }) {
483
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, relativeUpperBinId, strategyType, checkRange, targetActiveBin, }) {
440
484
  try {
441
485
  console.log('=== REDEPOSIT AUTOMATION 2 START ===');
442
486
  console.log('Parameters:', {
@@ -446,7 +490,7 @@ class MeteoraDlmmIxGenerator {
446
490
  relativeLowerBinId,
447
491
  relativeUpperBinId,
448
492
  strategyType,
449
- checkRange
493
+ checkRange,
450
494
  });
451
495
  // Initialize anchor
452
496
  anchor_1.Anchor.initialize(connection);
@@ -475,7 +519,7 @@ class MeteoraDlmmIxGenerator {
475
519
  console.log('LB pair info:', {
476
520
  tokenXMint: tokenXMint.toString(),
477
521
  tokenYMint: tokenYMint.toString(),
478
- activeBinId: activeBinId.toString()
522
+ activeBinId: activeBinId.toString(),
479
523
  });
480
524
  // const MAX_BIN_ARRAY_SIZE = new BN(Anchor.instance().meteoraProgram.idl.constants[1].value);
481
525
  // Get min and max bin id values from checkRange threshold
@@ -489,10 +533,10 @@ class MeteoraDlmmIxGenerator {
489
533
  relativeLowerBinId,
490
534
  relativeUpperBinId,
491
535
  expectedMinBinId,
492
- expectedMaxBinId
536
+ expectedMaxBinId,
493
537
  });
494
538
  if (expectedMaxBinId < expectedMinBinId) {
495
- throw new Error("Invalid bin range");
539
+ throw new Error('Invalid bin range');
496
540
  }
497
541
  // get min and max bin +- 3
498
542
  // this is to ensure that we allow for some buffer
@@ -532,9 +576,11 @@ class MeteoraDlmmIxGenerator {
532
576
  console.log('addLiquidityByStrategy completed, instruction count:', addLiquidityByStrategyTx.instructions.length);
533
577
  // const addLiquidityByStrategyIxs = addLiquidityByStrategyTx.instructions.filter((ix) => ix.programId.equals(METEORA_DLMM_PROGRAM))
534
578
  console.log('Filtering instructions for add_liquidity_by_strategy2...');
535
- const addLiquidityByStrategyIx = addLiquidityByStrategyTx.instructions.filter((ix) => {
536
- return ix.programId.equals(METEORA_DLMM_PROGRAM) &&
537
- ix.data.subarray(0, 8).equals(Buffer.from([3, 221, 149, 218, 111, 141, 118, 213]));
579
+ const addLiquidityByStrategyIx = addLiquidityByStrategyTx.instructions.filter(ix => {
580
+ return (ix.programId.equals(METEORA_DLMM_PROGRAM) &&
581
+ ix.data
582
+ .subarray(0, 8)
583
+ .equals(Buffer.from([3, 221, 149, 218, 111, 141, 118, 213])));
538
584
  })[0];
539
585
  const binArrayBitmapExtension = addLiquidityByStrategyIx.keys[2].pubkey;
540
586
  if (!addLiquidityByStrategyIx) {
@@ -564,20 +610,20 @@ class MeteoraDlmmIxGenerator {
564
610
  // const strategyParametersStrategyType = data[32];
565
611
  // const strategyParametersParameters = Array.from(data.subarray(33, 97));
566
612
  // const remainingAccountsInfo = this.ix.data.subarray(97);
567
- console.log("old strategy type", strategyType);
568
- console.log("new strategy type", mapOldStrategyTypeToNew(strategyType));
569
- console.log("strategyParametersStrategyType", strategyParametersStrategyType);
613
+ console.log('old strategy type', strategyType);
614
+ console.log('new strategy type', mapOldStrategyTypeToNew(strategyType));
615
+ console.log('strategyParametersStrategyType', strategyParametersStrategyType);
570
616
  // Log the first few keys to understand the structure
571
617
  console.log('First 5 instruction keys:', addLiquidityByStrategyIx.keys.slice(0, 5).map((key, i) => ({
572
618
  index: i,
573
619
  pubkey: key.pubkey.toString(),
574
620
  isSigner: key.isSigner,
575
- isWritable: key.isWritable
621
+ isWritable: key.isWritable,
576
622
  })));
577
623
  console.log('Creating extension instruction...');
578
624
  // @ts-ignore
579
- const extensionIx = yield anchor_1.Anchor.instance().iyfExtension.methods
580
- .meteoraDlmmRedepositAutomation2(relativeLowerBinId, relativeUpperBinId, strategyType, _checkRange,
625
+ const extensionIx = yield anchor_1.Anchor.instance()
626
+ .iyfExtension.methods.meteoraDlmmRedepositAutomation2(relativeLowerBinId, relativeUpperBinId, strategyType, _checkRange,
581
627
  // strategyParametersParameters,
582
628
  remainingAccountsInfo)
583
629
  .accounts({
@@ -604,25 +650,26 @@ class MeteoraDlmmIxGenerator {
604
650
  // Patch binArrayBitmapExtension writable flag: writable only when it's a real PDA, not the program ID placeholder
605
651
  const bitmapKey = extensionIx.keys.find(k => k.pubkey.equals(binArrayBitmapExtension));
606
652
  if (bitmapKey) {
607
- bitmapKey.isWritable = !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
653
+ bitmapKey.isWritable =
654
+ !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
608
655
  }
609
656
  console.log('Extension instruction created:', {
610
657
  keysCount: extensionIx.keys.length,
611
658
  dataLength: extensionIx.data.length,
612
- programId: extensionIx.programId.toString()
659
+ programId: extensionIx.programId.toString(),
613
660
  });
614
661
  // Generate instruction
615
662
  console.log('Calling iyfExtensionExecuteV2 with:', {
616
663
  authority: userWallet.toString(),
617
664
  extensionIxKeysCount: extensionIx.keys.length,
618
- extensionIxProgramId: extensionIx.programId.toString()
665
+ extensionIxProgramId: extensionIx.programId.toString(),
619
666
  });
620
- const sighash = util.sighash("meteora_dlmm_redeposit_automation_2");
667
+ const sighash = util.sighash('meteora_dlmm_redeposit_automation_2');
621
668
  extensionIx.data.set(sighash, 0);
622
669
  const ix = yield this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
623
670
  userPda,
624
671
  authority: addresses_1.HS_AUTHORITY,
625
- ix: extensionIx
672
+ ix: extensionIx,
626
673
  });
627
674
  console.log('ix data length:', ix.data.length);
628
675
  return ix;
@@ -640,7 +687,7 @@ class MeteoraDlmmIxGenerator {
640
687
  });
641
688
  }
642
689
  relativeOpenAutomation(connection_1, _a) {
643
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, relativeUpperBinId, strategyType, checkRange, targetActiveBin, userTokenXAmount, userTokenYAmount, useFuelAccount, pdaTokenType }) {
690
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, relativeLowerBinId, relativeUpperBinId, strategyType, checkRange, targetActiveBin, userTokenXAmount, userTokenYAmount, useFuelAccount, pdaTokenType, }) {
644
691
  try {
645
692
  // Initialize anchor
646
693
  anchor_1.Anchor.initialize(connection);
@@ -651,8 +698,7 @@ class MeteoraDlmmIxGenerator {
651
698
  const tokenXMint = lbPairInfo.tokenXMint;
652
699
  const tokenYMint = lbPairInfo.tokenYMint;
653
700
  // Fetch and cache mint accounts so AccountCache.get() returns the token programs
654
- yield MintCache_1.MintCache
655
- .instance(connection)
701
+ yield MintCache_1.MintCache.instance(connection)
656
702
  .getBatchedMultipleAccountsInfo([tokenXMint, tokenYMint])
657
703
  .waitForResult();
658
704
  const mintAInfo = AccountCache_1.AccountCache.get(tokenXMint);
@@ -687,7 +733,7 @@ class MeteoraDlmmIxGenerator {
687
733
  const expectedMinBinId = activeBinId + relativeLowerBinId;
688
734
  const expectedMaxBinId = activeBinId + relativeUpperBinId;
689
735
  if (expectedMaxBinId < expectedMinBinId) {
690
- throw new Error("Invalid bin range");
736
+ throw new Error('Invalid bin range');
691
737
  }
692
738
  let DLMM = yield this.dlmm(connection, lbPair);
693
739
  const addLiquidityByStrategyTx = yield DLMM.dlmm.initializePositionAndAddLiquidityByStrategy({
@@ -701,9 +747,11 @@ class MeteoraDlmmIxGenerator {
701
747
  },
702
748
  user: userWallet,
703
749
  });
704
- const addLiquidityByStrategyIx = addLiquidityByStrategyTx.instructions.filter((ix) => {
705
- return ix.programId.equals(METEORA_DLMM_PROGRAM) &&
706
- ix.data.subarray(0, 8).equals(Buffer.from([3, 221, 149, 218, 111, 141, 118, 213]));
750
+ const addLiquidityByStrategyIx = addLiquidityByStrategyTx.instructions.filter(ix => {
751
+ return (ix.programId.equals(METEORA_DLMM_PROGRAM) &&
752
+ ix.data
753
+ .subarray(0, 8)
754
+ .equals(Buffer.from([3, 221, 149, 218, 111, 141, 118, 213])));
707
755
  })[0];
708
756
  const binArrayBitmapExtension = addLiquidityByStrategyIx.keys[2].pubkey;
709
757
  if (!addLiquidityByStrategyIx) {
@@ -713,8 +761,8 @@ class MeteoraDlmmIxGenerator {
713
761
  const remainingAccountMeta = addLiquidityByStrategyIx.keys.slice(remainingAccountStartIndex);
714
762
  const remainingAccountsInfo = addLiquidityByStrategyIx.data.subarray(97);
715
763
  // @ts-ignore
716
- const extensionIx = yield anchor_1.Anchor.instance().iyfExtension.methods
717
- .meteoraDlmmRelativeOpenAutomation(relativeLowerBinId, relativeUpperBinId, strategyType, userTokenXAmount !== null && userTokenXAmount !== void 0 ? userTokenXAmount : null, userTokenYAmount !== null && userTokenYAmount !== void 0 ? userTokenYAmount : null, _checkRange, remainingAccountsInfo)
764
+ const extensionIx = yield anchor_1.Anchor.instance()
765
+ .iyfExtension.methods.meteoraDlmmRelativeOpenAutomation(relativeLowerBinId, relativeUpperBinId, strategyType, userTokenXAmount !== null && userTokenXAmount !== void 0 ? userTokenXAmount : null, userTokenYAmount !== null && userTokenYAmount !== void 0 ? userTokenYAmount : null, _checkRange, remainingAccountsInfo)
718
766
  .accounts({
719
767
  userPda,
720
768
  hawksightAuthority: addresses_1.HS_AUTHORITY,
@@ -740,15 +788,16 @@ class MeteoraDlmmIxGenerator {
740
788
  // Patch binArrayBitmapExtension writable flag: writable only when it's a real PDA, not the program ID placeholder
741
789
  const bitmapKey = extensionIx.keys.find(k => k.pubkey.equals(binArrayBitmapExtension));
742
790
  if (bitmapKey) {
743
- bitmapKey.isWritable = !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
791
+ bitmapKey.isWritable =
792
+ !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
744
793
  }
745
794
  // Set the correct sighash for the new instruction
746
- const sighash = util.sighash("meteora_dlmm_relative_open_automation");
795
+ const sighash = util.sighash('meteora_dlmm_relative_open_automation');
747
796
  extensionIx.data.set(sighash, 0);
748
797
  const ix = yield this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
749
798
  userPda,
750
799
  authority: addresses_1.HS_AUTHORITY,
751
- ix: extensionIx
800
+ ix: extensionIx,
752
801
  });
753
802
  return ix;
754
803
  }
@@ -771,7 +820,7 @@ class MeteoraDlmmIxGenerator {
771
820
  });
772
821
  }
773
822
  claimFee2(connection_1, _a) {
774
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, lowerBinId, upperBinId }) {
823
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, lowerBinId, upperBinId, }) {
775
824
  // Initialize anchor
776
825
  anchor_1.Anchor.initialize(connection);
777
826
  const userPda = (0, functions_1.generateUserPda)(userWallet);
@@ -782,12 +831,10 @@ class MeteoraDlmmIxGenerator {
782
831
  const ownerFeeX = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, tokenMintX, tokenProgramX);
783
832
  const ownerFeeY = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, tokenMintY, tokenProgramY);
784
833
  const binArrays = this.pda.meteora.deriveBinArrays(lbPair, lowerBinId, upperBinId);
785
- const sighash = util.sighash("meteora_dlmm_claim_fee_2");
834
+ const sighash = util.sighash('meteora_dlmm_claim_fee_2');
786
835
  const minBinId = Buffer.alloc(4);
787
836
  const maxBinId = Buffer.alloc(4);
788
- const remainingAccountsInfo = Buffer.from(new Uint8Array([
789
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
790
- ]));
837
+ const remainingAccountsInfo = Buffer.from(new Uint8Array([0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]));
791
838
  minBinId.writeInt32LE(lowerBinId, 0);
792
839
  maxBinId.writeInt32LE(upperBinId, 0);
793
840
  return yield this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
@@ -815,13 +862,21 @@ class MeteoraDlmmIxGenerator {
815
862
  { pubkey: tokenProgramX, isSigner: false, isWritable: false },
816
863
  { pubkey: tokenProgramY, isSigner: false, isWritable: false },
817
864
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
818
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
865
+ {
866
+ pubkey: METEORA_EVENT_AUTHORITY,
867
+ isSigner: false,
868
+ isWritable: false,
869
+ },
819
870
  { pubkey: ownerFeeX, isSigner: false, isWritable: true },
820
871
  { pubkey: ownerFeeY, isSigner: false, isWritable: true },
821
- ...binArrays.map(binArray => ({ pubkey: binArray, isSigner: false, isWritable: true })),
872
+ ...binArrays.map(binArray => ({
873
+ pubkey: binArray,
874
+ isSigner: false,
875
+ isWritable: true,
876
+ })),
822
877
  ],
823
878
  programId: addresses_1.IYF_EXTENSION,
824
- })
879
+ }),
825
880
  });
826
881
  });
827
882
  }
@@ -837,18 +892,18 @@ class MeteoraDlmmIxGenerator {
837
892
  });
838
893
  }
839
894
  claimReward2(connection_1, _a) {
840
- return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, rewardIndex, rewardMint, rewardVault, tokenProgram, lowerBinId, upperBinId }) {
895
+ return __awaiter(this, arguments, void 0, function* (connection, { userWallet, lbPair, position, rewardIndex, rewardMint, rewardVault, tokenProgram, lowerBinId, upperBinId, }) {
841
896
  // Initialize anchor
842
897
  anchor_1.Anchor.initialize(connection);
843
898
  const userPda = (0, functions_1.generateUserPda)(userWallet);
844
899
  const userTokenAccount = (0, functions_1.generateAta)(userPda, rewardMint);
845
900
  const ownerFee = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, rewardMint, tokenProgram);
846
901
  const binArrays = this.pda.meteora.deriveBinArrays(lbPair, lowerBinId, upperBinId);
847
- const sighash = util.sighash("meteora_dlmm_claim_reward_2");
902
+ const sighash = util.sighash('meteora_dlmm_claim_reward_2');
848
903
  const minBinId = Buffer.alloc(4);
849
904
  const maxBinId = Buffer.alloc(4);
850
905
  const remainingAccountsInfo = Buffer.from(new Uint8Array([
851
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00
906
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
852
907
  ]));
853
908
  minBinId.writeInt32LE(lowerBinId, 0);
854
909
  maxBinId.writeInt32LE(upperBinId, 0);
@@ -874,12 +929,20 @@ class MeteoraDlmmIxGenerator {
874
929
  { pubkey: userTokenAccount, isSigner: false, isWritable: true },
875
930
  { pubkey: tokenProgram, isSigner: false, isWritable: true },
876
931
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
877
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
932
+ {
933
+ pubkey: METEORA_EVENT_AUTHORITY,
934
+ isSigner: false,
935
+ isWritable: false,
936
+ },
878
937
  { pubkey: ownerFee, isSigner: false, isWritable: true },
879
- ...binArrays.map(binArray => ({ pubkey: binArray, isSigner: false, isWritable: true })),
938
+ ...binArrays.map(binArray => ({
939
+ pubkey: binArray,
940
+ isSigner: false,
941
+ isWritable: true,
942
+ })),
880
943
  ],
881
944
  programId: addresses_1.IYF_EXTENSION,
882
- })
945
+ }),
883
946
  });
884
947
  });
885
948
  }
@@ -919,7 +982,7 @@ class MeteoraDlmmIxGenerator {
919
982
  const ownerFeeX = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, tokenMintX, tokenProgramX);
920
983
  const ownerFeeY = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, tokenMintY, tokenProgramY);
921
984
  const binArrays = this.pda.meteora.deriveBinArrays(lbPair, lowerBinId, upperBinId);
922
- const sighash = util.sighash("meteora_dlmm_claim_fee_2_automation");
985
+ const sighash = util.sighash('meteora_dlmm_claim_fee_2_automation');
923
986
  const minBinId = Buffer.alloc(4);
924
987
  const maxBinId = Buffer.alloc(4);
925
988
  minBinId.writeInt32LE(lowerBinId, 0);
@@ -956,16 +1019,24 @@ class MeteoraDlmmIxGenerator {
956
1019
  { pubkey: tokenProgramX, isSigner: false, isWritable: false },
957
1020
  { pubkey: tokenProgramY, isSigner: false, isWritable: false },
958
1021
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
959
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
1022
+ {
1023
+ pubkey: METEORA_EVENT_AUTHORITY,
1024
+ isSigner: false,
1025
+ isWritable: false,
1026
+ },
960
1027
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
961
1028
  { pubkey: ownerFeeX, isSigner: false, isWritable: true },
962
1029
  { pubkey: ownerFeeY, isSigner: false, isWritable: true },
963
- ...binArrays.map(binArray => ({ pubkey: binArray, isSigner: false, isWritable: true })),
1030
+ ...binArrays.map(binArray => ({
1031
+ pubkey: binArray,
1032
+ isSigner: false,
1033
+ isWritable: true,
1034
+ })),
964
1035
  // Transfer hook accounts (if any)
965
1036
  ...((_c = remainingAccountsInfo === null || remainingAccountsInfo === void 0 ? void 0 : remainingAccountsInfo.accounts) !== null && _c !== void 0 ? _c : []),
966
1037
  ],
967
1038
  programId: addresses_1.IYF_EXTENSION,
968
- })
1039
+ }),
969
1040
  });
970
1041
  });
971
1042
  }
@@ -998,7 +1069,7 @@ class MeteoraDlmmIxGenerator {
998
1069
  }
999
1070
  const ownerFee = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, rewardMint, tokenProgram);
1000
1071
  const binArrays = this.pda.meteora.deriveBinArrays(lbPair, lowerBinId, upperBinId);
1001
- const sighash = util.sighash("meteora_dlmm_claim_reward_2_automation");
1072
+ const sighash = util.sighash('meteora_dlmm_claim_reward_2_automation');
1002
1073
  const minBinId = Buffer.alloc(4);
1003
1074
  const maxBinId = Buffer.alloc(4);
1004
1075
  minBinId.writeInt32LE(lowerBinId, 0);
@@ -1035,15 +1106,23 @@ class MeteoraDlmmIxGenerator {
1035
1106
  { pubkey: userTokenAccount, isSigner: false, isWritable: true },
1036
1107
  { pubkey: tokenProgram, isSigner: false, isWritable: true },
1037
1108
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
1038
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
1109
+ {
1110
+ pubkey: METEORA_EVENT_AUTHORITY,
1111
+ isSigner: false,
1112
+ isWritable: false,
1113
+ },
1039
1114
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
1040
1115
  { pubkey: ownerFee, isSigner: false, isWritable: true },
1041
- ...binArrays.map(binArray => ({ pubkey: binArray, isSigner: false, isWritable: true })),
1116
+ ...binArrays.map(binArray => ({
1117
+ pubkey: binArray,
1118
+ isSigner: false,
1119
+ isWritable: true,
1120
+ })),
1042
1121
  // Transfer hook accounts (if any)
1043
1122
  ...((_c = remainingAccountsInfo === null || remainingAccountsInfo === void 0 ? void 0 : remainingAccountsInfo.accounts) !== null && _c !== void 0 ? _c : []),
1044
1123
  ],
1045
1124
  programId: addresses_1.IYF_EXTENSION,
1046
- })
1125
+ }),
1047
1126
  });
1048
1127
  });
1049
1128
  }
@@ -1067,8 +1146,8 @@ class MeteoraDlmmIxGenerator {
1067
1146
  userTokenY = (0, functions_1.generateAta)(userPda, params.tokenYMint);
1068
1147
  }
1069
1148
  // @ts-ignore
1070
- const ix = yield anchor_1.Anchor.instance().iyfExtension.methods
1071
- .meteoraDlmmDepositAutomation(params.activeId, params.maxActiveBinSlippage, params.strategyParametersMinBinId, params.strategyParametersMaxBinId, params.strategyParametersStrategyType, params.strategyParametersParameters)
1149
+ const ix = yield anchor_1.Anchor.instance()
1150
+ .iyfExtension.methods.meteoraDlmmDepositAutomation(params.activeId, params.maxActiveBinSlippage, params.strategyParametersMinBinId, params.strategyParametersMaxBinId, params.strategyParametersStrategyType, params.strategyParametersParameters)
1072
1151
  .accounts({
1073
1152
  farm: addresses_1.USDC_FARM,
1074
1153
  userPda,
@@ -1090,11 +1169,13 @@ class MeteoraDlmmIxGenerator {
1090
1169
  tokenYProgram: params.tokenYProgram,
1091
1170
  eventAuthority: METEORA_EVENT_AUTHORITY,
1092
1171
  meteoraDlmmProgram: METEORA_DLMM_PROGRAM,
1093
- }).instruction();
1172
+ })
1173
+ .instruction();
1094
1174
  // Patch binArrayBitmapExtension writable flag: writable only when it's a real PDA, not the program ID placeholder
1095
1175
  const bitmapKey = ix.keys.find(k => k.pubkey.equals(params.binArrayBitmapExtension));
1096
1176
  if (bitmapKey) {
1097
- bitmapKey.isWritable = !params.binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
1177
+ bitmapKey.isWritable =
1178
+ !params.binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
1098
1179
  }
1099
1180
  return yield this.ix.iyfMain.iyfExtensionExecute(connection, {
1100
1181
  userWallet: params.userWallet,
@@ -1122,8 +1203,8 @@ class MeteoraDlmmIxGenerator {
1122
1203
  userTokenY = (0, functions_1.generateAta)(userPda, params.tokenYMint);
1123
1204
  }
1124
1205
  // @ts-ignore
1125
- const ix = yield anchor_1.Anchor.instance().iyfExtension.methods
1126
- .meteoraDlmmDepositWithAmountAutomation(params.activeId, params.maxActiveBinSlippage, params.strategyParametersMinBinId, params.strategyParametersMaxBinId, params.strategyParametersStrategyType, params.strategyParametersParameters, params.userTokenXAmount, params.userTokenYAmount)
1206
+ const ix = yield anchor_1.Anchor.instance()
1207
+ .iyfExtension.methods.meteoraDlmmDepositWithAmountAutomation(params.activeId, params.maxActiveBinSlippage, params.strategyParametersMinBinId, params.strategyParametersMaxBinId, params.strategyParametersStrategyType, params.strategyParametersParameters, params.userTokenXAmount, params.userTokenYAmount)
1127
1208
  .accounts({
1128
1209
  farm: addresses_1.USDC_FARM,
1129
1210
  userPda,
@@ -1150,7 +1231,8 @@ class MeteoraDlmmIxGenerator {
1150
1231
  // Patch binArrayBitmapExtension writable flag: writable only when it's a real PDA, not the program ID placeholder
1151
1232
  const bitmapKey = ix.keys.find(k => k.pubkey.equals(params.binArrayBitmapExtension));
1152
1233
  if (bitmapKey) {
1153
- bitmapKey.isWritable = !params.binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
1234
+ bitmapKey.isWritable =
1235
+ !params.binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
1154
1236
  }
1155
1237
  return yield this.ix.iyfMain.iyfExtensionExecute(connection, {
1156
1238
  userWallet: params.userWallet,
@@ -1200,8 +1282,10 @@ class MeteoraDlmmIxGenerator {
1200
1282
  // Derive bin array bitmap extension
1201
1283
  const lowerBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(params.strategyParametersMinBinId));
1202
1284
  const upperBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(params.strategyParametersMaxBinId));
1203
- const binArrayBitmapExtension = (this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
1204
- this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)) ? this.pda.meteora.deriveBinArrayBitmapExtension(params.lbPair) : METEORA_DLMM_PROGRAM;
1285
+ const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
1286
+ this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)
1287
+ ? this.pda.meteora.deriveBinArrayBitmapExtension(params.lbPair)
1288
+ : METEORA_DLMM_PROGRAM;
1205
1289
  // Serialize RemainingAccountsInfo as Vec<u8> (Borsh format)
1206
1290
  // This is passed directly to the on-chain instruction which forwards it to Meteora
1207
1291
  // For SPL tokens (non-Token2022), we still need to provide the slices structure with length=0
@@ -1233,8 +1317,8 @@ class MeteoraDlmmIxGenerator {
1233
1317
  ];
1234
1318
  // Use Anchor to serialize the instruction (ensures proper Borsh serialization)
1235
1319
  // @ts-ignore
1236
- const depositIx = yield anchor_1.Anchor.instance().iyfExtension.methods
1237
- .meteoraDlmmDeposit2Automation((_e = params.userTokenXAmount) !== null && _e !== void 0 ? _e : null, // Option<u64>
1320
+ const depositIx = yield anchor_1.Anchor.instance()
1321
+ .iyfExtension.methods.meteoraDlmmDeposit2Automation((_e = params.userTokenXAmount) !== null && _e !== void 0 ? _e : null, // Option<u64>
1238
1322
  (_f = params.userTokenYAmount) !== null && _f !== void 0 ? _f : null, // Option<u64>
1239
1323
  params.activeId, params.maxActiveBinSlippage, params.strategyParametersMinBinId, params.strategyParametersMaxBinId, params.strategyParametersStrategyType, params.strategyParametersParameters, Buffer.from(remainingAccountsInfoSerialized))
1240
1324
  .accounts({
@@ -1260,16 +1344,17 @@ class MeteoraDlmmIxGenerator {
1260
1344
  // Patch binArrayBitmapExtension writable flag: writable only when it's a real PDA, not the program ID placeholder
1261
1345
  const bitmapKey = depositIx.keys.find(k => k.pubkey.equals(binArrayBitmapExtension));
1262
1346
  if (bitmapKey) {
1263
- bitmapKey.isWritable = !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
1347
+ bitmapKey.isWritable =
1348
+ !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM);
1264
1349
  }
1265
1350
  // Override sighash: Anchor's TypeScript client generates a different sighash than what
1266
1351
  // the on-chain program expects. We need to manually set the correct sighash.
1267
- const sighash = util.sighash("meteora_dlmm_deposit_2_automation");
1352
+ const sighash = util.sighash('meteora_dlmm_deposit_2_automation');
1268
1353
  depositIx.data.set(sighash, 0);
1269
1354
  // Generate instruction via IYF Main ExecuteV2
1270
1355
  // @ts-ignore
1271
- const ix = yield anchor_1.Anchor.instance().iyfMain.methods
1272
- .iyfExtensionExecuteV2(depositIx.data)
1356
+ const ix = yield anchor_1.Anchor.instance()
1357
+ .iyfMain.methods.iyfExtensionExecuteV2(depositIx.data)
1273
1358
  .accounts({
1274
1359
  userPda,
1275
1360
  authority: addresses_1.HS_AUTHORITY,
@@ -1329,24 +1414,30 @@ class MeteoraDlmmIxGenerator {
1329
1414
  const userPda = (0, functions_1.generateUserPda)(userWallet);
1330
1415
  // Optional fuel account - use userPda as placeholder if not using fuel account
1331
1416
  // (userPda is already writable, while System Program cannot be writable)
1332
- const fuelAccount = useFuelAccount ? (0, functions_1.generateFuelAccount)(userWallet) : userPda;
1417
+ const fuelAccount = useFuelAccount
1418
+ ? (0, functions_1.generateFuelAccount)(userWallet)
1419
+ : userPda;
1333
1420
  // Generate instruction via IYF Extension
1334
1421
  return this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
1335
1422
  userPda,
1336
1423
  authority: addresses_1.HS_AUTHORITY,
1337
1424
  ix: new web3.TransactionInstruction({
1338
- data: Buffer.from(util.sighash("meteora_dlmm_close_position_automation_v2", undefined, true)),
1425
+ data: Buffer.from(util.sighash('meteora_dlmm_close_position_automation_v2', undefined, true)),
1339
1426
  keys: [
1340
1427
  { pubkey: userPda, isSigner: false, isWritable: false },
1341
1428
  { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: true },
1342
1429
  { pubkey: position, isSigner: false, isWritable: true },
1343
1430
  { pubkey: lbPair, isSigner: false, isWritable: true },
1344
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
1431
+ {
1432
+ pubkey: METEORA_EVENT_AUTHORITY,
1433
+ isSigner: false,
1434
+ isWritable: false,
1435
+ },
1345
1436
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
1346
1437
  { pubkey: fuelAccount, isSigner: false, isWritable: true },
1347
1438
  ],
1348
1439
  programId: addresses_1.IYF_EXTENSION,
1349
- })
1440
+ }),
1350
1441
  });
1351
1442
  });
1352
1443
  }
@@ -1383,7 +1474,7 @@ class MeteoraDlmmIxGenerator {
1383
1474
  console.log('dlmm method called with:', {
1384
1475
  connection: connection ? 'valid' : 'undefined',
1385
1476
  poolAddress: poolAddress.toString(),
1386
- ix: this.ix ? 'valid' : 'undefined'
1477
+ ix: this.ix ? 'valid' : 'undefined',
1387
1478
  });
1388
1479
  if (!connection) {
1389
1480
  throw new Error('Connection is undefined in dlmm method');
@@ -1410,9 +1501,8 @@ class MeteoraDlmmIxGenerator {
1410
1501
  const { ownerFeeX, ownerFeeY } = (0, functions_1.generateHawksightFeeAccounts)(tokenXMint, tokenYMint, tokenXProgram, tokenYProgram);
1411
1502
  // Create instruction
1412
1503
  // @ts-ignore
1413
- const limitOrderCloseV2Ix = yield anchor_1.Anchor.instance().iyfExtension
1414
- .methods
1415
- .limitOrderClose2(param, minBinId, maxBinId)
1504
+ const limitOrderCloseV2Ix = yield anchor_1.Anchor.instance()
1505
+ .iyfExtension.methods.limitOrderClose2(param, minBinId, maxBinId)
1416
1506
  .accounts({
1417
1507
  userPda,
1418
1508
  hawksightAuthority: addresses_1.HS_AUTHORITY,
@@ -1437,11 +1527,17 @@ class MeteoraDlmmIxGenerator {
1437
1527
  meteoraDlmmProgram: METEORA_DLMM_PROGRAM,
1438
1528
  ownerFeeX,
1439
1529
  ownerFeeY,
1440
- fuelAccount: useFuelAccount ? (0, functions_1.generateFuelAccount)(userWallet) : web3.SystemProgram.programId,
1530
+ fuelAccount: useFuelAccount
1531
+ ? (0, functions_1.generateFuelAccount)(userWallet)
1532
+ : web3.SystemProgram.programId,
1441
1533
  })
1442
- .remainingAccounts(binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true })))
1534
+ .remainingAccounts(binArrays.map(pubkey => ({
1535
+ pubkey,
1536
+ isSigner: false,
1537
+ isWritable: true,
1538
+ })))
1443
1539
  .instruction();
1444
- const sighash = util.sighash("limit_order_close_2", undefined, true);
1540
+ const sighash = util.sighash('limit_order_close_2', undefined, true);
1445
1541
  limitOrderCloseV2Ix.data.set(sighash, 0);
1446
1542
  // Return the instruction directly (no wrapper needed for Meteora IX Generator)
1447
1543
  return limitOrderCloseV2Ix;
@@ -1474,9 +1570,8 @@ class MeteoraDlmmIxGenerator {
1474
1570
  const { ownerFeeX, ownerFeeY } = (0, functions_1.generateHawksightFeeAccounts)(tokenXMint, tokenYMint, tokenXProgram, tokenYProgram);
1475
1571
  // Create instruction
1476
1572
  // @ts-ignore
1477
- const meteoraDlmmLimitCloseAutomationV2Ix = yield anchor_1.Anchor.instance().iyfExtension
1478
- .methods
1479
- .meteoraDlmmLimitCloseAutomationV2(param, minBinId, maxBinId, isHawkRefund)
1573
+ const meteoraDlmmLimitCloseAutomationV2Ix = yield anchor_1.Anchor.instance()
1574
+ .iyfExtension.methods.meteoraDlmmLimitCloseAutomationV2(param, minBinId, maxBinId, isHawkRefund)
1480
1575
  .accounts({
1481
1576
  userPda,
1482
1577
  hawksightAuthority,
@@ -1497,9 +1592,15 @@ class MeteoraDlmmIxGenerator {
1497
1592
  meteoraDlmmProgram: METEORA_DLMM_PROGRAM,
1498
1593
  ownerFeeX,
1499
1594
  ownerFeeY,
1500
- fuelAccount: useFuelAccount ? (0, functions_1.generateFuelAccount)(userWallet) : web3.SystemProgram.programId,
1595
+ fuelAccount: useFuelAccount
1596
+ ? (0, functions_1.generateFuelAccount)(userWallet)
1597
+ : web3.SystemProgram.programId,
1501
1598
  })
1502
- .remainingAccounts(binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true })))
1599
+ .remainingAccounts(binArrays.map(pubkey => ({
1600
+ pubkey,
1601
+ isSigner: false,
1602
+ isWritable: true,
1603
+ })))
1503
1604
  .instruction();
1504
1605
  // Return the instruction directly (no wrapper needed for Meteora IX Generator)
1505
1606
  return meteoraDlmmLimitCloseAutomationV2Ix;
@@ -1512,7 +1613,7 @@ class MeteoraDlmmIxGenerator {
1512
1613
  * @returns
1513
1614
  */
1514
1615
  initializeLbPair2Raw(_a) {
1515
- return __awaiter(this, arguments, void 0, function* ({ connection, funder, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, presetParameter, activeId }) {
1616
+ return __awaiter(this, arguments, void 0, function* ({ connection, funder, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, presetParameter, activeId, }) {
1516
1617
  // Initialize anchor
1517
1618
  anchor_1.Anchor.initialize(connection);
1518
1619
  const tokenX = tokenMintX;
@@ -1522,10 +1623,12 @@ class MeteoraDlmmIxGenerator {
1522
1623
  const reserveY = this.pda.meteora.deriveReserve(tokenY, lbPair);
1523
1624
  const oracle = this.pda.meteora.deriveOracle(lbPair);
1524
1625
  const activeBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(activeId));
1525
- const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(activeBinArrayIndex) ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair) : METEORA_DLMM_PROGRAM;
1626
+ const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(activeBinArrayIndex)
1627
+ ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair)
1628
+ : METEORA_DLMM_PROGRAM;
1526
1629
  return new web3.TransactionInstruction({
1527
1630
  data: Buffer.concat([
1528
- Buffer.from(util.sighash("initialize_lb_pair_2")),
1631
+ Buffer.from(util.sighash('initialize_lb_pair_2')),
1529
1632
  Buffer.from([activeId]),
1530
1633
  Buffer.from(Array(96).fill(0)),
1531
1634
  ]),
@@ -1534,7 +1637,11 @@ class MeteoraDlmmIxGenerator {
1534
1637
  { pubkey: lbPair, isSigner: false, isWritable: true },
1535
1638
  { pubkey: reserveX, isSigner: false, isWritable: true },
1536
1639
  { pubkey: reserveY, isSigner: false, isWritable: true },
1537
- { pubkey: binArrayBitmapExtension, isSigner: false, isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM) },
1640
+ {
1641
+ pubkey: binArrayBitmapExtension,
1642
+ isSigner: false,
1643
+ isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM),
1644
+ },
1538
1645
  { pubkey: tokenMintX, isSigner: false, isWritable: false },
1539
1646
  { pubkey: tokenMintY, isSigner: false, isWritable: false },
1540
1647
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
@@ -1549,7 +1656,7 @@ class MeteoraDlmmIxGenerator {
1549
1656
  }
1550
1657
  isOverflowDefaultBinArrayBitmap(binArrayIndex) {
1551
1658
  const [minBinArrayIndex, maxBinArrayIndex] = this.internalBitmapRange();
1552
- return binArrayIndex.gt(maxBinArrayIndex) || binArrayIndex.lt(minBinArrayIndex);
1659
+ return (binArrayIndex.gt(maxBinArrayIndex) || binArrayIndex.lt(minBinArrayIndex));
1553
1660
  }
1554
1661
  internalBitmapRange() {
1555
1662
  const lowerBinArrayIndex = new bn_js_1.default(512).neg();
@@ -1561,7 +1668,7 @@ class MeteoraDlmmIxGenerator {
1561
1668
  return binId.isNeg() && !mod.isZero() ? idx.sub(new bn_js_1.default(1)) : idx;
1562
1669
  }
1563
1670
  meteoraDlmmCreatePoolAndPosition(_a) {
1564
- return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, position, presetParameter, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, activeId, lowerBinId, upperBinId, strategyType, binStep, baseFactor, baseFeePowerFactor }) {
1671
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, position, presetParameter, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, activeId, lowerBinId, upperBinId, strategyType, binStep, baseFactor, baseFeePowerFactor, }) {
1565
1672
  // Initialize anchor
1566
1673
  anchor_1.Anchor.initialize(connection);
1567
1674
  const userPda = (0, functions_1.generateUserPda)(userWallet);
@@ -1586,10 +1693,10 @@ class MeteoraDlmmIxGenerator {
1586
1693
  const hawkfiPayer = this.pda.hawksight.generateHawkfiPayer();
1587
1694
  return new web3.TransactionInstruction({
1588
1695
  data: Buffer.concat([
1589
- Buffer.from(util.sighash("meteora_dlmm_create_pool_and_position")),
1590
- new bn_js_1.default(activeId).toTwos(32).toArrayLike(Buffer, "le", 4),
1591
- new bn_js_1.default(lowerBinId).toTwos(32).toArrayLike(Buffer, "le", 4),
1592
- new bn_js_1.default(upperBinId).toTwos(32).toArrayLike(Buffer, "le", 4),
1696
+ Buffer.from(util.sighash('meteora_dlmm_create_pool_and_position')),
1697
+ new bn_js_1.default(activeId).toTwos(32).toArrayLike(Buffer, 'le', 4),
1698
+ new bn_js_1.default(lowerBinId).toTwos(32).toArrayLike(Buffer, 'le', 4),
1699
+ new bn_js_1.default(upperBinId).toTwos(32).toArrayLike(Buffer, 'le', 4),
1593
1700
  Buffer.from([strategyType]),
1594
1701
  ]),
1595
1702
  keys: [
@@ -1610,12 +1717,20 @@ class MeteoraDlmmIxGenerator {
1610
1717
  { pubkey: tokenProgramY, isSigner: false, isWritable: false },
1611
1718
  { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
1612
1719
  { pubkey: web3.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
1613
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false },
1720
+ {
1721
+ pubkey: web3.SystemProgram.programId,
1722
+ isSigner: false,
1723
+ isWritable: false,
1724
+ },
1614
1725
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
1615
1726
  ...(() => {
1616
1727
  const binArrays = meteora_1.MeteoraFunctions.findMeteoraTickArrays(lbPair, lowerBinId, upperBinId);
1617
- return binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true }));
1618
- })()
1728
+ return binArrays.map(pubkey => ({
1729
+ pubkey,
1730
+ isSigner: false,
1731
+ isWritable: true,
1732
+ }));
1733
+ })(),
1619
1734
  ],
1620
1735
  programId: addresses_1.IYF_MAIN,
1621
1736
  });
@@ -1631,21 +1746,29 @@ class MeteoraDlmmIxGenerator {
1631
1746
  const hawkfiPayer = this.pda.hawksight.generateHawkfiPayer();
1632
1747
  return new web3.TransactionInstruction({
1633
1748
  data: Buffer.concat([
1634
- Buffer.from(util.sighash("meteora_dlmm_init_bin_arrays")),
1635
- new bn_js_1.default(lowerBinId).toTwos(32).toArrayLike(Buffer, "le", 4),
1636
- new bn_js_1.default(upperBinId).toTwos(32).toArrayLike(Buffer, "le", 4),
1749
+ Buffer.from(util.sighash('meteora_dlmm_init_bin_arrays')),
1750
+ new bn_js_1.default(lowerBinId).toTwos(32).toArrayLike(Buffer, 'le', 4),
1751
+ new bn_js_1.default(upperBinId).toTwos(32).toArrayLike(Buffer, 'le', 4),
1637
1752
  ]),
1638
1753
  keys: [
1639
1754
  { pubkey: userPda, isSigner: false, isWritable: false },
1640
1755
  { pubkey: userWallet, isSigner: true, isWritable: true },
1641
1756
  { pubkey: hawkfiPayer, isSigner: false, isWritable: true },
1642
1757
  { pubkey: lbPair, isSigner: false, isWritable: true },
1643
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false },
1758
+ {
1759
+ pubkey: web3.SystemProgram.programId,
1760
+ isSigner: false,
1761
+ isWritable: false,
1762
+ },
1644
1763
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
1645
1764
  ...(() => {
1646
1765
  const binArrays = meteora_1.MeteoraFunctions.findMeteoraTickArrays(lbPair, lowerBinId, upperBinId);
1647
- return binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true }));
1648
- })()
1766
+ return binArrays.map(pubkey => ({
1767
+ pubkey,
1768
+ isSigner: false,
1769
+ isWritable: true,
1770
+ }));
1771
+ })(),
1649
1772
  ],
1650
1773
  programId: addresses_1.IYF_MAIN,
1651
1774
  });
@@ -1675,8 +1798,8 @@ class MeteoraDlmmIxGenerator {
1675
1798
  const index = tickIndices[i] !== undefined ? tickIndices[i] : upperTickIndex;
1676
1799
  return new web3.TransactionInstruction({
1677
1800
  data: Buffer.concat([
1678
- Buffer.from(util.sighash("initialize_bin_array")),
1679
- new bn_js_1.default(index).toTwos(64).toArrayLike(Buffer, "le", 8),
1801
+ Buffer.from(util.sighash('initialize_bin_array')),
1802
+ new bn_js_1.default(index).toTwos(64).toArrayLike(Buffer, 'le', 8),
1680
1803
  ]),
1681
1804
  keys: [
1682
1805
  { pubkey: lbPair, isSigner: false, isWritable: false },
@@ -1726,7 +1849,7 @@ class MeteoraDlmmIxGenerator {
1726
1849
  * @returns TransactionInstruction for initializing the position
1727
1850
  */
1728
1851
  increasePositionLength(_a) {
1729
- return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, lengthToAdd, side }) {
1852
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, lengthToAdd, side, }) {
1730
1853
  // Initialize anchor
1731
1854
  anchor_1.Anchor.initialize(connection);
1732
1855
  // Generate user PDA
@@ -1740,7 +1863,7 @@ class MeteoraDlmmIxGenerator {
1740
1863
  // meteoraDynamicCpi will prepend userPda and authority
1741
1864
  const meteoraIx = new web3.TransactionInstruction({
1742
1865
  data: Buffer.concat([
1743
- Buffer.from(util.sighash("increase_position_length")),
1866
+ Buffer.from(util.sighash('increase_position_length')),
1744
1867
  lengthToAddBuffer,
1745
1868
  sideBuffer,
1746
1869
  ]),
@@ -1749,7 +1872,11 @@ class MeteoraDlmmIxGenerator {
1749
1872
  { pubkey: lbPair, isSigner: false, isWritable: false }, // lbPair
1750
1873
  { pubkey: position, isSigner: true, isWritable: true }, // position (Mutable, Signer)
1751
1874
  { pubkey: userPda, isSigner: false, isWritable: false }, // owner (Signer - signed by IYF Main)
1752
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false }, // systemProgram (required for realloc)
1875
+ {
1876
+ pubkey: web3.SystemProgram.programId,
1877
+ isSigner: false,
1878
+ isWritable: false,
1879
+ }, // systemProgram (required for realloc)
1753
1880
  { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false }, // eventAuthority (PDA)
1754
1881
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false }, // Meteora DLMM program
1755
1882
  ],
@@ -1763,7 +1890,7 @@ class MeteoraDlmmIxGenerator {
1763
1890
  });
1764
1891
  }
1765
1892
  increasePositionLengthAutomation(_a) {
1766
- return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, lengthToAdd, side, useFuelAccount }) {
1893
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, lengthToAdd, side, useFuelAccount, }) {
1767
1894
  // Initialize anchor
1768
1895
  anchor_1.Anchor.initialize(connection);
1769
1896
  // Generate user PDA
@@ -1773,14 +1900,16 @@ class MeteoraDlmmIxGenerator {
1773
1900
  lengthToAddBuffer.writeUInt16LE(lengthToAdd, 0);
1774
1901
  const sideBuffer = Buffer.alloc(1);
1775
1902
  sideBuffer.writeUInt8(side, 0);
1776
- const fuelAccount = useFuelAccount ? (0, functions_1.generateFuelAccount)(userWallet) : web3.SystemProgram.programId;
1903
+ const fuelAccount = useFuelAccount
1904
+ ? (0, functions_1.generateFuelAccount)(userWallet)
1905
+ : web3.SystemProgram.programId;
1777
1906
  // Generate instruction
1778
1907
  return this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
1779
1908
  userPda,
1780
1909
  authority: addresses_1.HS_AUTHORITY,
1781
1910
  ix: new web3.TransactionInstruction({
1782
1911
  data: Buffer.concat([
1783
- Buffer.from(util.sighash("meteora_dlmm_increase_position_length_automation")),
1912
+ Buffer.from(util.sighash('meteora_dlmm_increase_position_length_automation')),
1784
1913
  lengthToAddBuffer,
1785
1914
  sideBuffer,
1786
1915
  ]),
@@ -1789,13 +1918,25 @@ class MeteoraDlmmIxGenerator {
1789
1918
  { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: true },
1790
1919
  { pubkey: lbPair, isSigner: false, isWritable: false },
1791
1920
  { pubkey: position, isSigner: false, isWritable: true },
1792
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
1793
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false },
1921
+ {
1922
+ pubkey: METEORA_EVENT_AUTHORITY,
1923
+ isSigner: false,
1924
+ isWritable: false,
1925
+ },
1926
+ {
1927
+ pubkey: web3.SystemProgram.programId,
1928
+ isSigner: false,
1929
+ isWritable: false,
1930
+ },
1794
1931
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
1795
- { pubkey: fuelAccount, isSigner: false, isWritable: useFuelAccount !== null && useFuelAccount !== void 0 ? useFuelAccount : false },
1932
+ {
1933
+ pubkey: fuelAccount,
1934
+ isSigner: false,
1935
+ isWritable: useFuelAccount !== null && useFuelAccount !== void 0 ? useFuelAccount : false,
1936
+ },
1796
1937
  ],
1797
1938
  programId: addresses_1.IYF_EXTENSION,
1798
- })
1939
+ }),
1799
1940
  });
1800
1941
  });
1801
1942
  }
@@ -1836,8 +1977,10 @@ class MeteoraDlmmIxGenerator {
1836
1977
  // Derive bin array bitmap extension
1837
1978
  const lowerBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(activeId + addLiquidityParams[0].minDeltaId));
1838
1979
  const upperBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(activeId + addLiquidityParams[0].maxDeltaId));
1839
- const binArrayBitmapExtension = (this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
1840
- this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)) ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair) : METEORA_DLMM_PROGRAM;
1980
+ const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
1981
+ this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)
1982
+ ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair)
1983
+ : METEORA_DLMM_PROGRAM;
1841
1984
  // Derive reserves
1842
1985
  const reserveX = this.pda.meteora.deriveReserve(tokenXMint, lbPair);
1843
1986
  const reserveY = this.pda.meteora.deriveReserve(tokenYMint, lbPair);
@@ -1860,10 +2003,12 @@ class MeteoraDlmmIxGenerator {
1860
2003
  addLiquidityParams,
1861
2004
  });
1862
2005
  // Serialize RemainingAccountsInfo (default empty for now - no transfer hooks)
1863
- const remainingAccountsInfo = this.serializeRemainingAccountsInfo({ slices: [] });
2006
+ const remainingAccountsInfo = this.serializeRemainingAccountsInfo({
2007
+ slices: [],
2008
+ });
1864
2009
  // Build instruction data: sighash + RebalanceLiquidityParams + RemainingAccountsInfo
1865
2010
  const instructionData = Buffer.concat([
1866
- Buffer.from(util.sighash("rebalance_liquidity")),
2011
+ Buffer.from(util.sighash('rebalance_liquidity')),
1867
2012
  rebalanceParamsData,
1868
2013
  remainingAccountsInfo,
1869
2014
  ]);
@@ -1873,7 +2018,11 @@ class MeteoraDlmmIxGenerator {
1873
2018
  keys: [
1874
2019
  { pubkey: position, isSigner: false, isWritable: true }, // position (Mutable)
1875
2020
  { pubkey: lbPair, isSigner: false, isWritable: true }, // lbPair (Mutable)
1876
- { pubkey: binArrayBitmapExtension, isSigner: false, isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM) }, // binArrayBitmapExtension
2021
+ {
2022
+ pubkey: binArrayBitmapExtension,
2023
+ isSigner: false,
2024
+ isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM),
2025
+ }, // binArrayBitmapExtension
1877
2026
  { pubkey: userTokenX, isSigner: false, isWritable: true }, // userTokenX (Mutable)
1878
2027
  { pubkey: userTokenY, isSigner: false, isWritable: true }, // userTokenY (Mutable)
1879
2028
  { pubkey: reserveX, isSigner: false, isWritable: true }, // reserveX (Mutable)
@@ -1885,11 +2034,19 @@ class MeteoraDlmmIxGenerator {
1885
2034
  { pubkey: tokenXProgram, isSigner: false, isWritable: false }, // tokenXProgram
1886
2035
  { pubkey: tokenYProgram, isSigner: false, isWritable: false }, // tokenYProgram
1887
2036
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false }, // memoProgram
1888
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false }, // systemProgram
2037
+ {
2038
+ pubkey: web3.SystemProgram.programId,
2039
+ isSigner: false,
2040
+ isWritable: false,
2041
+ }, // systemProgram
1889
2042
  { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false }, // eventAuthority
1890
2043
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false }, // program
1891
2044
  // Bin arrays as remaining accounts
1892
- ...binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true })),
2045
+ ...binArrays.map(pubkey => ({
2046
+ pubkey,
2047
+ isSigner: false,
2048
+ isWritable: true,
2049
+ })),
1893
2050
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false }, // program
1894
2051
  ],
1895
2052
  programId: METEORA_DLMM_PROGRAM,
@@ -2058,8 +2215,10 @@ class MeteoraDlmmIxGenerator {
2058
2215
  // Derive bin array bitmap extension
2059
2216
  const lowerBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(fromBinId));
2060
2217
  const upperBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(toBinId));
2061
- const binArrayBitmapExtension = (this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
2062
- this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)) ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair) : METEORA_DLMM_PROGRAM;
2218
+ const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
2219
+ this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)
2220
+ ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair)
2221
+ : METEORA_DLMM_PROGRAM;
2063
2222
  // Derive reserves
2064
2223
  const reserveX = this.pda.meteora.deriveReserve(tokenXMint, lbPair);
2065
2224
  const reserveY = this.pda.meteora.deriveReserve(tokenYMint, lbPair);
@@ -2079,7 +2238,7 @@ class MeteoraDlmmIxGenerator {
2079
2238
  slices: (_b = remainingAccountsInfoParam === null || remainingAccountsInfoParam === void 0 ? void 0 : remainingAccountsInfoParam.slices) !== null && _b !== void 0 ? _b : [],
2080
2239
  });
2081
2240
  const instructionData = Buffer.concat([
2082
- Buffer.from(util.sighash("remove_liquidity_by_range2", undefined, true)),
2241
+ Buffer.from(util.sighash('remove_liquidity_by_range2', undefined, true)),
2083
2242
  fromBinIdBuffer,
2084
2243
  toBinIdBuffer,
2085
2244
  bpsToRemoveBuffer,
@@ -2094,7 +2253,11 @@ class MeteoraDlmmIxGenerator {
2094
2253
  keys: [
2095
2254
  { pubkey: position, isSigner: false, isWritable: true }, // position (Mutable)
2096
2255
  { pubkey: lbPair, isSigner: false, isWritable: true }, // lbPair (Mutable)
2097
- { pubkey: binArrayBitmapExtension, isSigner: false, isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM) }, // binArrayBitmapExtension (optional, writable when real PDA)
2256
+ {
2257
+ pubkey: binArrayBitmapExtension,
2258
+ isSigner: false,
2259
+ isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM),
2260
+ }, // binArrayBitmapExtension (optional, writable when real PDA)
2098
2261
  { pubkey: userTokenX, isSigner: false, isWritable: true }, // userTokenX (Mutable)
2099
2262
  { pubkey: userTokenY, isSigner: false, isWritable: true }, // userTokenY (Mutable)
2100
2263
  { pubkey: reserveX, isSigner: false, isWritable: true }, // reserveX (Mutable)
@@ -2108,7 +2271,11 @@ class MeteoraDlmmIxGenerator {
2108
2271
  { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false }, // eventAuthority
2109
2272
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false }, // program
2110
2273
  // Bin arrays as remaining accounts
2111
- ...binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true })),
2274
+ ...binArrays.map(pubkey => ({
2275
+ pubkey,
2276
+ isSigner: false,
2277
+ isWritable: true,
2278
+ })),
2112
2279
  // Transfer hook accounts (if any) - order must match slices order
2113
2280
  ...((_c = remainingAccountsInfoParam === null || remainingAccountsInfoParam === void 0 ? void 0 : remainingAccountsInfoParam.accounts) !== null && _c !== void 0 ? _c : []),
2114
2281
  ],
@@ -2137,7 +2304,7 @@ class MeteoraDlmmIxGenerator {
2137
2304
  // Generate user PDA
2138
2305
  const userPda = (0, functions_1.generateUserPda)(userWallet);
2139
2306
  // Build instruction data: sighash only (no args)
2140
- const instructionData = Buffer.from(util.sighash("close_position2", undefined, true));
2307
+ const instructionData = Buffer.from(util.sighash('close_position2', undefined, true));
2141
2308
  // Build raw Meteora instruction
2142
2309
  // Account order from IDL: position, sender, rentReceiver, eventAuthority, program
2143
2310
  const meteoraIx = new web3.TransactionInstruction({
@@ -2175,7 +2342,7 @@ class MeteoraDlmmIxGenerator {
2175
2342
  // Generate user PDA
2176
2343
  const userPda = (0, functions_1.generateUserPda)(userWallet);
2177
2344
  // Build instruction data: sighash only (no args)
2178
- const instructionData = Buffer.from(util.sighash("close_position_if_empty"));
2345
+ const instructionData = Buffer.from(util.sighash('close_position_if_empty'));
2179
2346
  // Build raw Meteora instruction
2180
2347
  // Account order from IDL: position, sender, rentReceiver, eventAuthority, program
2181
2348
  const meteoraIx = new web3.TransactionInstruction({
@@ -2254,8 +2421,10 @@ class MeteoraDlmmIxGenerator {
2254
2421
  // Derive bin array bitmap extension
2255
2422
  const lowerBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(minBinId));
2256
2423
  const upperBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(maxBinId));
2257
- const binArrayBitmapExtension = (this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
2258
- this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)) ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair) : METEORA_DLMM_PROGRAM;
2424
+ const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
2425
+ this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)
2426
+ ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair)
2427
+ : METEORA_DLMM_PROGRAM;
2259
2428
  // Derive reserves
2260
2429
  const reserveX = this.pda.meteora.deriveReserve(tokenXMint, lbPair);
2261
2430
  const reserveY = this.pda.meteora.deriveReserve(tokenYMint, lbPair);
@@ -2272,7 +2441,11 @@ class MeteoraDlmmIxGenerator {
2272
2441
  let userRewardToken = (0, functions_1.generateUserPdaStorageAccount)(userPda, reward.rewardMint);
2273
2442
  console.log(`[rebalanceLiquidityAutomation] Reward: vault=${reward.rewardVault.toString()}, userToken=${userRewardToken.toString()}, mint=${reward.rewardMint.toString()}, program=${reward.rewardTokenProgram.toString()}`);
2274
2443
  // Add reward accounts in order: vault, userToken, mint, tokenProgram
2275
- rewardRemainingAccounts.push({ pubkey: reward.rewardVault, isSigner: false, isWritable: true }, { pubkey: userRewardToken, isSigner: false, isWritable: true }, { pubkey: reward.rewardMint, isSigner: false, isWritable: false }, { pubkey: reward.rewardTokenProgram, isSigner: false, isWritable: false });
2444
+ rewardRemainingAccounts.push({ pubkey: reward.rewardVault, isSigner: false, isWritable: true }, { pubkey: userRewardToken, isSigner: false, isWritable: true }, { pubkey: reward.rewardMint, isSigner: false, isWritable: false }, {
2445
+ pubkey: reward.rewardTokenProgram,
2446
+ isSigner: false,
2447
+ isWritable: false,
2448
+ });
2276
2449
  }
2277
2450
  console.log(`[rebalanceLiquidityAutomation] Total reward remaining accounts: ${rewardRemainingAccounts.length}`);
2278
2451
  }
@@ -2300,7 +2473,7 @@ class MeteoraDlmmIxGenerator {
2300
2473
  // Build instruction data: sighash + RebalanceLiquidityParams + RemainingAccountsInfo
2301
2474
  // The handler takes two typed Anchor args (not Vec<u8>), so no length prefix needed.
2302
2475
  const instructionData = Buffer.concat([
2303
- Buffer.from(util.sighash("meteora_dlmm_rebalance_liquidity_automation")),
2476
+ Buffer.from(util.sighash('meteora_dlmm_rebalance_liquidity_automation')),
2304
2477
  rebalanceParamsData,
2305
2478
  serializedRemainingAccountsInfo,
2306
2479
  ]);
@@ -2315,7 +2488,11 @@ class MeteoraDlmmIxGenerator {
2315
2488
  { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: true },
2316
2489
  { pubkey: position, isSigner: false, isWritable: true },
2317
2490
  { pubkey: lbPair, isSigner: false, isWritable: true },
2318
- { pubkey: binArrayBitmapExtension, isSigner: false, isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM) },
2491
+ {
2492
+ pubkey: binArrayBitmapExtension,
2493
+ isSigner: false,
2494
+ isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM),
2495
+ },
2319
2496
  { pubkey: userTokenX, isSigner: false, isWritable: true },
2320
2497
  { pubkey: userTokenY, isSigner: false, isWritable: true },
2321
2498
  { pubkey: reserveX, isSigner: false, isWritable: true },
@@ -2325,20 +2502,32 @@ class MeteoraDlmmIxGenerator {
2325
2502
  { pubkey: tokenXProgram, isSigner: false, isWritable: false },
2326
2503
  { pubkey: tokenYProgram, isSigner: false, isWritable: false },
2327
2504
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
2328
- { pubkey: web3.SystemProgram.programId, isSigner: false, isWritable: false },
2329
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
2505
+ {
2506
+ pubkey: web3.SystemProgram.programId,
2507
+ isSigner: false,
2508
+ isWritable: false,
2509
+ },
2510
+ {
2511
+ pubkey: METEORA_EVENT_AUTHORITY,
2512
+ isSigner: false,
2513
+ isWritable: false,
2514
+ },
2330
2515
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
2331
2516
  // Transfer hook accounts (from fetchRemainingAccountsInfo)
2332
2517
  ...((_c = remainingAccountsInfo === null || remainingAccountsInfo === void 0 ? void 0 : remainingAccountsInfo.accounts) !== null && _c !== void 0 ? _c : []),
2333
2518
  // Bin arrays as remaining accounts
2334
- ...binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true })),
2519
+ ...binArrays.map(pubkey => ({
2520
+ pubkey,
2521
+ isSigner: false,
2522
+ isWritable: true,
2523
+ })),
2335
2524
  // Boundary account
2336
2525
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
2337
2526
  // Reward accounts after boundary account
2338
2527
  ...rewardRemainingAccounts,
2339
2528
  ],
2340
2529
  programId: addresses_1.IYF_EXTENSION,
2341
- })
2530
+ }),
2342
2531
  });
2343
2532
  });
2344
2533
  }
@@ -2377,8 +2566,10 @@ class MeteoraDlmmIxGenerator {
2377
2566
  // Derive bin array bitmap extension
2378
2567
  const lowerBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(fromBinId));
2379
2568
  const upperBinArrayIndex = this.binIdToBinArrayIndex(new bn_js_1.default(toBinId));
2380
- const binArrayBitmapExtension = (this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
2381
- this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)) ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair) : METEORA_DLMM_PROGRAM;
2569
+ const binArrayBitmapExtension = this.isOverflowDefaultBinArrayBitmap(lowerBinArrayIndex) ||
2570
+ this.isOverflowDefaultBinArrayBitmap(upperBinArrayIndex)
2571
+ ? this.pda.meteora.deriveBinArrayBitmapExtension(lbPair)
2572
+ : METEORA_DLMM_PROGRAM;
2382
2573
  // Derive reserves
2383
2574
  const reserveX = this.pda.meteora.deriveReserve(tokenXMint, lbPair);
2384
2575
  const reserveY = this.pda.meteora.deriveReserve(tokenYMint, lbPair);
@@ -2411,7 +2602,7 @@ class MeteoraDlmmIxGenerator {
2411
2602
  authority: addresses_1.HS_AUTHORITY,
2412
2603
  ix: new web3.TransactionInstruction({
2413
2604
  data: Buffer.concat([
2414
- Buffer.from(util.sighash("meteora_dlmm_withdraw_2_automation")),
2605
+ Buffer.from(util.sighash('meteora_dlmm_withdraw_2_automation')),
2415
2606
  instructionDataVec,
2416
2607
  ]),
2417
2608
  keys: [
@@ -2419,7 +2610,11 @@ class MeteoraDlmmIxGenerator {
2419
2610
  { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: true },
2420
2611
  { pubkey: position, isSigner: false, isWritable: true },
2421
2612
  { pubkey: lbPair, isSigner: false, isWritable: true },
2422
- { pubkey: binArrayBitmapExtension, isSigner: false, isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM) },
2613
+ {
2614
+ pubkey: binArrayBitmapExtension,
2615
+ isSigner: false,
2616
+ isWritable: !binArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM),
2617
+ },
2423
2618
  { pubkey: userTokenX, isSigner: false, isWritable: true },
2424
2619
  { pubkey: userTokenY, isSigner: false, isWritable: true },
2425
2620
  { pubkey: reserveX, isSigner: false, isWritable: true },
@@ -2428,16 +2623,185 @@ class MeteoraDlmmIxGenerator {
2428
2623
  { pubkey: tokenYMint, isSigner: false, isWritable: false },
2429
2624
  { pubkey: tokenXProgram, isSigner: false, isWritable: false },
2430
2625
  { pubkey: tokenYProgram, isSigner: false, isWritable: false },
2431
- { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: false },
2626
+ {
2627
+ pubkey: METEORA_EVENT_AUTHORITY,
2628
+ isSigner: false,
2629
+ isWritable: false,
2630
+ },
2432
2631
  { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: false },
2433
2632
  { pubkey: addresses_1.MEMO_PROGRAM, isSigner: false, isWritable: false },
2434
2633
  // Bin arrays as remaining accounts
2435
- ...binArrays.map(pubkey => ({ pubkey, isSigner: false, isWritable: true })),
2634
+ ...binArrays.map(pubkey => ({
2635
+ pubkey,
2636
+ isSigner: false,
2637
+ isWritable: true,
2638
+ })),
2436
2639
  // Transfer hook accounts (if any)
2437
2640
  ...((_c = remainingAccountsInfo === null || remainingAccountsInfo === void 0 ? void 0 : remainingAccountsInfo.accounts) !== null && _c !== void 0 ? _c : []),
2438
2641
  ],
2439
2642
  programId: addresses_1.IYF_EXTENSION,
2440
- })
2643
+ }),
2644
+ });
2645
+ });
2646
+ }
2647
+ addLiquidity2Automation(_a) {
2648
+ return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, lbPair, position, tokenXMint, tokenYMint, tokenXProgram, tokenYProgram, layers, checkRange, userTokenXAmount, userTokenYAmount, chunkLowerOffset, chunkUpperOffset, remainingAccountsInfo, pdaTokenType, lowerBinId, upperBinId, }) {
2649
+ var _b, _c;
2650
+ anchor_1.Anchor.initialize(connection);
2651
+ const reserveX = this.pda.meteora.deriveReserve(tokenXMint, lbPair);
2652
+ const reserveY = this.pda.meteora.deriveReserve(tokenYMint, lbPair);
2653
+ const derivedBinArrayBitmapExtension = this.pda.meteora.deriveBinArrayBitmapExtension(lbPair);
2654
+ const binArrayBitmapExtensionInfo = yield connection.getAccountInfo(derivedBinArrayBitmapExtension);
2655
+ const actualBinArrayBitmapExtension = binArrayBitmapExtensionInfo
2656
+ ? derivedBinArrayBitmapExtension
2657
+ : METEORA_DLMM_PROGRAM;
2658
+ const userPda = (0, functions_1.generateUserPda)(userWallet);
2659
+ let userTokenX;
2660
+ let userTokenY;
2661
+ if (pdaTokenType === types_1.TokenType.LTA) {
2662
+ userTokenX = (0, functions_1.generateLimitToken)(userPda, tokenXMint);
2663
+ userTokenY = (0, functions_1.generateLimitToken)(userPda, tokenYMint);
2664
+ }
2665
+ else if (pdaTokenType === types_1.TokenType.STA) {
2666
+ userTokenX = (0, functions_1.generateUserPdaStorageAccount)(userPda, tokenXMint);
2667
+ userTokenY = (0, functions_1.generateUserPdaStorageAccount)(userPda, tokenYMint);
2668
+ }
2669
+ else {
2670
+ userTokenX = (0, functions_1.generateAta)(userPda, tokenXMint, tokenXProgram);
2671
+ userTokenY = (0, functions_1.generateAta)(userPda, tokenYMint, tokenYProgram);
2672
+ }
2673
+ // --- Serialize instruction data ---
2674
+ const sighash = Buffer.from(util.sighash('meteora_dlmm_add_liquidity_2_automation'));
2675
+ layers.forEach((layer, index) => {
2676
+ const validateByteField = (fieldName, value, maxValue) => {
2677
+ if (!Number.isInteger(value) || value < 0 || value > maxValue) {
2678
+ throw new Error(`layers[${index}].${fieldName} must be an integer between 0 and ${maxValue}`);
2679
+ }
2680
+ };
2681
+ validateByteField('strategyTypeX', layer.strategyTypeX, 255);
2682
+ validateByteField('strategyTypeY', layer.strategyTypeY, 255);
2683
+ validateByteField('percentageX', layer.percentageX, 100);
2684
+ validateByteField('percentageY', layer.percentageY, 100);
2685
+ });
2686
+ // Vec<HybridLayer>: u32 length + 4 u8s per layer
2687
+ const layersLenBuf = Buffer.alloc(4);
2688
+ layersLenBuf.writeUInt32LE(layers.length, 0);
2689
+ const layersBuf = Buffer.concat([
2690
+ layersLenBuf,
2691
+ ...layers.map(l => Buffer.from([
2692
+ l.strategyTypeX,
2693
+ l.strategyTypeY,
2694
+ l.percentageX,
2695
+ l.percentageY,
2696
+ ])),
2697
+ ]);
2698
+ // Option<[i32; 2]> check_range
2699
+ const checkRangeBuf = checkRange
2700
+ ? (() => {
2701
+ const buf = Buffer.alloc(9);
2702
+ buf.writeUInt8(1, 0);
2703
+ buf.writeInt32LE(checkRange.lowerRange, 1);
2704
+ buf.writeInt32LE(checkRange.upperRange, 5);
2705
+ return buf;
2706
+ })()
2707
+ : Buffer.from([0]);
2708
+ // Option<u64> user_token_x_amount
2709
+ const xAmountBuf = userTokenXAmount
2710
+ ? Buffer.concat([
2711
+ Buffer.from([1]),
2712
+ Buffer.from(userTokenXAmount.toArrayLike(Buffer, 'le', 8)),
2713
+ ])
2714
+ : Buffer.from([0]);
2715
+ // Option<u64> user_token_y_amount
2716
+ const yAmountBuf = userTokenYAmount
2717
+ ? Buffer.concat([
2718
+ Buffer.from([1]),
2719
+ Buffer.from(userTokenYAmount.toArrayLike(Buffer, 'le', 8)),
2720
+ ])
2721
+ : Buffer.from([0]);
2722
+ // Option<i32> chunk_lower_offset
2723
+ const chunkLowerBuf = chunkLowerOffset !== undefined
2724
+ ? (() => {
2725
+ const b = Buffer.alloc(5);
2726
+ b.writeUInt8(1, 0);
2727
+ b.writeInt32LE(chunkLowerOffset, 1);
2728
+ return b;
2729
+ })()
2730
+ : Buffer.from([0]);
2731
+ // Option<i32> chunk_upper_offset
2732
+ const chunkUpperBuf = chunkUpperOffset !== undefined
2733
+ ? (() => {
2734
+ const b = Buffer.alloc(5);
2735
+ b.writeUInt8(1, 0);
2736
+ b.writeInt32LE(chunkUpperOffset, 1);
2737
+ return b;
2738
+ })()
2739
+ : Buffer.from([0]);
2740
+ // Vec<u8> remaining_accounts_info — needs u32 Vec length prefix (like depositRelativeAutomation)
2741
+ const defaultSlices = [
2742
+ { accountsType: 0, length: 0 },
2743
+ { accountsType: 1, length: 0 },
2744
+ ];
2745
+ const remainingAccountsInfoSerialized = this.serializeRemainingAccountsInfo({
2746
+ slices: (_b = remainingAccountsInfo === null || remainingAccountsInfo === void 0 ? void 0 : remainingAccountsInfo.slices) !== null && _b !== void 0 ? _b : defaultSlices,
2747
+ });
2748
+ const raiLenBuf = Buffer.alloc(4);
2749
+ raiLenBuf.writeUInt32LE(remainingAccountsInfoSerialized.length, 0);
2750
+ const remainingAccountsInfoWithLength = Buffer.concat([
2751
+ raiLenBuf,
2752
+ remainingAccountsInfoSerialized,
2753
+ ]);
2754
+ // --- Bin arrays ---
2755
+ const binArrays = meteora_1.MeteoraFunctions.findMeteoraTickArrays(lbPair, lowerBinId, upperBinId);
2756
+ const binArrayAccounts = binArrays.map(binArray => ({
2757
+ pubkey: binArray,
2758
+ isSigner: false,
2759
+ isWritable: true,
2760
+ }));
2761
+ const transferHookAccounts = (_c = remainingAccountsInfo === null || remainingAccountsInfo === void 0 ? void 0 : remainingAccountsInfo.accounts) !== null && _c !== void 0 ? _c : [];
2762
+ // --- Assemble instruction ---
2763
+ // Account order matches contract MeteoraDlmmAddLiquidity2Automation (meteora.rs:3699)
2764
+ // Same order as meteoraDlmmDepositRelativeAutomation (line 809)
2765
+ const ix = new web3.TransactionInstruction({
2766
+ data: Buffer.concat([
2767
+ sighash,
2768
+ layersBuf,
2769
+ checkRangeBuf,
2770
+ xAmountBuf,
2771
+ yAmountBuf,
2772
+ chunkLowerBuf,
2773
+ chunkUpperBuf,
2774
+ remainingAccountsInfoWithLength,
2775
+ ]),
2776
+ keys: [
2777
+ { pubkey: userPda, isSigner: false, isWritable: false },
2778
+ { pubkey: addresses_1.HS_AUTHORITY, isSigner: true, isWritable: true },
2779
+ { pubkey: position, isSigner: false, isWritable: true },
2780
+ { pubkey: lbPair, isSigner: false, isWritable: true },
2781
+ { pubkey: userTokenX, isSigner: false, isWritable: true },
2782
+ { pubkey: userTokenY, isSigner: false, isWritable: true },
2783
+ { pubkey: reserveX, isSigner: false, isWritable: true },
2784
+ { pubkey: reserveY, isSigner: false, isWritable: true },
2785
+ { pubkey: tokenXMint, isSigner: false, isWritable: false },
2786
+ { pubkey: tokenYMint, isSigner: false, isWritable: false },
2787
+ { pubkey: tokenXProgram, isSigner: false, isWritable: false },
2788
+ { pubkey: tokenYProgram, isSigner: false, isWritable: false },
2789
+ {
2790
+ pubkey: actualBinArrayBitmapExtension,
2791
+ isSigner: false,
2792
+ isWritable: !actualBinArrayBitmapExtension.equals(METEORA_DLMM_PROGRAM),
2793
+ },
2794
+ { pubkey: METEORA_EVENT_AUTHORITY, isSigner: false, isWritable: true },
2795
+ { pubkey: METEORA_DLMM_PROGRAM, isSigner: false, isWritable: true },
2796
+ ...transferHookAccounts,
2797
+ ...binArrayAccounts,
2798
+ ],
2799
+ programId: addresses_1.IYF_EXTENSION,
2800
+ });
2801
+ return this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
2802
+ userPda,
2803
+ authority: addresses_1.HS_AUTHORITY,
2804
+ ix,
2441
2805
  });
2442
2806
  });
2443
2807
  }