@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
package/lib/esm/src/tpuClient.js
DELETED
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
// Taken from https://raw.githubusercontent.com/lmvdz/tpu-client/main/src/index.ts bec of supply chain risk
|
|
2
|
-
import { Connection, Transaction, } from "@solana/web3.js";
|
|
3
|
-
import { default as Denque } from "denque";
|
|
4
|
-
import dgram from "dgram";
|
|
5
|
-
import bs58 from "bs58";
|
|
6
|
-
export class LeaderTpuCache {
|
|
7
|
-
leaderTpuMap;
|
|
8
|
-
connection;
|
|
9
|
-
first_slot;
|
|
10
|
-
slots_in_epoch;
|
|
11
|
-
last_epoch_info_slot;
|
|
12
|
-
leaders;
|
|
13
|
-
constructor(connection, startSlot) {
|
|
14
|
-
this.connection = connection;
|
|
15
|
-
this.first_slot = startSlot;
|
|
16
|
-
}
|
|
17
|
-
static load(connection, startSlot) {
|
|
18
|
-
return new Promise((resolve) => {
|
|
19
|
-
const leaderTpuCache = new LeaderTpuCache(connection, startSlot);
|
|
20
|
-
leaderTpuCache.connection.getEpochInfo().then((epochInfo) => {
|
|
21
|
-
leaderTpuCache.slots_in_epoch = epochInfo.slotsInEpoch;
|
|
22
|
-
leaderTpuCache
|
|
23
|
-
.fetchSlotLeaders(leaderTpuCache.first_slot, leaderTpuCache.slots_in_epoch)
|
|
24
|
-
.then((leaders) => {
|
|
25
|
-
leaderTpuCache.leaders = leaders;
|
|
26
|
-
leaderTpuCache.fetchClusterTpuSockets().then((leaderTpuMap) => {
|
|
27
|
-
leaderTpuCache.leaderTpuMap = leaderTpuMap;
|
|
28
|
-
resolve(leaderTpuCache);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
fetchClusterTpuSockets() {
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
const map = new Map();
|
|
37
|
-
this.connection
|
|
38
|
-
.getClusterNodes()
|
|
39
|
-
.then((contactInfo) => {
|
|
40
|
-
contactInfo.forEach((contactInfo) => {
|
|
41
|
-
map.set(contactInfo.pubkey, contactInfo.tpu);
|
|
42
|
-
});
|
|
43
|
-
resolve(map);
|
|
44
|
-
})
|
|
45
|
-
.catch((error) => {
|
|
46
|
-
reject(error);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
fetchSlotLeaders(start_slot, slots_in_epoch) {
|
|
51
|
-
const fanout = Math.min(2 * MAX_FANOUT_SLOTS, slots_in_epoch);
|
|
52
|
-
return this.connection.getSlotLeaders(start_slot, fanout);
|
|
53
|
-
}
|
|
54
|
-
lastSlot() {
|
|
55
|
-
return this.first_slot + this.leaders.length - 1;
|
|
56
|
-
}
|
|
57
|
-
getSlotLeader(slot) {
|
|
58
|
-
if (slot >= this.first_slot) {
|
|
59
|
-
const index = slot - this.first_slot;
|
|
60
|
-
return this.leaders[index];
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
getLeaderSockets(fanout_slots) {
|
|
67
|
-
return new Promise((resolve) => {
|
|
68
|
-
const leaderSet = new Set();
|
|
69
|
-
const leaderSockets = new Array();
|
|
70
|
-
let checkedSlots = 0;
|
|
71
|
-
this.leaders.forEach((leader) => {
|
|
72
|
-
const tpu_socket = this.leaderTpuMap.get(leader.toBase58());
|
|
73
|
-
if (tpu_socket !== undefined && tpu_socket !== null) {
|
|
74
|
-
if (!leaderSet.has(leader.toBase58())) {
|
|
75
|
-
leaderSet.add(leader.toBase58());
|
|
76
|
-
leaderSockets.push(tpu_socket);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
console.log("TPU not available for leader: ", leader.toBase58());
|
|
81
|
-
}
|
|
82
|
-
checkedSlots++;
|
|
83
|
-
if (checkedSlots === fanout_slots) {
|
|
84
|
-
resolve(leaderSockets);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
export const MAX_SLOT_SKIP_DISTANCE = 48;
|
|
91
|
-
export const DEFAULT_FANOUT_SLOTS = 12;
|
|
92
|
-
export const MAX_FANOUT_SLOTS = 100;
|
|
93
|
-
export class RecentLeaderSlots {
|
|
94
|
-
recent_slots;
|
|
95
|
-
//@ts-check
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @param current_slot {number}
|
|
99
|
-
*/
|
|
100
|
-
constructor(current_slot) {
|
|
101
|
-
this.recent_slots = new Denque();
|
|
102
|
-
this.recent_slots.push(current_slot);
|
|
103
|
-
}
|
|
104
|
-
//@ts-check
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
* @param current_slot {number}
|
|
108
|
-
*/
|
|
109
|
-
recordSlot(current_slot) {
|
|
110
|
-
this.recent_slots.push(current_slot);
|
|
111
|
-
while (this.recent_slots.length > 12) {
|
|
112
|
-
this.recent_slots.pop();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
//@ts-check
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
* @returns {number}
|
|
119
|
-
*/
|
|
120
|
-
estimatedCurrentSlot() {
|
|
121
|
-
if (this.recent_slots.isEmpty()) {
|
|
122
|
-
throw new Error("recent slots is empty");
|
|
123
|
-
}
|
|
124
|
-
const sortedRecentSlots = this.recent_slots.toArray().sort((a, b) => a - b);
|
|
125
|
-
const max_index = sortedRecentSlots.length - 1;
|
|
126
|
-
const median_index = max_index / 2;
|
|
127
|
-
const median_recent_slot = sortedRecentSlots[median_index];
|
|
128
|
-
const expected_current_slot = median_recent_slot + (max_index - median_index);
|
|
129
|
-
const max_reasonable_current_slot = expected_current_slot + MAX_SLOT_SKIP_DISTANCE;
|
|
130
|
-
return sortedRecentSlots
|
|
131
|
-
.reverse()
|
|
132
|
-
.find((slot) => slot <= max_reasonable_current_slot);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export class TpuClient {
|
|
136
|
-
sendSocket;
|
|
137
|
-
fanoutSlots;
|
|
138
|
-
leaderTpuService;
|
|
139
|
-
exit;
|
|
140
|
-
connection;
|
|
141
|
-
//@ts-check
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
* @param connection {Connection}
|
|
145
|
-
* @param config {TpuClientConfig}
|
|
146
|
-
*/
|
|
147
|
-
constructor(connection, config = { fanoutSlots: DEFAULT_FANOUT_SLOTS }) {
|
|
148
|
-
this.connection = connection;
|
|
149
|
-
this.exit = false;
|
|
150
|
-
this.sendSocket = dgram.createSocket("udp4");
|
|
151
|
-
this.fanoutSlots = Math.max(Math.min(config.fanoutSlots, MAX_FANOUT_SLOTS), 1);
|
|
152
|
-
}
|
|
153
|
-
//@ts-check
|
|
154
|
-
/**
|
|
155
|
-
*
|
|
156
|
-
* @param connection {Connection}
|
|
157
|
-
* @param websocketUrl {string}
|
|
158
|
-
* @param config {TpuClientConfig}
|
|
159
|
-
* @returns {Promise<TpuClient>}
|
|
160
|
-
*/
|
|
161
|
-
static load(connection, websocketUrl = "", config = { fanoutSlots: DEFAULT_FANOUT_SLOTS }) {
|
|
162
|
-
return new Promise((resolve) => {
|
|
163
|
-
const tpuClient = new TpuClient(connection, config);
|
|
164
|
-
LeaderTpuService.load(tpuClient.connection, websocketUrl).then((leaderTpuService) => {
|
|
165
|
-
tpuClient.leaderTpuService = leaderTpuService;
|
|
166
|
-
resolve(tpuClient);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
//@ts-check
|
|
171
|
-
/**
|
|
172
|
-
*
|
|
173
|
-
* @param transaction {Transaction}
|
|
174
|
-
* @param signers {Array<Signer>}
|
|
175
|
-
* @returns {Promise<string>}
|
|
176
|
-
*/
|
|
177
|
-
async sendTransaction(transaction, signers) {
|
|
178
|
-
if (transaction.nonceInfo) {
|
|
179
|
-
transaction.sign(...signers);
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
transaction.recentBlockhash = (await this.connection.getRecentBlockhash()).blockhash;
|
|
183
|
-
transaction.sign(...signers);
|
|
184
|
-
}
|
|
185
|
-
const rawTransaction = transaction.serialize();
|
|
186
|
-
return this.sendRawTransaction(rawTransaction);
|
|
187
|
-
}
|
|
188
|
-
//@ts-check
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
* @param rawTransaction {Buffer | number[] | Uint8ARray}
|
|
192
|
-
* @returns {Promise<string>}
|
|
193
|
-
*/
|
|
194
|
-
async sendRawTransaction(rawTransaction) {
|
|
195
|
-
return new Promise((resolve, reject) => {
|
|
196
|
-
this.leaderTpuService
|
|
197
|
-
.leaderTpuSockets(this.fanoutSlots)
|
|
198
|
-
.then((tpu_addresses) => {
|
|
199
|
-
tpu_addresses.forEach((tpu_address) => {
|
|
200
|
-
this.sendSocket.send(rawTransaction, parseInt(tpu_address.split(":")[1]), tpu_address.split(":")[0], (error) => {
|
|
201
|
-
if (!error) {
|
|
202
|
-
const message = Transaction.from(rawTransaction);
|
|
203
|
-
resolve(bs58.encode(message.signature));
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
console.error(error);
|
|
207
|
-
reject(error);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
export class LeaderTpuService {
|
|
216
|
-
recentSlots;
|
|
217
|
-
leaderTpuCache;
|
|
218
|
-
subscription;
|
|
219
|
-
connection;
|
|
220
|
-
//@ts-check
|
|
221
|
-
/**
|
|
222
|
-
*
|
|
223
|
-
* @param connection {Connection}
|
|
224
|
-
*/
|
|
225
|
-
constructor(connection) {
|
|
226
|
-
this.connection = connection;
|
|
227
|
-
}
|
|
228
|
-
//@ts-check
|
|
229
|
-
/**
|
|
230
|
-
*
|
|
231
|
-
* @param connection {Connection}
|
|
232
|
-
* @param websocket_url {string}
|
|
233
|
-
* @returns {Promise<LeaderTpuService}
|
|
234
|
-
*/
|
|
235
|
-
static load(connection, websocket_url = "") {
|
|
236
|
-
return new Promise((resolve) => {
|
|
237
|
-
const leaderTpuService = new LeaderTpuService(connection);
|
|
238
|
-
leaderTpuService.connection.getSlot("processed").then((start_slot) => {
|
|
239
|
-
leaderTpuService.recentSlots = new RecentLeaderSlots(start_slot);
|
|
240
|
-
LeaderTpuCache.load(connection, start_slot).then((leaderTpuCache) => {
|
|
241
|
-
leaderTpuService.leaderTpuCache = leaderTpuCache;
|
|
242
|
-
if (websocket_url !== "") {
|
|
243
|
-
leaderTpuService.subscription = connection.onSlotUpdate((slotUpdate) => {
|
|
244
|
-
if (slotUpdate.type === "completed") {
|
|
245
|
-
slotUpdate.slot++;
|
|
246
|
-
}
|
|
247
|
-
leaderTpuService.recentSlots.recordSlot(slotUpdate.slot);
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
leaderTpuService.subscription = null;
|
|
252
|
-
}
|
|
253
|
-
leaderTpuService.run();
|
|
254
|
-
resolve(leaderTpuService);
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
//@ts-check
|
|
260
|
-
/**
|
|
261
|
-
*
|
|
262
|
-
* @param fanout_slots {number}
|
|
263
|
-
* @returns {Promise<string[]>}
|
|
264
|
-
*/
|
|
265
|
-
leaderTpuSockets(fanout_slots) {
|
|
266
|
-
return this.leaderTpuCache.getLeaderSockets(fanout_slots);
|
|
267
|
-
}
|
|
268
|
-
//@ts-check
|
|
269
|
-
/**
|
|
270
|
-
* @returns {void}
|
|
271
|
-
*/
|
|
272
|
-
async run() {
|
|
273
|
-
const last_cluster_refresh = Date.now();
|
|
274
|
-
let sleep_ms = 1000;
|
|
275
|
-
setTimeout(async () => {
|
|
276
|
-
sleep_ms = 1000;
|
|
277
|
-
if (Date.now() - last_cluster_refresh > 1000 * 5 * 60) {
|
|
278
|
-
try {
|
|
279
|
-
this.leaderTpuCache.leaderTpuMap =
|
|
280
|
-
await this.leaderTpuCache.fetchClusterTpuSockets();
|
|
281
|
-
}
|
|
282
|
-
catch (error) {
|
|
283
|
-
console.warn("Failed to fetch cluster tpu sockets", error);
|
|
284
|
-
sleep_ms = 1000;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
const estimatedCurrentSlot = this.recentSlots.estimatedCurrentSlot();
|
|
288
|
-
if (estimatedCurrentSlot >=
|
|
289
|
-
this.leaderTpuCache.last_epoch_info_slot -
|
|
290
|
-
this.leaderTpuCache.slots_in_epoch) {
|
|
291
|
-
try {
|
|
292
|
-
const epochInfo = await this.connection.getEpochInfo("recent");
|
|
293
|
-
this.leaderTpuCache.slots_in_epoch = epochInfo.slotsInEpoch;
|
|
294
|
-
this.leaderTpuCache.last_epoch_info_slot = estimatedCurrentSlot;
|
|
295
|
-
}
|
|
296
|
-
catch (error) {
|
|
297
|
-
console.warn("failed to get epoch info");
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (estimatedCurrentSlot >=
|
|
301
|
-
this.leaderTpuCache.lastSlot() - MAX_FANOUT_SLOTS) {
|
|
302
|
-
try {
|
|
303
|
-
const slot_leaders = await this.leaderTpuCache.fetchSlotLeaders(estimatedCurrentSlot, this.leaderTpuCache.slots_in_epoch);
|
|
304
|
-
this.leaderTpuCache.first_slot = estimatedCurrentSlot;
|
|
305
|
-
this.leaderTpuCache.leaders = slot_leaders;
|
|
306
|
-
}
|
|
307
|
-
catch (error) {
|
|
308
|
-
console.warn(`Failed to fetch slot leaders (current estimated slot: ${estimatedCurrentSlot})`, error);
|
|
309
|
-
sleep_ms = 1000;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
this.run();
|
|
313
|
-
}, sleep_ms);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
export class TpuConnection extends Connection {
|
|
317
|
-
tpuClient;
|
|
318
|
-
//@ts-check
|
|
319
|
-
/**
|
|
320
|
-
*
|
|
321
|
-
* @param endpoint {string}
|
|
322
|
-
* @param commitmentOrConfig {Commitment | ConnectionConfig}
|
|
323
|
-
*/
|
|
324
|
-
constructor(endpoint, commitmentOrConfig) {
|
|
325
|
-
super(endpoint, commitmentOrConfig);
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
*
|
|
329
|
-
* @param transaction {Transaction}
|
|
330
|
-
* @param signers {Array<Signer>}
|
|
331
|
-
* @returns {Promise<string>}
|
|
332
|
-
*/
|
|
333
|
-
//@ts-ignore
|
|
334
|
-
sendTransaction(transaction, signers) {
|
|
335
|
-
return this.tpuClient.sendTransaction(transaction, signers);
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
*
|
|
339
|
-
* @param rawTransaction {Buffer | Array<number> | Uint8Array}
|
|
340
|
-
* @returns {Promise<string>}
|
|
341
|
-
*/
|
|
342
|
-
//@ts-ignore
|
|
343
|
-
sendRawTransaction(rawTransaction) {
|
|
344
|
-
return this.tpuClient.sendRawTransaction(rawTransaction);
|
|
345
|
-
}
|
|
346
|
-
///@ts-check
|
|
347
|
-
/**
|
|
348
|
-
*
|
|
349
|
-
* @param connection {TpuConnection}
|
|
350
|
-
* @param transaction {Transaction}
|
|
351
|
-
* @param signers {Array<Signer>}
|
|
352
|
-
* @param options {ConfirmOptions}
|
|
353
|
-
* @returns {Promise<TransactionSignature>}
|
|
354
|
-
*/
|
|
355
|
-
async sendAndConfirmTransaction(connection, transaction, signers, options) {
|
|
356
|
-
const signature = await this.sendTransaction(transaction, signers);
|
|
357
|
-
const status = (await connection.confirmTransaction(signature, options.commitment)).value;
|
|
358
|
-
if (status.err) {
|
|
359
|
-
throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
|
|
360
|
-
}
|
|
361
|
-
return signature;
|
|
362
|
-
}
|
|
363
|
-
//@ts-check
|
|
364
|
-
/**
|
|
365
|
-
*
|
|
366
|
-
* @param connection {TpuConnection}
|
|
367
|
-
* @param rawTransaction {Buffer | Array<number> | Uint8Array}
|
|
368
|
-
* @param options {ConfirmOptions}
|
|
369
|
-
* @returns {Promise<string>}
|
|
370
|
-
*/
|
|
371
|
-
async sendAndConfirmRawTransaction(connection, rawTransaction, options) {
|
|
372
|
-
const signature = await this.sendRawTransaction(rawTransaction);
|
|
373
|
-
const status = (await connection.confirmTransaction(signature, options.commitment)).value;
|
|
374
|
-
if (status.err) {
|
|
375
|
-
throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
|
|
376
|
-
}
|
|
377
|
-
return signature;
|
|
378
|
-
}
|
|
379
|
-
//@ts-check
|
|
380
|
-
/**
|
|
381
|
-
*
|
|
382
|
-
* @param endpoint {string}
|
|
383
|
-
* @param commitmentOrConfig {Commitment | ConnectionConfig}
|
|
384
|
-
* @returns {Promise<TpuConnection>}
|
|
385
|
-
*/
|
|
386
|
-
static load(endpoint, commitmentOrConfig) {
|
|
387
|
-
return new Promise((resolve) => {
|
|
388
|
-
const tpuConnection = new TpuConnection(endpoint, commitmentOrConfig);
|
|
389
|
-
//@ts-ignore
|
|
390
|
-
TpuClient.load(tpuConnection).then((tpuClient) => {
|
|
391
|
-
tpuConnection.tpuClient = tpuClient;
|
|
392
|
-
resolve(tpuConnection);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
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,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAC9D,CAAC;SACH;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,WAAW;IACX;;;;;;OAMG;IACH,KAAK,CAAC,4BAA4B,CAChC,UAAyB,EACzB,cAAmD,EACnD,OAAwB;QAExB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,CACb,MAAM,UAAU,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,CACnE,CAAC,KAAK,CAAC;QACR,IAAI,MAAM,CAAC,GAAG,EAAE;YACd,MAAM,IAAI,KAAK,CACb,eAAe,SAAS,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAC9D,CAAC;SACH;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,WAAW;IACX;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CACT,QAAgB,EAChB,kBAAkD;QAElD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;YACtE,YAAY;YACZ,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;gBAC/C,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;gBACpC,OAAO,CAAC,aAAa,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { Commitment, ConfirmOptions, Connection, ConnectionConfig, PublicKey, Signer, Transaction, TransactionSignature } from "@solana/web3.js";
|
|
4
|
-
import { default as Denque } from "denque";
|
|
5
|
-
import dgram from "dgram";
|
|
6
|
-
export declare class LeaderTpuCache {
|
|
7
|
-
leaderTpuMap: Map<string, string>;
|
|
8
|
-
connection: Connection;
|
|
9
|
-
first_slot: number;
|
|
10
|
-
slots_in_epoch: number;
|
|
11
|
-
last_epoch_info_slot: number;
|
|
12
|
-
leaders: Array<PublicKey>;
|
|
13
|
-
private constructor();
|
|
14
|
-
static load(connection: Connection, startSlot: number): Promise<LeaderTpuCache>;
|
|
15
|
-
fetchClusterTpuSockets(): Promise<Map<string, string>>;
|
|
16
|
-
fetchSlotLeaders(start_slot: number, slots_in_epoch: number): Promise<Array<PublicKey>>;
|
|
17
|
-
lastSlot(): number;
|
|
18
|
-
getSlotLeader(slot: number): PublicKey | null;
|
|
19
|
-
getLeaderSockets(fanout_slots: number): Promise<Array<string>>;
|
|
20
|
-
}
|
|
21
|
-
export declare const MAX_SLOT_SKIP_DISTANCE = 48;
|
|
22
|
-
export declare const DEFAULT_FANOUT_SLOTS = 12;
|
|
23
|
-
export declare const MAX_FANOUT_SLOTS = 100;
|
|
24
|
-
export declare class RecentLeaderSlots {
|
|
25
|
-
recent_slots: Denque;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param current_slot {number}
|
|
29
|
-
*/
|
|
30
|
-
constructor(current_slot: number);
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @param current_slot {number}
|
|
34
|
-
*/
|
|
35
|
-
recordSlot(current_slot: number): void;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @returns {number}
|
|
39
|
-
*/
|
|
40
|
-
estimatedCurrentSlot(): number;
|
|
41
|
-
}
|
|
42
|
-
export interface TpuClientConfig {
|
|
43
|
-
fanoutSlots: number;
|
|
44
|
-
}
|
|
45
|
-
export declare class TpuClient {
|
|
46
|
-
sendSocket: dgram.Socket;
|
|
47
|
-
fanoutSlots: number;
|
|
48
|
-
leaderTpuService: LeaderTpuService;
|
|
49
|
-
exit: boolean;
|
|
50
|
-
connection: Connection;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param connection {Connection}
|
|
54
|
-
* @param config {TpuClientConfig}
|
|
55
|
-
*/
|
|
56
|
-
private constructor();
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
* @param connection {Connection}
|
|
60
|
-
* @param websocketUrl {string}
|
|
61
|
-
* @param config {TpuClientConfig}
|
|
62
|
-
* @returns {Promise<TpuClient>}
|
|
63
|
-
*/
|
|
64
|
-
static load(connection: Connection, websocketUrl?: string, config?: TpuClientConfig): Promise<TpuClient>;
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param transaction {Transaction}
|
|
68
|
-
* @param signers {Array<Signer>}
|
|
69
|
-
* @returns {Promise<string>}
|
|
70
|
-
*/
|
|
71
|
-
sendTransaction(transaction: Transaction, signers: Array<Signer>): Promise<string>;
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @param rawTransaction {Buffer | number[] | Uint8ARray}
|
|
75
|
-
* @returns {Promise<string>}
|
|
76
|
-
*/
|
|
77
|
-
sendRawTransaction(rawTransaction: Buffer | number[] | Uint8Array): Promise<string>;
|
|
78
|
-
}
|
|
79
|
-
export declare class LeaderTpuService {
|
|
80
|
-
recentSlots: RecentLeaderSlots;
|
|
81
|
-
leaderTpuCache: LeaderTpuCache;
|
|
82
|
-
subscription: number | null;
|
|
83
|
-
connection: Connection;
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* @param connection {Connection}
|
|
87
|
-
*/
|
|
88
|
-
private constructor();
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param connection {Connection}
|
|
92
|
-
* @param websocket_url {string}
|
|
93
|
-
* @returns {Promise<LeaderTpuService}
|
|
94
|
-
*/
|
|
95
|
-
static load(connection: Connection, websocket_url?: string): Promise<LeaderTpuService>;
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @param fanout_slots {number}
|
|
99
|
-
* @returns {Promise<string[]>}
|
|
100
|
-
*/
|
|
101
|
-
leaderTpuSockets(fanout_slots: number): Promise<string[]>;
|
|
102
|
-
/**
|
|
103
|
-
* @returns {void}
|
|
104
|
-
*/
|
|
105
|
-
run(): Promise<void>;
|
|
106
|
-
}
|
|
107
|
-
export declare class TpuConnection extends Connection {
|
|
108
|
-
tpuClient: TpuClient;
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @param endpoint {string}
|
|
112
|
-
* @param commitmentOrConfig {Commitment | ConnectionConfig}
|
|
113
|
-
*/
|
|
114
|
-
private constructor();
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
* @param transaction {Transaction}
|
|
118
|
-
* @param signers {Array<Signer>}
|
|
119
|
-
* @returns {Promise<string>}
|
|
120
|
-
*/
|
|
121
|
-
sendTransaction(transaction: Transaction, signers: Array<Signer>): Promise<string>;
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
* @param rawTransaction {Buffer | Array<number> | Uint8Array}
|
|
125
|
-
* @returns {Promise<string>}
|
|
126
|
-
*/
|
|
127
|
-
sendRawTransaction(rawTransaction: Buffer | Array<number> | Uint8Array): Promise<string>;
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
* @param connection {TpuConnection}
|
|
131
|
-
* @param transaction {Transaction}
|
|
132
|
-
* @param signers {Array<Signer>}
|
|
133
|
-
* @param options {ConfirmOptions}
|
|
134
|
-
* @returns {Promise<TransactionSignature>}
|
|
135
|
-
*/
|
|
136
|
-
sendAndConfirmTransaction(connection: TpuConnection, transaction: Transaction, signers: Array<Signer>, options?: ConfirmOptions): Promise<TransactionSignature>;
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
* @param connection {TpuConnection}
|
|
140
|
-
* @param rawTransaction {Buffer | Array<number> | Uint8Array}
|
|
141
|
-
* @param options {ConfirmOptions}
|
|
142
|
-
* @returns {Promise<string>}
|
|
143
|
-
*/
|
|
144
|
-
sendAndConfirmRawTransaction(connection: TpuConnection, rawTransaction: Buffer | Array<number> | Uint8Array, options?: ConfirmOptions): Promise<string>;
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @param endpoint {string}
|
|
148
|
-
* @param commitmentOrConfig {Commitment | ConnectionConfig}
|
|
149
|
-
* @returns {Promise<TpuConnection>}
|
|
150
|
-
*/
|
|
151
|
-
static load(endpoint: string, commitmentOrConfig?: Commitment | ConnectionConfig): Promise<TpuConnection>;
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=TpuClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TpuClient.d.ts","sourceRoot":"","sources":["../../../src/TpuClient.ts"],"names":[],"mappings":";;AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,WAAW,EACX,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,qBAAa,cAAc;IACzB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,OAAO;IAIP,MAAM,CAAC,IAAI,CACT,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAoB1B,sBAAsB,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAgBtD,gBAAgB,CACd,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAI5B,QAAQ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