@hawksightco/hawk-sdk 1.1.42-rc3 → 1.1.43

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.
@@ -4,6 +4,7 @@ import * as _client from "@hawksightco/swagger-client";
4
4
  import { ResponseWithStatus, TransactionMetadata, UserPortfolioOut } from "../types";
5
5
  import { Client } from "./Client";
6
6
  import { GeneralUtility } from "./GeneralUtility";
7
+ import { InlineResponse200 } from '../../../swagger-client/dist/models/inline-response200';
7
8
  /**
8
9
  * Provides general utility functions for managing and querying blockchain-related data,
9
10
  * handling transactions, and interfacing with a specific blockchain network via the client API.
@@ -34,6 +35,12 @@ export declare class General {
34
35
  * @param maxPriorityFee The fee in lamports.
35
36
  */
36
37
  setMaxPriorityFee(maxPriorityFee: number): void;
38
+ /**
39
+ * @returns Returns a token supported by Hawksight
40
+ */
41
+ token(params: {
42
+ address: string;
43
+ }): Promise<ResponseWithStatus<InlineResponse200>>;
37
44
  /**
38
45
  * Retrieves the portfolio information for a specified wallet and optionally a pool.
39
46
  *
@@ -53,6 +60,16 @@ export declare class General {
53
60
  pools(params: {
54
61
  hash?: string;
55
62
  }): Promise<ResponseWithStatus<_client.HawksightPool[]>>;
63
+ /**
64
+ * Fetches a single pool either from Orca or Meteora.
65
+ *
66
+ * @param params Object containing hash of the pools
67
+ * @returns A Promise resolving to an array of pools, including metadata such as pool addresses and statistics.
68
+ */
69
+ pool(params: {
70
+ pairAddress: string;
71
+ protocol: string;
72
+ }): Promise<ResponseWithStatus<_client.HawksightPool[]>>;
56
73
  /**
57
74
  * Retrieves information about the available tokens on the platform.
58
75
  *
@@ -1 +1 @@
1
- {"version":3,"file":"General.d.ts","sourceRoot":"","sources":["../../../src/classes/General.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EA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R,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAevD;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAQxE;;;;;;;OAOG;IACG,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAU3I"}
@@ -69,6 +69,18 @@ class General {
69
69
  setMaxPriorityFee(maxPriorityFee) {
70
70
  this.maxPriorityFee = maxPriorityFee;
71
71
  }
72
+ /**
73
+ * @returns Returns a token supported by Hawksight
74
+ */
75
+ token(params) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const result = yield this.client.generalEndpoints.tokenGet(params.address).catch(e => e.response);
78
+ return {
79
+ status: result.status,
80
+ data: result.data,
81
+ };
82
+ });
83
+ }
72
84
  /**
73
85
  * Retrieves the portfolio information for a specified wallet and optionally a pool.
74
86
  *
@@ -99,6 +111,26 @@ class General {
99
111
  };
100
112
  });
101
113
  }
114
+ /**
115
+ * Fetches a single pool either from Orca or Meteora.
116
+ *
117
+ * @param params Object containing hash of the pools
118
+ * @returns A Promise resolving to an array of pools, including metadata such as pool addresses and statistics.
119
+ */
120
+ pool(params) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ if (["orca", "meteora"].includes(params.protocol)) {
123
+ const result = yield this.client.generalEndpoints.poolGet(params.pairAddress, params.protocol).catch(e => e.response);
124
+ return {
125
+ status: result.status,
126
+ data: result.data,
127
+ };
128
+ }
129
+ else {
130
+ throw new Error(`Protocol can only be: "orca" or "meteora". Value passed: ${params.protocol}`);
131
+ }
132
+ });
133
+ }
102
134
  /**
103
135
  * Retrieves information about the available tokens on the platform.
104
136
  *
@@ -70,5 +70,18 @@ export declare class Util {
70
70
  orcaGetPosition(params: {
71
71
  pool: string;
72
72
  }): Promise<ResponseWithStatus<any>>;
73
+ /**
74
+ * Returns orca tick current index of given whirlpool(s)
75
+ *
76
+ * @param params
77
+ * @returns
78
+ */
79
+ orcaGetActiveTick(params: {
80
+ pools: string[];
81
+ commitment?: string;
82
+ }): Promise<{
83
+ status: any;
84
+ data: any;
85
+ }>;
73
86
  }
