@kamino-finance/klend-sdk 5.11.5 → 5.11.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/classes/action.d.ts +23 -23
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +195 -122
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/index.d.ts +0 -1
  6. package/dist/classes/index.d.ts.map +1 -1
  7. package/dist/classes/index.js +0 -1
  8. package/dist/classes/index.js.map +1 -1
  9. package/dist/classes/manager.d.ts +1 -6
  10. package/dist/classes/manager.d.ts.map +1 -1
  11. package/dist/classes/manager.js +1 -16
  12. package/dist/classes/manager.js.map +1 -1
  13. package/dist/classes/market.d.ts +3 -3
  14. package/dist/classes/market.d.ts.map +1 -1
  15. package/dist/classes/market.js +16 -30
  16. package/dist/classes/market.js.map +1 -1
  17. package/dist/classes/obligation.d.ts +0 -2
  18. package/dist/classes/obligation.d.ts.map +1 -1
  19. package/dist/classes/obligation.js +0 -5
  20. package/dist/classes/obligation.js.map +1 -1
  21. package/dist/classes/types.d.ts.map +1 -1
  22. package/dist/classes/vault.d.ts +0 -1
  23. package/dist/classes/vault.d.ts.map +1 -1
  24. package/dist/classes/vault.js +18 -21
  25. package/dist/classes/vault.js.map +1 -1
  26. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +3 -6
  27. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
  28. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +7 -13
  29. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
  30. package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +1 -25
  31. package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
  32. package/dist/idl_codegen_kamino_vault/errors/custom.js +1 -43
  33. package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
  34. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts +1 -1
  35. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts.map +1 -1
  36. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js +1 -1
  37. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js.map +1 -1
  38. package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +0 -1
  39. package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
  40. package/dist/idl_codegen_kamino_vault/instructions/initVault.js +0 -1
  41. package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
  42. package/dist/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.d.ts +1 -1
  43. package/dist/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.d.ts.map +1 -1
  44. package/dist/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.js +1 -1
  45. package/dist/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.js.map +1 -1
  46. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +1 -1
  47. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
  48. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
  49. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
  50. package/dist/idl_codegen_kamino_vault/instructions/updateSharesMetadata.d.ts +1 -1
  51. package/dist/idl_codegen_kamino_vault/instructions/updateSharesMetadata.d.ts.map +1 -1
  52. package/dist/idl_codegen_kamino_vault/instructions/updateSharesMetadata.js +1 -1
  53. package/dist/idl_codegen_kamino_vault/instructions/updateSharesMetadata.js.map +1 -1
  54. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts +1 -1
  55. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts.map +1 -1
  56. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js +1 -1
  57. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js.map +1 -1
  58. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts +1 -1
  59. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts.map +1 -1
  60. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js +1 -1
  61. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js.map +1 -1
  62. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +0 -13
  63. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -1
  64. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +1 -25
  65. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -1
  66. package/dist/idl_codegen_kamino_vault/types/index.d.ts +2 -2
  67. package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
  68. package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
  69. package/dist/lending_operations/repay_with_collateral_operations.d.ts +4 -4
  70. package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
  71. package/dist/lending_operations/repay_with_collateral_operations.js +8 -10
  72. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  73. package/dist/lending_operations/swap_collateral_operations.d.ts +2 -2
  74. package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
  75. package/dist/lending_operations/swap_collateral_operations.js +6 -11
  76. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  77. package/dist/leverage/operations.d.ts +7 -9
  78. package/dist/leverage/operations.d.ts.map +1 -1
  79. package/dist/leverage/operations.js +66 -78
  80. package/dist/leverage/operations.js.map +1 -1
  81. package/dist/leverage/types.d.ts +4 -4
  82. package/dist/leverage/types.d.ts.map +1 -1
  83. package/dist/utils/ObligationType.d.ts +1 -1
  84. package/dist/utils/ObligationType.d.ts.map +1 -1
  85. package/dist/utils/constants.d.ts +0 -1
  86. package/dist/utils/constants.d.ts.map +1 -1
  87. package/dist/utils/constants.js +1 -2
  88. package/dist/utils/constants.js.map +1 -1
  89. package/dist/utils/managerTypes.d.ts.map +1 -1
  90. package/dist/utils/managerTypes.js +52 -7
  91. package/dist/utils/managerTypes.js.map +1 -1
  92. package/dist/utils/oracle.d.ts +3 -3
  93. package/dist/utils/oracle.d.ts.map +1 -1
  94. package/dist/utils/oracle.js +3 -4
  95. package/dist/utils/oracle.js.map +1 -1
  96. package/package.json +2 -2
  97. package/src/classes/action.ts +211 -143
  98. package/src/classes/index.ts +0 -1
  99. package/src/classes/manager.ts +1 -27
  100. package/src/classes/market.ts +25 -34
  101. package/src/classes/obligation.ts +0 -6
  102. package/src/classes/types.ts +1 -1
  103. package/src/classes/vault.ts +22 -23
  104. package/src/client.ts +3 -8
  105. package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +9 -17
  106. package/src/idl_codegen_kamino_vault/errors/custom.ts +0 -42
  107. package/src/idl_codegen_kamino_vault/instructions/giveUpPendingFees.ts +2 -2
  108. package/src/idl_codegen_kamino_vault/instructions/initVault.ts +0 -2
  109. package/src/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.ts +2 -2
  110. package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +2 -2
  111. package/src/idl_codegen_kamino_vault/instructions/updateSharesMetadata.ts +2 -2
  112. package/src/idl_codegen_kamino_vault/instructions/updateVaultConfig.ts +2 -2
  113. package/src/idl_codegen_kamino_vault/instructions/withdrawPendingFees.ts +2 -2
  114. package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +0 -30
  115. package/src/idl_codegen_kamino_vault/types/index.ts +0 -2
  116. package/src/idl_kamino_vault.json +8 -35
  117. package/src/lending_operations/repay_with_collateral_operations.ts +11 -15
  118. package/src/lending_operations/swap_collateral_operations.ts +7 -19
  119. package/src/leverage/operations.ts +66 -114
  120. package/src/leverage/types.ts +4 -4
  121. package/src/utils/ObligationType.ts +1 -1
  122. package/src/utils/constants.ts +0 -1
  123. package/src/utils/managerTypes.ts +52 -10
  124. package/src/utils/oracle.ts +6 -7
