@hawksightco/hawk-sdk 1.3.264 → 1.3.265
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/package.json +1 -1
- package/dist/src/addresses.d.ts +0 -37
- package/dist/src/addresses.d.ts.map +0 -1
- package/dist/src/addresses.js +0 -84
- package/dist/src/anchor.d.ts +0 -22
- package/dist/src/anchor.d.ts.map +0 -1
- package/dist/src/anchor.js +0 -121
- package/dist/src/classes/AltStorage.d.ts +0 -29
- package/dist/src/classes/AltStorage.d.ts.map +0 -1
- package/dist/src/classes/AltStorage.js +0 -58
- package/dist/src/classes/Atomicity.d.ts +0 -34
- package/dist/src/classes/Atomicity.d.ts.map +0 -1
- package/dist/src/classes/Atomicity.js +0 -110
- package/dist/src/classes/Client.d.ts +0 -35
- package/dist/src/classes/Client.d.ts.map +0 -1
- package/dist/src/classes/Client.js +0 -66
- package/dist/src/classes/CombineTransactions.d.ts +0 -11
- package/dist/src/classes/CombineTransactions.d.ts.map +0 -1
- package/dist/src/classes/CombineTransactions.js +0 -58
- package/dist/src/classes/CreateTxMetadata.d.ts +0 -100
- package/dist/src/classes/CreateTxMetadata.d.ts.map +0 -1
- package/dist/src/classes/CreateTxMetadata.js +0 -415
- package/dist/src/classes/General.d.ts +0 -87
- package/dist/src/classes/General.d.ts.map +0 -1
- package/dist/src/classes/General.js +0 -176
- package/dist/src/classes/GeneralUtility.d.ts +0 -79
- package/dist/src/classes/GeneralUtility.d.ts.map +0 -1
- package/dist/src/classes/GeneralUtility.js +0 -121
- package/dist/src/classes/HawkAPI.d.ts +0 -122
- package/dist/src/classes/HawkAPI.d.ts.map +0 -1
- package/dist/src/classes/HawkAPI.js +0 -169
- package/dist/src/classes/Health.d.ts +0 -29
- package/dist/src/classes/Health.d.ts.map +0 -1
- package/dist/src/classes/Health.js +0 -48
- package/dist/src/classes/JupiterAlts.d.ts +0 -37
- package/dist/src/classes/JupiterAlts.d.ts.map +0 -1
- package/dist/src/classes/JupiterAlts.js +0 -114
- package/dist/src/classes/JupiterSwap.d.ts +0 -21
- package/dist/src/classes/JupiterSwap.d.ts.map +0 -1
- package/dist/src/classes/JupiterSwap.js +0 -40
- package/dist/src/classes/Logging.d.ts +0 -13
- package/dist/src/classes/Logging.d.ts.map +0 -1
- package/dist/src/classes/Logging.js +0 -50
- package/dist/src/classes/MultiTransaction.d.ts +0 -75
- package/dist/src/classes/MultiTransaction.d.ts.map +0 -1
- package/dist/src/classes/MultiTransaction.js +0 -296
- package/dist/src/classes/RaydiumSDK.d.ts +0 -67
- package/dist/src/classes/RaydiumSDK.d.ts.map +0 -1
- package/dist/src/classes/RaydiumSDK.js +0 -206
- package/dist/src/classes/Search.d.ts +0 -100
- package/dist/src/classes/Search.d.ts.map +0 -1
- package/dist/src/classes/Search.js +0 -216
- package/dist/src/classes/SimpleIxGenerator.d.ts +0 -57
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +0 -1
- package/dist/src/classes/SimpleIxGenerator.js +0 -62
- package/dist/src/classes/SimplePdaGenerator.d.ts +0 -28
- package/dist/src/classes/SimplePdaGenerator.d.ts.map +0 -1
- package/dist/src/classes/SimplePdaGenerator.js +0 -33
- package/dist/src/classes/Transaction.d.ts +0 -229
- package/dist/src/classes/Transaction.d.ts.map +0 -1
- package/dist/src/classes/Transaction.js +0 -643
- package/dist/src/classes/Transaction2.d.ts +0 -107
- package/dist/src/classes/Transaction2.d.ts.map +0 -1
- package/dist/src/classes/Transaction2.js +0 -249
- package/dist/src/classes/Transaction3.d.ts +0 -165
- package/dist/src/classes/Transaction3.d.ts.map +0 -1
- package/dist/src/classes/Transaction3.js +0 -416
- package/dist/src/classes/TransactionBatchExecute.d.ts +0 -163
- package/dist/src/classes/TransactionBatchExecute.d.ts.map +0 -1
- package/dist/src/classes/TransactionBatchExecute.js +0 -466
- package/dist/src/classes/TransactionBatchExecute2.d.ts +0 -99
- package/dist/src/classes/TransactionBatchExecute2.d.ts.map +0 -1
- package/dist/src/classes/TransactionBatchExecute2.js +0 -357
- package/dist/src/classes/Transactions.d.ts +0 -586
- package/dist/src/classes/Transactions.d.ts.map +0 -1
- package/dist/src/classes/Transactions.js +0 -7658
- package/dist/src/classes/TxGenerator.d.ts +0 -350
- package/dist/src/classes/TxGenerator.d.ts.map +0 -1
- package/dist/src/classes/TxGenerator.js +0 -1957
- package/dist/src/classes/TxGeneratorAutomations.d.ts +0 -186
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +0 -1
- package/dist/src/classes/TxGeneratorAutomations.js +0 -897
- package/dist/src/classes/Util.d.ts +0 -87
- package/dist/src/classes/Util.d.ts.map +0 -1
- package/dist/src/classes/Util.js +0 -148
- package/dist/src/classes/account-cache/AccountCache.d.ts +0 -54
- package/dist/src/classes/account-cache/AccountCache.d.ts.map +0 -1
- package/dist/src/classes/account-cache/AccountCache.js +0 -143
- package/dist/src/classes/account-cache/MintCache.d.ts +0 -33
- package/dist/src/classes/account-cache/MintCache.d.ts.map +0 -1
- package/dist/src/classes/account-cache/MintCache.js +0 -47
- package/dist/src/classes/account-cache/TokenCache.d.ts +0 -33
- package/dist/src/classes/account-cache/TokenCache.d.ts.map +0 -1
- package/dist/src/classes/account-cache/TokenCache.js +0 -47
- package/dist/src/errors.d.ts +0 -13
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -96
- package/dist/src/functions.d.ts +0 -514
- package/dist/src/functions.d.ts.map +0 -1
- package/dist/src/functions.js +0 -1636
- package/dist/src/hawksight.d.ts +0 -53
- package/dist/src/hawksight.d.ts.map +0 -1
- package/dist/src/hawksight.js +0 -328
- package/dist/src/hsToMeteora.d.ts +0 -31
- package/dist/src/hsToMeteora.d.ts.map +0 -1
- package/dist/src/hsToMeteora.js +0 -3175
- package/dist/src/idl/iyf-extension-idl.d.ts +0 -14583
- package/dist/src/idl/iyf-extension-idl.d.ts.map +0 -1
- package/dist/src/idl/iyf-extension-idl.js +0 -14578
- package/dist/src/idl/iyf-extension-wrapper.d.ts +0 -112
- package/dist/src/idl/iyf-extension-wrapper.d.ts.map +0 -1
- package/dist/src/idl/iyf-extension-wrapper.js +0 -2
- package/dist/src/idl/iyf-main-idl.d.ts +0 -11329
- package/dist/src/idl/iyf-main-idl.d.ts.map +0 -1
- package/dist/src/idl/iyf-main-idl.js +0 -11324
- package/dist/src/idl/iyf-main-wrapper.d.ts +0 -112
- package/dist/src/idl/iyf-main-wrapper.d.ts.map +0 -1
- package/dist/src/idl/iyf-main-wrapper.js +0 -2
- package/dist/src/idl/jupiter-idl.d.ts +0 -3063
- package/dist/src/idl/jupiter-idl.d.ts.map +0 -1
- package/dist/src/idl/jupiter-idl.js +0 -3061
- package/dist/src/idl/meteora-idl.d.ts +0 -7371
- package/dist/src/idl/meteora-idl.d.ts.map +0 -1
- package/dist/src/idl/meteora-idl.js +0 -7372
- package/dist/src/idl/orca-idl.d.ts +0 -3833
- package/dist/src/idl/orca-idl.d.ts.map +0 -1
- package/dist/src/idl/orca-idl.js +0 -3834
- package/dist/src/idl/raydium-idl.d.ts +0 -3054
- package/dist/src/idl/raydium-idl.d.ts.map +0 -1
- package/dist/src/idl/raydium-idl.js +0 -3055
- package/dist/src/index.d.ts +0 -9
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -31
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts +0 -126
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.js +0 -467
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +0 -330
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +0 -1239
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +0 -685
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +0 -3005
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts +0 -119
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/OrcaIxGenerator.js +0 -438
- package/dist/src/ixGenerator/RaydiumIxGenerator.d.ts +0 -99
- package/dist/src/ixGenerator/RaydiumIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/RaydiumIxGenerator.js +0 -558
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts +0 -20
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts.map +0 -1
- package/dist/src/ixGenerator/UtilIxGenerator.js +0 -25
- package/dist/src/meteora/index.d.ts +0 -2
- package/dist/src/meteora/index.d.ts.map +0 -1
- package/dist/src/meteora/index.js +0 -17
- package/dist/src/meteora/liquidityStrategy.d.ts +0 -408
- package/dist/src/meteora/liquidityStrategy.d.ts.map +0 -1
- package/dist/src/meteora/liquidityStrategy.js +0 -1325
- package/dist/src/meteora.d.ts +0 -669
- package/dist/src/meteora.d.ts.map +0 -1
- package/dist/src/meteora.js +0 -1932
- package/dist/src/orca.d.ts +0 -57
- package/dist/src/orca.d.ts.map +0 -1
- package/dist/src/orca.js +0 -123
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts +0 -29
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/HawksightPdaGenerator.js +0 -75
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts +0 -76
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.js +0 -166
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts +0 -23
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/OrcaPdaGenerator.js +0 -68
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts +0 -49
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.js +0 -114
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts +0 -8
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts.map +0 -1
- package/dist/src/pdaGenerator/UtilPdaGenerator.js +0 -51
- package/dist/src/types.d.ts +0 -1100
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -95
|
@@ -1,58 +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.CombineTransactions = void 0;
|
|
13
|
-
const functions_1 = require("../functions");
|
|
14
|
-
class CombineTransactions {
|
|
15
|
-
constructor(generalUtility) {
|
|
16
|
-
this.generalUtility = generalUtility;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Combines transactions into a single transaction.
|
|
20
|
-
*/
|
|
21
|
-
combine(_a) {
|
|
22
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, payer, description, instructions, additionalAlt, }) {
|
|
23
|
-
var _b;
|
|
24
|
-
const ixs = [];
|
|
25
|
-
for (const ix of instructions) {
|
|
26
|
-
// Duck-type checks instead of instanceof (which breaks across package versions)
|
|
27
|
-
const q = ix;
|
|
28
|
-
if ('data' in q && ((_b = q.data) === null || _b === void 0 ? void 0 : _b.transaction) && 'instructions' in q.data.transaction && 'alts' in q.data.transaction) {
|
|
29
|
-
// ResponseWithStatus<TransactionMetadata> — has .data.transaction with instructions and alts
|
|
30
|
-
ixs.push(...q.data.transaction.instructions);
|
|
31
|
-
additionalAlt.push(...q.data.transaction.alts.map((alt) => alt.key.toBase58()));
|
|
32
|
-
}
|
|
33
|
-
else if ('instructions' in q && Array.isArray(q.instructions)) {
|
|
34
|
-
// Transaction — has .instructions array
|
|
35
|
-
ixs.push(...q.instructions);
|
|
36
|
-
}
|
|
37
|
-
else if ('keys' in q && 'programId' in q && 'data' in q) {
|
|
38
|
-
// TransactionInstruction — has .keys, .programId, .data
|
|
39
|
-
ixs.push(q);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw new Error("Invalid object");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Remove duplicates
|
|
46
|
-
additionalAlt = [...new Set(additionalAlt)];
|
|
47
|
-
return yield (0, functions_1.legacyTxMetadata)({
|
|
48
|
-
connection,
|
|
49
|
-
generalUtility: this.generalUtility,
|
|
50
|
-
payer,
|
|
51
|
-
description,
|
|
52
|
-
ixs,
|
|
53
|
-
additionalAlt
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.CombineTransactions = CombineTransactions;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as web3 from "@solana/web3.js";
|
|
2
|
-
import { TransactionMetadata, TransactionMetadataWithActions, TransactionMetadataResponse, TransactionMetadataResponse2 } from "../types";
|
|
3
|
-
import { GeneralUtility } from "./GeneralUtility";
|
|
4
|
-
/**
|
|
5
|
-
* The CreateTxMetadata class is responsible for creating and managing transaction metadata,
|
|
6
|
-
* including handling address lookup tables and constructing transactions with the necessary parameters.
|
|
7
|
-
*/
|
|
8
|
-
export declare class CreateTxMetadata {
|
|
9
|
-
private constructor();
|
|
10
|
-
private connection?;
|
|
11
|
-
/**
|
|
12
|
-
* Sets the connection to the Solana blockchain.
|
|
13
|
-
*
|
|
14
|
-
* @param connection - The Solana blockchain connection object.
|
|
15
|
-
*/
|
|
16
|
-
setConnection(connection: web3.Connection): void;
|
|
17
|
-
private static _instance;
|
|
18
|
-
/**
|
|
19
|
-
* Gets the singleton instance of the CreateTxMetadata class.
|
|
20
|
-
*
|
|
21
|
-
* @returns The singleton instance of CreateTxMetadata.
|
|
22
|
-
*/
|
|
23
|
-
static instance(): CreateTxMetadata;
|
|
24
|
-
private alts;
|
|
25
|
-
/**
|
|
26
|
-
* Loads the address lookup tables.
|
|
27
|
-
*/
|
|
28
|
-
load(): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Updates the address lookup tables by fetching their latest state from the Solana blockchain.
|
|
31
|
-
*/
|
|
32
|
-
updateAlts(): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Loads a single address lookup table account.
|
|
35
|
-
*
|
|
36
|
-
* @param alt - The address lookup table account address as a string.
|
|
37
|
-
* @param connection - (Optional) A specific Solana blockchain connection object to use.
|
|
38
|
-
* @returns A promise that resolves to the address lookup table account.
|
|
39
|
-
* @throws Error if the address lookup table does not exist.
|
|
40
|
-
*/
|
|
41
|
-
loadSingleAlt(alt: string, connection?: web3.Connection): Promise<web3.AddressLookupTableAccount>;
|
|
42
|
-
/**
|
|
43
|
-
* Gets an address lookup table account.
|
|
44
|
-
*
|
|
45
|
-
* @param alt - The address lookup table account address as a string.
|
|
46
|
-
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
47
|
-
*/
|
|
48
|
-
getAlt(alt: string): Promise<web3.AddressLookupTableAccount | null>;
|
|
49
|
-
/**
|
|
50
|
-
* Store address lookup table in the object
|
|
51
|
-
*
|
|
52
|
-
* @param alt
|
|
53
|
-
* @param account
|
|
54
|
-
*/
|
|
55
|
-
storeAlt(alt: string, account: web3.AddressLookupTableAccount): void;
|
|
56
|
-
/**
|
|
57
|
-
* String to address lookup table. Can input multiple address lookup table addresses
|
|
58
|
-
*
|
|
59
|
-
* @param connection
|
|
60
|
-
* @param alts
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
stringToAlt(alts: string[]): Promise<web3.AddressLookupTableAccount[]>;
|
|
64
|
-
/**
|
|
65
|
-
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
66
|
-
* This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
|
|
67
|
-
*
|
|
68
|
-
* @param generalUtility - The utility object for general helper functions.
|
|
69
|
-
* @param connection - The active Solana blockchain connection used to fetch state and simulate the transaction.
|
|
70
|
-
* @param payer - The public key (as a string) of the payer for the transaction, responsible for fees.
|
|
71
|
-
* @param data - An object containing necessary information to construct the transaction, such as:
|
|
72
|
-
* - addressLookupTableAddresses: Array of addresses for lookup tables.
|
|
73
|
-
* - computeBudgetInstructions: Array of instructions for setting compute budget.
|
|
74
|
-
* - description: Description of the transaction.
|
|
75
|
-
* - estimatedFeeInSOL: Estimated fee in SOL units.
|
|
76
|
-
* @returns A promise resolving to an object containing the transaction metadata including the description,
|
|
77
|
-
* estimated fee, and the transaction object itself.
|
|
78
|
-
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
79
|
-
*/
|
|
80
|
-
createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse): Promise<TransactionMetadata>;
|
|
81
|
-
/**
|
|
82
|
-
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
83
|
-
* This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
|
|
84
|
-
*
|
|
85
|
-
* @param generalUtility - The utility object for general helper functions.
|
|
86
|
-
* @param connection - The active Solana blockchain connection used to fetch state and simulate the transaction.
|
|
87
|
-
* @param payer - The public key (as a string) of the payer for the transaction, responsible for fees.
|
|
88
|
-
* @param data - An object containing necessary information to construct the transaction, such as:
|
|
89
|
-
* - addressLookupTableAddresses: Array of addresses for lookup tables.
|
|
90
|
-
* - computeBudgetInstructions: Array of instructions for setting compute budget.
|
|
91
|
-
* - description: Description of the transaction.
|
|
92
|
-
* - estimatedFeeInSOL: Estimated fee in SOL units.
|
|
93
|
-
* @returns A promise resolving to an object containing the transaction metadata including the description,
|
|
94
|
-
* estimated fee, and the transaction object itself.
|
|
95
|
-
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
96
|
-
*/
|
|
97
|
-
createTxMetadataWithActions(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse2): Promise<TransactionMetadataWithActions>;
|
|
98
|
-
createTxMetadata2(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse): Promise<TransactionMetadata[]>;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=CreateTxMetadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateTxMetadata.d.ts","sourceRoot":"","sources":["../../../src/classes/CreateTxMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAE1I,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD;;;GAGG;AACH,qBAAa,gBAAgB;IAE3B,OAAO;IAEP,OAAO,CAAC,UAAU,CAAC,CAAkB;IAErC;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAEzC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAmB;IAE3C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,IAAI,gBAAgB;IAOnC,OAAO,CAAC,IAAI,CAaV;IAEF;;OAEG;IACG,IAAI;IAIV;;OAEG;IACG,UAAU;IAUhB;;;;;;;OAOG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;IAcvG;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAIzE;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,yBAAyB;IAI7D;;;;;;OAMG;IACG,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IA8B5C;;;;;;;;;;;;;;;OAeG;IACG,gBAAgB,CACpB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAoE/B;;;;;;;;;;;;;;;OAeG;IACG,2BAA2B,CAC/B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,8BAA8B,CAAC;IA6EpC,iBAAiB,CACrB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,EAAE,CAAC;CA0ElC"}
|
|
@@ -1,415 +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 () {
|
|
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.CreateTxMetadata = void 0;
|
|
46
|
-
const web3 = __importStar(require("@solana/web3.js"));
|
|
47
|
-
const Transaction_1 = require("./Transaction");
|
|
48
|
-
const Logging_1 = require("./Logging");
|
|
49
|
-
const TransactionBatchExecute2_1 = require("./TransactionBatchExecute2");
|
|
50
|
-
/**
|
|
51
|
-
* The CreateTxMetadata class is responsible for creating and managing transaction metadata,
|
|
52
|
-
* including handling address lookup tables and constructing transactions with the necessary parameters.
|
|
53
|
-
*/
|
|
54
|
-
class CreateTxMetadata {
|
|
55
|
-
constructor() {
|
|
56
|
-
this.alts = {
|
|
57
|
-
"AC3t5k5PUTJirxGEHgGGQStafu1vXkvddPyqVNDrRQDt": null,
|
|
58
|
-
"F2gRaSdfWYucAMAKv3CHReKMHvPkE3sNWrQPPPPR6UMV": null,
|
|
59
|
-
"FQHdXaRjfKxEfqDXMs6L1gfx2wwa6idDVB8hdQuf6eSD": null,
|
|
60
|
-
"4vMQAkkjhxrgJmqbRd4Z9YP9K7WFVAhHZn4jTJoN45Qj": null,
|
|
61
|
-
"6KhzJ2cs85hKdLeUXS6QjQnygUY9rFUnJADJwrYp9mjM": null,
|
|
62
|
-
"4UgEL5PQVu9MSarh8yb7U22GEZQoSkmNM3w7mZFx47aL": null,
|
|
63
|
-
"5FrgBCVUtwD1cFw39PZxnUsBaAecZVxmaYEcvv6y7b1h": null,
|
|
64
|
-
"FJ76CVMrHBxQxLcQkKdh9YBpwZuECsPjBLJWphwS34XF": null,
|
|
65
|
-
"Fgxms1gyzwhF1L3pJSoAxrNkogbg9sqct7U1z6HfLv5A": null,
|
|
66
|
-
"7vaSmpacdSv7vDjpGhBfZf3rLXjsfDkY6A12JkbNqK5Q": null,
|
|
67
|
-
"AEAMg38ZiQHanFqFiYBQSqsmqyUHj66LZXQzEaD8YJxc": null,
|
|
68
|
-
"4gitar8xUmh2wJoY6tP6f2rbyoBWRnY6RJmMK1BLUtjh": null,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
;
|
|
72
|
-
/**
|
|
73
|
-
* Sets the connection to the Solana blockchain.
|
|
74
|
-
*
|
|
75
|
-
* @param connection - The Solana blockchain connection object.
|
|
76
|
-
*/
|
|
77
|
-
setConnection(connection) { this.connection = connection; }
|
|
78
|
-
/**
|
|
79
|
-
* Gets the singleton instance of the CreateTxMetadata class.
|
|
80
|
-
*
|
|
81
|
-
* @returns The singleton instance of CreateTxMetadata.
|
|
82
|
-
*/
|
|
83
|
-
static instance() {
|
|
84
|
-
if (this._instance === undefined) {
|
|
85
|
-
this._instance = new CreateTxMetadata();
|
|
86
|
-
}
|
|
87
|
-
return this._instance;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Loads the address lookup tables.
|
|
91
|
-
*/
|
|
92
|
-
load() {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
yield this.updateAlts();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Updates the address lookup tables by fetching their latest state from the Solana blockchain.
|
|
99
|
-
*/
|
|
100
|
-
updateAlts() {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
if (!!this.connection) {
|
|
103
|
-
for (const alt in this.alts) {
|
|
104
|
-
this.alts[alt] = (yield this.connection.getAddressLookupTable(new web3.PublicKey(alt))).value;
|
|
105
|
-
}
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () { return yield this.updateAlts(); }), 1000); // Update until done
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Loads a single address lookup table account.
|
|
113
|
-
*
|
|
114
|
-
* @param alt - The address lookup table account address as a string.
|
|
115
|
-
* @param connection - (Optional) A specific Solana blockchain connection object to use.
|
|
116
|
-
* @returns A promise that resolves to the address lookup table account.
|
|
117
|
-
* @throws Error if the address lookup table does not exist.
|
|
118
|
-
*/
|
|
119
|
-
loadSingleAlt(alt, connection) {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
if (!!connection) {
|
|
122
|
-
this.alts[alt] = (yield connection.getAddressLookupTable(new web3.PublicKey(alt))).value;
|
|
123
|
-
}
|
|
124
|
-
else if (!!this.connection) {
|
|
125
|
-
this.alts[alt] = (yield this.connection.getAddressLookupTable(new web3.PublicKey(alt))).value;
|
|
126
|
-
}
|
|
127
|
-
const result = this.alts[alt];
|
|
128
|
-
if (!!result) {
|
|
129
|
-
return result;
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
throw new Error(`ALT ${alt} does not exist`);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Gets an address lookup table account.
|
|
138
|
-
*
|
|
139
|
-
* @param alt - The address lookup table account address as a string.
|
|
140
|
-
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
141
|
-
*/
|
|
142
|
-
getAlt(alt) {
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
return this.alts[alt];
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Store address lookup table in the object
|
|
149
|
-
*
|
|
150
|
-
* @param alt
|
|
151
|
-
* @param account
|
|
152
|
-
*/
|
|
153
|
-
storeAlt(alt, account) {
|
|
154
|
-
this.alts[alt] = account;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* String to address lookup table. Can input multiple address lookup table addresses
|
|
158
|
-
*
|
|
159
|
-
* @param connection
|
|
160
|
-
* @param alts
|
|
161
|
-
* @returns
|
|
162
|
-
*/
|
|
163
|
-
stringToAlt(alts) {
|
|
164
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
var _a, _b;
|
|
166
|
-
const _alts = [];
|
|
167
|
-
const notExist = [];
|
|
168
|
-
alts.map((key, index) => {
|
|
169
|
-
const alt = this.alts[key];
|
|
170
|
-
if (!!alt) {
|
|
171
|
-
_alts.push(alt);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
notExist.push(index);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
if (notExist.length === 0) {
|
|
178
|
-
return _alts;
|
|
179
|
-
}
|
|
180
|
-
const pubkeys = notExist.map(index => new web3.PublicKey(alts[index]));
|
|
181
|
-
const accountInfos = yield this.connection.getMultipleAccountsInfo(pubkeys);
|
|
182
|
-
for (let i = 0; i < accountInfos.length; i++) {
|
|
183
|
-
if (((_a = accountInfos[i]) === null || _a === void 0 ? void 0 : _a.data) && ((_b = accountInfos[i]) === null || _b === void 0 ? void 0 : _b.owner.toString()) === "AddressLookupTab1e1111111111111111111111111") {
|
|
184
|
-
const key = pubkeys[i].toString();
|
|
185
|
-
const alt = new web3.AddressLookupTableAccount({
|
|
186
|
-
key: pubkeys[i],
|
|
187
|
-
state: web3.AddressLookupTableAccount.deserialize(new Uint8Array(accountInfos[i].data))
|
|
188
|
-
});
|
|
189
|
-
this.alts[key] = alt;
|
|
190
|
-
_alts.push(alt);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return _alts;
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
198
|
-
* This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
|
|
199
|
-
*
|
|
200
|
-
* @param generalUtility - The utility object for general helper functions.
|
|
201
|
-
* @param connection - The active Solana blockchain connection used to fetch state and simulate the transaction.
|
|
202
|
-
* @param payer - The public key (as a string) of the payer for the transaction, responsible for fees.
|
|
203
|
-
* @param data - An object containing necessary information to construct the transaction, such as:
|
|
204
|
-
* - addressLookupTableAddresses: Array of addresses for lookup tables.
|
|
205
|
-
* - computeBudgetInstructions: Array of instructions for setting compute budget.
|
|
206
|
-
* - description: Description of the transaction.
|
|
207
|
-
* - estimatedFeeInSOL: Estimated fee in SOL units.
|
|
208
|
-
* @returns A promise resolving to an object containing the transaction metadata including the description,
|
|
209
|
-
* estimated fee, and the transaction object itself.
|
|
210
|
-
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
211
|
-
*/
|
|
212
|
-
createTxMetadata(generalUtility, connection, payer, data) {
|
|
213
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
// Retrieve address lookup table accounts
|
|
215
|
-
const alts = [];
|
|
216
|
-
(0, Logging_1.Log)(`createTxMetadata`);
|
|
217
|
-
const mainStartTime = new Date().getTime() / 1000;
|
|
218
|
-
// Find jup alts
|
|
219
|
-
let startTime = mainStartTime;
|
|
220
|
-
const jupAlts = yield generalUtility.findAltWithTxPost({ transaction: data });
|
|
221
|
-
(0, Logging_1.Log)(`createTxMetadata: Checkpoint: (jupAlts) ${(new Date().getTime() / 1000) - startTime}`);
|
|
222
|
-
(0, Logging_1.Log)(`jupAlts: ${JSON.stringify(jupAlts)}`);
|
|
223
|
-
startTime = new Date().getTime() / 1000;
|
|
224
|
-
for (const alt of data.addressLookupTableAddresses) {
|
|
225
|
-
const _alt = yield this.getAlt(alt);
|
|
226
|
-
if (!!_alt) {
|
|
227
|
-
alts.push(_alt);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
try {
|
|
231
|
-
alts.push(yield this.loadSingleAlt(alt, connection));
|
|
232
|
-
}
|
|
233
|
-
catch (_a) {
|
|
234
|
-
console.error(`The ALT from addressLookupTableAddresses: ${alt} does not exist onchain. Skipping.`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
if (jupAlts.status === 200) {
|
|
239
|
-
for (const alt of jupAlts.data) {
|
|
240
|
-
const _alt = yield this.getAlt(alt);
|
|
241
|
-
if (!!_alt) {
|
|
242
|
-
alts.push(_alt);
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
try {
|
|
246
|
-
alts.push(yield this.loadSingleAlt(alt, connection));
|
|
247
|
-
}
|
|
248
|
-
catch (_b) {
|
|
249
|
-
console.error(`The ALT from Jupiter: ${alt} does not exist onchain. Skipping.`);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
console.error(jupAlts.data);
|
|
256
|
-
}
|
|
257
|
-
(0, Logging_1.Log)(`createTxMetadata: Checkpoint: (jupAlts after loop) ${(new Date().getTime() / 1000) - startTime}`);
|
|
258
|
-
// Get the recent blockhash
|
|
259
|
-
startTime = new Date().getTime() / 1000;
|
|
260
|
-
const latestBlockhash = yield connection.getLatestBlockhash();
|
|
261
|
-
(0, Logging_1.Log)(`createTxMetadata: Checkpoint: (latestBlockhash) ${(new Date().getTime() / 1000) - startTime}`);
|
|
262
|
-
// Create initial transaction instance
|
|
263
|
-
const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), latestBlockhash, alts, generalUtility);
|
|
264
|
-
(0, Logging_1.Log)(`createTxMetadata: Elapsed time: ${(new Date().getTime() / 1000) - mainStartTime}`);
|
|
265
|
-
// Return transaction metadata
|
|
266
|
-
return {
|
|
267
|
-
description: data.description,
|
|
268
|
-
estimatedFeeInSOL: data.estimatedFeeInSOL,
|
|
269
|
-
transaction,
|
|
270
|
-
};
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
275
|
-
* This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
|
|
276
|
-
*
|
|
277
|
-
* @param generalUtility - The utility object for general helper functions.
|
|
278
|
-
* @param connection - The active Solana blockchain connection used to fetch state and simulate the transaction.
|
|
279
|
-
* @param payer - The public key (as a string) of the payer for the transaction, responsible for fees.
|
|
280
|
-
* @param data - An object containing necessary information to construct the transaction, such as:
|
|
281
|
-
* - addressLookupTableAddresses: Array of addresses for lookup tables.
|
|
282
|
-
* - computeBudgetInstructions: Array of instructions for setting compute budget.
|
|
283
|
-
* - description: Description of the transaction.
|
|
284
|
-
* - estimatedFeeInSOL: Estimated fee in SOL units.
|
|
285
|
-
* @returns A promise resolving to an object containing the transaction metadata including the description,
|
|
286
|
-
* estimated fee, and the transaction object itself.
|
|
287
|
-
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
288
|
-
*/
|
|
289
|
-
createTxMetadataWithActions(generalUtility, connection, payer, data) {
|
|
290
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
-
// Retrieve address lookup table accounts
|
|
292
|
-
const alts = [];
|
|
293
|
-
(0, Logging_1.Log)(`createTxMetadataWithActions`);
|
|
294
|
-
const mainStartTime = new Date().getTime() / 1000;
|
|
295
|
-
// Find jup alts
|
|
296
|
-
let startTime = mainStartTime;
|
|
297
|
-
const jupAlts = yield generalUtility.findAltWithTxPost({ transaction: data });
|
|
298
|
-
(0, Logging_1.Log)(`createTxMetadataWithActions: Checkpoint: (jupAlts) ${(new Date().getTime() / 1000) - startTime}`);
|
|
299
|
-
(0, Logging_1.Log)(`jupAlts: ${JSON.stringify(jupAlts)}`);
|
|
300
|
-
startTime = new Date().getTime() / 1000;
|
|
301
|
-
for (const alt of data.addressLookupTableAddresses) {
|
|
302
|
-
const _alt = yield this.getAlt(alt);
|
|
303
|
-
if (!!_alt) {
|
|
304
|
-
alts.push(_alt);
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
try {
|
|
308
|
-
alts.push(yield this.loadSingleAlt(alt, connection));
|
|
309
|
-
}
|
|
310
|
-
catch (_a) {
|
|
311
|
-
console.error(`The ALT from addressLookupTableAddresses: ${alt} does not exist onchain. Skipping.`);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (jupAlts.status === 200) {
|
|
316
|
-
for (const alt of jupAlts.data) {
|
|
317
|
-
const _alt = yield this.getAlt(alt);
|
|
318
|
-
if (!!_alt) {
|
|
319
|
-
alts.push(_alt);
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
try {
|
|
323
|
-
alts.push(yield this.loadSingleAlt(alt, connection));
|
|
324
|
-
}
|
|
325
|
-
catch (_b) {
|
|
326
|
-
console.error(`The ALT from Jupiter: ${alt} does not exist onchain. Skipping.`);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
332
|
-
console.error(jupAlts.data);
|
|
333
|
-
}
|
|
334
|
-
(0, Logging_1.Log)(`createTxMetadataWithActions: Checkpoint: (jupAlts after loop) ${(new Date().getTime() / 1000) - startTime}`);
|
|
335
|
-
// Get the recent blockhash
|
|
336
|
-
startTime = new Date().getTime() / 1000;
|
|
337
|
-
const latestBlockhash = yield connection.getLatestBlockhash();
|
|
338
|
-
(0, Logging_1.Log)(`createTxMetadataWithActions: Checkpoint: (latestBlockhash) ${(new Date().getTime() / 1000) - startTime}`);
|
|
339
|
-
// Create initial transaction instance
|
|
340
|
-
const transaction = new Transaction_1.Transaction({
|
|
341
|
-
// @deprecated
|
|
342
|
-
description: '',
|
|
343
|
-
// @deprecated
|
|
344
|
-
estimatedFeeInSOL: '',
|
|
345
|
-
addressLookupTableAddresses: data.addressLookupTableAddresses, // "alts" is confusing, copied jup's naming
|
|
346
|
-
computeBudgetInstructions: data.computeBudgetInstructions, // this enables for ease of access while also making them optional
|
|
347
|
-
mainInstructions: data.mainInstructions,
|
|
348
|
-
payer: data.payer,
|
|
349
|
-
signature: '',
|
|
350
|
-
}, new web3.PublicKey(payer), latestBlockhash, alts, generalUtility);
|
|
351
|
-
(0, Logging_1.Log)(`createTxMetadataWithActions: Elapsed time: ${(new Date().getTime() / 1000) - mainStartTime}`);
|
|
352
|
-
// Return transaction metadata
|
|
353
|
-
return {
|
|
354
|
-
actions: data.actions,
|
|
355
|
-
transaction,
|
|
356
|
-
};
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
createTxMetadata2(generalUtility, connection, payer, data) {
|
|
360
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
361
|
-
// Ensure connection is available for ALT downloads
|
|
362
|
-
this.setConnection(connection);
|
|
363
|
-
// Retrieve address lookup table accounts
|
|
364
|
-
const alts = [];
|
|
365
|
-
(0, Logging_1.Log)(`createTxMetadata2`);
|
|
366
|
-
const mainStartTime = new Date().getTime() / 1000;
|
|
367
|
-
// Get the recent blockhash
|
|
368
|
-
let startTime = mainStartTime;
|
|
369
|
-
const latestBlockhash = yield connection.getLatestBlockhash();
|
|
370
|
-
(0, Logging_1.Log)(`createTxMetadata2: Checkpoint: (latestBlockhash) ${(new Date().getTime() / 1000) - startTime}`);
|
|
371
|
-
startTime = new Date().getTime() / 1000;
|
|
372
|
-
const batchExecute = new TransactionBatchExecute2_1.TransactionBatchExecute2(data.addressLookupTableAddresses.map(p => new web3.PublicKey(p)), data.mainInstructions.map(ix => {
|
|
373
|
-
const keys = ix.accounts.map(meta => {
|
|
374
|
-
return {
|
|
375
|
-
pubkey: new web3.PublicKey(meta.pubkey),
|
|
376
|
-
isSigner: meta.isSigner,
|
|
377
|
-
isWritable: meta.isWritable,
|
|
378
|
-
};
|
|
379
|
-
});
|
|
380
|
-
return {
|
|
381
|
-
keys,
|
|
382
|
-
programId: new web3.PublicKey(ix.programId),
|
|
383
|
-
data: Buffer.from(ix.data, 'base64'),
|
|
384
|
-
};
|
|
385
|
-
}), connection, this, latestBlockhash, new web3.PublicKey(payer));
|
|
386
|
-
(0, Logging_1.Log)(`createTxMetadata2: Checkpoint: Create 'batchExecute' instance ${(new Date().getTime() / 1000) - startTime}`);
|
|
387
|
-
startTime = new Date().getTime() / 1000;
|
|
388
|
-
const batch = yield batchExecute.buildBatch();
|
|
389
|
-
(0, Logging_1.Log)(`createTxMetadata2: Checkpoint: Create batch of transactions ${(new Date().getTime() / 1000) - startTime}`);
|
|
390
|
-
(0, Logging_1.Log)(`Number of transactions: ${batch.length}`);
|
|
391
|
-
startTime = new Date().getTime() / 1000;
|
|
392
|
-
const txMetadata = [];
|
|
393
|
-
let i = 0;
|
|
394
|
-
for (const tx of batch) {
|
|
395
|
-
let description = data.description;
|
|
396
|
-
if (batch.length > 1) {
|
|
397
|
-
description = `${description} #${i + 1}`;
|
|
398
|
-
}
|
|
399
|
-
const alts = batchExecute.findRequiredAltsForBatch2(tx);
|
|
400
|
-
// Create initial transaction instance
|
|
401
|
-
const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), latestBlockhash, alts, generalUtility, tx);
|
|
402
|
-
txMetadata.push({
|
|
403
|
-
description,
|
|
404
|
-
estimatedFeeInSOL: data.estimatedFeeInSOL,
|
|
405
|
-
transaction,
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
(0, Logging_1.Log)(`createTxMetadata2: Checkpoint: Generated multiple transaction metadata ${(new Date().getTime() / 1000) - startTime}`);
|
|
409
|
-
(0, Logging_1.Log)(`createTxMetadata2: Elapsed time: ${(new Date().getTime() / 1000) - mainStartTime}`);
|
|
410
|
-
// Return transaction metadata
|
|
411
|
-
return txMetadata;
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
exports.CreateTxMetadata = CreateTxMetadata;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as web3 from "@solana/web3.js";
|
|
2
|
-
import * as _client from "@hawksightco/swagger-client";
|
|
3
|
-
import { ResponseWithStatus, TransactionMetadata, UserPortfolioOut } from "../types";
|
|
4
|
-
import { Client } from "./Client";
|
|
5
|
-
import { GeneralUtility } from "./GeneralUtility";
|
|
6
|
-
/**
|
|
7
|
-
* Provides general utility functions for managing and querying blockchain-related data,
|
|
8
|
-
* handling transactions, and interfacing with a specific blockchain network via the client API.
|
|
9
|
-
* This class serves as an abstraction layer to interact with various blockchain operations
|
|
10
|
-
* such as registering new entities, retrieving portfolio information, and more.
|
|
11
|
-
*/
|
|
12
|
-
export declare class General {
|
|
13
|
-
private readonly client;
|
|
14
|
-
private readonly generalUtility;
|
|
15
|
-
/** The priority level for transactions, influencing transaction fee calculation and processing priority. */
|
|
16
|
-
protected priorityLevel: _client.PriorityLevel;
|
|
17
|
-
/** The maximum priority fee to be included in transaction fee calculations, specified in lamports. */
|
|
18
|
-
protected maxPriorityFee: number;
|
|
19
|
-
/**
|
|
20
|
-
* Constructs a new instance of the General class.
|
|
21
|
-
* @param client The Client object providing network access and API functionality.
|
|
22
|
-
*/
|
|
23
|
-
constructor(client: Client, generalUtility: GeneralUtility);
|
|
24
|
-
/**
|
|
25
|
-
* Sets the transaction priority level, which may affect the processing speed and fees.
|
|
26
|
-
*
|
|
27
|
-
* @param priorityLevel The desired priority level for upcoming transactions.
|
|
28
|
-
*/
|
|
29
|
-
setPriorityLevel(priorityLevel: _client.PriorityLevel): void;
|
|
30
|
-
/**
|
|
31
|
-
* Sets the maximum priority fee for transactions, which is the additional fee to speed up transaction processing.
|
|
32
|
-
*
|
|
33
|
-
* @param maxPriorityFee The fee in lamports.
|
|
34
|
-
*/
|
|
35
|
-
setMaxPriorityFee(maxPriorityFee: number): void;
|
|
36
|
-
/**
|
|
37
|
-
* @returns Returns a token supported by Hawksight
|
|
38
|
-
*/
|
|
39
|
-
token(params: {
|
|
40
|
-
address: string;
|
|
41
|
-
}): Promise<ResponseWithStatus<_client.InlineResponse200>>;
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves the portfolio information for a specified wallet and optionally a pool.
|
|
44
|
-
*
|
|
45
|
-
* @param params Object containing wallet address and optional pool identifier.
|
|
46
|
-
* @returns A Promise resolving to the portfolio information including assets and balances.
|
|
47
|
-
*/
|
|
48
|
-
portfolio(params: {
|
|
49
|
-
wallet: string;
|
|
50
|
-
pool?: string;
|
|
51
|
-
}): Promise<ResponseWithStatus<UserPortfolioOut>>;
|
|
52
|
-
/**
|
|
53
|
-
* Fetches a list of pools managed by the platform, providing details about each pool.
|
|
54
|
-
*
|
|
55
|
-
* @param params Object containing hash of the pools
|
|
56
|
-
* @returns A Promise resolving to an array of pools, including metadata such as pool addresses and statistics.
|
|
57
|
-
*/
|
|
58
|
-
pools(params: {
|
|
59
|
-
hash?: string;
|
|
60
|
-
}): Promise<ResponseWithStatus<_client.HawksightPool[]>>;
|
|
61
|
-
/**
|
|
62
|
-
* Fetches a single pool either from Orca or Meteora.
|
|
63
|
-
*
|
|
64
|
-
* @param params Object containing hash of the pools
|
|
65
|
-
* @returns A Promise resolving to an array of pools, including metadata such as pool addresses and statistics.
|
|
66
|
-
*/
|
|
67
|
-
pool(params: {
|
|
68
|
-
pairAddress: string;
|
|
69
|
-
protocol: string;
|
|
70
|
-
}): Promise<ResponseWithStatus<_client.HawksightPool[]>>;
|
|
71
|
-
/**
|
|
72
|
-
* Retrieves information about the available tokens on the platform.
|
|
73
|
-
*
|
|
74
|
-
* @returns A Promise resolving to an array of token details, including names, symbols, and other token-specific information.
|
|
75
|
-
*/
|
|
76
|
-
tokens(): Promise<ResponseWithStatus<_client.InlineResponse200[]>>;
|
|
77
|
-
/**
|
|
78
|
-
* Registers a new entity or user with the necessary parameters, handling transaction creation and response.
|
|
79
|
-
*
|
|
80
|
-
* @param connection A Solana web3 connection for interacting with the blockchain.
|
|
81
|
-
* @param payer The public key of the payer, responsible for transaction fees.
|
|
82
|
-
* @param params Registration parameters required by the API.
|
|
83
|
-
* @returns A Promise resolving to the transaction metadata or an error response, depending on the outcome of the registration.
|
|
84
|
-
*/
|
|
85
|
-
register(connection: web3.Connection, payer: string, params: _client.RegisterBody): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=General.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAoD,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvI,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;GAKG;AACH,qBAAa,OAAO;IAahB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAZjC,4GAA4G;IAC5G,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC;IAE/C,sGAAsG;IACtG,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;IAEjC;;;OAGG;gBAEgB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc;IAOjD;;;;OAIG;IACH,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,aAAa;IAIrD;;;;OAIG;IACH,iBAAiB,CAAC,cAAc,EAAE,MAAM;IAIxC;;OAEG;IACG,KAAK,CACT,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,GACA,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAQzD;;;;;OAKG;IACG,SAAS,CACb,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,KAAK,CACT,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAQvD;;;;;OAKG;IACG,IAAI,CACR,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"}
|