74
87
  //# sourceMappingURL=Util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../../src/classes/Util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAiB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;GAGG;AACH,qBAAa,IAAI;IAOb,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB;;;;OAIG;gBAEgB,MAAM,EAAE,MAAM;IAGjC;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAQlF;;;;;OAKG;IACG,oBAAoB,CACxB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IAQhD;;;;;OAKG;IACG,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IAQ/G;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAQvD;;;;;OAKG;IACG,aAAa,CACjB,MAAM,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QvD;;;;;OAKG;IACG,aAAa,CACjB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAQnC;;;;;OAKG;IACG,mBAAmB,CACvB,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAQnC;;;;;OAKG;IACG,eAAe,CACnB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;KACd,GACA,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAQnC;;;;;OAKG;IACG,iBAAiB,CACrB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB;;;;CAWJ"}
@@ -119,7 +119,25 @@ class Util {
119
119
  */
120
120
  orcaGetPosition(params) {
121
121
  return __awaiter(this, void 0, void 0, function* () {
122
- const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilPoolGet(params.pool).catch(e => e.response);
122
+ const result = yield this.client.generalEndpoints.poolGet(params.pool, "orca");
123
+ return {
124
+ status: result.status,
125
+ data: result.data,
126
+ };
127
+ });
128
+ }
129
+ /**
130
+ * Returns orca tick current index of given whirlpool(s)
131
+ *
132
+ * @param params
133
+ * @returns
134
+ */
135
+ orcaGetActiveTick(params) {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilActiveTickPost({
138
+ pools: params.pools,
139
+ commitment: params.commitment,
140
+ }).catch(e => e.response);
123
141
  return {
124
142
  status: result.status,
125
143
  data: result.data,
@@ -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,CAQpI;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"}
@@ -45,13 +45,15 @@ const util = __importStar(require("./functions"));
45
45
  */
46
46
  function meteoraToHawksight(_a) {
47
47
  return __awaiter(this, arguments, void 0, function* ({ ixs, userPda, authority }) {
48
- return ixs.map((ix) => {
49
- ix = HawksightMeteoraCpi.factory(ix, userPda, authority).getInstruction();
48
+ const _ixs = [];
49
+ for (const ix of ixs) {
50
+ const _ix = yield HawksightMeteoraCpi.factory(ix, userPda, authority).getInstruction();
50
51
  if (ix.programId.toString() === addresses_1.ASSOCIATED_TOKEN_PROGRAM.toString() && ix.keys.length === 6) {
51
52
  ix.keys[0] = Object.assign(Object.assign({}, ix.keys[0]), { pubkey: authority });
52
53
  }
53
- return ix;
54
- });
54
+ _ixs.push(_ix);
55
+ }
56
+ return _ixs;
55
57
  });
56
58
  }
57
59
  exports.meteoraToHawksight = meteoraToHawksight;
@@ -141,13 +143,34 @@ class HawksightMeteoraCpi {
141
143
  * @returns The (possibly modified) transaction instruction.
142
144
  */
143
145
  getInstruction() {
144
- const matchInstance = this.sighashMatch();
145
- if (this.programIdMatch() && matchInstance !== undefined) {
146
- matchInstance.replace();
147
- matchInstance.addHawksightCpi();
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ const matchInstance = this.sighashMatch();
148
+ if (this.programIdMatch() && matchInstance !== undefined) {
149
+ matchInstance.replace();
150
+ yield matchInstance.addHawksightCpi();
151
+ return this.ix;
152
+ }
148
153
  return this.ix;
149
- }
150
- return this.ix;
154
+ });
155
+ }
156
+ /**
157
+ * Modifies the transaction instruction to include specific Hawksight CPI details.
158
+ * Prepares the instruction for execution by adjusting its program ID and data based on Hawksight criteria.
159
+ */
160
+ addHawksightCpi() {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ const METEORA_PROGRAM = addresses_1.METEORA_DLMM_PROGRAM;
163
+ const size = Buffer.alloc(4);
164
+ size.writeUint32LE(this.ix.data.length);
165
+ const data = Buffer.concat([util.sighash('meteora_dynamic_cpi'), size, this.ix.data]);
166
+ this.ix.programId = addresses_1.IYF_MAIN;
167
+ this.ix.data = data;
168
+ this.ix.keys.unshift(...[
169
+ { pubkey: this.userPda, isSigner: false, isWritable: false },
170
+ { pubkey: this.authority, isSigner: true, isWritable: true },
171
+ { pubkey: METEORA_PROGRAM, isSigner: false, isWritable: false },
172
+ ]);
173
+ });
151
174
  }
