@hawksightco/hawk-sdk 0.0.13 → 0.0.14

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 (37) hide show
  1. package/package.json +1 -1
  2. package/dist/src/classes/Client.d.ts +0 -35
  3. package/dist/src/classes/Client.d.ts.map +0 -1
  4. package/dist/src/classes/Client.js +0 -56
  5. package/dist/src/classes/General.d.ts +0 -68
  6. package/dist/src/classes/General.d.ts.map +0 -1
  7. package/dist/src/classes/General.js +0 -133
  8. package/dist/src/classes/GeneralUtility.d.ts +0 -34
  9. package/dist/src/classes/GeneralUtility.d.ts.map +0 -1
  10. package/dist/src/classes/GeneralUtility.js +0 -52
  11. package/dist/src/classes/HawkAPI.d.ts +0 -36
  12. package/dist/src/classes/HawkAPI.d.ts.map +0 -1
  13. package/dist/src/classes/HawkAPI.js +0 -36
  14. package/dist/src/classes/Health.d.ts +0 -29
  15. package/dist/src/classes/Health.d.ts.map +0 -1
  16. package/dist/src/classes/Health.js +0 -48
  17. package/dist/src/classes/Transaction.d.ts +0 -87
  18. package/dist/src/classes/Transaction.d.ts.map +0 -1
  19. package/dist/src/classes/Transaction.js +0 -250
  20. package/dist/src/classes/TxGenerator.d.ts +0 -131
  21. package/dist/src/classes/TxGenerator.d.ts.map +0 -1
  22. package/dist/src/classes/TxGenerator.js +0 -242
  23. package/dist/src/classes/TxGeneratorAutomations.d.ts +0 -70
  24. package/dist/src/classes/TxGeneratorAutomations.d.ts.map +0 -1
  25. package/dist/src/classes/TxGeneratorAutomations.js +0 -121
  26. package/dist/src/classes/Util.d.ts +0 -65
  27. package/dist/src/classes/Util.d.ts.map +0 -1
  28. package/dist/src/classes/Util.js +0 -115
  29. package/dist/src/functions.d.ts +0 -44
  30. package/dist/src/functions.d.ts.map +0 -1
  31. package/dist/src/functions.js +0 -129
  32. package/dist/src/index.d.ts +0 -3
  33. package/dist/src/index.d.ts.map +0 -1
  34. package/dist/src/index.js +0 -20
  35. package/dist/src/types.d.ts +0 -268
  36. package/dist/src/types.d.ts.map +0 -1
  37. package/dist/src/types.js +0 -17
