@hawksightco/hawk-sdk 1.3.265 → 1.3.267
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.
- package/dist/addresses.d.ts +37 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +84 -0
- package/dist/anchor.d.ts +22 -0
- package/dist/anchor.d.ts.map +1 -0
- package/dist/anchor.js +121 -0
- package/dist/classes/AltStorage.d.ts +29 -0
- package/dist/classes/AltStorage.d.ts.map +1 -0
- package/dist/classes/AltStorage.js +58 -0
- package/dist/classes/Atomicity.d.ts +34 -0
- package/dist/classes/Atomicity.d.ts.map +1 -0
- package/dist/classes/Atomicity.js +110 -0
- package/dist/classes/Client.d.ts +35 -0
- package/dist/classes/Client.d.ts.map +1 -0
- package/dist/classes/Client.js +66 -0
- package/dist/classes/CombineTransactions.d.ts +11 -0
- package/dist/classes/CombineTransactions.d.ts.map +1 -0
- package/dist/classes/CombineTransactions.js +58 -0
- package/dist/classes/CreateTxMetadata.d.ts +100 -0
- package/dist/classes/CreateTxMetadata.d.ts.map +1 -0
- package/dist/classes/CreateTxMetadata.js +415 -0
- package/dist/classes/General.d.ts +87 -0
- package/dist/classes/General.d.ts.map +1 -0
- package/dist/classes/General.js +176 -0
- package/dist/classes/GeneralUtility.d.ts +79 -0
- package/dist/classes/GeneralUtility.d.ts.map +1 -0
- package/dist/classes/GeneralUtility.js +121 -0
- package/dist/classes/HawkAPI.d.ts +122 -0
- package/dist/classes/HawkAPI.d.ts.map +1 -0
- package/dist/classes/HawkAPI.js +169 -0
- package/dist/classes/Health.d.ts +29 -0
- package/dist/classes/Health.d.ts.map +1 -0
- package/dist/classes/Health.js +48 -0
- package/dist/classes/JupiterAlts.d.ts +37 -0
- package/dist/classes/JupiterAlts.d.ts.map +1 -0
- package/dist/classes/JupiterAlts.js +114 -0
- package/dist/classes/JupiterSwap.d.ts +21 -0
- package/dist/classes/JupiterSwap.d.ts.map +1 -0
- package/dist/classes/JupiterSwap.js +40 -0
- package/dist/classes/Logging.d.ts +13 -0
- package/dist/classes/Logging.d.ts.map +1 -0
- package/dist/classes/Logging.js +50 -0
- package/dist/classes/MultiTransaction.d.ts +75 -0
- package/dist/classes/MultiTransaction.d.ts.map +1 -0
- package/dist/classes/MultiTransaction.js +296 -0
- package/dist/classes/RaydiumSDK.d.ts +67 -0
- package/dist/classes/RaydiumSDK.d.ts.map +1 -0
- package/dist/classes/RaydiumSDK.js +206 -0
- package/dist/classes/Search.d.ts +100 -0
- package/dist/classes/Search.d.ts.map +1 -0
- package/dist/classes/Search.js +216 -0
- package/dist/classes/SimpleIxGenerator.d.ts +57 -0
- package/dist/classes/SimpleIxGenerator.d.ts.map +1 -0
- package/dist/classes/SimpleIxGenerator.js +62 -0
- package/dist/classes/SimplePdaGenerator.d.ts +28 -0
- package/dist/classes/SimplePdaGenerator.d.ts.map +1 -0
- package/dist/classes/SimplePdaGenerator.js +33 -0
- package/dist/classes/Transaction.d.ts +229 -0
- package/dist/classes/Transaction.d.ts.map +1 -0
- package/dist/classes/Transaction.js +643 -0
- package/dist/classes/Transaction2.d.ts +107 -0
- package/dist/classes/Transaction2.d.ts.map +1 -0
- package/dist/classes/Transaction2.js +249 -0
- package/dist/classes/Transaction3.d.ts +165 -0
- package/dist/classes/Transaction3.d.ts.map +1 -0
- package/dist/classes/Transaction3.js +416 -0
- package/dist/classes/TransactionBatchExecute.d.ts +163 -0
- package/dist/classes/TransactionBatchExecute.d.ts.map +1 -0
- package/dist/classes/TransactionBatchExecute.js +466 -0
- package/dist/classes/TransactionBatchExecute2.d.ts +99 -0
- package/dist/classes/TransactionBatchExecute2.d.ts.map +1 -0
- package/dist/classes/TransactionBatchExecute2.js +357 -0
- package/dist/classes/Transactions.d.ts +586 -0
- package/dist/classes/Transactions.d.ts.map +1 -0
- package/dist/classes/Transactions.js +7667 -0
- package/dist/classes/TxGenerator.d.ts +350 -0
- package/dist/classes/TxGenerator.d.ts.map +1 -0
- package/dist/classes/TxGenerator.js +1957 -0
- package/dist/classes/TxGeneratorAutomations.d.ts +186 -0
- package/dist/classes/TxGeneratorAutomations.d.ts.map +1 -0
- package/dist/classes/TxGeneratorAutomations.js +897 -0
- package/dist/classes/Util.d.ts +87 -0
- package/dist/classes/Util.d.ts.map +1 -0
- package/dist/classes/Util.js +148 -0
- package/dist/classes/account-cache/AccountCache.d.ts +54 -0
- package/dist/classes/account-cache/AccountCache.d.ts.map +1 -0
- package/dist/classes/account-cache/AccountCache.js +143 -0
- package/dist/classes/account-cache/MintCache.d.ts +33 -0
- package/dist/classes/account-cache/MintCache.d.ts.map +1 -0
- package/dist/classes/account-cache/MintCache.js +47 -0
- package/dist/classes/account-cache/TokenCache.d.ts +33 -0
- package/dist/classes/account-cache/TokenCache.d.ts.map +1 -0
- package/dist/classes/account-cache/TokenCache.js +47 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +96 -0
- package/dist/functions.d.ts +514 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/functions.js +1636 -0
- package/dist/hawksight.d.ts +53 -0
- package/dist/hawksight.d.ts.map +1 -0
- package/dist/hawksight.js +328 -0
- package/dist/hsToMeteora.d.ts +31 -0
- package/dist/hsToMeteora.d.ts.map +1 -0
- package/dist/hsToMeteora.js +3175 -0
- package/dist/idl/iyf-extension-idl.d.ts +14583 -0
- package/dist/idl/iyf-extension-idl.d.ts.map +1 -0
- package/dist/idl/iyf-extension-idl.js +14578 -0
- package/dist/idl/iyf-extension-wrapper.d.ts +112 -0
- package/dist/idl/iyf-extension-wrapper.d.ts.map +1 -0
- package/dist/idl/iyf-extension-wrapper.js +2 -0
- package/dist/idl/iyf-main-idl.d.ts +12078 -0
- package/dist/idl/iyf-main-idl.d.ts.map +1 -0
- package/dist/idl/iyf-main-idl.js +12073 -0
- package/dist/idl/iyf-main-wrapper.d.ts +112 -0
- package/dist/idl/iyf-main-wrapper.d.ts.map +1 -0
- package/dist/idl/iyf-main-wrapper.js +2 -0
- package/dist/idl/jupiter-idl.d.ts +3063 -0
- package/dist/idl/jupiter-idl.d.ts.map +1 -0
- package/dist/idl/jupiter-idl.js +3061 -0
- package/dist/idl/meteora-idl.d.ts +7371 -0
- package/dist/idl/meteora-idl.d.ts.map +1 -0
- package/dist/idl/meteora-idl.js +7372 -0
- package/dist/idl/orca-idl.d.ts +3833 -0
- package/dist/idl/orca-idl.d.ts.map +1 -0
- package/dist/idl/orca-idl.js +3834 -0
- package/dist/idl/raydium-idl.d.ts +3054 -0
- package/dist/idl/raydium-idl.d.ts.map +1 -0
- package/dist/idl/raydium-idl.js +3055 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts +126 -0
- package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/IyfExtensionIxGenerator.js +467 -0
- package/dist/ixGenerator/IyfMainIxGenerator.d.ts +330 -0
- package/dist/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/IyfMainIxGenerator.js +1239 -0
- package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts +685 -0
- package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/MeteoraDlmmIxGenerator.js +3008 -0
- package/dist/ixGenerator/OrcaIxGenerator.d.ts +119 -0
- package/dist/ixGenerator/OrcaIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/OrcaIxGenerator.js +438 -0
- package/dist/ixGenerator/RaydiumIxGenerator.d.ts +99 -0
- package/dist/ixGenerator/RaydiumIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/RaydiumIxGenerator.js +558 -0
- package/dist/ixGenerator/UtilIxGenerator.d.ts +20 -0
- package/dist/ixGenerator/UtilIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/UtilIxGenerator.js +25 -0
- package/dist/meteora/index.d.ts +2 -0
- package/dist/meteora/index.d.ts.map +1 -0
- package/dist/meteora/index.js +17 -0
- package/dist/meteora/liquidityStrategy.d.ts +408 -0
- package/dist/meteora/liquidityStrategy.d.ts.map +1 -0
- package/dist/meteora/liquidityStrategy.js +1325 -0
- package/dist/meteora.d.ts +669 -0
- package/dist/meteora.d.ts.map +1 -0
- package/dist/meteora.js +1932 -0
- package/dist/orca.d.ts +57 -0
- package/dist/orca.d.ts.map +1 -0
- package/dist/orca.js +123 -0
- package/dist/pdaGenerator/HawksightPdaGenerator.d.ts +29 -0
- package/dist/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/HawksightPdaGenerator.js +75 -0
- package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts +76 -0
- package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/MeteoraPdaGenerator.js +166 -0
- package/dist/pdaGenerator/OrcaPdaGenerator.d.ts +23 -0
- package/dist/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/OrcaPdaGenerator.js +68 -0
- package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts +49 -0
- package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/RaydiumPdaGenerator.js +114 -0
- package/dist/pdaGenerator/UtilPdaGenerator.d.ts +8 -0
- package/dist/pdaGenerator/UtilPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/UtilPdaGenerator.js +51 -0
- package/dist/types.d.ts +1104 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +95 -0
- package/package.json +6 -5
|
@@ -0,0 +1,176 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.General = void 0;
|
|
46
|
+
const _client = __importStar(require("@hawksightco/swagger-client"));
|
|
47
|
+
const functions_1 = require("../functions");
|
|
48
|
+
/**
|
|
49
|
+
* Provides general utility functions for managing and querying blockchain-related data,
|
|
50
|
+
* handling transactions, and interfacing with a specific blockchain network via the client API.
|
|
51
|
+
* This class serves as an abstraction layer to interact with various blockchain operations
|
|
52
|
+
* such as registering new entities, retrieving portfolio information, and more.
|
|
53
|
+
*/
|
|
54
|
+
class General {
|
|
55
|
+
/**
|
|
56
|
+
* Constructs a new instance of the General class.
|
|
57
|
+
* @param client The Client object providing network access and API functionality.
|
|
58
|
+
*/
|
|
59
|
+
constructor(client, generalUtility) {
|
|
60
|
+
this.client = client;
|
|
61
|
+
this.generalUtility = generalUtility;
|
|
62
|
+
// Initialize with default values for transaction priority and fees.
|
|
63
|
+
this.priorityLevel = _client.PriorityLevel.Default;
|
|
64
|
+
this.maxPriorityFee = 500000;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Sets the transaction priority level, which may affect the processing speed and fees.
|
|
68
|
+
*
|
|
69
|
+
* @param priorityLevel The desired priority level for upcoming transactions.
|
|
70
|
+
*/
|
|
71
|
+
setPriorityLevel(priorityLevel) {
|
|
72
|
+
this.priorityLevel = priorityLevel;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sets the maximum priority fee for transactions, which is the additional fee to speed up transaction processing.
|
|
76
|
+
*
|
|
77
|
+
* @param maxPriorityFee The fee in lamports.
|
|
78
|
+
*/
|
|
79
|
+
setMaxPriorityFee(maxPriorityFee) {
|
|
80
|
+
this.maxPriorityFee = maxPriorityFee;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @returns Returns a token supported by Hawksight
|
|
84
|
+
*/
|
|
85
|
+
token(params) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const result = yield this.client.generalEndpoints.tokenGet(params.address).catch(e => e.response);
|
|
88
|
+
return {
|
|
89
|
+
status: result.status,
|
|
90
|
+
data: result.data,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Retrieves the portfolio information for a specified wallet and optionally a pool.
|
|
96
|
+
*
|
|
97
|
+
* @param params Object containing wallet address and optional pool identifier.
|
|
98
|
+
* @returns A Promise resolving to the portfolio information including assets and balances.
|
|
99
|
+
*/
|
|
100
|
+
portfolio(params) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const result = yield this.client.generalEndpoints.portfolioGet(params.wallet, params.pool).catch(e => e.response);
|
|
103
|
+
return {
|
|
104
|
+
status: result.status,
|
|
105
|
+
data: result.data,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Fetches a list of pools managed by the platform, providing details about each pool.
|
|
111
|
+
*
|
|
112
|
+
* @param params Object containing hash of the pools
|
|
113
|
+
* @returns A Promise resolving to an array of pools, including metadata such as pool addresses and statistics.
|
|
114
|
+
*/
|
|
115
|
+
pools(params) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
const result = yield this.client.generalEndpoints.poolsGet(params.hash).catch(e => e.response);
|
|
118
|
+
return {
|
|
119
|
+
status: result.status,
|
|
120
|
+
data: result.data,
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Fetches a single pool either from Orca or Meteora.
|
|
126
|
+
*
|
|
127
|
+
* @param params Object containing hash of the pools
|
|
128
|
+
* @returns A Promise resolving to an array of pools, including metadata such as pool addresses and statistics.
|
|
129
|
+
*/
|
|
130
|
+
pool(params) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
if (["orca", "meteora"].includes(params.protocol)) {
|
|
133
|
+
const result = yield this.client.generalEndpoints.poolGet(params.pairAddress, params.protocol).catch(e => e.response);
|
|
134
|
+
return {
|
|
135
|
+
status: result.status,
|
|
136
|
+
data: result.data,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
throw new Error(`Protocol can only be: "orca" or "meteora". Value passed: ${params.protocol}`);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Retrieves information about the available tokens on the platform.
|
|
146
|
+
*
|
|
147
|
+
* @returns A Promise resolving to an array of token details, including names, symbols, and other token-specific information.
|
|
148
|
+
*/
|
|
149
|
+
tokens() {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
const result = yield this.client.generalEndpoints.tokensGet().catch(e => e.response);
|
|
152
|
+
return {
|
|
153
|
+
status: result.status,
|
|
154
|
+
data: result.data,
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Registers a new entity or user with the necessary parameters, handling transaction creation and response.
|
|
160
|
+
*
|
|
161
|
+
* @param connection A Solana web3 connection for interacting with the blockchain.
|
|
162
|
+
* @param payer The public key of the payer, responsible for transaction fees.
|
|
163
|
+
* @param params Registration parameters required by the API.
|
|
164
|
+
* @returns A Promise resolving to the transaction metadata or an error response, depending on the outcome of the registration.
|
|
165
|
+
*/
|
|
166
|
+
register(connection, payer, params) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const result = yield this.client.generalEndpoints.registerPost(params).catch(e => e.response);
|
|
169
|
+
return (0, functions_1.resultOrError)({
|
|
170
|
+
status: result.status,
|
|
171
|
+
data: result.data,
|
|
172
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.General = General;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PriorityFeeEstimate, UtilGetPriorityFeeEstimateBody, UtilFindAltWithTxBody } from "@hawksightco/swagger-client";
|
|
2
|
+
import { ResponseWithStatus } from "../types";
|
|
3
|
+
import { Client } from "./Client";
|
|
4
|
+
/**
|
|
5
|
+
* Provides general utilities related to blockchain fee estimates.
|
|
6
|
+
*
|
|
7
|
+
* This class handles operations related to fetching priority fee estimates
|
|
8
|
+
* for transactions on the blockchain. It leverages a client provided during
|
|
9
|
+
* instantiation to make HTTP requests to the required endpoint.
|
|
10
|
+
*/
|
|
11
|
+
export declare class GeneralUtility {
|
|
12
|
+
private readonly client;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of the GeneralUtility class.
|
|
15
|
+
*
|
|
16
|
+
* @param client The client instance used for making HTTP requests.
|
|
17
|
+
*/
|
|
18
|
+
constructor(client: Client);
|
|
19
|
+
/**
|
|
20
|
+
* Overridable get priority fee estiamte function
|
|
21
|
+
*
|
|
22
|
+
* @param params
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
private getPriorityFeeEstimateFn;
|
|
26
|
+
/**
|
|
27
|
+
* Override get priority fee estimate function
|
|
28
|
+
* @param getPriorityFeeEstimateFn
|
|
29
|
+
*/
|
|
30
|
+
overrideGetPriorityFeeEstimateFn(getPriorityFeeEstimateFn: (params: any) => Promise<ResponseWithStatus<PriorityFeeEstimate>>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Fetches the priority fee estimate based on the provided parameters.
|
|
33
|
+
*
|
|
34
|
+
* This method communicates with an HTTP client to retrieve the priority fee estimate
|
|
35
|
+
* for a transaction. It uses the `utilGetPriorityFeeEstimatePost` method of the client.
|
|
36
|
+
* The result is processed to fit a standardized response structure.
|
|
37
|
+
*
|
|
38
|
+
* @param params The parameters required to fetch the priority fee estimate, including
|
|
39
|
+
* details like the transaction type and network.
|
|
40
|
+
* @returns A Promise resolving to an object containing the status code and data of
|
|
41
|
+
* the priority fee estimate.
|
|
42
|
+
* @throws Captures and returns any errors encountered during the API call.
|
|
43
|
+
*/
|
|
44
|
+
getPriorityFeeEstimate(params: UtilGetPriorityFeeEstimateBody): Promise<ResponseWithStatus<PriorityFeeEstimate>>;
|
|
45
|
+
/**
|
|
46
|
+
* Overridable jupiter alt function
|
|
47
|
+
*
|
|
48
|
+
* @param params
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
private findAltWithTxPostFn;
|
|
52
|
+
/**
|
|
53
|
+
* Override get priority fee estimate function
|
|
54
|
+
* @param getPriorityFeeEstimateFn
|
|
55
|
+
*/
|
|
56
|
+
overrideFindAltWithTxPostFn(findAltWithTxPostFn: (params: any) => Promise<ResponseWithStatus<Array<string>>>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Finds alternative public keys related to a given transaction and returns them along with the response status.
|
|
59
|
+
*
|
|
60
|
+
* This method sends a request to the `utilFindAltWithTxPost` endpoint with the provided parameters, and returns the response
|
|
61
|
+
* status and an array of public key strings. In case of an error, it captures the error response and includes the status and
|
|
62
|
+
* data in the returned object.
|
|
63
|
+
*
|
|
64
|
+
* @param {UtilFindAltWithTxBody} params - The parameters for the function, which include the transaction metadata.
|
|
65
|
+
* @returns {Promise<ResponseWithStatus<Array<string>>>} A promise that resolves to an object containing the response status and an array of public key strings.
|
|
66
|
+
*/
|
|
67
|
+
findAltWithTxPost(params: UtilFindAltWithTxBody): Promise<ResponseWithStatus<Array<string>>>;
|
|
68
|
+
/**
|
|
69
|
+
* Get candlestick data from Birdeye.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} address - The contract address to fetch candlestick data for.
|
|
72
|
+
* @param {string} frequency - The frequency of the candlestick data (e.g., '15m').
|
|
73
|
+
* @param {number} startMs - The start time in milliseconds.
|
|
74
|
+
* @param {number} endMs - The end time in milliseconds.
|
|
75
|
+
* @returns {Promise<ResponseWithStatus<Array<Object>>>} A promise that resolves to an object containing the response status and an array of candlestick data objects.
|
|
76
|
+
*/
|
|
77
|
+
candlestick(address: string, frequency: string, startMs: number, endMs: number): Promise<ResponseWithStatus<Array<string>>>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=GeneralUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneralUtility.d.ts","sourceRoot":"","sources":["../../src/classes/GeneralUtility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzH,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;GAMG;AACH,qBAAa,cAAc;IAQvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB;;;;OAIG;gBAEgB,MAAM,EAAE,MAAM;IAGjC;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB,CAM9B;IAEF;;;OAGG;IACH,gCAAgC,CAAC,wBAAwB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAI5H;;;;;;;;;;;;OAYG;IACG,sBAAsB,CAAC,MAAM,EAAE,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAItH;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB,CAM1B;IAEC;;;KAGC;IACD,2BAA2B,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAI9G;;;;;;;;;OASG;IACG,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAIlG;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAOlI"}
|
|
@@ -0,0 +1,121 @@
|
|
|
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.GeneralUtility = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Provides general utilities related to blockchain fee estimates.
|
|
15
|
+
*
|
|
16
|
+
* This class handles operations related to fetching priority fee estimates
|
|
17
|
+
* for transactions on the blockchain. It leverages a client provided during
|
|
18
|
+
* instantiation to make HTTP requests to the required endpoint.
|
|
19
|
+
*/
|
|
20
|
+
class GeneralUtility {
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of the GeneralUtility class.
|
|
23
|
+
*
|
|
24
|
+
* @param client The client instance used for making HTTP requests.
|
|
25
|
+
*/
|
|
26
|
+
constructor(client) {
|
|
27
|
+
this.client = client;
|
|
28
|
+
/**
|
|
29
|
+
* Overridable get priority fee estiamte function
|
|
30
|
+
*
|
|
31
|
+
* @param params
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
this.getPriorityFeeEstimateFn = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const result = yield this.client.generalUtility.utilGetPriorityFeeEstimatePost(params).catch(e => e.response);
|
|
36
|
+
return {
|
|
37
|
+
status: result.status,
|
|
38
|
+
data: result.data,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Overridable jupiter alt function
|
|
43
|
+
*
|
|
44
|
+
* @param params
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
this.findAltWithTxPostFn = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const result = yield this.client.generalUtility.utilFindAltWithTxPost(params).catch(e => e.response);
|
|
49
|
+
return {
|
|
50
|
+
status: result.status,
|
|
51
|
+
data: result.data,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Override get priority fee estimate function
|
|
57
|
+
* @param getPriorityFeeEstimateFn
|
|
58
|
+
*/
|
|
59
|
+
overrideGetPriorityFeeEstimateFn(getPriorityFeeEstimateFn) {
|
|
60
|
+
this.getPriorityFeeEstimateFn = getPriorityFeeEstimateFn;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Fetches the priority fee estimate based on the provided parameters.
|
|
64
|
+
*
|
|
65
|
+
* This method communicates with an HTTP client to retrieve the priority fee estimate
|
|
66
|
+
* for a transaction. It uses the `utilGetPriorityFeeEstimatePost` method of the client.
|
|
67
|
+
* The result is processed to fit a standardized response structure.
|
|
68
|
+
*
|
|
69
|
+
* @param params The parameters required to fetch the priority fee estimate, including
|
|
70
|
+
* details like the transaction type and network.
|
|
71
|
+
* @returns A Promise resolving to an object containing the status code and data of
|
|
72
|
+
* the priority fee estimate.
|
|
73
|
+
* @throws Captures and returns any errors encountered during the API call.
|
|
74
|
+
*/
|
|
75
|
+
getPriorityFeeEstimate(params) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return yield this.getPriorityFeeEstimateFn(params);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Override get priority fee estimate function
|
|
82
|
+
* @param getPriorityFeeEstimateFn
|
|
83
|
+
*/
|
|
84
|
+
overrideFindAltWithTxPostFn(findAltWithTxPostFn) {
|
|
85
|
+
this.findAltWithTxPostFn = findAltWithTxPostFn;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Finds alternative public keys related to a given transaction and returns them along with the response status.
|
|
89
|
+
*
|
|
90
|
+
* This method sends a request to the `utilFindAltWithTxPost` endpoint with the provided parameters, and returns the response
|
|
91
|
+
* status and an array of public key strings. In case of an error, it captures the error response and includes the status and
|
|
92
|
+
* data in the returned object.
|
|
93
|
+
*
|
|
94
|
+
* @param {UtilFindAltWithTxBody} params - The parameters for the function, which include the transaction metadata.
|
|
95
|
+
* @returns {Promise<ResponseWithStatus<Array<string>>>} A promise that resolves to an object containing the response status and an array of public key strings.
|
|
96
|
+
*/
|
|
97
|
+
findAltWithTxPost(params) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
return yield this.findAltWithTxPostFn(params);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get candlestick data from Birdeye.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} address - The contract address to fetch candlestick data for.
|
|
106
|
+
* @param {string} frequency - The frequency of the candlestick data (e.g., '15m').
|
|
107
|
+
* @param {number} startMs - The start time in milliseconds.
|
|
108
|
+
* @param {number} endMs - The end time in milliseconds.
|
|
109
|
+
* @returns {Promise<ResponseWithStatus<Array<Object>>>} A promise that resolves to an object containing the response status and an array of candlestick data objects.
|
|
110
|
+
*/
|
|
111
|
+
candlestick(address, frequency, startMs, endMs) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const result = yield this.client.generalUtility.utilCandlestickGet(address, frequency, startMs, endMs).catch(e => e.response);
|
|
114
|
+
return {
|
|
115
|
+
status: result.status,
|
|
116
|
+
data: result.data,
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.GeneralUtility = GeneralUtility;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
import { General } from "./General";
|
|
3
|
+
import { Health } from "./Health";
|
|
4
|
+
import { TxGenerator } from "./TxGenerator";
|
|
5
|
+
import { Util } from "./Util";
|
|
6
|
+
import { TxGeneratorAutomations } from "./TxGeneratorAutomations";
|
|
7
|
+
import { Client } from "./Client";
|
|
8
|
+
import { GeneralUtility } from "./GeneralUtility";
|
|
9
|
+
import { Search } from "./Search";
|
|
10
|
+
import { CombineTransactionsParams, HawkApiOptions, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
11
|
+
import { SimpleIxGenerator } from "./SimpleIxGenerator";
|
|
12
|
+
import { TransactionBatchExecute, TransactionBatchExecuteParams } from "./TransactionBatchExecute";
|
|
13
|
+
import { Atomicity } from "./Atomicity";
|
|
14
|
+
import { JupiterAlts } from "./JupiterAlts";
|
|
15
|
+
import { JupiterSwap } from "./JupiterSwap";
|
|
16
|
+
import { SimplePdaGenerator } from './SimplePdaGenerator';
|
|
17
|
+
import { RaydiumSDK } from "./RaydiumSDK";
|
|
18
|
+
import { Anchor } from "../anchor";
|
|
19
|
+
import { MintCache } from "./account-cache/MintCache";
|
|
20
|
+
import { TokenCache } from "./account-cache/TokenCache";
|
|
21
|
+
/**
|
|
22
|
+
* HawkAPI is a central gateway class that aggregates access to various functional modules
|
|
23
|
+
* for interacting with HawkSight's blockchain APIs. This class initializes and exposes modules
|
|
24
|
+
* that manage different aspects of the blockchain interactions such as general utilities,
|
|
25
|
+
* transaction generation, health checks, and automation services.
|
|
26
|
+
*
|
|
27
|
+
* Each module connected through this class offers specialized APIs for different tasks,
|
|
28
|
+
* making it easier to manage and use HawkSight's comprehensive blockchain features.
|
|
29
|
+
*/
|
|
30
|
+
export declare class HawkAPI {
|
|
31
|
+
protected readonly url: string;
|
|
32
|
+
protected readonly options?: HawkApiOptions | undefined;
|
|
33
|
+
/** Swagger Client Instance. */
|
|
34
|
+
private readonly client;
|
|
35
|
+
/** Health module to check system health and API connectivity. */
|
|
36
|
+
readonly health: Health;
|
|
37
|
+
/** General module for basic blockchain operations like portfolio management, token information retrieval. */
|
|
38
|
+
readonly general: General;
|
|
39
|
+
/** General utility endpoint */
|
|
40
|
+
readonly generalUtility: GeneralUtility;
|
|
41
|
+
/** Util module for various utility functions that assist with blockchain interactions. */
|
|
42
|
+
readonly util: Util;
|
|
43
|
+
/** TxGenerator module for creating and managing transactions on the blockchain. */
|
|
44
|
+
private _txGenerator;
|
|
45
|
+
get txGenerator(): TxGenerator;
|
|
46
|
+
/** TxGeneratorAutomations module for automating and optimizing transaction creation processes. */
|
|
47
|
+
readonly txGeneratorAutomation: TxGeneratorAutomations;
|
|
48
|
+
/** Search module (token search only for now...) */
|
|
49
|
+
readonly search: Search;
|
|
50
|
+
/** Simple instruction generator */
|
|
51
|
+
readonly ix: SimpleIxGenerator;
|
|
52
|
+
/** Jupiter address lookup tables */
|
|
53
|
+
readonly jupAlts: JupiterAlts;
|
|
54
|
+
/** Jupiter swap (part of automations) */
|
|
55
|
+
readonly jupiterSwap: JupiterSwap;
|
|
56
|
+
/** Simple PDA generator */
|
|
57
|
+
readonly pda: SimplePdaGenerator;
|
|
58
|
+
/**
|
|
59
|
+
* Initializes a new instance of the HawkAPI class with a specified API URL.
|
|
60
|
+
* @param url The base URL for the HawkSight API services, defaulted to "https://api2.hawksight.co" if not specified.
|
|
61
|
+
*/
|
|
62
|
+
constructor(url?: string, options?: HawkApiOptions | undefined);
|
|
63
|
+
/**
|
|
64
|
+
* Expose the Anchor class
|
|
65
|
+
*
|
|
66
|
+
* @param connection The Solana connection
|
|
67
|
+
* @returns The Anchor instance
|
|
68
|
+
*/
|
|
69
|
+
anchor(connection: web3.Connection): Promise<Anchor>;
|
|
70
|
+
/**
|
|
71
|
+
* Mint cache
|
|
72
|
+
*
|
|
73
|
+
* @param connection The Solana connection
|
|
74
|
+
* @returns The MintCache instance
|
|
75
|
+
*/
|
|
76
|
+
mintCache(connection: web3.Connection): MintCache;
|
|
77
|
+
/**
|
|
78
|
+
* Token cache
|
|
79
|
+
*
|
|
80
|
+
* @param connection The Solana connection
|
|
81
|
+
* @returns The TokenCache instance
|
|
82
|
+
*/
|
|
83
|
+
tokenCache(connection: web3.Connection): TokenCache;
|
|
84
|
+
/**
|
|
85
|
+
* Override transaction generator
|
|
86
|
+
*
|
|
87
|
+
* @param txGenerator
|
|
88
|
+
*/
|
|
89
|
+
overrideTxGenerator(builderFn: (client: Client, generalUtility: GeneralUtility) => TxGenerator): void;
|
|
90
|
+
/**
|
|
91
|
+
* Combines transactions into a single transaction.
|
|
92
|
+
*
|
|
93
|
+
* @param param0
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
combine({ connection, payer, description, instructions, additionalAlt }: CombineTransactionsParams): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
97
|
+
/**
|
|
98
|
+
* Create instance of TransactionBatchExecute class
|
|
99
|
+
*
|
|
100
|
+
* @param param
|
|
101
|
+
*/
|
|
102
|
+
batchExecute({ lookupTableAddresses, instructions, payer, connection, signers }: TransactionBatchExecuteParams): TransactionBatchExecute;
|
|
103
|
+
/**
|
|
104
|
+
* Create instance of Atomicity class
|
|
105
|
+
*
|
|
106
|
+
* @param param
|
|
107
|
+
*/
|
|
108
|
+
atomicity({ lookupTableAddresses, instructions, payer, connection, signers }: TransactionBatchExecuteParams): Atomicity;
|
|
109
|
+
/**
|
|
110
|
+
* Whether enable logging or not
|
|
111
|
+
*
|
|
112
|
+
* @param flag
|
|
113
|
+
*/
|
|
114
|
+
logging(flag: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* Load the Raydium SDK
|
|
117
|
+
*
|
|
118
|
+
* @param connection The Solana connection
|
|
119
|
+
*/
|
|
120
|
+
raydiumSDK(connection: web3.Connection): Promise<RaydiumSDK>;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=HawkAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HawkAPI.d.ts","sourceRoot":"","sources":["../../src/classes/HawkAPI.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,169 @@
|
|
|
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.HawkAPI = void 0;
|
|
13
|
+
const General_1 = require("./General");
|
|
14
|
+
const Health_1 = require("./Health");
|
|
15
|
+
const TxGenerator_1 = require("./TxGenerator");
|
|
16
|
+
const Util_1 = require("./Util");
|
|
17
|
+
const TxGeneratorAutomations_1 = require("./TxGeneratorAutomations");
|
|
18
|
+
const Client_1 = require("./Client");
|
|
19
|
+
const GeneralUtility_1 = require("./GeneralUtility");
|
|
20
|
+
const Search_1 = require("./Search");
|
|
21
|
+
const CreateTxMetadata_1 = require("./CreateTxMetadata");
|
|
22
|
+
const SimpleIxGenerator_1 = require("./SimpleIxGenerator");
|
|
23
|
+
const TransactionBatchExecute_1 = require("./TransactionBatchExecute");
|
|
24
|
+
const Atomicity_1 = require("./Atomicity");
|
|
25
|
+
const JupiterAlts_1 = require("./JupiterAlts");
|
|
26
|
+
const JupiterSwap_1 = require("./JupiterSwap");
|
|
27
|
+
const Logging_1 = require("./Logging");
|
|
28
|
+
const Transactions_1 = require("./Transactions");
|
|
29
|
+
const CombineTransactions_1 = require("./CombineTransactions");
|
|
30
|
+
const RaydiumSDK_1 = require("./RaydiumSDK");
|
|
31
|
+
const anchor_1 = require("../anchor");
|
|
32
|
+
const MintCache_1 = require("./account-cache/MintCache");
|
|
33
|
+
const TokenCache_1 = require("./account-cache/TokenCache");
|
|
34
|
+
/**
|
|
35
|
+
* HawkAPI is a central gateway class that aggregates access to various functional modules
|
|
36
|
+
* for interacting with HawkSight's blockchain APIs. This class initializes and exposes modules
|
|
37
|
+
* that manage different aspects of the blockchain interactions such as general utilities,
|
|
38
|
+
* transaction generation, health checks, and automation services.
|
|
39
|
+
*
|
|
40
|
+
* Each module connected through this class offers specialized APIs for different tasks,
|
|
41
|
+
* making it easier to manage and use HawkSight's comprehensive blockchain features.
|
|
42
|
+
*/
|
|
43
|
+
class HawkAPI {
|
|
44
|
+
get txGenerator() { return this._txGenerator; }
|
|
45
|
+
/**
|
|
46
|
+
* Initializes a new instance of the HawkAPI class with a specified API URL.
|
|
47
|
+
* @param url The base URL for the HawkSight API services, defaulted to "https://api2.hawksight.co" if not specified.
|
|
48
|
+
*/
|
|
49
|
+
constructor(url = "https://api2.hawksight.co", options) {
|
|
50
|
+
this.url = url;
|
|
51
|
+
this.options = options;
|
|
52
|
+
const client = new Client_1.Client(url);
|
|
53
|
+
this.client = client;
|
|
54
|
+
this.health = new Health_1.Health(client);
|
|
55
|
+
this.generalUtility = new GeneralUtility_1.GeneralUtility(client);
|
|
56
|
+
this.general = new General_1.General(client, this.generalUtility);
|
|
57
|
+
this.util = new Util_1.Util(client);
|
|
58
|
+
this._txGenerator = new TxGenerator_1.TxGenerator(client, this.generalUtility);
|
|
59
|
+
this.txGeneratorAutomation = new TxGeneratorAutomations_1.TxGeneratorAutomations(client, this.generalUtility);
|
|
60
|
+
this.search = new Search_1.Search(url);
|
|
61
|
+
this.ix = new SimpleIxGenerator_1.SimpleIxGenerator();
|
|
62
|
+
this.pda = this.ix.pda;
|
|
63
|
+
this.jupAlts = new JupiterAlts_1.JupiterAlts();
|
|
64
|
+
this.jupiterSwap = new JupiterSwap_1.JupiterSwap(this.ix);
|
|
65
|
+
Transactions_1.txgen.ix = this.ix;
|
|
66
|
+
// Load create tx metadata module
|
|
67
|
+
if (this.options === undefined || !this.options.disableTxMetadataLoad) {
|
|
68
|
+
CreateTxMetadata_1.CreateTxMetadata.instance().load();
|
|
69
|
+
}
|
|
70
|
+
// Load search module
|
|
71
|
+
if (this.options === undefined || !this.options.disableTokenLoad) {
|
|
72
|
+
this.search.load();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Expose the Anchor class
|
|
77
|
+
*
|
|
78
|
+
* @param connection The Solana connection
|
|
79
|
+
* @returns The Anchor instance
|
|
80
|
+
*/
|
|
81
|
+
anchor(connection) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
anchor_1.Anchor.initialize(connection);
|
|
84
|
+
return anchor_1.Anchor.instance();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Mint cache
|
|
89
|
+
*
|
|
90
|
+
* @param connection The Solana connection
|
|
91
|
+
* @returns The MintCache instance
|
|
92
|
+
*/
|
|
93
|
+
mintCache(connection) {
|
|
94
|
+
return MintCache_1.MintCache.instance(connection);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Token cache
|
|
98
|
+
*
|
|
99
|
+
* @param connection The Solana connection
|
|
100
|
+
* @returns The TokenCache instance
|
|
101
|
+
*/
|
|
102
|
+
tokenCache(connection) {
|
|
103
|
+
return TokenCache_1.TokenCache.instance(connection);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Override transaction generator
|
|
107
|
+
*
|
|
108
|
+
* @param txGenerator
|
|
109
|
+
*/
|
|
110
|
+
overrideTxGenerator(builderFn) {
|
|
111
|
+
this._txGenerator = builderFn(this.client, this.generalUtility);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Combines transactions into a single transaction.
|
|
115
|
+
*
|
|
116
|
+
* @param param0
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
combine(_a) {
|
|
120
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, payer, description, instructions, additionalAlt }) {
|
|
121
|
+
const obj = new CombineTransactions_1.CombineTransactions(this.generalUtility);
|
|
122
|
+
return yield obj.combine({
|
|
123
|
+
connection,
|
|
124
|
+
payer,
|
|
125
|
+
description,
|
|
126
|
+
instructions,
|
|
127
|
+
additionalAlt,
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Create instance of TransactionBatchExecute class
|
|
133
|
+
*
|
|
134
|
+
* @param param
|
|
135
|
+
*/
|
|
136
|
+
batchExecute({ lookupTableAddresses, instructions, payer, connection, signers }) {
|
|
137
|
+
return new TransactionBatchExecute_1.TransactionBatchExecute(lookupTableAddresses, instructions, payer, connection, signers, this.jupAlts);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Create instance of Atomicity class
|
|
141
|
+
*
|
|
142
|
+
* @param param
|
|
143
|
+
*/
|
|
144
|
+
atomicity({ lookupTableAddresses, instructions, payer, connection, signers }) {
|
|
145
|
+
return new Atomicity_1.Atomicity(lookupTableAddresses, instructions, payer, connection, signers, this.jupAlts, this.ix);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Whether enable logging or not
|
|
149
|
+
*
|
|
150
|
+
* @param flag
|
|
151
|
+
*/
|
|
152
|
+
logging(flag) {
|
|
153
|
+
(0, Logging_1.logging)(flag);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Load the Raydium SDK
|
|
157
|
+
*
|
|
158
|
+
* @param connection The Solana connection
|
|
159
|
+
*/
|
|
160
|
+
raydiumSDK(connection) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
// Load the Raydium SDK
|
|
163
|
+
yield RaydiumSDK_1.RaydiumSDK.load(connection);
|
|
164
|
+
// Return the Raydium SDK instance
|
|
165
|
+
return RaydiumSDK_1.RaydiumSDK.instance();
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.HawkAPI = HawkAPI;
|