@hawksightco/hawk-sdk 1.1.47 → 1.1.48-hotfix-5

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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
2
2
  import * as web3 from "@solana/web3.js";
3
- import { MeteoraClaim, MeteoraClaimAll, MeteoraClose, MeteoraCompound, MeteoraCreatePositionAndDeposit, MeteoraDeposit, MeteoraInitializeBinArrays, MeteoraRebalance, MeteoraWithdraw, Register, TxgenParams, InitializeStorageTokenAccount, MeteoraLimitCloseAutomation, OrcaOpenPosition, OrcaClosePosition, OrcaDeposit, OrcaWithdraw, OrcaClaimRewards, TransactionMetadataResponse, MeteoraRebalance2 } from '../types';
3
+ import { MeteoraClaim, MeteoraClaimAll, MeteoraClose, MeteoraCompound, MeteoraCreatePositionAndDeposit, MeteoraCreatePositionAndDepositPda, MeteoraDeposit, MeteoraInitializeBinArrays, MeteoraRebalance, MeteoraWithdraw, Register, TxgenParams, InitializeStorageTokenAccount, MeteoraLimitCloseAutomation, OrcaOpenPosition, OrcaClosePosition, OrcaDeposit, OrcaWithdraw, OrcaClaimRewards, TransactionMetadataResponse, MeteoraRebalance2 } from '../types';
4
4
  import { GeneralUtility } from "./GeneralUtility";
5
5
  import { MultiTransaction } from "./MultiTransaction";
6
6
  import { SimpleIxGenerator } from "./SimpleIxGenerator";