@@ -1,70 +0,0 @@
1
- import * as web3 from "@solana/web3.js";
2
- import * as _client from "@hawksightco/swagger-client";
3
- import { ResponseWithStatus, TransactionMetadata, TransactionMetadataResponse } from "../types";
4
- import { Client } from "./Client";
5
- import { GeneralUtility } from "./GeneralUtility";
6
- /**
7
- * The `TxGeneratorAutomations` class encapsulates methods to generate transactions with various trading operations
8
- * on decentralized market making platforms like Meteora and Orca within the Solana ecosystem. It allows
9
- * setting custom transaction priority and fees to manage transaction processing speed and cost.
10
- *
11
- * NOTE: For hawksight devs only.
12
- */
13
- export declare class TxGeneratorAutomations {
14
- private readonly client;
15
- private readonly generalUtility;
16
- /**
17
- * The current priority level of transactions generated by this instance.
18
- */
19
- protected priorityLevel: _client.UtilGetPriorityFeeEstimateBodyPriorityEnum;
20
- /**
21
- * The maximum priority fee in lamports that can be added to transactions for faster processing.
22
- */
23
- protected maxPriorityFee: number;
24
- /**
25
- * Initializes a new instance of the TxGenerator class with a specified client.
26
- *
27
- * @param client An instance of Client used to interact with various APIs for transaction generation.
28
- */
29
- constructor(client: Client, generalUtility: GeneralUtility);
30
- /**
31
- * Creates meteora automation instruction that claims fee and rewards
32
- *
33
- * NOTE: For hawksight devs only.
34
- *
35
- * Autocompound IX
36
- *
37
- * @param connection The Solana web3 connection object for blockchain interactions.
38
- * @param payer The public key of the payer for transaction fees.
39
- * @param params Parameters required
40
- * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
41
- */
42
- meteoraClaimFeeAndRewards(connection: web3.Connection, payer: string, params: _client.AutomationClaimFeeAndRewardsAutomationIxBody): Promise<ResponseWithStatus<TransactionMetadataResponse> | ResponseWithStatus<TransactionMetadata>>;
43
- /**
44
- * Creates meteora automation instruction fully withdraws position and closes it
45
- *
46
- * NOTE: For hawksight devs only.
47
- *
48
- * Rebalance IX Part 1
49
- *
50
- * @param connection The Solana web3 connection object for blockchain interactions.
51
- * @param payer The public key of the payer for transaction fees.
52
- * @param params Parameters required
53
- * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
54
- */
55
- meteoraFullWithdrawalAndClosePosition(connection: web3.Connection, payer: string, params: _client.AutomationFullWithdrawAndClosePositionAutomationIxBody): Promise<ResponseWithStatus<TransactionMetadataResponse> | ResponseWithStatus<TransactionMetadata>>;
56
- /**
57
- * Creates meteora automation instruction that creates new position and deposit to that position
58
- *
59
- * NOTE: For hawksight devs only.
60
- *
61
- * Rebalance IX Part 2
62
- *
63
- * @param connection The Solana web3 connection object for blockchain interactions.
64
- * @param payer The public key of the payer for transaction fees.
65
- * @param params Parameters required
66
- * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
67
- */
68
- meteoraCreatePositionAndDeposit(connection: web3.Connection, payer: string, params: _client.AutomationCreatePositionAndDepositAutomationIxBody): Promise<ResponseWithStatus<TransactionMetadataResponse> | ResponseWithStatus<TransactionMetadata>>;
69
- }
70
- //# sourceMappingURL=TxGeneratorAutomations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TxGeneratorAutomations.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGeneratorAutomations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2BAA2B,EAAuB,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,sBAAsB;IAkB/B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAjBjC;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,0CAA0C,CAAC;IAE5E;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;IAEjC;;;;OAIG;gBAEgB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc;IAMjD;;;;;;;;;;;OAWG;IACG,yBAAyB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,4CAA4C,GAAG,OAAO,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAW7O;;;;;;;;;;;OAWG;IACG,qCAAqC,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,sDAAsD,GAAG,OAAO,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAWnQ;;;;;;;;;;;OAWG;IACG,+BAA+B,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,kDAAkD,GAAG,OAAO,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAU1P"}
@@ -1,121 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.TxGeneratorAutomations = void 0;
36
- const _client = __importStar(require("@hawksightco/swagger-client"));
37
- const functions_1 = require("../functions");
38
- /**
39
- * The `TxGeneratorAutomations` class encapsulates methods to generate transactions with various trading operations
40
- * on decentralized market making platforms like Meteora and Orca within the Solana ecosystem. It allows
41
- * setting custom transaction priority and fees to manage transaction processing speed and cost.
42
- *
43
- * NOTE: For hawksight devs only.
44
- */
45
- class TxGeneratorAutomations {
46
- /**
47
- * Initializes a new instance of the TxGenerator class with a specified client.
48
- *
49
- * @param client An instance of Client used to interact with various APIs for transaction generation.
50
- */
51
- constructor(client, generalUtility) {
52
- this.client = client;
53
- this.generalUtility = generalUtility;
54
- this.priorityLevel = _client.UtilGetPriorityFeeEstimateBodyPriorityEnum.Default;
55
- this.maxPriorityFee = 500000; // Default max priority fee in lamports
56
- }
57
- /**
58
- * Creates meteora automation instruction that claims fee and rewards
59
- *
60
- * NOTE: For hawksight devs only.
61
- *
62
- * Autocompound IX
63
- *
64
- * @param connection The Solana web3 connection object for blockchain interactions.
65
- * @param payer The public key of the payer for transaction fees.
66
- * @param params Parameters required
67
- * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
68
- */
69
- meteoraClaimFeeAndRewards(connection, payer, params) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const result = yield this.client.meteoraDLMMAutomationInstructionsApi.meteoraDlmmAutomationClaimFeeAndRewardsAutomationIxPost(params).catch(e => e.response);
72
- return (0, functions_1.resultOrError)({
73
- status: result.status,
74
- data: result.data,
75
- }, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
76
- });
77
- }
78
- /**
79
- * Creates meteora automation instruction fully withdraws position and closes it
80
- *
81
- * NOTE: For hawksight devs only.
82
- *
83
- * Rebalance IX Part 1
84
- *
85
- * @param connection The Solana web3 connection object for blockchain interactions.
86
- * @param payer The public key of the payer for transaction fees.
87
- * @param params Parameters required
88
- * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
89
- */
90
- meteoraFullWithdrawalAndClosePosition(connection, payer, params) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const result = yield this.client.meteoraDLMMAutomationInstructionsApi.meteoraDlmmAutomationFullWithdrawAndClosePositionAutomationIxPost(params).catch(e => e.response);
93
- return (0, functions_1.resultOrError)({
94
- status: result.status,
95
- data: result.data,
96
- }, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
97
- });
98
- }
99
- /**
100
- * Creates meteora automation instruction that creates new position and deposit to that position
101
- *
102
- * NOTE: For hawksight devs only.
103
- *
104
- * Rebalance IX Part 2
105
- *
106
- * @param connection The Solana web3 connection object for blockchain interactions.
107
- * @param payer The public key of the payer for transaction fees.
108
- * @param params Parameters required
109
- * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
110
- */
111
- meteoraCreatePositionAndDeposit(connection, payer, params) {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- const result = yield this.client.meteoraDLMMAutomationInstructionsApi.meteoraDlmmAutomationCreatePositionAndDepositAutomationIxPost(params).catch(e => e.response);
114
- return (0, functions_1.resultOrError)({
115
- status: result.status,
116
- data: result.data,
117
- }, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
118
- });
119
- }
120
- }
121
- exports.TxGeneratorAutomations = TxGeneratorAutomations;
@@ -1,65 +0,0 @@
1
- import * as client from "@hawksightco/swagger-client";
2
- import { MeteoraDlmmActiveBin, ResponseWithStatus } from "../types";
3
- import { Client } from "./Client";
4
- /**
5
- * Provides utility functions for interacting with the Meteora DLMM and Orca CLMM subsystems of the HawkSight API.
6
- * This class enables fetching and manipulating data related to pools, positions, and other transaction-related information.
7
- */
8
- export declare class Util {
9
- private readonly client;
10
- /**
11
- * Initializes a new instance of the Util class.
12
- *
13
- * @param client The Client object through which API calls will be made.
14
- */
15
- constructor(client: Client);
16
- /**
17
- * Retrieves a list of pools managed by Meteora DLMM.
18
- *
19
- * @returns A Promise resolving to a response object containing the status and array of pool information.
20
- */
21
- meteoraDlmmPools(): Promise<ResponseWithStatus<client.InlineResponse2005[]>>;
22
- /**
23
- * Fetches positions held in Meteora DLMM pools, optionally filtered by a specific pool.
24
- *
25
- * @param params An object containing wallet address and an optional pool identifier.
26
- * @returns A Promise resolving to a response object with the status and data of positions.
27
- */
28
- meteoraDlmmPositions(params: {
29
- wallet: string;
30
- pool?: string;
31
- }): Promise<ResponseWithStatus<any>>;
32
- /**
33
- * Retrieves the active bin data for a specific set of parameters in Meteora DLMM.
34
- *
35
- * @param params The parameters required to define the active bin query.
36
- * @returns A Promise resolving to a response with the status and data of the active bin.
37
- */
38
- meteoraDlmmActiveBin(params: client.UtilActiveBinBody): Promise<ResponseWithStatus<MeteoraDlmmActiveBin>>;
39
- /**
40
- * Retrieves a list of pools managed by Orca CLMM.
41
- *
42
- * @returns A Promise resolving to a response object containing the status and array of pool information.
43
- */
44
- orcaClmmPools(): Promise<ResponseWithStatus<any>>;
45
- /**
46
- * Fetches positions held in Orca CLMM pools, optionally filtered by a specific pool.
47
- *
48
- * @param params An object containing wallet address and an optional pool identifier.
49
- * @returns A Promise resolving to a response object with the status and data of positions.
50
- */
51
- orcaPositions(params: {
52
- wallet: string;
53
- pool?: string;
54
- }): Promise<ResponseWithStatus<any>>;
55
- /**
56
- * Retrieves the mint information of a specific position managed by Orca CLMM.
57
- *
58
- * @param params An object containing the identifier of the position.
59
- * @returns A Promise resolving to a response object with the status and mint details of the position.
60
- */
61
- orcaGetPositionMint(params: {
62
- position: string;
63
- }): Promise<ResponseWithStatus<any>>;
64
- }
65
- //# sourceMappingURL=Util.d.ts.map
@@ -1 +0,0 @@
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,EAAE,MAAM,UAAU,CAAC;AACpE,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,GAAG,CAAC,CAAC;IAQnC;;;;;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,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;CAOpC"}
@@ -1,115 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Util = void 0;
13
- /**
14
- * Provides utility functions for interacting with the Meteora DLMM and Orca CLMM subsystems of the HawkSight API.
15
- * This class enables fetching and manipulating data related to pools, positions, and other transaction-related information.
16
- */
17
- class Util {
18
- /**
19
- * Initializes a new instance of the Util class.
20
- *
21
- * @param client The Client object through which API calls will be made.
22
- */
23
- constructor(client) {
24
- this.client = client;
25
- }
26
- /**
27
- * Retrieves a list of pools managed by Meteora DLMM.
28
- *
29
- * @returns A Promise resolving to a response object containing the status and array of pool information.
30
- */
31
- meteoraDlmmPools() {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const result = yield this.client.meteoraDLMMUtilityFunctionsApi.meteoraDlmmUtilPoolsGet().catch(e => e.response);
34
- return {
35
- status: result.status,
36
- data: result.data,
37
- };
38
- });
39
- }
40
- /**
41
- * Fetches positions held in Meteora DLMM pools, optionally filtered by a specific pool.
42
- *
43
- * @param params An object containing wallet address and an optional pool identifier.
44
- * @returns A Promise resolving to a response object with the status and data of positions.
45
- */
46
- meteoraDlmmPositions(params) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- const result = yield this.client.meteoraDLMMUtilityFunctionsApi.meteoraDlmmUtilPositionsGet(params.wallet, params.pool).catch(e => e.response);
49
- return {
50
- status: result.status,
51
- data: result.data,
52
- };
53
- });
54
- }
55
- /**
56
- * Retrieves the active bin data for a specific set of parameters in Meteora DLMM.
57
- *
58
- * @param params The parameters required to define the active bin query.
59
- * @returns A Promise resolving to a response with the status and data of the active bin.
60
- */
61
- meteoraDlmmActiveBin(params) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- const result = yield this.client.meteoraDLMMUtilityFunctionsApi.meteoraDlmmUtilActiveBinPost(params).catch(e => e.response);
64
- return {
65
- status: result.status,
66
- data: result.data,
67
- };
68
- });
69
- }
70
- /**
71
- * Retrieves a list of pools managed by Orca CLMM.
72
- *
73
- * @returns A Promise resolving to a response object containing the status and array of pool information.
74
- */
75
- orcaClmmPools() {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilPoolsGet().catch(e => e.response);
78
- return {
79
- status: result.status,
80
- data: result.data,
81
- };
82
- });
83
- }
84
- /**
85
- * Fetches positions held in Orca CLMM pools, optionally filtered by a specific pool.
86
- *
87
- * @param params An object containing wallet address and an optional pool identifier.
88
- * @returns A Promise resolving to a response object with the status and data of positions.
89
- */
90
- orcaPositions(params) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilPositionsGet(params.wallet, params.pool).catch(e => e.response);
93
- return {
94
- status: result.status,
95
- data: result.data,
96
- };
97
- });
98
- }
99
- /**
100
- * Retrieves the mint information of a specific position managed by Orca CLMM.
101
- *
102
- * @param params An object containing the identifier of the position.
103
- * @returns A Promise resolving to a response object with the status and mint details of the position.
104
- */
105
- orcaGetPositionMint(params) {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- const result = yield this.client.orcaUtilityFunctionsApi.orcaUtilGetPositionMintGet(params.position).catch(e => e.response);
108
- return {
109
- status: result.status,
110
- data: result.data,
111
- };
112
- });
113
- }
114
- }
115
- exports.Util = Util;
@@ -1,44 +0,0 @@
1
- import * as client from "@hawksightco/swagger-client";
2
- import * as web3 from "@solana/web3.js";
3
- import { ResponseWithStatus, TransactionMetadata, TransactionMetadataResponse } from "./types";
4
- import { GeneralUtility } from "./classes/GeneralUtility";
5
- /**
6
- * Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
7
- * This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
8
- *
9
- * @param connection The active Solana blockchain connection used to fetch state and simulate the transaction.
10
- * @param payer The public key (as a string) of the payer for the transaction, responsible for fees.
11
- * @param data An object containing necessary information to construct the transaction, such as:
12
- * - addressLookupTableAddresses: Array of addresses for lookup tables.
13
- * - computeBudgetInstructions: Array of instructions for setting compute budget.
14
- * - description: Description of the transaction.
15
- * - estimatedFeeInSOL: Estimated fee in SOL units.
16
- * @param priorityLevel An enum representing the priority level of the transaction which might influence the fee.
17
- * @param maxPriorityFee The maximum priority fee willing to be paid on top of the base fee for faster processing (in lamports)
18
- * @returns A promise resolving to an object containing the transaction metadata including the description,
19
- * estimated fee, and the transaction object itself.
20
- * @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
21
- */
22
- export declare function createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse, priorityLevel: client.UtilGetPriorityFeeEstimateBodyPriorityEnum, maxPriorityFee: number): Promise<TransactionMetadata>;
23
- /**
24
- * Wraps the result of an API call or operation in an object containing status information.
25
- * If the result status is 200, applies a success function to the data.
26
- * @param result The result object containing the HTTP status code and response data.
27
- * @param successFn A function to be applied to the response data in case of success.
28
- * @returns A promise that resolves to an object containing status information and the transformed or original response data.
29
- * The response data may be of type Out if the success function is applied, or type Response if not.
30
- */
31
- export declare function resultOrError<Response, Out>(result: {
32
- status: number;
33
- data: Response;
34
- }, successFn: (data: Response) => Promise<Out>): Promise<ResponseWithStatus<Out>>;
35
- /**
36
- * Retrieves an estimate of the priority fee for a transaction using the provided connection.
37
- *
38
- * @param connection The web3 connection object used for interacting with the blockchain.
39
- * @param priorityLevel The priority level of the transaction.
40
- * @param versionedTransaction The versioned transaction object for which the fee estimate is needed.
41
- * @returns A Promise resolving to the estimated priority fee for the transaction.
42
- */
43
- export declare function getFeeEstimate(generalUtility: GeneralUtility, priority: client.UtilGetPriorityFeeEstimateBodyPriorityEnum, transaction: TransactionMetadataResponse): Promise<number>;
44
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2BAA2B,EAAuB,MAAM,SAAS,CAAC;AAGpH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,EACjC,aAAa,EAAE,MAAM,CAAC,0CAA0C,EAChE,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAyC9B;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,GAAG,EAC/C,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,EAC1C,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,GAAG,CAAC,GAC1C,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAYlC;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,CAAC,0CAA0C,EAC3D,WAAW,EAAE,2BAA2B,GACvC,OAAO,CAAC,MAAM,CAAC,CASjB"}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.getFeeEstimate = exports.resultOrError = exports.createTxMetadata = void 0;
36
- const web3 = __importStar(require("@solana/web3.js"));
37
- const Transaction_1 = require("./classes/Transaction");
38
- /**
39
- * Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
40
- * This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
41
- *
42
- * @param connection The active Solana blockchain connection used to fetch state and simulate the transaction.
43
- * @param payer The public key (as a string) of the payer for the transaction, responsible for fees.
44
- * @param data An object containing necessary information to construct the transaction, such as:
45
- * - addressLookupTableAddresses: Array of addresses for lookup tables.
46
- * - computeBudgetInstructions: Array of instructions for setting compute budget.
47
- * - description: Description of the transaction.
48
- * - estimatedFeeInSOL: Estimated fee in SOL units.
49
- * @param priorityLevel An enum representing the priority level of the transaction which might influence the fee.
50
- * @param maxPriorityFee The maximum priority fee willing to be paid on top of the base fee for faster processing (in lamports)
51
- * @returns A promise resolving to an object containing the transaction metadata including the description,
52
- * estimated fee, and the transaction object itself.
53
- * @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
54
- */
55
- function createTxMetadata(generalUtility, connection, payer, data, priorityLevel, maxPriorityFee) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- // Retrieve address lookup table accounts
58
- const alts = [];
59
- for (const alt of data.addressLookupTableAddresses) {
60
- alts.push((yield connection.getAddressLookupTable(new web3.PublicKey(alt))).value);
61
- }
62
- // Get the recent blockhash
63
- const { blockhash: recentBlockhash } = yield connection.getLatestBlockhash();
64
- // Create initial transaction instance
65
- const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), recentBlockhash, alts);
66
- // Simulate transaction to get consumed units
67
- const simulation = yield transaction.simulateTransaction(connection);
68
- // Check if there's error in transaction
69
- if (simulation.err !== null) {
70
- console.error(`Transaction Error: ${simulation.err}`);
71
- for (const log in simulation.logs) {
72
- console.error(log);
73
- }
74
- throw new Error(simulation.err.toString());
75
- }
76
- // Include priority fee instructions generated via Helius (assuming we use Helius as RPC)
77
- transaction.addPriorityFeeIx(generalUtility, connection, priorityLevel, simulation.unitsConsumed, maxPriorityFee);
78
- // Return transaction metadatauni
79
- return {
80
- description: data.description,
81
- estimatedFeeInSOL: data.estimatedFeeInSOL,
82
- transaction,
83
- };
84
- });
85
- }
86
- exports.createTxMetadata = createTxMetadata;
87
- /**
88
- * Wraps the result of an API call or operation in an object containing status information.
89
- * If the result status is 200, applies a success function to the data.
90
- * @param result The result object containing the HTTP status code and response data.
91
- * @param successFn A function to be applied to the response data in case of success.
92
- * @returns A promise that resolves to an object containing status information and the transformed or original response data.
93
- * The response data may be of type Out if the success function is applied, or type Response if not.
94
- */
95
- function resultOrError(result, successFn) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- if (result.status === 200) {
98
- // If the status is 200, apply the success function to the data
99
- return {
100
- status: result.status,
101
- data: yield successFn(result.data),
102
- };
103
- }
104
- else {
105
- console.error(`Error:`);
106
- console.error(result.data);
107
- throw new Error();
108
- }
109
- });
110
- }
111
- exports.resultOrError = resultOrError;
112
- /**
113
- * Retrieves an estimate of the priority fee for a transaction using the provided connection.
114
- *
115
- * @param connection The web3 connection object used for interacting with the blockchain.
116
- * @param priorityLevel The priority level of the transaction.
117
- * @param versionedTransaction The versioned transaction object for which the fee estimate is needed.
118
- * @returns A Promise resolving to the estimated priority fee for the transaction.
119
- */
120
- function getFeeEstimate(generalUtility, priority, transaction) {
121
- return __awaiter(this, void 0, void 0, function* () {
122
- const response = yield generalUtility.getPriorityFeeEstimate({
123
- priority,
124
- transaction,
125
- });
126
- return (yield resultOrError(response, (result) => __awaiter(this, void 0, void 0, function* () { return result.priorityFeeEstimate; }))).data;
127
- });
128
- }
129
- exports.getFeeEstimate = getFeeEstimate;
@@ -1,3 +0,0 @@
1
- export * from "./types";
2
- export { HawkAPI } from "./classes/HawkAPI";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/src/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.HawkAPI = void 0;
18
- __exportStar(require("./types"), exports);
19
- var HawkAPI_1 = require("./classes/HawkAPI");
20
- Object.defineProperty(exports, "HawkAPI", { enumerable: true, get: function () { return HawkAPI_1.HawkAPI; } });