152
175
  /**
153
176
  * Adds a subsequent CPI to the chain.
@@ -187,23 +210,6 @@ class HawksightMeteoraCpi {
187
210
  programIdMatch() {
188
211
  return this.ix.programId.equals(addresses_1.METEORA_DLMM_PROGRAM);
189
212
  }
190
- /**
191
- * Modifies the transaction instruction to include specific Hawksight CPI details.
192
- * Prepares the instruction for execution by adjusting its program ID and data based on Hawksight criteria.
193
- */
194
- addHawksightCpi() {
195
- const METEORA_PROGRAM = addresses_1.METEORA_DLMM_PROGRAM;
196
- const size = Buffer.alloc(4);
197
- size.writeUint32LE(this.ix.data.length);
198
- const data = Buffer.concat([util.sighash('meteora_dynamic_cpi'), size, this.ix.data]);
199
- this.ix.programId = addresses_1.IYF_MAIN;
200
- this.ix.data = data;
201
- this.ix.keys.unshift(...[
202
- { pubkey: this.userPda, isSigner: false, isWritable: false },
203
- { pubkey: this.authority, isSigner: true, isWritable: true },
204
- { pubkey: METEORA_PROGRAM, isSigner: false, isWritable: false },
205
- ]);
206
- }
207
213
  }
208
214
  /**
209
215
  * Handles the initialization of a position in a blockchain transaction.
@@ -379,6 +385,80 @@ class ClaimFee extends HawksightMeteoraCpi {
379
385
  this.ix.keys[4].pubkey = this.userPda;
380
386
  this.ix.keys[4].isSigner = false;
381
387
  }
388
+ /**
389
+ * Overrides default add hawksight cpi to use meteoraDlmmClaimFee instead of meteoraDynamicCpi
390
+ */
391
+ addHawksightCpi() {
392
+ return __awaiter(this, void 0, void 0, function* () {
393
+ // Common parameters
394
+ const farm = addresses_1.USDC_FARM;
395
+ const userPda = this.userPda;
396
+ const authority = this.authority;
397
+ const iyfProgram = addresses_1.IYF_MAIN;
398
+ // Get token mints X and Y
399
+ const tokenXMint = this.ix.keys[9].pubkey;
400
+ const tokenYMint = this.ix.keys[10].pubkey;
401
+ // Generate owner fee X and Y ATA
402
+ const ownerFeeX = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenXMint);
403
+ const ownerFeeY = util.generateAta(addresses_1.SITE_FEE_OWNER, tokenYMint);
404
+ // Generate IX via extension contract
405
+ const claimFeeIx = yield anchor_1.Anchor.instance().iyfExtension.methods
406
+ .meteoraDlmmClaimFee()
407
+ .accounts({
408
+ farm,
409
+ userPda,
410
+ authority,
411
+ iyfProgram,
412
+ lbPair: this.ix.keys[0].pubkey,
413
+ position: this.ix.keys[1].pubkey,
414
+ binArrayLower: this.ix.keys[2].pubkey,
415
+ binArrayUpper: this.ix.keys[3].pubkey,
416
+ reserveX: this.ix.keys[5].pubkey,
417
+ reserveY: this.ix.keys[6].pubkey,
418
+ userTokenX: this.ix.keys[7].pubkey,
419
+ userTokenY: this.ix.keys[8].pubkey,
420
+ tokenXMint: this.ix.keys[9].pubkey,
421
+ tokenYMint: this.ix.keys[10].pubkey,
422
+ tokenProgram: this.ix.keys[11].pubkey,
423
+ eventAuthority: this.ix.keys[12].pubkey,
424
+ meteoraDlmmProgram: this.ix.keys[13].pubkey,
425
+ ownerFeeX,
426
+ ownerFeeY,
427
+ }).instruction();
428
+ // Instruction via main hawksight contract
429
+ const ix = yield anchor_1.Anchor.instance().iyfMain.methods
430
+ .iyfExtensionExecute(claimFeeIx.data)
431
+ .accounts({
432
+ farm,
433
+ userPda,
434
+ authority,
435
+ iyfProgram,
436
+ iyfExtensionProgram: addresses_1.IYF_EXTENSION,
437
+ })
438
+ .remainingAccounts([
439
+ claimFeeIx.keys[4],
440
+ claimFeeIx.keys[5],
441
+ claimFeeIx.keys[6],
442
+ claimFeeIx.keys[7],
443
+ claimFeeIx.keys[8],
444
+ claimFeeIx.keys[9],
445
+ claimFeeIx.keys[10],
446
+ claimFeeIx.keys[11],
447
+ claimFeeIx.keys[12],
448
+ claimFeeIx.keys[13],
449
+ claimFeeIx.keys[14],
450
+ claimFeeIx.keys[15],
451
+ claimFeeIx.keys[16],
452
+ claimFeeIx.keys[17],
453
+ claimFeeIx.keys[18],
454
+ ])
455
+ .instruction();
456
+ // Override the instruction
457
+ this.ix.programId = ix.programId;
458
+ this.ix.data = ix.data;
459
+ this.ix.keys = ix.keys;
460
+ });
461
+ }
382
462
  }