@@ -57,7 +57,7 @@ export declare class Transactions {
57
57
  * @param params Parameters required
58
58
  * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
59
59
  */
60
- meteoraCreatePositionAndDepositPda({ connection, params, }: TxgenParams<MeteoraCreatePositionAndDeposit>): Promise<TransactionMetadataResponse>;
60
+ meteoraCreatePositionAndDepositPda({ connection, params, }: TxgenParams<MeteoraCreatePositionAndDepositPda>): Promise<TransactionMetadataResponse>;
61
61
  /**
62
62
  * Creates meteora instruction that initializes bin arrays.
63
63
  *
@@ -1 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AAM,GACP,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAiFjC;;;;;;OAMG;IACG,8BAA8B,CAAC,EACnC,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,6BAA6B,CAAC,GAAG,OAAO,CACrD,2BAA2B,GAAG,EAAE,CACjC;IAgEK,sBAAsB,CAAC,EAC3B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,2BAA2B,CAAC;IA+H3C,OAAO,CAAC,0BAA0B;IAkClC;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2DnH;;;;;;;OAOG;IACG,iBAAiB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAqDrH;;;;;;;OAOG;IACG,WAAW,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA4IzG;;;;;;;OAOG;IACG,YAAY,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2F3G;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAoGpH;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
@@ -183,8 +183,8 @@ class Transactions {
183
183
  const mainInstructions = (yield dlmmPool.initializePositionAndAddLiquidityByStrategyPda(params.userWallet, params.userWallet, {
184
184
  positionPubKey: params.position,
185
185
  user: userPda,
186
- totalXAmount: params.totalXAmount,
187
- totalYAmount: params.totalYAmount,
186
+ totalXAmount: new bn_js_1.default(10), // Dummy amounts to generate met tx
187
+ totalYAmount: new bn_js_1.default(10),
188
188
  strategy: {
189
189
  maxBinId: params.binRange.upperRange,
190
190
  minBinId: params.binRange.lowerRange,
@@ -192,7 +192,7 @@ class Transactions {
192
192
  },
193
193
  slippage: params.slippage,
194
194
  skipInputTokenCheck: params.skipInputTokenCheck,
195
- }, hsToMeteora_1.meteoraToHawksight)).default();
195
+ }, hsToMeteora_1.meteoraToHawksightPdaIxs)).default();
196
196
  return (0, functions_1.createTransactionMeta)({
197
197
  payer: params.userWallet,
198
198
  description: "Create position and deposit to Meteora DLMM",
@@ -1,7 +1,7 @@
1
1
  /// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
2
2
  import * as web3 from "@solana/web3.js";
3
3
  import * as _client from "@hawksightco/swagger-client";
4
- import { ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll } from "../types";
4
+ import { ResponseWithStatus, TransactionMetadata, OrcaWithdraw, OrcaDeposit, OrcaClosePosition, OrcaOpenPosition, OrcaClaimRewards, MeteoraClaimAll, MeteoraCreatePositionAndDepositPda } from "../types";
5
5
  import { Client } from "./Client";
6
6
  import { GeneralUtility } from "./GeneralUtility";
7
7
  import { MultiTransaction } from "./MultiTransaction";
@@ -36,7 +36,7 @@ export declare class TxGenerator {
36
36
  * @param params Parameters required
37
37
  * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
38
38
  */
39
- meteoraCreatePositionAndDepositPda(connection: web3.Connection, payer: string, params: _client.TxCreatePositionAndDepositBody): Promise<ResponseWithStatus<TransactionMetadata>>;
39
+ meteoraCreatePositionAndDepositPda(connection: web3.Connection, payer: string, params: MeteoraCreatePositionAndDepositPda): Promise<ResponseWithStatus<TransactionMetadata>>;
40
40
  /**
41
41
  * Creates meteora instruction that deposits to position.
42
42
  *
@@ -1 +1 @@
1
- {"version":3,"file":"TxGenerator.d.ts","sourceRoot":"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AAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA+B/I"}
@@ -120,11 +120,9 @@ class TxGenerator {
120
120
  position: new web3.PublicKey(params.position),
121
121
  pool: new web3.PublicKey(params.pool),
122
122
  userWallet: new web3.PublicKey(params.userWallet),
123
- totalXAmount: new bn_js_1.BN(params.totalXAmount),
124
- totalYAmount: new bn_js_1.BN(params.totalYAmount),
125
123
  binRange: {
126
- lowerRange: params.lowerBinRange,
127
- upperRange: params.upperBinRange,
124
+ lowerRange: params.binRange.lowerRange,
125
+ upperRange: params.binRange.upperRange,
128
126
  },
129
127
  slippage: params.slippage,
130
128
  distribution: params.distribution,
@@ -15,4 +15,11 @@ export declare function meteoraToHawksight({ ixs, userPda, authority }: MeteoraT
15
15
  * @returns
16
16
  */
17
17
  export declare function meteoraToHawksightAutomationIxs({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
18
+ /**
19
+ * Convert listed meteora instruction to hawksight meteora automation cpi
20
+ *
21
+ * @param params
22
+ * @returns
23
+ */
24
+ export declare function meteoraToHawksightPdaIxs({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
18
25
  //# sourceMappingURL=hsToMeteora.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAcnD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUpI;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUjJ"}
1
+ {"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAcnD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUpI;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUjJ;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAU1I"}
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.meteoraToHawksightAutomationIxs = exports.meteoraToHawksight = void 0;
35
+ exports.meteoraToHawksightPdaIxs = exports.meteoraToHawksightAutomationIxs = exports.meteoraToHawksight = void 0;
36
36
  const addresses_1 = require("./addresses");
37
37
  const anchor_1 = require("./anchor");
38
38
  const bn_js_1 = require("bn.js");
@@ -77,6 +77,26 @@ function meteoraToHawksightAutomationIxs(_a) {
77
77
  });
78
78
  }
79
79
  exports.meteoraToHawksightAutomationIxs = meteoraToHawksightAutomationIxs;
80
+ /**
81
+ * Convert listed meteora instruction to hawksight meteora automation cpi
82
+ *
83
+ * @param params
84
+ * @returns
85
+ */
86
+ function meteoraToHawksightPdaIxs(_a) {
87
+ return __awaiter(this, arguments, void 0, function* ({ ixs, userPda, authority }) {
88
+ const _ixs = [];
89
+ for (const ix of ixs) {
90
+ const _ix = yield HawksightMeteoraPdaCpi.factory(ix, userPda, authority).getInstruction();
91
+ if (ix.programId.toString() === addresses_1.ASSOCIATED_TOKEN_PROGRAM.toString() && ix.keys.length === 6) {
92
+ ix.keys[0] = Object.assign(Object.assign({}, ix.keys[0]), { pubkey: addresses_1.HS_AUTHORITY });
93
+ }
94
+ _ixs.push(_ix);
95
+ }
96
+ return _ixs;
97
+ });
98
+ }
99
+ exports.meteoraToHawksightPdaIxs = meteoraToHawksightPdaIxs;
80
100
  /**
81
101
  * Abstract base class `HawksightMeteoraCpi` for handling and chaining transaction instructions.
82
102
  * This class provides a framework for creating and linking complex transaction processes in a blockchain environment.
@@ -1296,3 +1316,338 @@ class ClosePositionAutomation extends HawksightMeteoraAutomationCpi {
1296
1316
  });
1297
1317
  }
1298
1318
  }
1319
+ /**
1320
+ * Abstract base class `HawksightMeteoraCpi` for handling and chaining transaction instructions.
1321
+ * This class provides a framework for creating and linking complex transaction processes in a blockchain environment.
1322
+ *
1323
+ * Attributes:
1324
+ * - `ix`: web3.TransactionInstruction - The transaction instruction associated with this CPI.
1325
+ * - `userPda`: web3.PublicKey - The public key of the user's program-derived address (PDA).
1326
+ * - `authority`: web3.PublicKey - The public key of the authority that can sign transactions.
1327
+ * - `_next`: HawksightMeteoraCpi | undefined - Pointer to the next CPI in the chain.
1328
+ * - `sighash`: Buffer - A buffer representing the signature hash used for identifying and validating instructions.
1329
+ *
1330
+ * Methods:
1331
+ * - `constructor(ix, userPda, authority, sighash)`: Constructs an instance of the HawksightMeteoraCpi.
1332
+ * - `factory(ix, userPda, authority)`: Static factory method to create a chain of CPIs starting with `InitializePosition` and linking subsequent operations.
1333
+ * - `getInstruction()`: Returns the modified transaction instruction after processing by matching CPIs in the chain.
1334
+ * - `replace()`: Abstract method to be implemented by subclasses to modify the transaction keys or other properties.
1335
+ * - `next(next)`: Chains the current CPI instance to the next one.
1336
+ * - `sighashMatch()`: Checks if the current transaction instruction matches the provided sighash and recurses through the chain if not.
1337
+ * - `programIdMatch()`: Checks if the program ID of the transaction matches the expected ID.
1338
+ * - `addHawksightCpi()`: Modifies the transaction instruction to include specific Hawksight CPI details.
1339
+ *
1340
+ * Usage:
1341
+ * This class is intended to be extended by specific CPI implementations like `InitializePosition`, each implementing their own `replace()` method to handle specific transaction modifications.
1342
+ */
1343
+ class HawksightMeteoraPdaCpi {
1344
+ /**
1345
+ * Constructs an instance of HawksightMeteoraCpi with the necessary transaction parameters.
1346
+ * @param ix The core transaction instruction.
1347
+ * @param userPda The user's program-derived address (PDA) as a public key.
1348
+ * @param authority The authority public key that has signing capabilities over the transaction.
1349
+ * @param sighash A Buffer containing the sighash used for matching the transaction instruction.
1350
+ */
1351
+ constructor(ix, userPda, authority, sighash) {
1352
+ this.ix = ix;
1353
+ this.userPda = userPda;
1354
+ this.authority = authority;
1355
+ this.sighash = sighash;
1356
+ }
1357
+ /**
1358
+ * Factory method to create and link a chain of CPIs starting from `InitializePosition`.
1359
+ * Subsequent CPIs include operations like adding liquidity, removing liquidity, claiming fees, and rewards, and closing the position.
1360
+ * @param ix The initial transaction instruction.
1361
+ * @param userPda The user's public key.
1362
+ * @param authority The authority public key.
1363
+ * @returns The first CPI in the chain.
1364
+ */
1365
+ static factory(ix, userPda, authority) {
1366
+ const chain = new InitializePositionPda(ix, userPda, authority);
1367
+ chain
1368
+ .next(new AddLiquidityByStrategyPda(ix, userPda, authority))
1369
+ .next(new AddLiquidityByStrategyOneSidePda(ix, userPda, authority));
1370
+ return chain;
1371
+ }
1372
+ /**
1373
+ * Retrieves and possibly modifies the transaction instruction based on matching conditions.
1374
+ * If a matching CPI is found in the chain, it performs modifications and returns the updated instruction.
1375
+ * @returns The (possibly modified) transaction instruction.
1376
+ */
1377
+ getInstruction() {
1378
+ return __awaiter(this, void 0, void 0, function* () {
1379
+ const matchInstance = this.sighashMatch();
1380
+ if (this.programIdMatch() && matchInstance !== undefined) {
1381
+ matchInstance.replace();
1382
+ yield matchInstance.addHawksightCpi();
1383
+ return this.ix;
1384
+ }
1385
+ return this.ix;
1386
+ });
1387
+ }
1388
+ /**
1389
+ * Modifies the transaction instruction to include specific Hawksight CPI details.
1390
+ * Prepares the instruction for execution by adjusting its program ID and data based on Hawksight criteria.
1391
+ */
1392
+ addHawksightCpi() {
1393
+ return __awaiter(this, void 0, void 0, function* () {
1394
+ const METEORA_PROGRAM = addresses_1.METEORA_DLMM_PROGRAM;
1395
+ const size = Buffer.alloc(4);
1396
+ size.writeUint32LE(this.ix.data.length);
1397
+ const data = Buffer.concat([util.sighash('meteora_dynamic_cpi'), size, this.ix.data]);
1398
+ this.ix.programId = addresses_1.IYF_MAIN;
1399
+ this.ix.data = data;
1400
+ this.ix.keys.unshift(...[
1401
+ { pubkey: this.userPda, isSigner: false, isWritable: false },
1402
+ { pubkey: this.authority, isSigner: true, isWritable: true },
1403
+ { pubkey: METEORA_PROGRAM, isSigner: false, isWritable: false },
1404
+ ]);
1405
+ });
1406
+ }
1407
+ /**
1408
+ * Adds a subsequent CPI to the chain.
1409
+ * @param next The next CPI object to link.
1410
+ * @returns The added CPI object, allowing for method chaining.
1411
+ */
1412
+ next(next) {
1413
+ this._next = next;
1414
+ return this._next;
1415
+ }
1416
+ /**
1417
+ * Recursively checks this CPI and subsequent ones for a sighash match in the transaction data.
1418
+ * @returns The first CPI instance in the chain that matches the sighash, or undefined if no match is found.
1419
+ */
1420
+ sighashMatch() {
1421
+ var _a, _b;
1422
+ try {
1423
+ const match = util.sighashMatch(this.ix.data, this.sighash);
1424
+ if (match) {
1425
+ return this;
1426
+ }
1427
+ else if (this._next !== undefined) {
1428
+ return (_a = this._next) === null || _a === void 0 ? void 0 : _a.sighashMatch();
1429
+ }
1430
+ }
1431
+ catch (_c) {
1432
+ if (this._next !== undefined) {
1433
+ return (_b = this._next) === null || _b === void 0 ? void 0 : _b.sighashMatch();
1434
+ }
1435
+ }
1436
+ return undefined;
1437
+ }
1438
+ /**
1439
+ * Checks if the program ID of the transaction instruction matches the expected program ID.
1440
+ * @returns True if the program ID matches, otherwise false.
1441
+ */
1442
+ programIdMatch() {
1443
+ return this.ix.programId.equals(addresses_1.METEORA_DLMM_PROGRAM);
1444
+ }
1445
+ }
1446
+ /**
1447
+ * Handles the initialization of a position in a blockchain transaction.
1448
+ * This class extends the HawksightMeteoraCpi and provides specific logic to modify the transaction instruction for position initialization.
1449
+ */
1450
+ class InitializePositionPda extends HawksightMeteoraPdaCpi {
1451
+ /**
1452
+ * Constructs an instance of InitializePosition with the necessary transaction parameters.
1453
+ *
1454
+ * @param ix The core transaction instruction.
1455
+ * @param userPda The user's program-derived address (PDA) as a public key.
1456
+ * @param authority The authority public key that has signing capabilities over the transaction.
1457
+ */
1458
+ constructor(ix, userPda, authority) {
1459
+ super(ix, userPda, authority, util.sighash("InitializePosition"));
1460
+ }
1461
+ /**
1462
+ * Modifies the transaction keys to set the correct public keys for an initial position setup.
1463
+ */
1464
+ replace() {
1465
+ this.ix.keys[0].pubkey = this.authority;
1466
+ this.ix.keys[3].pubkey = this.userPda;
1467
+ this.ix.keys[3].isSigner = false;
1468
+ }
1469
+ }
1470
+ /**
1471
+ * Deposit liquidity via user pda
1472
+ */
1473
+ class AddLiquidityByStrategyPda extends HawksightMeteoraPdaCpi {
1474
+ /**
1475
+ * Constructs an instance of InitializePosition with the necessary transaction parameters.
1476
+ *
1477
+ * @param ix The core transaction instruction.
1478
+ * @param userPda The user's program-derived address (PDA) as a public key.
1479
+ * @param authority The authority public key that has signing capabilities over the transaction.
1480
+ */
1481
+ constructor(ix, userPda, authority) {
1482
+ super(ix, userPda, authority, util.sighash("AddLiquidityByStrategy"));
1483
+ }
1484
+ /**
1485
+ * Modifies transaction keys for the purpose of claiming transaction fees.
1486
+ */
1487
+ replace() {
1488
+ this.ix.keys[11].pubkey = this.userPda;
1489
+ this.ix.keys[11].isSigner = false;
1490
+ }
1491
+ /**
1492
+ * Replaces Meteora CPI with Hawksight CPI that calls the target Meteora CPI.
1493
+ */
1494
+ addHawksightCpi() {
1495
+ return __awaiter(this, void 0, void 0, function* () {
1496
+ // Common parameters
1497
+ const farm = addresses_1.USDC_FARM;
1498
+ const userPda = this.userPda;
1499
+ const authority = this.authority;
1500
+ const iyfProgram = addresses_1.IYF_MAIN;
1501
+ // Get token mints X and Y
1502
+ const tokenXMint = this.ix.keys[7].pubkey;
1503
+ const tokenYMint = this.ix.keys[8].pubkey;
1504
+ // Generate IX via extension contract
1505
+ const data = this.ix.data.subarray(8);
1506
+ const activeId = data.subarray(16, 20).readInt32LE();
1507
+ const maxActiveBinSlippage = data.subarray(20, 24).readInt32LE();
1508
+ const strategyParametersMinBinId = data.subarray(24, 28).readInt32LE();
1509
+ const strategyParametersMaxBinId = data.subarray(28, 32).readInt32LE();
1510
+ const strategyParametersStrategyType = data[32];
1511
+ const strategyParametersParameters = Array.from(data.subarray(33));
1512
+ const depositIx = yield anchor_1.Anchor.instance().iyfExtension.methods
1513
+ .meteoraDlmmDeposit(activeId, maxActiveBinSlippage, strategyParametersMinBinId, strategyParametersMaxBinId, strategyParametersStrategyType, strategyParametersParameters)
1514
+ .accounts({
1515
+ farm,
1516
+ userPda,
1517
+ authority,
1518
+ iyfProgram,
1519
+ position: this.ix.keys[0].pubkey,
1520
+ lbPair: this.ix.keys[1].pubkey,
1521
+ binArrayBitmapExtension: this.ix.keys[2].pubkey,
1522
+ userTokenX: this.ix.keys[3].pubkey,
1523
+ userTokenY: this.ix.keys[4].pubkey,
1524
+ reserveX: this.ix.keys[5].pubkey,
1525
+ reserveY: this.ix.keys[6].pubkey,
1526
+ tokenXMint,
1527
+ tokenYMint,
1528
+ binArrayLower: this.ix.keys[9].pubkey,
1529
+ binArrayUpper: this.ix.keys[10].pubkey,
1530
+ tokenXProgram: this.ix.keys[12].pubkey,
1531
+ tokenYProgram: this.ix.keys[13].pubkey,
1532
+ eventAuthority: this.ix.keys[14].pubkey,
1533
+ meteoraDlmmProgram: this.ix.keys[15].pubkey,
1534
+ }).instruction();
1535
+ // Instruction via main hawksight contract
1536
+ const ix = yield anchor_1.Anchor.instance().iyfMain.methods
1537
+ .iyfExtensionExecute(depositIx.data)
1538
+ .accounts({
1539
+ farm,
1540
+ userPda,
1541
+ authority,
1542
+ iyfProgram,
1543
+ iyfExtensionProgram: addresses_1.IYF_EXTENSION,
1544
+ })
1545
+ .remainingAccounts([
1546
+ depositIx.keys[4],
1547
+ depositIx.keys[5],
1548
+ depositIx.keys[6],
1549
+ depositIx.keys[7],
1550
+ depositIx.keys[8],
1551
+ depositIx.keys[9],
1552
+ depositIx.keys[10],
1553
+ depositIx.keys[11],
1554
+ depositIx.keys[12],
1555
+ depositIx.keys[13],
1556
+ depositIx.keys[14],
1557
+ depositIx.keys[15],
1558
+ depositIx.keys[16],
1559
+ depositIx.keys[17],
1560
+ depositIx.keys[18],
1561
+ ])
1562
+ .instruction();
1563
+ // Override the instruction
1564
+ this.ix.programId = ix.programId;
1565
+ this.ix.data = ix.data;
1566
+ this.ix.keys = ix.keys;
1567
+ });
1568
+ }
1569
+ }
1570
+ /**
1571
+ * Adjusts transaction instructions to add liquidity based on a specific weight in a financial application.
1572
+ * This class is designed for blockchain operations that manage liquidity pools.
1573
+ */
1574
+ class AddLiquidityByStrategyOneSidePda extends HawksightMeteoraPdaCpi {
1575
+ /**
1576
+ * Constructs an instance of InitializePosition with the necessary transaction parameters.
1577
+ *
1578
+ * @param ix The core transaction instruction.
1579
+ * @param userPda The user's program-derived address (PDA) as a public key.
1580
+ * @param authority The authority public key that has signing capabilities over the transaction.
1581
+ */
1582
+ constructor(ix, userPda, authority) {
1583
+ super(ix, userPda, authority, util.sighash("AddLiquidityByStrategyOneSide"));
1584
+ }
1585
+ /**
1586
+ * Alters the transaction keys for adding liquidity, ensuring the user's PDA is correctly configured.
1587
+ */
1588
+ replace() {
1589
+ this.ix.keys[8].pubkey = this.userPda;
1590
+ this.ix.keys[8].isSigner = false;
1591
+ }
1592
+ /**
1593
+ * Replaces Meteora CPI with Hawksight CPI that calls the target Meteora CPI.
1594
+ */
1595
+ addHawksightCpi() {
1596
+ return __awaiter(this, void 0, void 0, function* () {
1597
+ // Common parameters
1598
+ const farm = addresses_1.USDC_FARM;
1599
+ const userPda = this.userPda;
1600
+ const authority = this.authority;
1601
+ const iyfProgram = addresses_1.IYF_MAIN;
1602
+ // Generate IX via extension contract
1603
+ const depositIx = yield anchor_1.Anchor.instance().iyfExtension.methods
1604
+ .meteoraDlmmOneSideDepositManual(this.ix.data.subarray(8))
1605
+ .accounts({
1606
+ farm,
1607
+ userPda,
1608
+ authority,
1609
+ iyfProgram,
1610
+ position: this.ix.keys[0].pubkey,
1611
+ lbPair: this.ix.keys[1].pubkey,
1612
+ binArrayBitmapExtension: this.ix.keys[2].pubkey,
1613
+ userToken: this.ix.keys[3].pubkey,
1614
+ reserve: this.ix.keys[4].pubkey,
1615
+ tokenMint: this.ix.keys[5].pubkey,
1616
+ binArrayLower: this.ix.keys[6].pubkey,
1617
+ binArrayUpper: this.ix.keys[7].pubkey,
1618
+ tokenProgram: this.ix.keys[9].pubkey,
1619
+ eventAuthority: this.ix.keys[10].pubkey,
1620
+ meteoraDlmmProgram: this.ix.keys[11].pubkey,
1621
+ }).instruction();
1622
+ // Instruction via main hawksight contract
1623
+ const ix = yield anchor_1.Anchor.instance().iyfMain.methods
1624
+ .iyfExtensionExecute(depositIx.data)
1625
+ .accounts({
1626
+ farm,
1627
+ userPda,
1628
+ authority,
1629
+ iyfProgram,
1630
+ iyfExtensionProgram: addresses_1.IYF_EXTENSION,
1631
+ })
1632
+ .remainingAccounts([
1633
+ depositIx.keys[4],
1634
+ depositIx.keys[5],
1635
+ depositIx.keys[6],
1636
+ depositIx.keys[7],
1637
+ depositIx.keys[8],
1638
+ depositIx.keys[9],
1639
+ depositIx.keys[10],
1640
+ depositIx.keys[11],
1641
+ depositIx.keys[12],
1642
+ depositIx.keys[13],
1643
+ depositIx.keys[14],
1644
+ depositIx.keys[15],
1645
+ ])
1646
+ .instruction();
1647
+ // Override the instruction
1648
+ this.ix.programId = ix.programId;
1649
+ this.ix.data = ix.data;
1650
+ this.ix.keys = ix.keys;
1651
+ });
1652
+ }
1653
+ }