@hawksightco/hawk-sdk 0.0.53 → 0.0.55
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/src/classes/General.js +1 -1
- package/dist/src/classes/TxGenerator.d.ts +1 -21
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +10 -52
- package/dist/src/classes/TxGeneratorAutomations.js +2 -2
- package/dist/src/functions.d.ts +1 -3
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +7 -15
- package/package.json +1 -1
|
@@ -127,7 +127,7 @@ class General {
|
|
|
127
127
|
return (0, functions_1.resultOrError)({
|
|
128
128
|
status: result.status,
|
|
129
129
|
data: result.data,
|
|
130
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
130
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -10,33 +10,13 @@ import { GeneralUtility } from "./GeneralUtility";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class TxGenerator {
|
|
12
12
|
private readonly client;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The current priority level of transactions generated by this instance.
|
|
16
|
-
*/
|
|
17
|
-
protected priorityLevel: _client.PriorityLevel;
|
|
18
|
-
/**
|
|
19
|
-
* The maximum priority fee in lamports that can be added to transactions for faster processing.
|
|
20
|
-
*/
|
|
21
|
-
protected maxPriorityFee: number;
|
|
13
|
+
protected readonly generalUtility: GeneralUtility;
|
|
22
14
|
/**
|
|
23
15
|
* Initializes a new instance of the TxGenerator class with a specified client.
|
|
24
16
|
*
|
|
25
17
|
* @param client An instance of Client used to interact with various APIs for transaction generation.
|
|
26
18
|
*/
|
|
27
19
|
constructor(client: Client, generalUtility: GeneralUtility);
|
|
28
|
-
/**
|
|
29
|
-
* Sets the priority level of the transaction.
|
|
30
|
-
*
|
|
31
|
-
* @param priorityLevel The desired transaction priority level.
|
|
32
|
-
*/
|
|
33
|
-
setPriorityLevel(priorityLevel: _client.PriorityLevel): void;
|
|
34
|
-
/**
|
|
35
|
-
* Sets the maximum priority fee for the transaction.
|
|
36
|
-
*
|
|
37
|
-
* @param maxPriorityFee The maximum priority fee in lamports.
|
|
38
|
-
*/
|
|
39
|
-
setMaxPriorityFee(maxPriorityFee: number): void;
|
|
40
20
|
/**
|
|
41
21
|
* Creates meteora instruction that creates new position and deposit.
|
|
42
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAoD,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAoD,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,WAAW;IAQpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc;IAPnD;;;;OAIG;gBAEgB,MAAM,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc;IAGnD;;;;;;;OAOG;IACG,+BAA+B,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAWnL;;;;;;;OAOG;IACG,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAWjJ;;;;;;;OAOG;IACG,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAWnJ;;;;;;;OAOG;IACG,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAW7I;;;;;;;OAOG;IACG,oBAAoB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAW7J;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAWxJ;;;;;;;OAOG;IACG,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAW3J;;;;;;;OAOG;IACG,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAW/I;;;;;;;OAOG;IACG,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAWjJ;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAUzJ"}
|
|
@@ -1,27 +1,4 @@
|
|
|
1
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
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -33,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
10
|
};
|
|
34
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
12
|
exports.TxGenerator = void 0;
|
|
36
|
-
const _client = __importStar(require("@hawksightco/swagger-client"));
|
|
37
13
|
const functions_1 = require("../functions");
|
|
38
14
|
/**
|
|
39
15
|
* The `TxGenerator` class encapsulates methods to generate transactions with various trading operations
|
|
@@ -49,24 +25,6 @@ class TxGenerator {
|
|
|
49
25
|
constructor(client, generalUtility) {
|
|
50
26
|
this.client = client;
|
|
51
27
|
this.generalUtility = generalUtility;
|
|
52
|
-
this.priorityLevel = _client.PriorityLevel.Default;
|
|
53
|
-
this.maxPriorityFee = 500000; // Default max priority fee in lamports
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Sets the priority level of the transaction.
|
|
57
|
-
*
|
|
58
|
-
* @param priorityLevel The desired transaction priority level.
|
|
59
|
-
*/
|
|
60
|
-
setPriorityLevel(priorityLevel) {
|
|
61
|
-
this.priorityLevel = priorityLevel;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Sets the maximum priority fee for the transaction.
|
|
65
|
-
*
|
|
66
|
-
* @param maxPriorityFee The maximum priority fee in lamports.
|
|
67
|
-
*/
|
|
68
|
-
setMaxPriorityFee(maxPriorityFee) {
|
|
69
|
-
this.maxPriorityFee = maxPriorityFee;
|
|
70
28
|
}
|
|
71
29
|
/**
|
|
72
30
|
* Creates meteora instruction that creates new position and deposit.
|
|
@@ -82,7 +40,7 @@ class TxGenerator {
|
|
|
82
40
|
return (0, functions_1.resultOrError)({
|
|
83
41
|
status: result.status,
|
|
84
42
|
data: result.data,
|
|
85
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
43
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
86
44
|
});
|
|
87
45
|
}
|
|
88
46
|
/**
|
|
@@ -99,7 +57,7 @@ class TxGenerator {
|
|
|
99
57
|
return (0, functions_1.resultOrError)({
|
|
100
58
|
status: result.status,
|
|
101
59
|
data: result.data,
|
|
102
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
60
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
103
61
|
});
|
|
104
62
|
}
|
|
105
63
|
/**
|
|
@@ -116,7 +74,7 @@ class TxGenerator {
|
|
|
116
74
|
return (0, functions_1.resultOrError)({
|
|
117
75
|
status: result.status,
|
|
118
76
|
data: result.data,
|
|
119
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
77
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
120
78
|
});
|
|
121
79
|
}
|
|
122
80
|
/**
|
|
@@ -133,7 +91,7 @@ class TxGenerator {
|
|
|
133
91
|
return (0, functions_1.resultOrError)({
|
|
134
92
|
status: result.status,
|
|
135
93
|
data: result.data,
|
|
136
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
94
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
137
95
|
});
|
|
138
96
|
}
|
|
139
97
|
/**
|
|
@@ -150,7 +108,7 @@ class TxGenerator {
|
|
|
150
108
|
return (0, functions_1.resultOrError)({
|
|
151
109
|
status: result.status,
|
|
152
110
|
data: result.data,
|
|
153
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
111
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
154
112
|
});
|
|
155
113
|
}
|
|
156
114
|
/**
|
|
@@ -167,7 +125,7 @@ class TxGenerator {
|
|
|
167
125
|
return (0, functions_1.resultOrError)({
|
|
168
126
|
status: result.status,
|
|
169
127
|
data: result.data,
|
|
170
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
128
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
171
129
|
});
|
|
172
130
|
}
|
|
173
131
|
/**
|
|
@@ -184,7 +142,7 @@ class TxGenerator {
|
|
|
184
142
|
return (0, functions_1.resultOrError)({
|
|
185
143
|
status: result.status,
|
|
186
144
|
data: result.data,
|
|
187
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
145
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
188
146
|
});
|
|
189
147
|
}
|
|
190
148
|
/**
|
|
@@ -201,7 +159,7 @@ class TxGenerator {
|
|
|
201
159
|
return (0, functions_1.resultOrError)({
|
|
202
160
|
status: result.status,
|
|
203
161
|
data: result.data,
|
|
204
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
162
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
205
163
|
});
|
|
206
164
|
}
|
|
207
165
|
/**
|
|
@@ -218,7 +176,7 @@ class TxGenerator {
|
|
|
218
176
|
return (0, functions_1.resultOrError)({
|
|
219
177
|
status: result.status,
|
|
220
178
|
data: result.data,
|
|
221
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
179
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
222
180
|
});
|
|
223
181
|
}
|
|
224
182
|
/**
|
|
@@ -235,7 +193,7 @@ class TxGenerator {
|
|
|
235
193
|
return (0, functions_1.resultOrError)({
|
|
236
194
|
status: result.status,
|
|
237
195
|
data: result.data,
|
|
238
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
196
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
239
197
|
});
|
|
240
198
|
}
|
|
241
199
|
}
|
|
@@ -70,7 +70,7 @@ class TxGeneratorAutomations {
|
|
|
70
70
|
return (0, functions_1.resultOrError)({
|
|
71
71
|
status: result.status,
|
|
72
72
|
data: result.data,
|
|
73
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
73
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
@@ -89,7 +89,7 @@ class TxGeneratorAutomations {
|
|
|
89
89
|
return (0, functions_1.resultOrError)({
|
|
90
90
|
status: result.status,
|
|
91
91
|
data: result.data,
|
|
92
|
-
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data
|
|
92
|
+
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
}
|
package/dist/src/functions.d.ts
CHANGED
|
@@ -13,13 +13,11 @@ import { GeneralUtility } from "./classes/GeneralUtility";
|
|
|
13
13
|
* - computeBudgetInstructions: Array of instructions for setting compute budget.
|
|
14
14
|
* - description: Description of the transaction.
|
|
15
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
16
|
* @returns A promise resolving to an object containing the transaction metadata including the description,
|
|
19
17
|
* estimated fee, and the transaction object itself.
|
|
20
18
|
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
21
19
|
*/
|
|
22
|
-
export declare function createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse
|
|
20
|
+
export declare function createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse): Promise<TransactionMetadata>;
|
|
23
21
|
/**
|
|
24
22
|
* Wraps the result of an API call or operation in an object containing status information.
|
|
25
23
|
* If the result status is 200, applies a success function to the data.
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,CAAC,CAiD9B;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,aAAa,EAC9B,WAAW,EAAE,2BAA2B,GACvC,OAAO,CAAC,MAAM,CAAC,CAwBjB"}
|
package/dist/src/functions.js
CHANGED
|
@@ -47,20 +47,21 @@ const Transaction_1 = require("./classes/Transaction");
|
|
|
47
47
|
* - computeBudgetInstructions: Array of instructions for setting compute budget.
|
|
48
48
|
* - description: Description of the transaction.
|
|
49
49
|
* - estimatedFeeInSOL: Estimated fee in SOL units.
|
|
50
|
-
* @param priorityLevel An enum representing the priority level of the transaction which might influence the fee.
|
|
51
|
-
* @param maxPriorityFee The maximum priority fee willing to be paid on top of the base fee for faster processing (in lamports)
|
|
52
50
|
* @returns A promise resolving to an object containing the transaction metadata including the description,
|
|
53
51
|
* estimated fee, and the transaction object itself.
|
|
54
52
|
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
55
53
|
*/
|
|
56
|
-
function createTxMetadata(generalUtility, connection, payer, data
|
|
54
|
+
function createTxMetadata(generalUtility, connection, payer, data) {
|
|
57
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
56
|
// Retrieve address lookup table accounts
|
|
59
57
|
const alts = [];
|
|
58
|
+
console.log(`createTxMetadata`);
|
|
59
|
+
const startTime = new Date().getTime() / 1000;
|
|
60
60
|
// Find jup alts
|
|
61
61
|
const jupAlts = yield generalUtility.findAltWithTxPost({
|
|
62
62
|
transaction: data,
|
|
63
63
|
});
|
|
64
|
+
console.log(`createTxMetadata: Checkpoint: (jupAlts) ${(new Date().getTime() / 1000) - startTime}`);
|
|
64
65
|
for (const alt of data.addressLookupTableAddresses) {
|
|
65
66
|
alts.push((yield connection.getAddressLookupTable(new web3.PublicKey(alt))).value);
|
|
66
67
|
}
|
|
@@ -72,22 +73,13 @@ function createTxMetadata(generalUtility, connection, payer, data, priorityLevel
|
|
|
72
73
|
else {
|
|
73
74
|
console.error(jupAlts.data);
|
|
74
75
|
}
|
|
76
|
+
console.log(`createTxMetadata: Checkpoint: (jupAlts after loop) ${(new Date().getTime() / 1000) - startTime}`);
|
|
75
77
|
// Get the recent blockhash
|
|
76
78
|
const latestBlockhash = yield connection.getLatestBlockhash();
|
|
79
|
+
console.log(`createTxMetadata: Checkpoint: (latestBlockhash) ${(new Date().getTime() / 1000) - startTime}`);
|
|
77
80
|
// Create initial transaction instance
|
|
78
81
|
const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), latestBlockhash, alts, generalUtility);
|
|
79
|
-
|
|
80
|
-
// const simulation = await transaction.simulateTransaction(connection);
|
|
81
|
-
// // Check if there's error in transaction
|
|
82
|
-
// if (simulation.err !== null) {
|
|
83
|
-
// console.log(`Transaction Error: ${simulation.err}`);
|
|
84
|
-
// for (const log of simulation.logs as string[]) {
|
|
85
|
-
// console.log(log);
|
|
86
|
-
// }
|
|
87
|
-
// // throw new Error(simulation.err.toString());
|
|
88
|
-
// }
|
|
89
|
-
// // Include priority fee instructions generated via Helius (assuming we use Helius as RPC)
|
|
90
|
-
// transaction.addPriorityFeeIx(connection, priorityLevel, simulation.unitsConsumed, maxPriorityFee);
|
|
82
|
+
console.log(`createTxMetadata: Elapsed time: ${(new Date().getTime() / 1000) - startTime}`);
|
|
91
83
|
// Return transaction metadatauni
|
|
92
84
|
return {
|
|
93
85
|
description: data.description,
|