@@ -61,11 +61,11 @@ import {
61
61
  isNotNullPubkey,
62
62
  PublicKeySet,
63
63
  getAssociatedTokenAddress,
64
- ScopePriceRefreshConfig,
64
+ ScopeRefresh,
65
65
  createAtasIdempotent,
66
66
  obligationFarmStatePda,
67
67
  } from '../utils';
68
- import { getTokenIdsForScopeRefresh, KaminoMarket } from './market';
68
+ import { KaminoMarket } from './market';
69
69
  import { KaminoObligation } from './obligation';
70
70
  import { KaminoReserve } from './reserve';
71
71
  import { ReserveFarmKind } from '../idl_codegen/types';
@@ -73,7 +73,7 @@ import { farmsId } from '@kamino-finance/farms-sdk';
73
73
  import { Reserve } from '../idl_codegen/accounts';
74
74
  import { VanillaObligation } from '../utils/ObligationType';
75
75
  import { PROGRAM_ID } from '../lib';
76
- import { Scope } from '@kamino-finance/scope-sdk';
76
+ import { U16_MAX } from '@kamino-finance/scope-sdk';
77
77
 
78
78
  const SOL_PADDING_FOR_INTEREST = new BN('1000000');
79
79
 
@@ -411,7 +411,6 @@ export class KaminoAction {
411
411
  owner: PublicKey,
412
412
  obligation: KaminoObligation | ObligationType,
413
413
  useV2Ixs: boolean,
414
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
415
414
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
416
415
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas,
417
416
  requestElevationGroup: boolean = false, // to be requested *before* the deposit
@@ -419,6 +418,7 @@ export class KaminoAction {
419
418
  createLookupTable: boolean = true,
420
419
  referrer: PublicKey = PublicKey.default,
421
420
  currentSlot: number = 0,
421
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' },
422
422
  overrideElevationGroupRequest: number | undefined = undefined // if set, when an elevationgroup request is made, it will use this value
423
423
  ) {
424
424
  const axn = await KaminoAction.initialize(
@@ -437,6 +437,16 @@ export class KaminoAction {
437
437
  axn.addComputeBudgetIxn(extraComputeBudget);
438
438
  }
439
439
 
440
+ const allReserves = new PublicKeySet<PublicKey>([
441
+ ...axn.depositReserves,
442
+ ...axn.borrowReserves,
443
+ axn.reserve.address,
444
+ ]).toArray();
445
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
446
+
447
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
448
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
449
+ }
440
450
  await axn.addSupportIxs(
441
451
  'deposit',
442
452
  includeAtaIxns,
@@ -444,7 +454,6 @@ export class KaminoAction {
444
454
  includeUserMetadata,
445
455
  addInitObligationForFarm,
446
456
  useV2Ixs,
447
- scopeRefreshConfig,
448
457
  createLookupTable,
449
458
  undefined,
450
459
  overrideElevationGroupRequest
@@ -459,10 +468,36 @@ export class KaminoAction {
459
468
  return axn;
460
469
  }
461
470
 
462
- async addScopeRefreshIxs(scope: Scope, tokens: number[], feed: string = 'hubble') {
463
- this.setupIxsLabels.unshift(`refreshScopePrices`);
464
- this.setupIxs.unshift(
465
- await scope.refreshPriceListIx(
471
+ getTokenIdsForScopeRefresh(kaminoMarket: KaminoMarket, reserves: PublicKey[]): number[] {
472
+ const tokenIds: number[] = [];
473
+
474
+ for (const reserveAddress of reserves) {
475
+ const reserve = kaminoMarket.getReserveByAddress(reserveAddress);
476
+ if (!reserve) {
477
+ throw new Error(`Reserve not found for reserve ${reserveAddress.toBase58()}`);
478
+ }
479
+
480
+ if (!reserve.state.config.tokenInfo.scopeConfiguration.priceFeed.equals(PublicKey.default)) {
481
+ reserve.state.config.tokenInfo.scopeConfiguration.priceChain.map((x) => {
482
+ if (x !== U16_MAX) {
483
+ tokenIds.push(x);
484
+ }
485
+ });
486
+ reserve.state.config.tokenInfo.scopeConfiguration.twapChain.map((x) => {
487
+ if (x !== U16_MAX) {
488
+ tokenIds.push(x);
489
+ }
490
+ });
491
+ }
492
+ }
493
+
494
+ return tokenIds;
495
+ }
496
+
497
+ async addScopeRefreshIxs(tokens: number[], feed: string = 'hubble') {
498
+ this.preTxnIxsLabels.unshift(`refreshScopePrices`);
499
+ this.preTxnIxs.unshift(
500
+ await this.kaminoMarket.scope.refreshPriceListIx(
466
501
  {
467
502
  feed: feed,
468
503
  },
@@ -478,7 +513,6 @@ export class KaminoAction {
478
513
  owner: PublicKey,
479
514
  obligation: KaminoObligation | ObligationType,
480
515
  useV2Ixs: boolean,
481
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
482
516
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
483
517
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas,
484
518
  requestElevationGroup: boolean = false,
@@ -486,6 +520,7 @@ export class KaminoAction {
486
520
  createLookupTable: boolean = true,
487
521
  referrer: PublicKey = PublicKey.default,
488
522
  currentSlot: number = 0,
523
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' },
489
524
  overrideElevationGroupRequest: number | undefined = undefined // if set, when an elevationgroup request is made, it will use this value
490
525
  ) {
491
526
  const axn = await KaminoAction.initialize(
@@ -503,16 +538,15 @@ export class KaminoAction {
503
538
  axn.addComputeBudgetIxn(extraComputeBudget);
504
539
  }
505
540
 
506
- if (!axn.referrer.equals(PublicKey.default)) {
507
- const referrerTokenState = referrerTokenStatePda(
508
- axn.referrer,
509
- axn.reserve.address,
510
- axn.kaminoMarket.programId
511
- )[0];
512
- const account = await axn.kaminoMarket.getConnection().getAccountInfo(referrerTokenState);
513
- if (!account) {
514
- axn.addInitReferrerTokenStateIx(axn.reserve, referrerTokenState);
515
- }
541
+ const allReserves = new PublicKeySet<PublicKey>([
542
+ ...axn.depositReserves,
543
+ ...axn.borrowReserves,
544
+ axn.reserve.address,
545
+ ]).toArray();
546
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
547
+
548
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
549
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
516
550
  }
517
551
 
518
552
  await axn.addSupportIxs(
@@ -522,7 +556,6 @@ export class KaminoAction {
522
556
  includeUserMetadata,
523
557
  addInitObligationForFarm,
524
558
  useV2Ixs,
525
- scopeRefreshConfig,
526
559
  createLookupTable,
527
560
  undefined,
528
561
  overrideElevationGroupRequest
@@ -543,12 +576,12 @@ export class KaminoAction {
543
576
  mint: PublicKey,
544
577
  owner: PublicKey,
545
578
  obligation: KaminoObligation | ObligationType,
546
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
547
579
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
548
580
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas
549
581
  requestElevationGroup: boolean = false,
550
582
  referrer: PublicKey = PublicKey.default,
551
- currentSlot: number = 0
583
+ currentSlot: number = 0,
584
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
552
585
  ) {
553
586
  const axn = await KaminoAction.initialize(
554
587
  'mint',
@@ -566,6 +599,17 @@ export class KaminoAction {
566
599
  axn.addComputeBudgetIxn(extraComputeBudget);
567
600
  }
568
601
 
602
+ const allReserves = new PublicKeySet<PublicKey>([
603
+ ...axn.depositReserves,
604
+ ...axn.borrowReserves,
605
+ axn.reserve.address,
606
+ ]).toArray();
607
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
608
+
609
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
610
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
611
+ }
612
+
569
613
  await axn.addSupportIxs(
570
614
  'mint',
571
615
  includeAtaIxns,
@@ -573,7 +617,6 @@ export class KaminoAction {
573
617
  false,
574
618
  addInitObligationForFarm,
575
619
  false,
576
- scopeRefreshConfig,
577
620
  false
578
621
  );
579
622
  axn.addDepositReserveLiquidityIx();
@@ -587,12 +630,12 @@ export class KaminoAction {
587
630
  mint: PublicKey,
588
631
  owner: PublicKey,
589
632
  obligation: KaminoObligation | ObligationType,
590
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
591
633
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
592
634
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas
593
635
  requestElevationGroup: boolean = false,
594
636
  referrer: PublicKey = PublicKey.default,
595
- currentSlot: number = 0
637
+ currentSlot: number = 0,
638
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
596
639
  ) {
597
640
  const axn = await KaminoAction.initialize(
598
641
  'redeem',
@@ -610,6 +653,17 @@ export class KaminoAction {
610
653
  axn.addComputeBudgetIxn(extraComputeBudget);
611
654
  }
612
655
 
656
+ const allReserves = new PublicKeySet<PublicKey>([
657
+ ...axn.depositReserves,
658
+ ...axn.borrowReserves,
659
+ axn.reserve.address,
660
+ ]).toArray();
661
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
662
+
663
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
664
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
665
+ }
666
+
613
667
  await axn.addSupportIxs(
614
668
  'redeem',
615
669
  includeAtaIxns,
@@ -617,7 +671,6 @@ export class KaminoAction {
617
671
  false,
618
672
  addInitObligationForFarm,
619
673
  false,
620
- scopeRefreshConfig,
621
674
  false
622
675
  );
623
676
  axn.addRedeemReserveCollateralIx();
@@ -632,14 +685,14 @@ export class KaminoAction {
632
685
  owner: PublicKey,
633
686
  obligation: KaminoObligation | ObligationType,
634
687
  useV2Ixs: boolean,
635
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
636
688
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
637
689
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas
638
690
  requestElevationGroup: boolean = false,
639
691
  includeUserMetadata: boolean = true, // if true it includes user metadata
640
692
  createLookupTable: boolean = true,
641
693
  referrer: PublicKey = PublicKey.default,
642
- currentSlot: number = 0
694
+ currentSlot: number = 0,
695
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
643
696
  ) {
644
697
  const axn = await KaminoAction.initialize(
645
698
  'depositCollateral',
@@ -657,6 +710,17 @@ export class KaminoAction {
657
710
  axn.addComputeBudgetIxn(extraComputeBudget);
658
711
  }
659
712
 
713
+ const allReserves = new PublicKeySet<PublicKey>([
714
+ ...axn.depositReserves,
715
+ ...axn.borrowReserves,
716
+ axn.reserve.address,
717
+ ]).toArray();
718
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
719
+
720
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
721
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
722
+ }
723
+
660
724
  await axn.addSupportIxs(
661
725
  'depositCollateral',
662
726
  includeAtaIxns,
@@ -664,7 +728,6 @@ export class KaminoAction {
664
728
  includeUserMetadata,
665
729
  addInitObligationForFarm,
666
730
  useV2Ixs,
667
- scopeRefreshConfig,
668
731
  createLookupTable
669
732
  );
670
733
  if (useV2Ixs) {
@@ -685,14 +748,14 @@ export class KaminoAction {
685
748
  payer: PublicKey,
686
749
  obligation: KaminoObligation | ObligationType,
687
750
  useV2Ixs: boolean,
688
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
689
751
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
690
752
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas,
691
753
  requestElevationGroup: boolean = false,
692
754
  includeUserMetadata: boolean = true, // if true it includes user metadata,
693
755
  createLookupTable: boolean = true,
694
756
  referrer: PublicKey = PublicKey.default,
695
- currentSlot: number = 0
757
+ currentSlot: number = 0,
758
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
696
759
  ) {
697
760
  const axn = await KaminoAction.initializeMultiTokenAction(
698
761
  kaminoMarket,
@@ -715,17 +778,18 @@ export class KaminoAction {
715
778
  axn.addComputeBudgetIxn(extraComputeBudget);
716
779
  }
717
780
 
718
- if (!axn.referrer.equals(PublicKey.default)) {
719
- const referrerTokenState = referrerTokenStatePda(
720
- axn.referrer,
721
- axn.outflowReserve!.address,
722
- axn.kaminoMarket.programId
723
- )[0];
724
- const account = await axn.kaminoMarket.getConnection().getAccountInfo(referrerTokenState);
725
- if (!account) {
726
- axn.addInitReferrerTokenStateIx(axn.outflowReserve!, referrerTokenState);
727
- }
781
+ const allReserves = new PublicKeySet<PublicKey>([
782
+ ...axn.depositReserves,
783
+ ...axn.borrowReserves,
784
+ axn.reserve.address,
785
+ axn.outflowReserve!.address,
786
+ ]).toArray();
787
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
788
+
789
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
790
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
728
791
  }
792
+
729
793
  await axn.addSupportIxs(
730
794
  'deposit',
731
795
  includeAtaIxns,
@@ -733,7 +797,6 @@ export class KaminoAction {
733
797
  includeUserMetadata,
734
798
  addInitObligationForFarmForDeposit,
735
799
  useV2Ixs,
736
- undefined,
737
800
  createLookupTable,
738
801
  twoTokenAction
739
802
  );
@@ -751,20 +814,6 @@ export class KaminoAction {
751
814
  useV2Ixs
752
815
  );
753
816
  axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
754
-
755
- // Create the scope refresh ixn in here to ensure it's the first ixn in the txn
756
- const allReserves = new PublicKeySet<PublicKey>([
757
- ...axn.depositReserves,
758
- ...axn.borrowReserves,
759
- axn.reserve.address,
760
- ...(axn.outflowReserve ? [axn.outflowReserve.address] : []),
761
- ...(axn.preLoadedDepositReservesSameTx ? axn.preLoadedDepositReservesSameTx : []),
762
- ]).toArray();
763
- const tokenIds = getTokenIdsForScopeRefresh(axn.kaminoMarket, allReserves);
764
-
765
- if (tokenIds.length > 0 && scopeRefreshConfig) {
766
- await axn.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, scopeRefreshConfig.scopeFeed);
767
- }
768
817
  return axn;
769
818
  }
770
819
 
@@ -778,13 +827,13 @@ export class KaminoAction {
778
827
  currentSlot: number,
779
828
  obligation: KaminoObligation | ObligationType,
780
829
  useV2Ixs: boolean,
781
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
782
830
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
783
831
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas,
784
832
  requestElevationGroup: boolean = false,
785
833
  includeUserMetadata: boolean = true, // if true it includes user metadata,
786
834
  createLookupTable: boolean = true,
787
- referrer: PublicKey = PublicKey.default
835
+ referrer: PublicKey = PublicKey.default,
836
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
788
837
  ) {
789
838
  const axn = await KaminoAction.initializeMultiTokenAction(
790
839
  kaminoMarket,
@@ -806,6 +855,18 @@ export class KaminoAction {
806
855
  axn.addComputeBudgetIxn(extraComputeBudget);
807
856
  }
808
857
 
858
+ const allReserves = new PublicKeySet<PublicKey>([
859
+ ...axn.depositReserves,
860
+ ...axn.borrowReserves,
861
+ axn.reserve.address,
862
+ axn.outflowReserve!.address,
863
+ ]).toArray();
864
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
865
+
866
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
867
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
868
+ }
869
+
809
870
  await axn.addSupportIxs(
810
871
  'repay',
811
872
  includeAtaIxns,
@@ -813,7 +874,6 @@ export class KaminoAction {
813
874
  includeUserMetadata,
814
875
  addInitObligationForFarmForRepay,
815
876
  useV2Ixs,
816
- undefined,
817
877
  createLookupTable,
818
878
  twoTokenAction
819
879
  );
@@ -833,19 +893,6 @@ export class KaminoAction {
833
893
  useV2Ixs
834
894
  );
835
895
  axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
836
- // Create the scope refresh ixn in here to ensure it's the first ixn in the txn
837
- const allReserves = new PublicKeySet<PublicKey>([
838
- ...axn.depositReserves,
839
- ...axn.borrowReserves,
840
- axn.reserve.address,
841
- ...(axn.outflowReserve ? [axn.outflowReserve.address] : []),
842
- ...(axn.preLoadedDepositReservesSameTx ? axn.preLoadedDepositReservesSameTx : []),
843
- ]).toArray();
844
- const tokenIds = getTokenIdsForScopeRefresh(axn.kaminoMarket, allReserves);
845
-
846
- if (tokenIds.length > 0 && scopeRefreshConfig) {
847
- await axn.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, scopeRefreshConfig.scopeFeed);
848
- }
849
896
  return axn;
850
897
  }
851
898
 
@@ -856,7 +903,6 @@ export class KaminoAction {
856
903
  owner: PublicKey,
857
904
  obligation: KaminoObligation | ObligationType,
858
905
  useV2Ixs: boolean,
859
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
860
906
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
861
907
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas,
862
908
  requestElevationGroup: boolean = false, // to be requested *after* the withdraw
@@ -864,6 +910,7 @@ export class KaminoAction {
864
910
  createLookupTable: boolean = true,
865
911
  referrer: PublicKey = PublicKey.default,
866
912
  currentSlot: number = 0,
913
+ scopeRefresh: ScopeRefresh | undefined = undefined,
867
914
  overrideElevationGroupRequest?: number,
868
915
  // Optional customizations which may be needed if the obligation was mutated by some previous ixn.
869
916
  obligationCustomizations?: {
@@ -889,6 +936,17 @@ export class KaminoAction {
889
936
 
890
937
  axn.depositReserves.push(...(obligationCustomizations?.addedDepositReserves || []));
891
938
 
939
+ const allReserves = new PublicKeySet<PublicKey>([
940
+ ...axn.depositReserves,
941
+ ...axn.borrowReserves,
942
+ axn.reserve.address,
943
+ ]).toArray();
944
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
945
+
946
+ if (tokenIds.length > 0 && scopeRefresh && scopeRefresh.includeScopeRefresh) {
947
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
948
+ }
949
+
892
950
  await axn.addSupportIxs(
893
951
  'withdraw',
894
952
  includeAtaIxns,
@@ -896,7 +954,6 @@ export class KaminoAction {
896
954
  includeUserMetadata,
897
955
  addInitObligationForFarm,
898
956
  useV2Ixs,
899
- scopeRefreshConfig,
900
957
  createLookupTable,
901
958
  false,
902
959
  overrideElevationGroupRequest
@@ -936,7 +993,6 @@ export class KaminoAction {
936
993
  owner: PublicKey,
937
994
  obligation: KaminoObligation | ObligationType,
938
995
  useV2Ixs: boolean,
939
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
940
996
  currentSlot: number,
941
997
  payer: PublicKey | undefined = undefined,
942
998
  extraComputeBudget: number = 1_000_000,
@@ -944,7 +1000,8 @@ export class KaminoAction {
944
1000
  requestElevationGroup: boolean = false,
945
1001
  includeUserMetadata: boolean = true,
946
1002
  createLookupTable: boolean = true,
947
- referrer: PublicKey = PublicKey.default
1003
+ referrer: PublicKey = PublicKey.default,
1004
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
948
1005
  ) {
949
1006
  const axn = await KaminoAction.initialize(
950
1007
  'repay',
@@ -963,6 +1020,17 @@ export class KaminoAction {
963
1020
  axn.addComputeBudgetIxn(extraComputeBudget);
964
1021
  }
965
1022
 
1023
+ const allReserves = new PublicKeySet<PublicKey>([
1024
+ ...axn.depositReserves,
1025
+ ...axn.borrowReserves,
1026
+ axn.reserve.address,
1027
+ ]).toArray();
1028
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
1029
+
1030
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
1031
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
1032
+ }
1033
+
966
1034
  await axn.addSupportIxs(
967
1035
  'repay',
968
1036
  includeAtaIxns,
@@ -970,7 +1038,6 @@ export class KaminoAction {
970
1038
  includeUserMetadata,
971
1039
  addInitObligationForFarm,
972
1040
  useV2Ixs,
973
- scopeRefreshConfig,
974
1041
  createLookupTable
975
1042
  );
976
1043
  if (useV2Ixs) {
@@ -993,7 +1060,6 @@ export class KaminoAction {
993
1060
  obligationOwner: PublicKey,
994
1061
  obligation: KaminoObligation | ObligationType,
995
1062
  useV2Ixs: boolean,
996
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
997
1063
  extraComputeBudget: number = 1_000_000, // if > 0 then adds the ixn
998
1064
  includeAtaIxns: boolean = true, // if true it includes create and close wsol and token atas, and creates all other token atas if they don't exist
999
1065
  requestElevationGroup: boolean = false,
@@ -1001,7 +1067,8 @@ export class KaminoAction {
1001
1067
  createLookupTable: boolean = true,
1002
1068
  referrer: PublicKey = PublicKey.default,
1003
1069
  maxAllowedLtvOverridePercent: number = 0,
1004
- currentSlot: number = 0
1070
+ currentSlot: number = 0,
1071
+ scopeRefresh: ScopeRefresh = { includeScopeRefresh: false, scopeFeed: 'hubble' }
1005
1072
  ) {
1006
1073
  const axn = await KaminoAction.initializeMultiTokenAction(
1007
1074
  kaminoMarket,
@@ -1022,6 +1089,18 @@ export class KaminoAction {
1022
1089
  axn.addComputeBudgetIxn(extraComputeBudget);
1023
1090
  }
1024
1091
 
1092
+ const allReserves = new PublicKeySet<PublicKey>([
1093
+ ...axn.depositReserves,
1094
+ ...axn.borrowReserves,
1095
+ axn.reserve.address,
1096
+ axn.outflowReserve!.address,
1097
+ ]).toArray();
1098
+ const tokenIds = axn.getTokenIdsForScopeRefresh(kaminoMarket, allReserves);
1099
+
1100
+ if (tokenIds.length > 0 && scopeRefresh.includeScopeRefresh) {
1101
+ await axn.addScopeRefreshIxs(tokenIds, scopeRefresh.scopeFeed);
1102
+ }
1103
+
1025
1104
  await axn.addSupportIxs(
1026
1105
  'liquidate',
1027
1106
  includeAtaIxns,
@@ -1029,7 +1108,6 @@ export class KaminoAction {
1029
1108
  includeUserMetadata,
1030
1109
  addInitObligationForFarm,
1031
1110
  useV2Ixs,
1032
- scopeRefreshConfig,
1033
1111
  createLookupTable
1034
1112
  );
1035
1113
  if (useV2Ixs) {
@@ -1058,17 +1136,6 @@ export class KaminoAction {
1058
1136
  axn.preTxnIxs.push(...createAtaIxs);
1059
1137
  axn.preTxnIxsLabels.push(`createAtasIxs[${axn.userTokenAccountAddress.toString()}]`);
1060
1138
 
1061
- if (!axn.referrer.equals(PublicKey.default)) {
1062
- const referrerTokenState = referrerTokenStatePda(
1063
- axn.referrer,
1064
- axn.reserve.address,
1065
- axn.kaminoMarket.programId
1066
- )[0];
1067
- const account = await axn.kaminoMarket.getConnection().getAccountInfo(referrerTokenState);
1068
- if (!account) {
1069
- axn.addInitReferrerTokenStateIx(axn.reserve, referrerTokenState);
1070
- }
1071
- }
1072
1139
  axn.addRefreshReserveIxs([axn.reserve.address]);
1073
1140
  axn.addWithdrawReferrerFeesIxs();
1074
1141
 
@@ -1257,8 +1324,8 @@ export class KaminoAction {
1257
1324
  addDepositIxV2() {
1258
1325
  const farmsAccounts = this.reserve.state.farmCollateral.equals(PublicKey.default)
1259
1326
  ? {
1260
- obligationFarmUserState: this.kaminoMarket.programId,
1261
- reserveFarmState: this.kaminoMarket.programId,
1327
+ obligationFarmUserState: PROGRAM_ID,
1328
+ reserveFarmState: PROGRAM_ID,
1262
1329
  }
1263
1330
  : {
1264
1331
  obligationFarmUserState: obligationFarmStatePda(
@@ -1325,8 +1392,8 @@ export class KaminoAction {
1325
1392
  addDepositObligationCollateralIxV2() {
1326
1393
  const farmsAccounts = this.reserve.state.farmCollateral.equals(PublicKey.default)
1327
1394
  ? {
1328
- obligationFarmUserState: this.kaminoMarket.programId,
1329
- reserveFarmState: this.kaminoMarket.programId,
1395
+ obligationFarmUserState: PROGRAM_ID,
1396
+ reserveFarmState: PROGRAM_ID,
1330
1397
  }
1331
1398
  : {
1332
1399
  obligationFarmUserState: obligationFarmStatePda(
@@ -1410,8 +1477,8 @@ export class KaminoAction {
1410
1477
 
1411
1478
  const farmsAccounts = this.reserve.state.farmDebt.equals(PublicKey.default)
1412
1479
  ? {
1413
- obligationFarmUserState: this.kaminoMarket.programId,
1414
- reserveFarmState: this.kaminoMarket.programId,
1480
+ obligationFarmUserState: PROGRAM_ID,
1481
+ reserveFarmState: PROGRAM_ID,
1415
1482
  }
1416
1483
  : {
1417
1484
  obligationFarmUserState: obligationFarmStatePda(this.getObligationPda(), this.reserve.state.farmDebt)[0],
@@ -1485,8 +1552,8 @@ export class KaminoAction {
1485
1552
  async addWithdrawIxV2(collateralAmount: BN) {
1486
1553
  const farmsAccounts = this.reserve.state.farmCollateral.equals(PublicKey.default)
1487
1554
  ? {
1488
- obligationFarmUserState: this.kaminoMarket.programId,
1489
- reserveFarmState: this.kaminoMarket.programId,
1555
+ obligationFarmUserState: PROGRAM_ID,
1556
+ reserveFarmState: PROGRAM_ID,
1490
1557
  }
1491
1558
  : {
1492
1559
  obligationFarmUserState: obligationFarmStatePda(
@@ -1572,8 +1639,8 @@ export class KaminoAction {
1572
1639
 
1573
1640
  const farmsAccounts = this.reserve.state.farmDebt.equals(PublicKey.default)
1574
1641
  ? {
1575
- obligationFarmUserState: this.kaminoMarket.programId,
1576
- reserveFarmState: this.kaminoMarket.programId,
1642
+ obligationFarmUserState: PROGRAM_ID,
1643
+ reserveFarmState: PROGRAM_ID,
1577
1644
  }
1578
1645
  : {
1579
1646
  obligationFarmUserState: obligationFarmStatePda(this.getObligationPda(), this.reserve.state.farmDebt)[0],
@@ -1693,8 +1760,8 @@ export class KaminoAction {
1693
1760
  async addDepositAndBorrowIxV2() {
1694
1761
  const collateralFarmsAccounts = this.reserve.state.farmCollateral.equals(PublicKey.default)
1695
1762
  ? {
1696
- obligationFarmUserState: this.kaminoMarket.programId,
1697
- reserveFarmState: this.kaminoMarket.programId,
1763
+ obligationFarmUserState: PROGRAM_ID,
1764
+ reserveFarmState: PROGRAM_ID,
1698
1765
  }
1699
1766
  : {
1700
1767
  obligationFarmUserState: obligationFarmStatePda(
@@ -1757,8 +1824,8 @@ export class KaminoAction {
1757
1824
 
1758
1825
  const debtFarmsAccounts = this.outflowReserve.state.farmDebt.equals(PublicKey.default)
1759
1826
  ? {
1760
- obligationFarmUserState: this.kaminoMarket.programId,
1761
- reserveFarmState: this.kaminoMarket.programId,
1827
+ obligationFarmUserState: PROGRAM_ID,
1828
+ reserveFarmState: PROGRAM_ID,
1762
1829
  }
1763
1830
  : {
1764
1831
  obligationFarmUserState: obligationFarmStatePda(
@@ -1886,8 +1953,8 @@ export class KaminoAction {
1886
1953
 
1887
1954
  const debtFarmsAccounts = this.reserve.state.farmDebt.equals(PublicKey.default)
1888
1955
  ? {
1889
- obligationFarmUserState: this.kaminoMarket.programId,
1890
- reserveFarmState: this.kaminoMarket.programId,
1956
+ obligationFarmUserState: PROGRAM_ID,
1957
+ reserveFarmState: PROGRAM_ID,
1891
1958
  }
1892
1959
  : {
1893
1960
  obligationFarmUserState: obligationFarmStatePda(this.getObligationPda(), this.reserve.state.farmDebt)[0],
@@ -1934,8 +2001,8 @@ export class KaminoAction {
1934
2001
 
1935
2002
  const collateralFarmsAccounts = this.outflowReserve.state.farmCollateral.equals(PublicKey.default)
1936
2003
  ? {
1937
- obligationFarmUserState: this.kaminoMarket.programId,
1938
- reserveFarmState: this.kaminoMarket.programId,
2004
+ obligationFarmUserState: PROGRAM_ID,
2005
+ reserveFarmState: PROGRAM_ID,
1939
2006
  }
1940
2007
  : {
1941
2008
  obligationFarmUserState: obligationFarmStatePda(
@@ -2043,8 +2110,8 @@ export class KaminoAction {
2043
2110
 
2044
2111
  const collateralFarmsAccounts = this.outflowReserve.state.farmCollateral.equals(PublicKey.default)
2045
2112
  ? {
2046
- obligationFarmUserState: this.kaminoMarket.programId,
2047
- reserveFarmState: this.kaminoMarket.programId,
2113
+ obligationFarmUserState: PROGRAM_ID,
2114
+ reserveFarmState: PROGRAM_ID,
2048
2115
  }
2049
2116
  : {
2050
2117
  obligationFarmUserState: obligationFarmStatePda(
@@ -2056,8 +2123,8 @@ export class KaminoAction {
2056
2123
 
2057
2124
  const debtFarmsAccounts = this.reserve.state.farmDebt.equals(PublicKey.default)
2058
2125
  ? {
2059
- obligationFarmUserState: this.kaminoMarket.programId,
2060
- reserveFarmState: this.kaminoMarket.programId,
2126
+ obligationFarmUserState: PROGRAM_ID,
2127
+ reserveFarmState: PROGRAM_ID,
2061
2128
  }
2062
2129
  : {
2063
2130
  obligationFarmUserState: obligationFarmStatePda(this.getObligationPda(), this.reserve.state.farmDebt)[0],
@@ -2433,7 +2500,6 @@ export class KaminoAction {
2433
2500
  includeUserMetadata: boolean,
2434
2501
  addInitObligationForFarm: boolean,
2435
2502
  useV2Ixs: boolean,
2436
- scopeRefreshConfig: ScopePriceRefreshConfig | undefined,
2437
2503
  createLookupTable: boolean,
2438
2504
  twoTokenAction: boolean = false,
2439
2505
  overrideElevationGroupRequest?: number
@@ -2454,6 +2520,13 @@ export class KaminoAction {
2454
2520
  this.addInitUserMetadataIxs(lookupTable);
2455
2521
  }
2456
2522
 
2523
+ if (['borrow', 'withdrawReferrerFees'].includes(action)) {
2524
+ await this.addInitReferrerTokenStateIx(this.reserve);
2525
+ }
2526
+ // depositAndBorrow
2527
+ if (action === 'deposit' && this.outflowReserve) {
2528
+ await this.addInitReferrerTokenStateIx(this.outflowReserve);
2529
+ }
2457
2530
  await this.addInitObligationIxs();
2458
2531
  }
2459
2532
 
@@ -2467,19 +2540,6 @@ export class KaminoAction {
2467
2540
  twoTokenAction,
2468
2541
  overrideElevationGroupRequest
2469
2542
  );
2470
-
2471
- const allReserves = new PublicKeySet<PublicKey>([
2472
- ...this.depositReserves,
2473
- ...this.borrowReserves,
2474
- this.reserve.address,
2475
- ...(this.outflowReserve ? [this.outflowReserve.address] : []),
2476
- ...(this.preLoadedDepositReservesSameTx ? this.preLoadedDepositReservesSameTx : []),
2477
- ]).toArray();
2478
- const tokenIds = getTokenIdsForScopeRefresh(this.kaminoMarket, allReserves);
2479
-
2480
- if (tokenIds.length > 0 && scopeRefreshConfig) {
2481
- await this.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, scopeRefreshConfig.scopeFeed);
2482
- }
2483
2543
  }
2484
2544
 
2485
2545
  private static optionalAccount(pubkey: PublicKey, programId: PublicKey = PROGRAM_ID): PublicKey {
@@ -2888,21 +2948,29 @@ export class KaminoAction {
2888
2948
  this.setupIxsLabels.push(`initUserMetadata[${userMetadataAddress.toString()}]`);
2889
2949
  }
2890
2950
 
2891
- private addInitReferrerTokenStateIx(reserve: KaminoReserve, referrerTokenState: PublicKey) {
2892
- const initReferrerTokenStateIx = initReferrerTokenState(
2893
- {
2894
- lendingMarket: this.kaminoMarket.getAddress(),
2895
- payer: this.owner,
2896
- reserve: reserve.address,
2897
- referrer: this.referrer,
2898
- referrerTokenState,
2899
- rent: SYSVAR_RENT_PUBKEY,
2900
- systemProgram: SystemProgram.programId,
2901
- },
2902
- this.kaminoMarket.programId
2903
- );
2904
- this.setupIxs.unshift(initReferrerTokenStateIx);
2905
- this.setupIxsLabels.unshift(`InitReferrerTokenState[${referrerTokenState.toString()} res=${reserve.address}]`);
2951
+ private async addInitReferrerTokenStateIx(reserve: KaminoReserve) {
2952
+ if (this.referrer.equals(PublicKey.default)) {
2953
+ return;
2954
+ }
2955
+
2956
+ const referrerTokenState = referrerTokenStatePda(this.referrer, reserve.address, this.kaminoMarket.programId)[0];
2957
+ const account = await this.kaminoMarket.getConnection().getAccountInfo(referrerTokenState);
2958
+ if (!account) {
2959
+ const initReferrerTokenStateIx = initReferrerTokenState(
2960
+ {
2961
+ lendingMarket: this.kaminoMarket.getAddress(),
2962
+ payer: this.owner,
2963
+ reserve: reserve.address,
2964
+ referrer: this.referrer,
2965
+ referrerTokenState,
2966
+ rent: SYSVAR_RENT_PUBKEY,
2967
+ systemProgram: SystemProgram.programId,
2968
+ },
2969
+ this.kaminoMarket.programId
2970
+ );
2971
+ this.setupIxs.unshift(initReferrerTokenStateIx);
2972
+ this.setupIxsLabels.unshift(`InitReferrerTokenState[${referrerTokenState.toString()} res=${reserve.address}]`);
2973
+ }
2906
2974
  }
2907
2975
 
2908
2976
  private addWithdrawReferrerFeesIxs() {