383
463
  /**
384
464
  * Manages the claiming of rewards in blockchain operations, typically associated with staking or similar activities.
@@ -401,6 +481,72 @@ class ClaimReward extends HawksightMeteoraCpi {
401
481
  this.ix.keys[4].pubkey = this.userPda;
402
482
  this.ix.keys[4].isSigner = false;
403
483
  }
484
+ /**
485
+ * Overrides default add hawksight cpi to use meteoraDlmmClaimReward instead of meteoraDynamicCpi
486
+ */
487
+ addHawksightCpi() {
488
+ return __awaiter(this, void 0, void 0, function* () {
489
+ // Common parameters
490
+ const farm = addresses_1.USDC_FARM;
491
+ const userPda = this.userPda;
492
+ const authority = this.authority;
493
+ const iyfProgram = addresses_1.IYF_MAIN;
494
+ // Get token mint
495
+ const rewardMint = this.ix.keys[9].pubkey;
496
+ // Generate owner fee X and Y ATA
497
+ const ownerFee = util.generateAta(addresses_1.SITE_FEE_OWNER, rewardMint);
498
+ // Get reward index from parameter
499
+ const rewardIndex = new bn_js_1.BN(this.ix.data.readBigInt64LE(8).toString());
500
+ // Generate IX via extension contract
501
+ const claimReward = yield anchor_1.Anchor.instance().iyfExtension.methods
502
+ .meteoraDlmmClaimReward(rewardIndex)
503
+ .accounts({
504
+ farm,
505
+ userPda,
506
+ authority,
507
+ iyfProgram,
508
+ lbPair: this.ix.keys[4].pubkey,
509
+ position: this.ix.keys[5].pubkey,
510
+ binArrayLower: this.ix.keys[6].pubkey,
511
+ binArrayUpper: this.ix.keys[7].pubkey,
512
+ rewardVault: this.ix.keys[8].pubkey,
513
+ rewardMint: this.ix.keys[9].pubkey,
514
+ userTokenAccount: this.ix.keys[10].pubkey,
515
+ tokenProgram: this.ix.keys[11].pubkey,
516
+ eventAuthority: this.ix.keys[12].pubkey,
517
+ meteoraDlmmProgram: this.ix.keys[13].pubkey,
518
+ ownerFee,
519
+ }).instruction();
520
+ // Instruction via main hawksight contract
521
+ const ix = yield anchor_1.Anchor.instance().iyfMain.methods
522
+ .iyfExtensionExecute(claimReward.data)
523
+ .accounts({
524
+ farm,
525
+ userPda,
526
+ authority,
527
+ iyfProgram,
528
+ iyfExtensionProgram: addresses_1.IYF_EXTENSION,
529
+ })
530
+ .remainingAccounts([
531
+ claimReward.keys[4],
532
+ claimReward.keys[5],
533
+ claimReward.keys[6],
534
+ claimReward.keys[7],
535
+ claimReward.keys[8],
536
+ claimReward.keys[9],
537
+ claimReward.keys[10],
538
+ claimReward.keys[11],
539
+ claimReward.keys[12],
540
+ claimReward.keys[13],
541
+ claimReward.keys[14],
542
+ ])
543
+ .instruction();
544
+ // Override the instruction
545
+ this.ix.programId = ix.programId;
546
+ this.ix.data = ix.data;
547
+ this.ix.keys = ix.keys;
548
+ });
549
+ }
404
550
  }
405
551
  /**
406
552
  * Handles the closure of a position within a blockchain transaction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawksightco/hawk-sdk",
3
- "version": "1.1.42-rc3",
3
+ "version": "1.1.43",
4
4
  "description": "Hawksight v2 SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": "https://github.com/ghabxph/hawk-api-client.git",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@coral-xyz/anchor": "~0.29.0",
27
- "@hawksightco/swagger-client": "^0.0.33",
27
+ "@hawksightco/swagger-client": "^0.0.34",
28
28
  "@meteora-ag/dlmm": "^1.0.51",
29
29
  "@solana/spl-token": "^0.4.6",
30
30
  "@solana/web3.js": "^1.89.1",