@hawksightco/hawk-sdk 1.3.4 → 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.
@@ -44,6 +44,7 @@ const bn_js_1 = __importDefault(require("bn.js"));
44
44
  const util = __importStar(require("./functions"));
45
45
  // import { Log } from "./classes/Logging";
46
46
  const SimpleIxGenerator_1 = require("./classes/SimpleIxGenerator");
47
+ const AccountCache_1 = require("./classes/account-cache/AccountCache");
47
48
  /**
48
49
  * Convert listed meteora instruction to generalized hawksight meteora cpi
49
50
  *
@@ -289,19 +290,28 @@ class AddLiquidityByWeight extends HawksightMeteoraCpi {
289
290
  var _a;
290
291
  this.ix.keys[11].pubkey = this.userPda;
291
292
  this.ix.keys[11].isSigner = false;
292
- // Adjust by token type
293
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
294
- if (pdaTokenType === types_1.TokenType.LTA) {
295
- this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
296
- this.ix.keys[4].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[8].pubkey);
297
- }
298
- else if (pdaTokenType === types_1.TokenType.STA) {
299
- this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[7].pubkey);
300
- this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
293
+ const mintAInfo = AccountCache_1.AccountCache.get(this.ix.keys[7].pubkey);
294
+ const mintBInfo = AccountCache_1.AccountCache.get(this.ix.keys[8].pubkey);
295
+ if (!!mintAInfo && !!mintBInfo) {
296
+ const tokenProgramA = mintAInfo.info.owner;
297
+ const tokenProgramB = mintBInfo.info.owner;
298
+ // Adjust by token type
299
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
300
+ if (pdaTokenType === types_1.TokenType.LTA) {
301
+ this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
302
+ this.ix.keys[4].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[8].pubkey);
303
+ }
304
+ else if (pdaTokenType === types_1.TokenType.STA) {
305
+ this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[7].pubkey);
306
+ this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
307
+ }
308
+ else {
309
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenProgramA);
310
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenProgramB);
311
+ }
301
312
  }
302
313
  else {
303
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
304
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
314
+ throw new Error("Unexpected error: Mint A or B not found in cache.");
305
315
  }
306
316
  }
307
317
  }
@@ -327,19 +337,30 @@ class AddLiquidityByStrategy extends HawksightMeteoraCpi {
327
337
  var _a;
328
338
  this.ix.keys[11].pubkey = this.userPda;
329
339
  this.ix.keys[11].isSigner = false;
330
- // Adjust by token type
331
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
332
- if (pdaTokenType === types_1.TokenType.LTA) {
333
- this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
334
- this.ix.keys[4].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[8].pubkey);
335
- }
336
- else if (pdaTokenType === types_1.TokenType.STA) {
337
- this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[7].pubkey);
338
- this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
340
+ const mintAInfo = AccountCache_1.AccountCache.get(this.ix.keys[7].pubkey);
341
+ const mintBInfo = AccountCache_1.AccountCache.get(this.ix.keys[8].pubkey);
342
+ if (!!mintAInfo && !!mintBInfo) {
343
+ const tokenProgramA = mintAInfo.info.owner;
344
+ const tokenProgramB = mintBInfo.info.owner;
345
+ this.ix.keys[12].pubkey = tokenProgramA;
346
+ this.ix.keys[13].pubkey = tokenProgramB;
347
+ // Adjust by token type
348
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
349
+ if (pdaTokenType === types_1.TokenType.LTA) {
350
+ this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
351
+ this.ix.keys[4].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[8].pubkey);
352
+ }
353
+ else if (pdaTokenType === types_1.TokenType.STA) {
354
+ this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[7].pubkey);
355
+ this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
356
+ }
357
+ else {
358
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenProgramA);
359
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenProgramB);
360
+ }
339
361
  }
340
362
  else {
341
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
342
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
363
+ throw new Error("Unexpected error: Mint A or B not found in cache.");
343
364
  }
344
365
  }
345
366
  }
@@ -365,16 +386,23 @@ class AddLiquidityOneSide extends HawksightMeteoraCpi {
365
386
  var _a;
366
387
  this.ix.keys[8].pubkey = this.userPda;
367
388
  this.ix.keys[8].isSigner = false;
368
- // Adjust by token type
369
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
370
- if (pdaTokenType === types_1.TokenType.LTA) {
371
- this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[5].pubkey);
372
- }
373
- else if (pdaTokenType === types_1.TokenType.STA) {
374
- this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[5].pubkey);
389
+ const mintInfo = AccountCache_1.AccountCache.get(this.ix.keys[5].pubkey);
390
+ if (!!mintInfo) {
391
+ const tokenProgram = mintInfo.info.owner;
392
+ // Adjust by token type
393
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
394
+ if (pdaTokenType === types_1.TokenType.LTA) {
395
+ this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[5].pubkey);
396
+ }
397
+ else if (pdaTokenType === types_1.TokenType.STA) {
398
+ this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[5].pubkey);
399
+ }
400
+ else {
401
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey, tokenProgram);
402
+ }
375
403
  }
376
404
  else {
377
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey);
405
+ throw new Error("Unexpected error: Mint not found in cache.");
378
406
  }
379
407
  }
380
408
  }
@@ -400,16 +428,23 @@ class AddLiquidityByStrategyOneSide extends HawksightMeteoraCpi {
400
428
  var _a;
401
429
  this.ix.keys[8].pubkey = this.userPda;
402
430
  this.ix.keys[8].isSigner = false;
403
- // Adjust by token type
404
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
405
- if (pdaTokenType === types_1.TokenType.LTA) {
406
- this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[5].pubkey);
407
- }
408
- else if (pdaTokenType === types_1.TokenType.STA) {
409
- this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[5].pubkey);
431
+ const mintInfo = AccountCache_1.AccountCache.get(this.ix.keys[5].pubkey);
432
+ if (!!mintInfo) {
433
+ const tokenProgram = mintInfo.info.owner;
434
+ // Adjust by token type
435
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
436
+ if (pdaTokenType === types_1.TokenType.LTA) {
437
+ this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[5].pubkey);
438
+ }
439
+ else if (pdaTokenType === types_1.TokenType.STA) {
440
+ this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[5].pubkey);
441
+ }
442
+ else {
443
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey, tokenProgram);
444
+ }
410
445
  }
411
446
  else {
412
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey);
447
+ throw new Error("Unexpected error: Mint not found in cache.");
413
448
  }
414
449
  }
415
450
  }
@@ -434,19 +469,28 @@ class RemoveLiquidity extends HawksightMeteoraCpi {
434
469
  var _a;
435
470
  this.ix.keys[11].pubkey = this.userPda;
436
471
  this.ix.keys[11].isSigner = false;
437
- // Adjust by token type
438
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
439
- if (pdaTokenType === types_1.TokenType.LTA) {
440
- this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
441
- this.ix.keys[4].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[8].pubkey);
442
- }
443
- else if (pdaTokenType === types_1.TokenType.STA) {
444
- this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[7].pubkey);
445
- this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
472
+ const mintAInfo = AccountCache_1.AccountCache.get(this.ix.keys[7].pubkey);
473
+ const mintBInfo = AccountCache_1.AccountCache.get(this.ix.keys[8].pubkey);
474
+ if (!!mintAInfo && !!mintBInfo) {
475
+ const tokenProgramA = mintAInfo.info.owner;
476
+ const tokenProgramB = mintBInfo.info.owner;
477
+ // Adjust by token type
478
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
479
+ if (pdaTokenType === types_1.TokenType.LTA) {
480
+ this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
481
+ this.ix.keys[4].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[8].pubkey);
482
+ }
483
+ else if (pdaTokenType === types_1.TokenType.STA) {
484
+ this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[7].pubkey);
485
+ this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
486
+ }
487
+ else {
488
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenProgramA);
489
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenProgramB);
490
+ }
446
491
  }
447
492
  else {
448
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
449
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
493
+ throw new Error("Unexpected error: Mint A or B not found in cache.");
450
494
  }
451
495
  }
452
496
  }
@@ -486,19 +530,28 @@ class ClaimFee extends HawksightMeteoraCpi {
486
530
  var _a;
487
531
  this.ix.keys[4].pubkey = this.userPda;
488
532
  this.ix.keys[4].isSigner = false;
489
- // Adjust by token type
490
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
491
- if (pdaTokenType === types_1.TokenType.LTA) {
492
- this.ix.keys[7].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[9].pubkey);
493
- this.ix.keys[8].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[10].pubkey);
494
- }
495
- else if (pdaTokenType === types_1.TokenType.STA) {
496
- this.ix.keys[7].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[9].pubkey);
497
- this.ix.keys[8].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[10].pubkey);
533
+ const mintAInfo = AccountCache_1.AccountCache.get(this.ix.keys[9].pubkey);
534
+ const mintBInfo = AccountCache_1.AccountCache.get(this.ix.keys[10].pubkey);
535
+ if (!!mintAInfo && !!mintBInfo) {
536
+ const tokenProgramA = mintAInfo.info.owner;
537
+ const tokenProgramB = mintBInfo.info.owner;
538
+ // Adjust by token type
539
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
540
+ if (pdaTokenType === types_1.TokenType.LTA) {
541
+ this.ix.keys[7].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[9].pubkey);
542
+ this.ix.keys[8].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[10].pubkey);
543
+ }
544
+ else if (pdaTokenType === types_1.TokenType.STA) {
545
+ this.ix.keys[7].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[9].pubkey);
546
+ this.ix.keys[8].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[10].pubkey);
547
+ }
548
+ else {
549
+ this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[9].pubkey, tokenProgramA);
550
+ this.ix.keys[8].pubkey = util.generateAta(this.userPda, this.ix.keys[10].pubkey, tokenProgramB);
551
+ }
498
552
  }
499
553
  else {
500
- this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[9].pubkey);
501
- this.ix.keys[8].pubkey = util.generateAta(this.userPda, this.ix.keys[10].pubkey);
554
+ throw new Error("Unexpected error: Mint A or B not found in cache.");
502
555
  }
503
556
  }
504
557
  /**
@@ -514,9 +567,14 @@ class ClaimFee extends HawksightMeteoraCpi {
514
567
  // Get token mints X and Y
515
568
  const tokenXMint = this.ix.keys[9].pubkey;
516
569
  const tokenYMint = this.ix.keys[10].pubkey;
570
+ const tokenXMintInfo = AccountCache_1.AccountCache.get(tokenXMint);
571
+ const tokenYMintInfo = AccountCache_1.AccountCache.get(tokenYMint);
572
+ if (!(!!tokenXMintInfo && !!tokenYMintInfo)) {
573
+ throw new Error("Unexpected error: Mint X or Y not found in cache.");
574
+ }
517
575
  // Generate owner fee X and Y ATA
518
- const ownerFeeX = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenXMint);
519
- const ownerFeeY = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenYMint);
576
+ const ownerFeeX = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenXMint, tokenXMintInfo.info.owner);
577
+ const ownerFeeY = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenYMint, tokenYMintInfo.info.owner);
520
578
  // Generate IX via extension contract
521
579
  // @ts-ignore
522
580
  const claimFeeIx = yield anchor_1.Anchor.instance().iyfExtension.methods
@@ -543,6 +601,7 @@ class ClaimFee extends HawksightMeteoraCpi {
543
601
  ownerFeeY,
544
602
  }).instruction();
545
603
  // Instruction via main hawksight contract
604
+ // @ts-ignore
546
605
  const ix = yield anchor_1.Anchor.instance().iyfMain.methods
547
606
  .iyfExtensionExecute(claimFeeIx.data)
548
607
  .accounts({
@@ -598,16 +657,23 @@ class ClaimReward extends HawksightMeteoraCpi {
598
657
  var _a;
599
658
  this.ix.keys[4].pubkey = this.userPda;
600
659
  this.ix.keys[4].isSigner = false;
601
- // Adjust by token type
602
- const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
603
- if (pdaTokenType === types_1.TokenType.LTA) {
604
- this.ix.keys[7].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[6].pubkey);
605
- }
606
- else if (pdaTokenType === types_1.TokenType.STA) {
607
- this.ix.keys[7].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[6].pubkey);
660
+ const mintInfo = AccountCache_1.AccountCache.get(this.ix.keys[6].pubkey);
661
+ if (!!mintInfo) {
662
+ const tokenProgram = mintInfo.info.owner;
663
+ // Adjust by token type
664
+ const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
665
+ if (pdaTokenType === types_1.TokenType.LTA) {
666
+ this.ix.keys[7].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[6].pubkey);
667
+ }
668
+ else if (pdaTokenType === types_1.TokenType.STA) {
669
+ this.ix.keys[7].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[6].pubkey);
670
+ }
671
+ else {
672
+ this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[6].pubkey, tokenProgram);
673
+ }
608
674
  }
609
675
  else {
610
- this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[6].pubkey);
676
+ throw new Error("Unexpected error: Mint not found in cache.");
611
677
  }
612
678
  }
613
679
  /**
@@ -622,8 +688,12 @@ class ClaimReward extends HawksightMeteoraCpi {
622
688
  const iyfProgram = addresses_1.IYF_MAIN;
623
689
  // Get token mint
624
690
  const rewardMint = this.ix.keys[6].pubkey;
691
+ const mintInfo = AccountCache_1.AccountCache.get(rewardMint);
692
+ if (!mintInfo) {
693
+ throw new Error("Unexpected error: Reward mint not found in cache.");
694
+ }
625
695
  // Generate owner fee X and Y ATA
626
- const ownerFee = util.generateAta(addresses_1.SITE_FEE_OWNER, rewardMint);
696
+ const ownerFee = util.generateAta(addresses_1.SITE_FEE_OWNER, rewardMint, mintInfo.info.owner);
627
697
  // Get reward index from parameter
628
698
  const rewardIndex = new bn_js_1.default(this.ix.data.readBigInt64LE(8).toString());
629
699
  // Generate IX via extension contract
@@ -934,6 +1004,11 @@ class AddLiquidityByWeightAutomation extends HawksightMeteoraAutomationCpi {
934
1004
  const strategyParametersMaxBinId = data.subarray(28, 32).readInt32LE();
935
1005
  const strategyParametersStrategyType = data[32];
936
1006
  const strategyParametersParameters = Array.from(data.subarray(33));
1007
+ const tokenXMintInfo = AccountCache_1.AccountCache.get(tokenXMint);
1008
+ const tokenYMintInfo = AccountCache_1.AccountCache.get(tokenYMint);
1009
+ if (!(!!tokenXMintInfo && !!tokenYMintInfo)) {
1010
+ throw new Error("Unexpected error: Mint X or Y not found in cache.");
1011
+ }
937
1012
  // Adjust by token type
938
1013
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
939
1014
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -945,8 +1020,8 @@ class AddLiquidityByWeightAutomation extends HawksightMeteoraAutomationCpi {
945
1020
  this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
946
1021
  }
947
1022
  else {
948
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
949
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
1023
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenXMintInfo.info.owner);
1024
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenYMintInfo.info.owner);
950
1025
  }
951
1026
  // @ts-ignore
952
1027
  const depositIx = yield anchor_1.Anchor.instance().iyfExtension.methods
@@ -1089,6 +1164,11 @@ class AddLiquidityByStrategyAutomation extends HawksightMeteoraAutomationCpi {
1089
1164
  this._ix = ix;
1090
1165
  return;
1091
1166
  }
1167
+ const tokenXMintInfo = AccountCache_1.AccountCache.get(tokenXMint);
1168
+ const tokenYMintInfo = AccountCache_1.AccountCache.get(tokenYMint);
1169
+ if (!(!!tokenXMintInfo && !!tokenYMintInfo)) {
1170
+ throw new Error("Unexpected error: Mint X or Y not found in cache.");
1171
+ }
1092
1172
  // Adjust by token type
1093
1173
  if (pdaTokenType === types_1.TokenType.LTA) {
1094
1174
  this.ix.keys[3].pubkey = util.generateLimitToken(this.userPda, this.ix.keys[7].pubkey);
@@ -1099,8 +1179,8 @@ class AddLiquidityByStrategyAutomation extends HawksightMeteoraAutomationCpi {
1099
1179
  this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
1100
1180
  }
1101
1181
  else {
1102
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
1103
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
1182
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenXMintInfo.info.owner);
1183
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenYMintInfo.info.owner);
1104
1184
  }
1105
1185
  const ix = yield generator.meteoraDlmm.depositAutomation(anchor_1.Anchor.instance().connection, {
1106
1186
  userWallet: authority,
@@ -1162,6 +1242,10 @@ class AddLiquidityOneSideAutomation extends HawksightMeteoraAutomationCpi {
1162
1242
  const authority = this.authority;
1163
1243
  const iyfProgram = addresses_1.IYF_MAIN;
1164
1244
  const hawksightAuthority = addresses_1.HS_AUTHORITY;
1245
+ const mintInfo = AccountCache_1.AccountCache.get(this.ix.keys[5].pubkey);
1246
+ if (!mintInfo) {
1247
+ throw new Error("Unexpected error: Mint not found in cache.");
1248
+ }
1165
1249
  // Adjust by token type
1166
1250
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
1167
1251
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -1171,7 +1255,7 @@ class AddLiquidityOneSideAutomation extends HawksightMeteoraAutomationCpi {
1171
1255
  this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[5].pubkey);
1172
1256
  }
1173
1257
  else {
1174
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey);
1258
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey, mintInfo.info.owner);
1175
1259
  }
1176
1260
  // Generate IX via extension contract
1177
1261
  // @ts-ignore
@@ -1261,6 +1345,11 @@ class RemoveLiquidityAutomation extends HawksightMeteoraAutomationCpi {
1261
1345
  // Get token mints X and Y
1262
1346
  const tokenXMint = this.ix.keys[7].pubkey;
1263
1347
  const tokenYMint = this.ix.keys[8].pubkey;
1348
+ const tokenXMintInfo = AccountCache_1.AccountCache.get(tokenXMint);
1349
+ const tokenYMintInfo = AccountCache_1.AccountCache.get(tokenYMint);
1350
+ if (!(!!tokenXMintInfo && !!tokenYMintInfo)) {
1351
+ throw new Error("Unexpected error: Mint X or Y not found in cache.");
1352
+ }
1264
1353
  // Adjust by token type
1265
1354
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
1266
1355
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -1272,8 +1361,8 @@ class RemoveLiquidityAutomation extends HawksightMeteoraAutomationCpi {
1272
1361
  this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
1273
1362
  }
1274
1363
  else {
1275
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
1276
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
1364
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenXMintInfo.info.owner);
1365
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenYMintInfo.info.owner);
1277
1366
  }
1278
1367
  // Generate IX via extension contract
1279
1368
  // @ts-ignore
@@ -1386,9 +1475,14 @@ class ClaimFeeAutomation extends HawksightMeteoraAutomationCpi {
1386
1475
  // Get token mints X and Y
1387
1476
  const tokenXMint = this.ix.keys[9].pubkey;
1388
1477
  const tokenYMint = this.ix.keys[10].pubkey;
1478
+ const tokenXMintInfo = AccountCache_1.AccountCache.get(tokenXMint);
1479
+ const tokenYMintInfo = AccountCache_1.AccountCache.get(tokenYMint);
1480
+ if (!(!!tokenXMintInfo && !!tokenYMintInfo)) {
1481
+ throw new Error("Unexpected error: Mint X or Y not found in cache.");
1482
+ }
1389
1483
  // Generate owner fee X and Y ATA
1390
- const ownerFeeX = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenXMint);
1391
- const ownerFeeY = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenYMint);
1484
+ const ownerFeeX = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenXMint, tokenXMintInfo.info.owner);
1485
+ const ownerFeeY = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenYMint, tokenYMintInfo.info.owner);
1392
1486
  // Adjust by token type
1393
1487
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
1394
1488
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -1400,8 +1494,8 @@ class ClaimFeeAutomation extends HawksightMeteoraAutomationCpi {
1400
1494
  this.ix.keys[8].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[10].pubkey);
1401
1495
  }
1402
1496
  else {
1403
- this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[9].pubkey);
1404
- this.ix.keys[8].pubkey = util.generateAta(this.userPda, this.ix.keys[10].pubkey);
1497
+ this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[9].pubkey, tokenXMintInfo.info.owner);
1498
+ this.ix.keys[8].pubkey = util.generateAta(this.userPda, this.ix.keys[10].pubkey, tokenYMintInfo.info.owner);
1405
1499
  }
1406
1500
  // Generate IX via extension contract
1407
1501
  // @ts-ignore
@@ -1500,7 +1594,11 @@ class ClaimRewardAutomation extends HawksightMeteoraAutomationCpi {
1500
1594
  const hawksightAuthority = addresses_1.HS_AUTHORITY;
1501
1595
  // Generate owner fee ATA
1502
1596
  const rewardMint = this.ix.keys[6].pubkey;
1503
- const ownerFee = util.generateAta(addresses_1.SITE_FEE_OWNER, rewardMint);
1597
+ const mintInfo = AccountCache_1.AccountCache.get(rewardMint);
1598
+ if (!mintInfo) {
1599
+ throw new Error("Unexpected error: Reward mint not found in cache.");
1600
+ }
1601
+ const ownerFee = util.generateAta(addresses_1.SITE_FEE_OWNER, rewardMint, mintInfo.info.owner);
1504
1602
  // Adjust by token type
1505
1603
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
1506
1604
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -1510,7 +1608,7 @@ class ClaimRewardAutomation extends HawksightMeteoraAutomationCpi {
1510
1608
  this.ix.keys[7].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[6].pubkey);
1511
1609
  }
1512
1610
  else {
1513
- this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[6].pubkey);
1611
+ this.ix.keys[7].pubkey = util.generateAta(this.userPda, this.ix.keys[6].pubkey, mintInfo.info.owner);
1514
1612
  }
1515
1613
  // Generate IX via extension contract
1516
1614
  // @ts-ignore
@@ -1827,6 +1925,11 @@ class AddLiquidityByStrategyPda extends HawksightMeteoraPdaCpi {
1827
1925
  var _a;
1828
1926
  this.ix.keys[11].pubkey = this.userPda;
1829
1927
  this.ix.keys[11].isSigner = false;
1928
+ const tokenXMintInfo = AccountCache_1.AccountCache.get(this.ix.keys[7].pubkey);
1929
+ const tokenYMintInfo = AccountCache_1.AccountCache.get(this.ix.keys[8].pubkey);
1930
+ if (!(!!tokenXMintInfo && !!tokenYMintInfo)) {
1931
+ throw new Error("Unexpected error: Mint X or Y not found in cache.");
1932
+ }
1830
1933
  // Adjust by token type
1831
1934
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
1832
1935
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -1838,8 +1941,8 @@ class AddLiquidityByStrategyPda extends HawksightMeteoraPdaCpi {
1838
1941
  this.ix.keys[4].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[8].pubkey);
1839
1942
  }
1840
1943
  else {
1841
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey);
1842
- this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey);
1944
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[7].pubkey, tokenXMintInfo.info.owner);
1945
+ this.ix.keys[4].pubkey = util.generateAta(this.userPda, this.ix.keys[8].pubkey, tokenYMintInfo.info.owner);
1843
1946
  }
1844
1947
  }
1845
1948
  /**
@@ -1888,6 +1991,7 @@ class AddLiquidityByStrategyPda extends HawksightMeteoraPdaCpi {
1888
1991
  meteoraDlmmProgram: this.ix.keys[15].pubkey,
1889
1992
  }).instruction();
1890
1993
  // Instruction via main hawksight contract
1994
+ // @ts-ignore
1891
1995
  const ix = yield anchor_1.Anchor.instance().iyfMain.methods
1892
1996
  .iyfExtensionExecute(depositIx.data)
1893
1997
  .accounts({
@@ -1945,6 +2049,10 @@ class AddLiquidityByStrategyOneSidePda extends HawksightMeteoraPdaCpi {
1945
2049
  var _a;
1946
2050
  this.ix.keys[8].pubkey = this.userPda;
1947
2051
  this.ix.keys[8].isSigner = false;
2052
+ const tokenMintInfo = AccountCache_1.AccountCache.get(this.ix.keys[5].pubkey);
2053
+ if (!tokenMintInfo) {
2054
+ throw new Error("Unexpected error: Mint not found in cache.");
2055
+ }
1948
2056
  // Adjust by token type
1949
2057
  const pdaTokenType = (_a = this.opt) === null || _a === void 0 ? void 0 : _a.pdaTokenType;
1950
2058
  if (pdaTokenType === types_1.TokenType.LTA) {
@@ -1954,7 +2062,7 @@ class AddLiquidityByStrategyOneSidePda extends HawksightMeteoraPdaCpi {
1954
2062
  this.ix.keys[3].pubkey = util.generateUserPdaStorageAccount(this.userPda, this.ix.keys[5].pubkey);
1955
2063
  }
1956
2064
  else {
1957
- this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey);
2065
+ this.ix.keys[3].pubkey = util.generateAta(this.userPda, this.ix.keys[5].pubkey, tokenMintInfo.info.owner);
1958
2066
  }
1959
2067
  }
1960
2068
  /**