@helium/spl-utils 0.0.27 → 0.0.28
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/lib/cjs/transaction.js +4 -1
- package/lib/cjs/transaction.js.map +1 -1
- package/lib/esm/src/transaction.js +4 -1
- package/lib/esm/src/transaction.js.map +1 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/transaction.d.ts.map +1 -1
- package/package.json +2 -2
- package/lib/cjs/tpuClient.js +0 -410
- package/lib/cjs/tpuClient.js.map +0 -1
- package/lib/esm/src/tpuClient.js +0 -397
- package/lib/esm/src/tpuClient.js.map +0 -1
- package/lib/types/src/tpuClient.d.ts +0 -153
- package/lib/types/src/tpuClient.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EAER,SAAS,EAET,WAAW,EACX,eAAe,EACf,MAAM,EAEN,WAAW,EACX,sBAAsB,EAEtB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAoBzB,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,YAAY,EAAE,sBAAsB,EAAE,CAAC;IACvC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,YAAY,EAAE,sBAAs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AqC,SAC1C,oBAAoB,WACjB,MAAM,cACH,UAAU,eACV,UAAU,4BAErB,QAAQ,eAAe,GAAG,IAAI,GAAG,IAAI,CAuFvC,CAAC;AAsCF,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,OAAO,SAAkB,GACxB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA0D3B;AAED,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,eAE5D;AAED,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,eAE5D;AAgBD,KAAK,MAAM,GAAG;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,WAAW,EAAE,EAClB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACrC,cAAc,GAAE,MAAU,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAyDnB;AAMD,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EAAE,EACb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACrC,oBAAoB,CAAC,EAAE,MAAM,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC,CAoEnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helium/spl-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Utils shared across spl suite",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"typescript": "^4.3.4",
|
|
46
46
|
"yarn": "^1.22.18"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b4ff3a8ac49a3aadfdd9fc9b8a7ea12b0453f47b"
|
|
49
49
|
}
|
package/lib/cjs/tpuClient.js
DELETED
|
@@ -1,410 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.TpuConnection = exports.LeaderTpuService = exports.TpuClient = exports.RecentLeaderSlots = exports.MAX_FANOUT_SLOTS = exports.DEFAULT_FANOUT_SLOTS = exports.MAX_SLOT_SKIP_DISTANCE = exports.LeaderTpuCache = void 0;
|
|
16
|
-
// Taken from https://raw.githubusercontent.com/lmvdz/tpu-client/main/src/index.ts bec of supply chain risk
|
|
17
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
18
|
-
const denque_1 = __importDefault(require("denque"));
|
|
19
|
-
const dgram_1 = __importDefault(require("dgram"));
|
|
20
|
-
const bs58_1 = __importDefault(require("bs58"));
|
|
21
|
-
class LeaderTpuCache {
|
|
22
|
-
constructor(connection, startSlot) {
|
|
23
|
-
this.connection = connection;
|
|
24
|
-
this.first_slot = startSlot;
|
|
25
|
-
}
|
|
26
|
-
static load(connection, startSlot) {
|
|
27
|
-
return new Promise((resolve) => {
|
|
28
|
-
const leaderTpuCache = new LeaderTpuCache(connection, startSlot);
|
|
29
|
-
leaderTpuCache.connection.getEpochInfo().then((epochInfo) => {
|
|
30
|
-
leaderTpuCache.slots_in_epoch = epochInfo.slotsInEpoch;
|
|
31
|
-
leaderTpuCache
|
|
32
|
-
.fetchSlotLeaders(leaderTpuCache.first_slot, leaderTpuCache.slots_in_epoch)
|
|
33
|
-
.then((leaders) => {
|
|
34
|
-
leaderTpuCache.leaders = leaders;
|
|
35
|
-
leaderTpuCache.fetchClusterTpuSockets().then((leaderTpuMap) => {
|
|
36
|
-
leaderTpuCache.leaderTpuMap = leaderTpuMap;
|
|
37
|
-
resolve(leaderTpuCache);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
fetchClusterTpuSockets() {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
const map = new Map();
|
|
46
|
-
this.connection
|
|
47
|
-
.getClusterNodes()
|
|
48
|
-
.then((contactInfo) => {
|
|
49
|
-
contactInfo.forEach((contactInfo) => {
|
|
50
|
-
map.set(contactInfo.pubkey, contactInfo.tpu);
|
|
51
|
-
});
|
|
52
|
-
resolve(map);
|
|
53
|
-
})
|
|
54
|
-
.catch((error) => {
|
|
55
|
-
reject(error);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
fetchSlotLeaders(start_slot, slots_in_epoch) {
|
|
60
|
-
const fanout = Math.min(2 * exports.MAX_FANOUT_SLOTS, slots_in_epoch);
|
|
61
|
-
return this.connection.getSlotLeaders(start_slot, fanout);
|
|
62
|
-
}
|
|
63
|
-
lastSlot() {
|
|
64
|
-
return this.first_slot + this.leaders.length - 1;
|
|
65
|
-
}
|
|
66
|
-
getSlotLeader(slot) {
|
|
67
|
-
if (slot >= this.first_slot) {
|
|
68
|
-
const index = slot - this.first_slot;
|
|
69
|
-
return this.leaders[index];
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
getLeaderSockets(fanout_slots) {
|
|
76
|
-
return new Promise((resolve) => {
|
|
77
|
-
const leaderSet = new Set();
|
|
78
|
-
const leaderSockets = new Array();
|
|
79
|
-
let checkedSlots = 0;
|
|
80
|
-
this.leaders.forEach((leader) => {
|
|
81
|
-
const tpu_socket = this.leaderTpuMap.get(leader.toBase58());
|
|
82
|
-
if (tpu_socket !== undefined && tpu_socket !== null) {
|
|
83
|
-
if (!leaderSet.has(leader.toBase58())) {
|
|
84
|
-
leaderSet.add(leader.toBase58());
|
|
85
|
-
leaderSockets.push(tpu_socket);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
console.log("TPU not available for leader: ", leader.toBase58());
|
|
90
|
-
}
|
|
91
|
-
checkedSlots++;
|
|
92
|
-
if (checkedSlots === fanout_slots) {
|
|
93
|
-
resolve(leaderSockets);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.LeaderTpuCache = LeaderTpuCache;
|
|
100
|
-
exports.MAX_SLOT_SKIP_DISTANCE = 48;
|
|
101
|
-
exports.DEFAULT_FANOUT_SLOTS = 12;
|
|
102
|
-
exports.MAX_FANOUT_SLOTS = 100;
|
|
103
|
-
class RecentLeaderSlots {
|
|
104
|
-
//@ts-check
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
* @param current_slot {number}
|
|
108
|
-
*/
|
|
109
|
-
constructor(current_slot) {
|
|
110
|
-
this.recent_slots = new denque_1.default();
|
|
111
|
-
this.recent_slots.push(current_slot);
|
|
112
|
-
}
|
|
113
|
-
//@ts-check
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
* @param current_slot {number}
|
|
117
|
-
*/
|
|
118
|
-
recordSlot(current_slot) {
|
|
119
|
-
this.recent_slots.push(current_slot);
|
|
120
|
-
while (this.recent_slots.length > 12) {
|
|
121
|
-
this.recent_slots.pop();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//@ts-check
|
|
125
|
-
/**
|
|
126
|
-
*
|
|
127
|
-
* @returns {number}
|
|
128
|
-
*/
|
|
129
|
-
estimatedCurrentSlot() {
|
|
130
|
-
if (this.recent_slots.isEmpty()) {
|
|
131
|
-
throw new Error("recent slots is empty");
|
|
132
|
-
}
|
|
133
|
-
const sortedRecentSlots = this.recent_slots.toArray().sort((a, b) => a - b);
|
|
134
|
-
const max_index = sortedRecentSlots.length - 1;
|
|
135
|
-
const median_index = max_index / 2;
|
|
136
|
-
const median_recent_slot = sortedRecentSlots[median_index];
|
|
137
|
-
const expected_current_slot = median_recent_slot + (max_index - median_index);
|
|
138
|
-
const max_reasonable_current_slot = expected_current_slot + exports.MAX_SLOT_SKIP_DISTANCE;
|
|
139
|
-
return sortedRecentSlots
|
|
140
|
-
.reverse()
|
|
141
|
-
.find((slot) => slot <= max_reasonable_current_slot);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.RecentLeaderSlots = RecentLeaderSlots;
|
|
145
|
-
class TpuClient {
|
|
146
|
-
//@ts-check
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* @param connection {Connection}
|
|
150
|
-
* @param config {TpuClientConfig}
|
|
151
|
-
*/
|
|
152
|
-
constructor(connection, config = { fanoutSlots: exports.DEFAULT_FANOUT_SLOTS }) {
|
|
153
|
-
this.connection = connection;
|
|
154
|
-
this.exit = false;
|
|
155
|
-
this.sendSocket = dgram_1.default.createSocket("udp4");
|
|
156
|
-
this.fanoutSlots = Math.max(Math.min(config.fanoutSlots, exports.MAX_FANOUT_SLOTS), 1);
|
|
157
|
-
}
|
|
158
|
-
//@ts-check
|
|
159
|
-
/**
|
|
160
|
-
*
|
|
161
|
-
* @param connection {Connection}
|
|
162
|
-
* @param websocketUrl {string}
|
|
163
|
-
* @param config {TpuClientConfig}
|
|
164
|
-
* @returns {Promise<TpuClient>}
|
|
165
|
-
*/
|
|
166
|
-
static load(connection, websocketUrl = "", config = { fanoutSlots: exports.DEFAULT_FANOUT_SLOTS }) {
|
|
167
|
-
return new Promise((resolve) => {
|
|
168
|
-
const tpuClient = new TpuClient(connection, config);
|
|
169
|
-
LeaderTpuService.load(tpuClient.connection, websocketUrl).then((leaderTpuService) => {
|
|
170
|
-
tpuClient.leaderTpuService = leaderTpuService;
|
|
171
|
-
resolve(tpuClient);
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
//@ts-check
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
178
|
-
* @param transaction {Transaction}
|
|
179
|
-
* @param signers {Array<Signer>}
|
|
180
|
-
* @returns {Promise<string>}
|
|
181
|
-
*/
|
|
182
|
-
sendTransaction(transaction, signers) {
|
|
183
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
-
if (transaction.nonceInfo) {
|
|
185
|
-
transaction.sign(...signers);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
transaction.recentBlockhash = (yield this.connection.getRecentBlockhash()).blockhash;
|
|
189
|
-
transaction.sign(...signers);
|
|
190
|
-
}
|
|
191
|
-
const rawTransaction = transaction.serialize();
|
|
192
|
-
return this.sendRawTransaction(rawTransaction);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
//@ts-check
|
|
196
|
-
/**
|
|
197
|
-
*
|
|
198
|
-
* @param rawTransaction {Buffer | number[] | Uint8ARray}
|
|
199
|
-
* @returns {Promise<string>}
|
|
200
|
-
*/
|
|
201
|
-
sendRawTransaction(rawTransaction) {
|
|
202
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
return new Promise((resolve, reject) => {
|
|
204
|
-
this.leaderTpuService
|
|
205
|
-
.leaderTpuSockets(this.fanoutSlots)
|
|
206
|
-
.then((tpu_addresses) => {
|
|
207
|
-
tpu_addresses.forEach((tpu_address) => {
|
|
208
|
-
this.sendSocket.send(rawTransaction, parseInt(tpu_address.split(":")[1]), tpu_address.split(":")[0], (error) => {
|
|
209
|
-
if (!error) {
|
|
210
|
-
const message = web3_js_1.Transaction.from(rawTransaction);
|
|
211
|
-
resolve(bs58_1.default.encode(message.signature));
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
console.error(error);
|
|
215
|
-
reject(error);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
exports.TpuClient = TpuClient;
|
|
225
|
-
class LeaderTpuService {
|
|
226
|
-
//@ts-check
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
229
|
-
* @param connection {Connection}
|
|
230
|
-
*/
|
|
231
|
-
constructor(connection) {
|
|
232
|
-
this.connection = connection;
|
|
233
|
-
}
|
|
234
|
-
//@ts-check
|
|
235
|
-
/**
|
|
236
|
-
*
|
|
237
|
-
* @param connection {Connection}
|
|
238
|
-
* @param websocket_url {string}
|
|
239
|
-
* @returns {Promise<LeaderTpuService}
|
|
240
|
-
*/
|
|
241
|
-
static load(connection, websocket_url = "") {
|
|
242
|
-
return new Promise((resolve) => {
|
|
243
|
-
const leaderTpuService = new LeaderTpuService(connection);
|
|
244
|
-
leaderTpuService.connection.getSlot("processed").then((start_slot) => {
|
|
245
|
-
leaderTpuService.recentSlots = new RecentLeaderSlots(start_slot);
|
|
246
|
-
LeaderTpuCache.load(connection, start_slot).then((leaderTpuCache) => {
|
|
247
|
-
leaderTpuService.leaderTpuCache = leaderTpuCache;
|
|
248
|
-
if (websocket_url !== "") {
|
|
249
|
-
leaderTpuService.subscription = connection.onSlotUpdate((slotUpdate) => {
|
|
250
|
-
if (slotUpdate.type === "completed") {
|
|
251
|
-
slotUpdate.slot++;
|
|
252
|
-
}
|
|
253
|
-
leaderTpuService.recentSlots.recordSlot(slotUpdate.slot);
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
leaderTpuService.subscription = null;
|
|
258
|
-
}
|
|
259
|
-
leaderTpuService.run();
|
|
260
|
-
resolve(leaderTpuService);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
//@ts-check
|
|
266
|
-
/**
|
|
267
|
-
*
|
|
268
|
-
* @param fanout_slots {number}
|
|
269
|
-
* @returns {Promise<string[]>}
|
|
270
|
-
*/
|
|
271
|
-
leaderTpuSockets(fanout_slots) {
|
|
272
|
-
return this.leaderTpuCache.getLeaderSockets(fanout_slots);
|
|
273
|
-
}
|
|
274
|
-
//@ts-check
|
|
275
|
-
/**
|
|
276
|
-
* @returns {void}
|
|
277
|
-
*/
|
|
278
|
-
run() {
|
|
279
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
-
const last_cluster_refresh = Date.now();
|
|
281
|
-
let sleep_ms = 1000;
|
|
282
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
283
|
-
sleep_ms = 1000;
|
|
284
|
-
if (Date.now() - last_cluster_refresh > 1000 * 5 * 60) {
|
|
285
|
-
try {
|
|
286
|
-
this.leaderTpuCache.leaderTpuMap =
|
|
287
|
-
yield this.leaderTpuCache.fetchClusterTpuSockets();
|
|
288
|
-
}
|
|
289
|
-
catch (error) {
|
|
290
|
-
console.warn("Failed to fetch cluster tpu sockets", error);
|
|
291
|
-
sleep_ms = 1000;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
const estimatedCurrentSlot = this.recentSlots.estimatedCurrentSlot();
|
|
295
|
-
if (estimatedCurrentSlot >=
|
|
296
|
-
this.leaderTpuCache.last_epoch_info_slot -
|
|
297
|
-
this.leaderTpuCache.slots_in_epoch) {
|
|
298
|
-
try {
|
|
299
|
-
const epochInfo = yield this.connection.getEpochInfo("recent");
|
|
300
|
-
this.leaderTpuCache.slots_in_epoch = epochInfo.slotsInEpoch;
|
|
301
|
-
this.leaderTpuCache.last_epoch_info_slot = estimatedCurrentSlot;
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
304
|
-
console.warn("failed to get epoch info");
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (estimatedCurrentSlot >=
|
|
308
|
-
this.leaderTpuCache.lastSlot() - exports.MAX_FANOUT_SLOTS) {
|
|
309
|
-
try {
|
|
310
|
-
const slot_leaders = yield this.leaderTpuCache.fetchSlotLeaders(estimatedCurrentSlot, this.leaderTpuCache.slots_in_epoch);
|
|
311
|
-
this.leaderTpuCache.first_slot = estimatedCurrentSlot;
|
|
312
|
-
this.leaderTpuCache.leaders = slot_leaders;
|
|
313
|
-
}
|
|
314
|
-
catch (error) {
|
|
315
|
-
console.warn(`Failed to fetch slot leaders (current estimated slot: ${estimatedCurrentSlot})`, error);
|
|
316
|
-
sleep_ms = 1000;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
this.run();
|
|
320
|
-
}), sleep_ms);
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
exports.LeaderTpuService = LeaderTpuService;
|
|
325
|
-
class TpuConnection extends web3_js_1.Connection {
|
|
326
|
-
//@ts-check
|
|
327
|
-
/**
|
|
328
|
-
*
|
|
329
|
-
* @param endpoint {string}
|
|
330
|
-
* @param commitmentOrConfig {Commitment | ConnectionConfig}
|
|
331
|
-
*/
|
|
332
|
-
constructor(endpoint, commitmentOrConfig) {
|
|
333
|
-
super(endpoint, commitmentOrConfig);
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
*
|
|
337
|
-
* @param transaction {Transaction}
|
|
338
|
-
* @param signers {Array<Signer>}
|
|
339
|
-
* @returns {Promise<string>}
|
|
340
|
-
*/
|
|
341
|
-
//@ts-ignore
|
|
342
|
-
sendTransaction(transaction, signers) {
|
|
343
|
-
return this.tpuClient.sendTransaction(transaction, signers);
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
*
|
|
347
|
-
* @param rawTransaction {Buffer | Array<number> | Uint8Array}
|
|
348
|
-
* @returns {Promise<string>}
|
|
349
|
-
*/
|
|
350
|
-
//@ts-ignore
|
|
351
|
-
sendRawTransaction(rawTransaction) {
|
|
352
|
-
return this.tpuClient.sendRawTransaction(rawTransaction);
|
|
353
|
-
}
|
|
354
|
-
///@ts-check
|
|
355
|
-
/**
|
|
356
|
-
*
|
|
357
|
-
* @param connection {TpuConnection}
|
|
358
|
-
* @param transaction {Transaction}
|
|
359
|
-
* @param signers {Array<Signer>}
|
|
360
|
-
* @param options {ConfirmOptions}
|
|
361
|
-
* @returns {Promise<TransactionSignature>}
|
|
362
|
-
*/
|
|
363
|
-
sendAndConfirmTransaction(connection, transaction, signers, options) {
|
|
364
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
365
|
-
const signature = yield this.sendTransaction(transaction, signers);
|
|
366
|
-
const status = (yield connection.confirmTransaction(signature, options.commitment)).value;
|
|
367
|
-
if (status.err) {
|
|
368
|
-
throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
|
|
369
|
-
}
|
|
370
|
-
return signature;
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
//@ts-check
|
|
374
|
-
/**
|
|
375
|
-
*
|
|
376
|
-
* @param connection {TpuConnection}
|
|
377
|
-
* @param rawTransaction {Buffer | Array<number> | Uint8Array}
|
|
378
|
-
* @param options {ConfirmOptions}
|
|
379
|
-
* @returns {Promise<string>}
|
|
380
|
-
*/
|
|
381
|
-
sendAndConfirmRawTransaction(connection, rawTransaction, options) {
|
|
382
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
383
|
-
const signature = yield this.sendRawTransaction(rawTransaction);
|
|
384
|
-
const status = (yield connection.confirmTransaction(signature, options.commitment)).value;
|
|
385
|
-
if (status.err) {
|
|
386
|
-
throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
|
|
387
|
-
}
|
|
388
|
-
return signature;
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
//@ts-check
|
|
392
|
-
/**
|
|
393
|
-
*
|
|
394
|
-
* @param endpoint {string}
|
|
395
|
-
* @param commitmentOrConfig {Commitment | ConnectionConfig}
|
|
396
|
-
* @returns {Promise<TpuConnection>}
|
|
397
|
-
*/
|
|
398
|
-
static load(endpoint, commitmentOrConfig) {
|
|
399
|
-
return new Promise((resolve) => {
|
|
400
|
-
const tpuConnection = new TpuConnection(endpoint, commitmentOrConfig);
|
|
401
|
-
//@ts-ignore
|
|
402
|
-
TpuClient.load(tpuConnection).then((tpuClient) => {
|
|
403
|
-
tpuConnection.tpuClient = tpuClient;
|
|
404
|
-
resolve(tpuConnection);
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
exports.TpuConnection = TpuConnection;
|
|
410
|
-
//# sourceMappingURL=TpuClient.js.map
|
package/lib/cjs/tpuClient.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TpuClient.js","sourceRoot":"","sources":["../../src/TpuClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2GAA2G;AAC3G,6CASyB;AACzB,oDAA2C;AAC3C,kDAA0B;AAC1B,gDAAwB;AAExB,MAAa,cAAc;IAOzB,YAAoB,UAAsB,EAAE,SAAiB;QAC3D,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD,MAAM,CAAC,IAAI,CACT,UAAsB,EACtB,SAAiB;QAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACjE,cAAc,CAAC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