@clonegod/ttd-sol-common 1.2.1 → 2.0.1

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.
Files changed (101) hide show
  1. package/dist/index.d.ts +0 -6
  2. package/dist/index.js +0 -6
  3. package/dist/quote/index.d.ts +1 -3
  4. package/dist/quote/index.js +1 -3
  5. package/dist/quote/pricing/index.d.ts +1 -0
  6. package/dist/{helius_sdk_v1.4.0/utils → quote/pricing}/index.js +1 -1
  7. package/dist/quote/pricing/token_price_cache.d.ts +9 -0
  8. package/dist/quote/pricing/token_price_cache.js +39 -0
  9. package/package.json +2 -3
  10. package/src/index.ts +1 -0
  11. package/src/quote/index.ts +1 -0
  12. package/src/quote/pricing/index.ts +1 -0
  13. package/src/quote/pricing/token_price_cache.ts +48 -0
  14. package/tsconfig.json +22 -0
  15. package/dist/appconfig/app_config.d.ts +0 -23
  16. package/dist/appconfig/app_config.js +0 -134
  17. package/dist/appconfig/env_args.d.ts +0 -27
  18. package/dist/appconfig/env_args.js +0 -39
  19. package/dist/appconfig/index.d.ts +0 -2
  20. package/dist/appconfig/index.js +0 -18
  21. package/dist/common/constants.d.ts +0 -12
  22. package/dist/common/constants.js +0 -18
  23. package/dist/common/context.d.ts +0 -23
  24. package/dist/common/context.js +0 -51
  25. package/dist/common/index.d.ts +0 -2
  26. package/dist/common/index.js +0 -18
  27. package/dist/helius_geyser_ws/index.d.ts +0 -3
  28. package/dist/helius_geyser_ws/index.js +0 -19
  29. package/dist/helius_geyser_ws/subscribe_pool_change_by_geyser.d.ts +0 -3
  30. package/dist/helius_geyser_ws/subscribe_pool_change_by_geyser.js +0 -102
  31. package/dist/helius_geyser_ws/subscribe_txid.d.ts +0 -2
  32. package/dist/helius_geyser_ws/subscribe_txid.js +0 -109
  33. package/dist/helius_geyser_ws/subscribe_wallet_transaction.d.ts +0 -2
  34. package/dist/helius_geyser_ws/subscribe_wallet_transaction.js +0 -102
  35. package/dist/helius_sdk_v1.4.0/Helius.d.ts +0 -31
  36. package/dist/helius_sdk_v1.4.0/Helius.js +0 -450
  37. package/dist/helius_sdk_v1.4.0/RpcClient.d.ts +0 -70
  38. package/dist/helius_sdk_v1.4.0/RpcClient.js +0 -978
  39. package/dist/helius_sdk_v1.4.0/constants.d.ts +0 -1
  40. package/dist/helius_sdk_v1.4.0/constants.js +0 -4
  41. package/dist/helius_sdk_v1.4.0/index.d.ts +0 -5
  42. package/dist/helius_sdk_v1.4.0/index.js +0 -21
  43. package/dist/helius_sdk_v1.4.0/types/das-types.d.ts +0 -408
  44. package/dist/helius_sdk_v1.4.0/types/das-types.js +0 -2
  45. package/dist/helius_sdk_v1.4.0/types/enums.d.ts +0 -542
  46. package/dist/helius_sdk_v1.4.0/types/enums.js +0 -606
  47. package/dist/helius_sdk_v1.4.0/types/index.d.ts +0 -3
  48. package/dist/helius_sdk_v1.4.0/types/index.js +0 -19
  49. package/dist/helius_sdk_v1.4.0/types/types.d.ts +0 -305
  50. package/dist/helius_sdk_v1.4.0/types/types.js +0 -2
  51. package/dist/helius_sdk_v1.4.0/utils/get-helius-endpoints.d.ts +0 -2
  52. package/dist/helius_sdk_v1.4.0/utils/get-helius-endpoints.js +0 -19
  53. package/dist/helius_sdk_v1.4.0/utils/index.d.ts +0 -1
  54. package/dist/helius_sdk_v1.4.0/utils/mintApi.d.ts +0 -2
  55. package/dist/helius_sdk_v1.4.0/utils/mintApi.js +0 -14
  56. package/dist/jito/index.d.ts +0 -14
  57. package/dist/jito/index.js +0 -142
  58. package/dist/jito/jitodontfront.d.ts +0 -5
  59. package/dist/jito/jitodontfront.js +0 -41
  60. package/dist/quote/log_quote_price.d.ts +0 -2
  61. package/dist/quote/log_quote_price.js +0 -29
  62. package/dist/quote/publish_quote_price.d.ts +0 -3
  63. package/dist/quote/publish_quote_price.js +0 -19
  64. package/dist/quote/to_price_message.d.ts +0 -5
  65. package/dist/quote/to_price_message.js +0 -103
  66. package/dist/send_tx/get_jito_tip_floor.d.ts +0 -1
  67. package/dist/send_tx/get_jito_tip_floor.js +0 -86
  68. package/dist/send_tx/get_signature.d.ts +0 -2
  69. package/dist/send_tx/get_signature.js +0 -17
  70. package/dist/send_tx/helius_client.d.ts +0 -16
  71. package/dist/send_tx/helius_client.js +0 -119
  72. package/dist/send_tx/index.d.ts +0 -4
  73. package/dist/send_tx/index.js +0 -20
  74. package/dist/send_tx/notify_new_txid.d.ts +0 -1
  75. package/dist/send_tx/notify_new_txid.js +0 -20
  76. package/dist/send_tx/sol_gas_cache.d.ts +0 -3
  77. package/dist/send_tx/sol_gas_cache.js +0 -15
  78. package/dist/send_tx/strategy_util.d.ts +0 -7
  79. package/dist/send_tx/strategy_util.js +0 -147
  80. package/dist/token/get_token_info.d.ts +0 -4
  81. package/dist/token/get_token_info.js +0 -136
  82. package/dist/token/get_token_price.d.ts +0 -6
  83. package/dist/token/get_token_price.js +0 -186
  84. package/dist/token/index.d.ts +0 -4
  85. package/dist/token/index.js +0 -20
  86. package/dist/token/types.d.ts +0 -17
  87. package/dist/token/types.js +0 -2
  88. package/dist/token/util.d.ts +0 -3
  89. package/dist/token/util.js +0 -33
  90. package/dist/trade/abstract_trade.d.ts +0 -5
  91. package/dist/trade/abstract_trade.js +0 -6
  92. package/dist/trade/handle_order_message.d.ts +0 -4
  93. package/dist/trade/handle_order_message.js +0 -118
  94. package/dist/trade/index.d.ts +0 -4
  95. package/dist/trade/index.js +0 -20
  96. package/dist/trade/tx_result_check.d.ts +0 -29
  97. package/dist/trade/tx_result_check.js +0 -232
  98. package/dist/trade/tx_result_parse.d.ts +0 -13
  99. package/dist/trade/tx_result_parse.js +0 -150
  100. package/grpc/transaction/LThcUp2D5p4JgRMnWEUVVSdNEHiq5YfN5HXPGRYeWBfypMT3aTa1CaC9XdPT69CyMdoJ32XAkjXAa2TmBYBeZAy.json +0 -1
  101. package/types/index.d.ts +0 -71
@@ -1,978 +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.RpcClient = void 0;
16
- const web3_js_1 = require("@solana/web3.js");
17
- const bs58_1 = __importDefault(require("bs58"));
18
- const axios_1 = __importDefault(require("axios"));
19
- const types_1 = require("./types");
20
- const get_signature_1 = require("../send_tx/get_signature");
21
- const dist_1 = require("@clonegod/ttd-core/dist");
22
- const common_1 = require("../common");
23
- const jito_1 = require("../jito");
24
- const jitodontfront_1 = require("../jito/jitodontfront");
25
- class RpcClient {
26
- constructor(connection, id) {
27
- this.connection = connection;
28
- this.id = id;
29
- this.jitoClient = new jito_1.JitoJsonRpcClient('https://mainnet.block-engine.jito.wtf/api/v1', undefined);
30
- }
31
- airdrop(publicKey, lamports, commitment) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const signature = yield this.connection.requestAirdrop(publicKey, lamports);
34
- const blockhashWithExpiryBlockHeight = yield this.getLatestBlockhash();
35
- const confirmResponse = yield this.connection.confirmTransaction(Object.assign({ signature }, blockhashWithExpiryBlockHeight), commitment);
36
- return Object.assign({ signature, confirmResponse }, blockhashWithExpiryBlockHeight);
37
- });
38
- }
39
- getLatestBlockhash() {
40
- return __awaiter(this, arguments, void 0, function* (commitmentOrConfig = 'finalized') {
41
- return this.connection.getLatestBlockhash(commitmentOrConfig);
42
- });
43
- }
44
- getCurrentTPS() {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- var _a, _b;
47
- try {
48
- const samples = yield this.connection.getRecentPerformanceSamples(1);
49
- return ((_a = samples[0]) === null || _a === void 0 ? void 0 : _a.numTransactions) / ((_b = samples[0]) === null || _b === void 0 ? void 0 : _b.samplePeriodSecs);
50
- }
51
- catch (e) {
52
- throw new Error(`error calling getCurrentTPS: ${e}`);
53
- }
54
- });
55
- }
56
- getStakeAccounts(wallet) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- try {
59
- return this.connection.getParsedProgramAccounts(new web3_js_1.PublicKey('Stake11111111111111111111111111111111111111'), {
60
- filters: [
61
- {
62
- dataSize: 200,
63
- },
64
- {
65
- memcmp: {
66
- offset: 44,
67
- bytes: wallet,
68
- },
69
- },
70
- ],
71
- });
72
- }
73
- catch (e) {
74
- throw new Error(`error calling getStakeAccounts: ${e}`);
75
- }
76
- });
77
- }
78
- getTokenHolders(mintAddress) {
79
- try {
80
- return this.connection.getParsedProgramAccounts(new web3_js_1.PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'), {
81
- filters: [
82
- {
83
- dataSize: 165,
84
- },
85
- {
86
- memcmp: {
87
- offset: 0,
88
- bytes: mintAddress,
89
- },
90
- },
91
- ],
92
- });
93
- }
94
- catch (e) {
95
- throw new Error(`error calling getTokenHolders: ${e}`);
96
- }
97
- }
98
- getAsset(params) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- try {
101
- const url = `${this.connection.rpcEndpoint}`;
102
- const response = yield axios_1.default.post(url, {
103
- jsonrpc: '2.0',
104
- id: this.id,
105
- method: 'getAsset',
106
- params,
107
- }, {
108
- headers: {
109
- 'Content-Type': 'application/json',
110
- },
111
- });
112
- const { result } = response.data;
113
- return result;
114
- }
115
- catch (error) {
116
- throw new Error(`Error in getAsset: ${error}`);
117
- }
118
- });
119
- }
120
- getRwaAsset(params) {
121
- return __awaiter(this, void 0, void 0, function* () {
122
- try {
123
- const url = `${this.connection.rpcEndpoint}`;
124
- const response = yield axios_1.default.post(url, {
125
- jsonrpc: '2.0',
126
- id: this.id,
127
- method: 'getRwaAccountsByMint',
128
- params,
129
- }, {
130
- headers: {
131
- 'Content-Type': 'application/json',
132
- },
133
- });
134
- const { result } = response.data;
135
- return result;
136
- }
137
- catch (error) {
138
- throw new Error(`Error in getRwaAsset: ${error}`);
139
- }
140
- });
141
- }
142
- getAssetBatch(params) {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- try {
145
- const url = `${this.connection.rpcEndpoint}`;
146
- const response = yield axios_1.default.post(url, {
147
- jsonrpc: '2.0',
148
- id: this.id,
149
- method: 'getAssetBatch',
150
- params,
151
- });
152
- return response.data.result;
153
- }
154
- catch (error) {
155
- throw new Error(`Error in getAssetBatch: ${error}`);
156
- }
157
- });
158
- }
159
- getAssetProof(params) {
160
- return __awaiter(this, void 0, void 0, function* () {
161
- try {
162
- const url = `${this.connection.rpcEndpoint}`;
163
- const response = yield axios_1.default.post(url, {
164
- jsonrpc: '2.0',
165
- id: this.id,
166
- method: 'getAssetProof',
167
- params,
168
- });
169
- const { data } = response;
170
- return data.result;
171
- }
172
- catch (error) {
173
- throw new Error(`Error in getAssetProof: ${error}`);
174
- }
175
- });
176
- }
177
- getAssetsByGroup(params) {
178
- return __awaiter(this, void 0, void 0, function* () {
179
- try {
180
- const url = `${this.connection.rpcEndpoint}`;
181
- const response = yield axios_1.default.post(url, {
182
- jsonrpc: '2.0',
183
- id: this.id,
184
- method: 'getAssetsByGroup',
185
- params,
186
- });
187
- const { data } = response;
188
- return data.result;
189
- }
190
- catch (error) {
191
- throw new Error(`Error in getAssetsByGroup: ${error}`);
192
- }
193
- });
194
- }
195
- getAssetsByOwner(params) {
196
- return __awaiter(this, void 0, void 0, function* () {
197
- try {
198
- const url = `${this.connection.rpcEndpoint}`;
199
- const response = yield axios_1.default.post(url, {
200
- jsonrpc: '2.0',
201
- id: this.id,
202
- method: 'getAssetsByOwner',
203
- params,
204
- });
205
- const { data } = response;
206
- return data.result;
207
- }
208
- catch (error) {
209
- throw new Error(`Error in getAssetsByOwner: ${error}`);
210
- }
211
- });
212
- }
213
- getAssetsByCreator(params) {
214
- return __awaiter(this, void 0, void 0, function* () {
215
- try {
216
- const url = `${this.connection.rpcEndpoint}`;
217
- const response = yield axios_1.default.post(url, {
218
- jsonrpc: '2.0',
219
- id: this.id,
220
- method: 'getAssetsByCreator',
221
- params,
222
- });
223
- const { data } = response;
224
- return data.result;
225
- }
226
- catch (error) {
227
- throw new Error(`Error in getAssetsByCreator: ${error}`);
228
- }
229
- });
230
- }
231
- getAssetsByAuthority(params) {
232
- return __awaiter(this, void 0, void 0, function* () {
233
- try {
234
- const url = `${this.connection.rpcEndpoint}`;
235
- const response = yield axios_1.default.post(url, {
236
- jsonrpc: '2.0',
237
- id: this.id,
238
- method: 'getAssetsByAuthority',
239
- params,
240
- });
241
- const { data } = response;
242
- return data.result;
243
- }
244
- catch (error) {
245
- throw new Error(`Error in getAssetsByAuthority: ${error}`);
246
- }
247
- });
248
- }
249
- searchAssets(params) {
250
- return __awaiter(this, void 0, void 0, function* () {
251
- try {
252
- const url = `${this.connection.rpcEndpoint}`;
253
- const response = yield axios_1.default.post(url, {
254
- jsonrpc: '2.0',
255
- id: this.id,
256
- method: 'searchAssets',
257
- params,
258
- });
259
- const { data } = response;
260
- return data.result;
261
- }
262
- catch (error) {
263
- throw new Error(`Error in searchAssets: ${error}`);
264
- }
265
- });
266
- }
267
- getSignaturesForAsset(params) {
268
- return __awaiter(this, void 0, void 0, function* () {
269
- try {
270
- const url = `${this.connection.rpcEndpoint}`;
271
- const response = yield axios_1.default.post(url, {
272
- jsonrpc: '2.0',
273
- id: this.id,
274
- method: 'getSignaturesForAsset',
275
- params,
276
- });
277
- const { data } = response;
278
- return data.result;
279
- }
280
- catch (error) {
281
- throw new Error(`Error in getSignaturesForAsset: ${error}`);
282
- }
283
- });
284
- }
285
- getPriorityFeeEstimate(params) {
286
- return __awaiter(this, void 0, void 0, function* () {
287
- try {
288
- const url = `${this.connection.rpcEndpoint}`;
289
- const response = yield axios_1.default.post(url, {
290
- jsonrpc: '2.0',
291
- id: this.id,
292
- method: 'getPriorityFeeEstimate',
293
- params: [params],
294
- }, {
295
- headers: { 'Content-Type': 'application/json' },
296
- });
297
- if (response.data.error) {
298
- throw new Error(`Error fetching priority fee estimate: ${JSON.stringify(response.data.error, null, 2)}`);
299
- }
300
- return response.data.result;
301
- }
302
- catch (error) {
303
- if (axios_1.default.isAxiosError(error) && error.response) {
304
- throw new Error(`Error fetching priority fee estimate: ${JSON.stringify(error.response.data, null, 2)}`);
305
- }
306
- throw new Error(`Error fetching priority fee estimate: ${error}`);
307
- }
308
- });
309
- }
310
- getComputeUnits(instructions, payer, lookupTables, signers) {
311
- return __awaiter(this, void 0, void 0, function* () {
312
- const testInstructions = [
313
- web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 1400000 }),
314
- ...instructions,
315
- ];
316
- const testTransaction = new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
317
- instructions: testInstructions,
318
- payerKey: payer,
319
- recentBlockhash: (yield this.connection.getLatestBlockhash()).blockhash,
320
- }).compileToV0Message(lookupTables));
321
- if (signers) {
322
- testTransaction.sign(signers);
323
- }
324
- const rpcResponse = yield this.connection.simulateTransaction(testTransaction, {
325
- sigVerify: !!signers,
326
- });
327
- if (rpcResponse.value.err) {
328
- console.error(`Simulation error: ${JSON.stringify(rpcResponse.value.err, null, 2)}`);
329
- return null;
330
- }
331
- return rpcResponse.value.unitsConsumed || null;
332
- });
333
- }
334
- pollTransactionConfirmation(txtSig_1) {
335
- return __awaiter(this, arguments, void 0, function* (txtSig, pollOptions = {
336
- confirmationStatuses: ["confirmed", "finalized"],
337
- timeout: 15000,
338
- interval: 5000
339
- }) {
340
- let elapsed = 0;
341
- return new Promise((resolve, reject) => {
342
- const intervalId = setInterval(() => __awaiter(this, void 0, void 0, function* () {
343
- var _a, _b, _c;
344
- elapsed += pollOptions.interval;
345
- if (elapsed >= pollOptions.timeout) {
346
- clearInterval(intervalId);
347
- reject(new Error(`Transaction ${txtSig}'s confirmation timed out`));
348
- }
349
- const status = yield this.connection.getSignatureStatus(txtSig);
350
- if (((_a = status === null || status === void 0 ? void 0 : status.value) === null || _a === void 0 ? void 0 : _a.confirmationStatus) && ((_b = pollOptions.confirmationStatuses) === null || _b === void 0 ? void 0 : _b.includes((_c = status === null || status === void 0 ? void 0 : status.value) === null || _c === void 0 ? void 0 : _c.confirmationStatus))) {
351
- clearInterval(intervalId);
352
- resolve(txtSig);
353
- }
354
- }), pollOptions.interval);
355
- });
356
- });
357
- }
358
- createSmartTransaction(solana_trade_runtime_1, instructions_1, signers_1) {
359
- return __awaiter(this, arguments, void 0, function* (solana_trade_runtime, instructions, signers, lookupTables = [], feePayer, serializeOptions = {
360
- requireAllSignatures: true,
361
- verifySignatures: true,
362
- }) {
363
- if (!signers.length) {
364
- throw new Error('The transaction must have at least one signer');
365
- }
366
- const existingComputeBudgetInstructions = instructions.filter((instruction) => instruction.programId.equals(web3_js_1.ComputeBudgetProgram.programId));
367
- if (existingComputeBudgetInstructions.length > 0) {
368
- throw new Error('Cannot provide instructions that set the compute unit price and/or limit');
369
- }
370
- (0, dist_1.log_info)(`>>> getLatestBlockhashAndContext, start`);
371
- const payerKey = feePayer ? feePayer.publicKey : signers[0].publicKey;
372
- let { context: { slot: minContextSlot }, value: blockhash, } = yield this.get_last_blockhash_slot([solana_trade_runtime.connection, this.connection]);
373
- let block_offset = solana_trade_runtime.settings.strategy.block_offset;
374
- if (!isNaN(block_offset) && block_offset > 0) {
375
- let blockhash_by_slot_offset = yield this.getBlockhashBySlotOffset(block_offset);
376
- (0, dist_1.log_info)(`>>> getBlockhashBySlotOffset`, {
377
- block_offset,
378
- pre: {
379
- minContextSlot,
380
- blockhash,
381
- },
382
- new: {
383
- minContextSlot: blockhash_by_slot_offset.context.slot,
384
- blockhash: blockhash_by_slot_offset.value.blockhash,
385
- }
386
- });
387
- blockhash = blockhash_by_slot_offset.value;
388
- minContextSlot = blockhash_by_slot_offset.context.slot;
389
- }
390
- (0, dist_1.log_info)(`>>> getLatestBlockhashAndContext, end`);
391
- const recentBlockhash = blockhash.blockhash;
392
- const isVersioned = lookupTables.length > 0;
393
- let legacyTransaction = null;
394
- let versionedTransaction = null;
395
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
396
- if (Math.random() > -1)
397
- return;
398
- if (isVersioned) {
399
- const v0Message = new web3_js_1.TransactionMessage({
400
- instructions,
401
- payerKey,
402
- recentBlockhash,
403
- }).compileToV0Message(lookupTables);
404
- versionedTransaction = new web3_js_1.VersionedTransaction(v0Message);
405
- const allSigners = feePayer ? [...signers, feePayer] : signers;
406
- versionedTransaction.sign(allSigners);
407
- }
408
- else {
409
- legacyTransaction = new web3_js_1.Transaction().add(...instructions);
410
- legacyTransaction.recentBlockhash = recentBlockhash;
411
- legacyTransaction.feePayer = payerKey;
412
- for (const signer of signers) {
413
- legacyTransaction.partialSign(signer);
414
- }
415
- if (feePayer) {
416
- legacyTransaction.partialSign(feePayer);
417
- }
418
- }
419
- const serializedTransaction = bs58_1.default.encode(isVersioned
420
- ? versionedTransaction.serialize()
421
- : legacyTransaction.serialize(serializeOptions));
422
- (0, dist_1.log_info)(`>>> getPriorityFeeEstimate, start`);
423
- const priorityFeeEstimateResponse = yield this.getPriorityFeeEstimate({
424
- transaction: serializedTransaction,
425
- options: {
426
- recommended: true,
427
- },
428
- });
429
- const { priorityFeeEstimate } = priorityFeeEstimateResponse;
430
- (0, dist_1.log_info)(`>>> getPriorityFeeEstimate, end. priorityFeeEstimate=${priorityFeeEstimate}`);
431
- if (!priorityFeeEstimate) {
432
- throw new Error('Priority fee estimate not available');
433
- }
434
- }), 0);
435
- let priorityFeeEstimate = solana_trade_runtime.cu_price;
436
- if (solana_trade_runtime.settings.strategy.broadcast_type === 'jito') {
437
- priorityFeeEstimate = 1;
438
- }
439
- const computeBudgetIx = web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
440
- microLamports: priorityFeeEstimate,
441
- });
442
- instructions.unshift(computeBudgetIx);
443
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
444
- if (Math.random() > -1)
445
- return;
446
- (0, dist_1.log_info)(`>>> getComputeUnits, start`);
447
- const units = yield this.getComputeUnits(instructions, payerKey, isVersioned ? lookupTables : [], signers);
448
- (0, dist_1.log_info)(`>>> getComputeUnits, end. ComputeUnits=${units}`);
449
- if (!units) {
450
- throw new Error(`Error fetching compute units for the instructions provided`);
451
- }
452
- }), 0);
453
- const customersCU = Math.ceil(solana_trade_runtime.cu_limit);
454
- const jitodontfrontPubkey = process.env.JITODONTFRONT_PUBKEY || 'jitodontfront111111111111111111111111111111';
455
- const computeUnitsIx = (0, jitodontfront_1.createCustomComputeBudgetInstructionWithJitoDontFront)(new web3_js_1.PublicKey(jitodontfrontPubkey), customersCU);
456
- instructions.unshift(computeUnitsIx);
457
- if (isVersioned) {
458
- const v0Message = new web3_js_1.TransactionMessage({
459
- instructions,
460
- payerKey,
461
- recentBlockhash,
462
- }).compileToV0Message(lookupTables);
463
- versionedTransaction = new web3_js_1.VersionedTransaction(v0Message);
464
- const allSigners = feePayer ? [...signers, feePayer] : signers;
465
- versionedTransaction.sign(allSigners);
466
- return {
467
- transaction: versionedTransaction,
468
- blockhash,
469
- minContextSlot,
470
- };
471
- }
472
- legacyTransaction = new web3_js_1.Transaction().add(...instructions);
473
- legacyTransaction.recentBlockhash = recentBlockhash;
474
- legacyTransaction.feePayer = payerKey;
475
- legacyTransaction.sign(signers[0]);
476
- return {
477
- transaction: legacyTransaction,
478
- blockhash,
479
- minContextSlot,
480
- };
481
- });
482
- }
483
- sendSmartTransaction(solana_trade_runtime_1, instructions_1, signers_1) {
484
- return __awaiter(this, arguments, void 0, function* (solana_trade_runtime, instructions, signers, lookupTables = [], sendOptions = { skipPreflight: false, lastValidBlockHeightOffset: 150 }) {
485
- var _a;
486
- const lastValidBlockHeightOffset = (_a = sendOptions.lastValidBlockHeightOffset) !== null && _a !== void 0 ? _a : 150;
487
- if (lastValidBlockHeightOffset < 0)
488
- throw new Error('expiryBlockOffset must be a positive integer');
489
- try {
490
- const { transaction, blockhash, minContextSlot } = yield this.createSmartTransaction(solana_trade_runtime, instructions, signers, lookupTables, sendOptions.feePayer);
491
- (0, dist_1.log_info)(`>>> createSmartTransaction, end`);
492
- let txid = (0, get_signature_1.getSignature)(transaction);
493
- yield this.connection.sendRawTransaction(transaction.serialize({ verifySignatures: false }), {
494
- maxRetries: 3,
495
- skipPreflight: true
496
- });
497
- return txid;
498
- }
499
- catch (error) {
500
- throw new Error(`Error sending smart transaction: ${error}`);
501
- }
502
- });
503
- }
504
- addTipInstruction(instructions, feePayer, tipAccount, tipAmount) {
505
- const tipInstruction = web3_js_1.SystemProgram.transfer({
506
- fromPubkey: feePayer,
507
- toPubkey: new web3_js_1.PublicKey(tipAccount),
508
- lamports: tipAmount,
509
- });
510
- instructions.push(tipInstruction);
511
- }
512
- getTipTransaction(singers, tipAccount, tipAmount, blockhash) {
513
- const feePayer = singers[0];
514
- const tipInstruction = web3_js_1.SystemProgram.transfer({
515
- fromPubkey: feePayer.publicKey,
516
- toPubkey: new web3_js_1.PublicKey(tipAccount),
517
- lamports: tipAmount,
518
- });
519
- const transaction = new web3_js_1.Transaction().add(tipInstruction);
520
- transaction.recentBlockhash = blockhash;
521
- transaction.feePayer = feePayer.publicKey;
522
- transaction.sign(feePayer);
523
- return transaction;
524
- }
525
- createSmartTransactionWithTip(solana_trade_runtime_1, instructions_1, signers_1) {
526
- return __awaiter(this, arguments, void 0, function* (solana_trade_runtime, instructions, signers, lookupTables = [], tipAmount = 1000, feePayer) {
527
- if (!signers.length) {
528
- throw new Error('The transaction must have at least one signer');
529
- }
530
- if (!solana_trade_runtime.jito_use_separate_tx) {
531
- const randomTipAccount = types_1.JITO_TIP_ACCOUNTS[Math.floor(Math.random() * types_1.JITO_TIP_ACCOUNTS.length)];
532
- const payerKey = feePayer ? feePayer.publicKey : signers[0].publicKey;
533
- this.addTipInstruction(instructions, payerKey, randomTipAccount, tipAmount);
534
- }
535
- return this.createSmartTransaction(solana_trade_runtime, instructions, signers, lookupTables, feePayer);
536
- });
537
- }
538
- sendJitoBundle(serializedTransactions, encoding, jitoApiUrl) {
539
- return __awaiter(this, void 0, void 0, function* () {
540
- const response = yield axios_1.default.post(jitoApiUrl, {
541
- jsonrpc: '2.0',
542
- id: 1,
543
- method: 'sendBundle',
544
- params: [
545
- serializedTransactions,
546
- {
547
- "encoding": encoding
548
- }
549
- ]
550
- }, {
551
- headers: { 'Content-Type': 'application/json' },
552
- });
553
- if (response.data.error) {
554
- throw new Error(`Error sending bundles: ${JSON.stringify(response.data.error, null, 2)}`);
555
- }
556
- return response.data.result;
557
- });
558
- }
559
- getBundleStatuses(bundleIds, jitoApiUrl) {
560
- return __awaiter(this, void 0, void 0, function* () {
561
- if (!bundleIds || bundleIds.length == 0 || bundleIds[0] == null) {
562
- return;
563
- }
564
- const response = yield axios_1.default.post(jitoApiUrl, {
565
- jsonrpc: '2.0',
566
- id: 1,
567
- method: 'getBundleStatuses',
568
- params: [bundleIds],
569
- }, {
570
- headers: { 'Content-Type': 'application/json' },
571
- });
572
- if (response.data.error) {
573
- (0, dist_1.log_warn)(`getBundleStatuses error!`, {
574
- jitoApiUrl,
575
- bundleIds,
576
- });
577
- throw new Error(`Error getting bundle statuses: ${JSON.stringify(response.data.error, null, 2)}`);
578
- }
579
- return response.data.result;
580
- });
581
- }
582
- sendSmartTransactionWithTip(solana_trade_runtime_1, instructions_1, signers_1) {
583
- return __awaiter(this, arguments, void 0, function* (solana_trade_runtime, instructions, signers, lookupTables = [], tipAmount = 1000, region = 'Default', feePayer, lastValidBlockHeightOffset = 150) {
584
- if (lastValidBlockHeightOffset < 0)
585
- throw new Error('lastValidBlockHeightOffset must be a positive integer');
586
- if (!signers.length) {
587
- throw new Error('The transaction must have at least one signer');
588
- }
589
- const { transaction, blockhash } = yield this.createSmartTransactionWithTip(solana_trade_runtime, instructions, signers, lookupTables, tipAmount, feePayer);
590
- let txid = (0, get_signature_1.getSignature)(transaction);
591
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
592
- const encoding = 'base64';
593
- const serializedMainTx = transaction.serialize({ verifySignatures: false }).toString(encoding);
594
- let jito_region = process.env.JITO_REGION || region;
595
- let jitoApiUrl = `${types_1.JITO_API_URLS[jito_region]}/api/v1/bundles`;
596
- const send_tx_jito_url = process.env.SEND_TX_JITO_URL || '';
597
- const send_tx_jito_stratgy = process.env.SEND_TX_JITO_STRATEGY || '';
598
- if (!(0, dist_1.isEmpty)(send_tx_jito_url) && send_tx_jito_stratgy === 'mul_ips') {
599
- let { jito_use_separate_tx } = solana_trade_runtime;
600
- let group_id = solana_trade_runtime.group.id;
601
- let recent_blockhash = blockhash.blockhash;
602
- let encoded_tx = serializedMainTx;
603
- if (jito_use_separate_tx) {
604
- let serializedTipTx = (yield axios_1.default.get(`${process.env.JITO_CREATE_TIP_TX_URL}?group_id=${group_id}&blockhash=${recent_blockhash}&encoding=${encoding}&tip_amount=${tipAmount}`)).data.data;
605
- encoded_tx = [
606
- serializedMainTx,
607
- serializedTipTx
608
- ].join(',');
609
- }
610
- const max_retry = Number(process.env.JITO_MAX_RETRIES || '10');
611
- this.redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry);
612
- const send_result = yield (0, dist_1.postJSON)(send_tx_jito_url, {
613
- encoding,
614
- encoded_tx,
615
- txid,
616
- trace_id: '',
617
- group_id,
618
- max_retry
619
- });
620
- (0, dist_1.log_info)(`sendJitoBundle (mul_ips)`, {
621
- txid,
622
- jito_use_separate_tx,
623
- max_retry,
624
- send_result
625
- });
626
- return;
627
- }
628
- let bundleId = yield this.sendJitoBundle([serializedMainTx], encoding, jitoApiUrl);
629
- (0, dist_1.log_info)(`sendJitoBundle`, {
630
- txid,
631
- jitoApiUrl,
632
- encoding,
633
- bundleId
634
- });
635
- }), 0);
636
- return txid;
637
- });
638
- }
639
- send_jup_ag_tx_by_jito(solana_trade_runtime_1, transaction_1, signers_1) {
640
- return __awaiter(this, arguments, void 0, function* (solana_trade_runtime, transaction, signers, tipAmount = 1000, region = 'Default') {
641
- let txid = (0, get_signature_1.getSignature)(transaction);
642
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
643
- let block_offset = solana_trade_runtime.settings.strategy.block_offset;
644
- if (isNaN(block_offset) || block_offset < 0) {
645
- throw new Error('block_offset must be a positive integer');
646
- }
647
- let blockhash_by_slot_offset = yield this.getBlockhashBySlotOffset(block_offset);
648
- let blockhash = blockhash_by_slot_offset.value.blockhash;
649
- const encoding = 'base64';
650
- const serializedMainTx = Buffer.from(transaction.serialize()).toString(encoding);
651
- let jito_region = process.env.JITO_REGION || region;
652
- let jitoApiUrl = `${types_1.JITO_API_URLS[jito_region]}/api/v1/bundles`;
653
- const send_tx_jito_url = process.env.SEND_TX_JITO_URL || '';
654
- const send_tx_jito_stratgy = process.env.SEND_TX_JITO_STRATEGY || '';
655
- let serializedTipTx = '';
656
- if (!(0, dist_1.isEmpty)(send_tx_jito_url) && send_tx_jito_stratgy === 'mul_ips') {
657
- let { jito_use_separate_tx } = solana_trade_runtime;
658
- let group_id = solana_trade_runtime.group.id;
659
- let recent_blockhash = blockhash;
660
- let encoded_tx = serializedMainTx;
661
- if (jito_use_separate_tx) {
662
- serializedTipTx = (yield axios_1.default.get(`${process.env.JITO_CREATE_TIP_TX_URL}?group_id=${group_id}&blockhash=${recent_blockhash}&encoding=${encoding}&tip_amount=${tipAmount}`)).data.data;
663
- }
664
- else {
665
- serializedTipTx = yield this.getSerializedTipTransaction(signers, tipAmount, blockhash, encoding);
666
- }
667
- encoded_tx = [
668
- serializedTipTx,
669
- serializedMainTx
670
- ].join(',');
671
- const max_retry = Number(process.env.JITO_MAX_RETRIES || '2');
672
- this.redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry);
673
- const send_result = yield (0, dist_1.postJSON)(send_tx_jito_url, {
674
- encoding,
675
- encoded_tx,
676
- txid,
677
- trace_id: '',
678
- group_id,
679
- max_retry
680
- });
681
- (0, dist_1.log_info)(`sendJitoBundle (mul_ips)`, {
682
- txid,
683
- jito_use_separate_tx,
684
- max_retry,
685
- send_result
686
- });
687
- return;
688
- }
689
- serializedTipTx = yield this.getSerializedTipTransaction(signers, tipAmount, blockhash, encoding);
690
- let bundleId = yield this.sendJitoBundle([serializedMainTx, serializedTipTx], encoding, jitoApiUrl);
691
- (0, dist_1.log_info)(`sendJitoBundle`, {
692
- txid,
693
- jitoApiUrl,
694
- encoding,
695
- bundleId
696
- });
697
- }), 0);
698
- return txid;
699
- });
700
- }
701
- getSerializedTipTransaction(signers_1, tipAmount_1, blockhash_1) {
702
- return __awaiter(this, arguments, void 0, function* (signers, tipAmount, blockhash, encoding = 'base64') {
703
- const randomTipAccount = types_1.JITO_TIP_ACCOUNTS[Math.floor(Math.random() * types_1.JITO_TIP_ACCOUNTS.length)];
704
- let tipTransaction = this.getTipTransaction(signers, randomTipAccount, tipAmount, blockhash);
705
- return tipTransaction.serialize({ verifySignatures: false }).toString(encoding);
706
- });
707
- }
708
- redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry) {
709
- return __awaiter(this, void 0, void 0, function* () {
710
- const jito_send_tx_ext_srv_list = process.env.JITO_SEND_TX_EXT_SRV_LIST || '';
711
- if ((0, dist_1.isEmpty)(jito_send_tx_ext_srv_list)) {
712
- (0, dist_1.log_info)(`jito_send_tx_ext_srv_list is empty, process.env.JITO_SEND_TX_EXT_SRV_LIST=${jito_send_tx_ext_srv_list}`);
713
- return;
714
- }
715
- const regionGroups = jito_send_tx_ext_srv_list.split(';').filter(Boolean);
716
- regionGroups.forEach((region_group) => __awaiter(this, void 0, void 0, function* () {
717
- const hosts = region_group.split(',');
718
- const host = hosts[(0, dist_1.generateRandomNumber)(0, hosts.length - 1)];
719
- const url = `http://${host}/solana/send_tx`;
720
- (0, dist_1.postJSON)(url, {
721
- encoding,
722
- encoded_tx,
723
- txid,
724
- trace_id: '',
725
- group_id,
726
- max_retry
727
- }).then(res => {
728
- (0, dist_1.log_info)(`redirect tx ${txid} to ${url} success`, res);
729
- }).catch(err => {
730
- (0, dist_1.log_warn)(`redirect tx ${txid} to ${url} failed`, err.message);
731
- });
732
- }));
733
- });
734
- }
735
- getNftEditions(params) {
736
- return __awaiter(this, void 0, void 0, function* () {
737
- try {
738
- const url = `${this.connection.rpcEndpoint}`;
739
- const response = yield axios_1.default.post(url, {
740
- jsonrpc: '2.0',
741
- id: this.id,
742
- method: 'getNftEditions',
743
- params,
744
- }, {
745
- headers: { 'Content-Type': 'application/json' },
746
- });
747
- return response.data.result;
748
- }
749
- catch (error) {
750
- throw new Error(`Error in getNftEditions: ${error}`);
751
- }
752
- });
753
- }
754
- getTokenAccounts(params) {
755
- return __awaiter(this, void 0, void 0, function* () {
756
- try {
757
- const url = `${this.connection.rpcEndpoint}`;
758
- const response = yield axios_1.default.post(url, {
759
- jsonrpc: '2.0',
760
- id: this.id,
761
- method: 'getTokenAccounts',
762
- params,
763
- }, {
764
- headers: { 'Content-Type': 'application/json' },
765
- });
766
- return response.data.result;
767
- }
768
- catch (error) {
769
- throw new Error(`Error in getTokenAccounts: ${error}`);
770
- }
771
- });
772
- }
773
- sendTransaction(transaction_1) {
774
- return __awaiter(this, arguments, void 0, function* (transaction, options = {
775
- skipPreflight: true,
776
- }) {
777
- let rawTransaction;
778
- if (transaction instanceof web3_js_1.VersionedTransaction) {
779
- rawTransaction = Buffer.from(transaction.serialize()).toString('base64');
780
- }
781
- else {
782
- rawTransaction = transaction.serialize({ verifySignatures: false }).toString('base64');
783
- }
784
- try {
785
- const url = `${this.connection.rpcEndpoint}`;
786
- const response = yield axios_1.default.post(url, {
787
- jsonrpc: '2.0',
788
- id: this.id,
789
- method: 'sendTransaction',
790
- params: [rawTransaction, Object.assign({ encoding: 'base64' }, options)],
791
- }, {
792
- headers: { 'Content-Type': 'application/json' },
793
- });
794
- if (response.data.error) {
795
- throw new Error(`RPC error: ${JSON.stringify(response.data.error)}`);
796
- }
797
- let txid = response.data.result;
798
- (0, dist_1.log_info)(`sendTransaction`, {
799
- url,
800
- txid
801
- });
802
- return txid;
803
- }
804
- catch (error) {
805
- throw new Error(`Error sending transaction: ${error}`);
806
- }
807
- });
808
- }
809
- sendSmartTransactionWithTipMixed(solana_trade_runtime_1, instructions_1, signers_1) {
810
- return __awaiter(this, arguments, void 0, function* (solana_trade_runtime, instructions, signers, lookupTables = [], tipAmount = 1000, region = 'Default', feePayer, lastValidBlockHeightOffset = 150) {
811
- if (lastValidBlockHeightOffset < 0)
812
- throw new Error('lastValidBlockHeightOffset must be a positive integer');
813
- if (!signers.length) {
814
- throw new Error('The transaction must have at least one signer');
815
- }
816
- const { transaction, blockhash } = yield this.createSmartTransactionWithTip(solana_trade_runtime, instructions, signers, lookupTables, tipAmount, feePayer);
817
- let txid = (0, get_signature_1.getSignature)(transaction);
818
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
819
- const serializedTransaction = bs58_1.default.encode(transaction.serialize({ verifySignatures: false }));
820
- let jitoApiUrl = `${types_1.JITO_API_URLS[region]}/api/v1/bundles`;
821
- (0, dist_1.log_info)('sendSmartTransactionWithTipMixed, start');
822
- this.sendTransaction(transaction);
823
- this.sendJitoTransaction(serializedTransaction, `${types_1.JITO_API_URLS['Default']}/api/v1/transactions?bundleOnly=true`);
824
- const bundleId = yield this.sendJitoTransaction(serializedTransaction, `${types_1.JITO_API_URLS['Default']}/api/v1/transactions?bundleOnly=true`);
825
- (0, dist_1.log_info)(`sendJitoTransaction`, {
826
- txid,
827
- bundleId
828
- });
829
- }), 0);
830
- return txid;
831
- });
832
- }
833
- sendJitoTransaction(serializedTransaction_1, jitoApiUrl_1) {
834
- return __awaiter(this, arguments, void 0, function* (serializedTransaction, jitoApiUrl, encoding = 'base58') {
835
- let start = Date.now();
836
- let params;
837
- if (encoding === 'base58') {
838
- params = [serializedTransaction];
839
- }
840
- else if (encoding === 'base64') {
841
- params = [serializedTransaction, { encoding }];
842
- }
843
- else {
844
- throw new Error('Invalid encoding type:' + encoding);
845
- }
846
- const response = yield axios_1.default.post(jitoApiUrl, {
847
- jsonrpc: '2.0',
848
- id: 1,
849
- method: 'sendTransaction',
850
- params,
851
- }, {
852
- headers: { 'Content-Type': 'application/json' },
853
- });
854
- if (response.data.error) {
855
- throw new Error(`Error sending bundles: ${JSON.stringify(response.data.error, null, 2)}`);
856
- }
857
- let bundleId = response.headers['x-bundle-id'];
858
- (0, dist_1.log_info)('sendJitoTransaction finish', {
859
- jitoApiUrl,
860
- encoding,
861
- bundleId,
862
- take: (Date.now() - start) + 'ms'
863
- });
864
- return bundleId;
865
- });
866
- }
867
- get_last_blockhash_slot(connections) {
868
- return __awaiter(this, void 0, void 0, function* () {
869
- let last_blockhash_slot;
870
- try {
871
- let appConfig = global.appConfig;
872
- let { key, value } = yield appConfig.arb_cache.loading_cache.get(dist_1.CHAIN_ID.SOLANA, 'b', 'slot', true);
873
- let { context_slot, blockhash, blockHeight } = JSON.parse(value);
874
- last_blockhash_slot = {
875
- context: {
876
- slot: context_slot
877
- },
878
- value: {
879
- blockhash,
880
- lastValidBlockHeight: blockHeight
881
- }
882
- };
883
- }
884
- catch (err) {
885
- (0, dist_1.log_error)('get_last_blockhash_slot, from redis', err);
886
- }
887
- if (!last_blockhash_slot) {
888
- for (let c of connections) {
889
- try {
890
- (0, dist_1.log_info)(`get_last_blockhash_slot, rpc_endpoint=${c.rpcEndpoint}`);
891
- last_blockhash_slot = yield c.getLatestBlockhashAndContext();
892
- break;
893
- }
894
- catch (err) {
895
- (0, dist_1.log_error)('get_last_blockhash_slot, fetch by connection', err);
896
- }
897
- }
898
- }
899
- return last_blockhash_slot;
900
- });
901
- }
902
- getBlockhashBySlotOffset() {
903
- return __awaiter(this, arguments, void 0, function* (targetSlotOffset = 145, limit = 1) {
904
- let appConfig = global.appConfig;
905
- let { key, blocks } = yield appConfig.arb_cache.loading_cache.get_block_info(dist_1.CHAIN_ID.SOLANA, targetSlotOffset, limit);
906
- let { slot, blockhash, blockHeight } = JSON.parse(blocks[0]);
907
- return {
908
- key,
909
- context: { slot },
910
- value: {
911
- blockhash,
912
- lastValidBlockHeight: blockHeight
913
- }
914
- };
915
- });
916
- }
917
- try_get_bundle_failed_result(txid_1, bundle_id_1) {
918
- return __awaiter(this, arguments, void 0, function* (txid, bundle_id, timeoutMs = 90000) {
919
- let url = `https://bundles.jito.wtf/api/v1/bundles/get_bundle_error/${bundle_id}`;
920
- let check_interval = parseInt(process.env.CHECK_BUNDLE_ERROR_INTERVAL_MILLS || '7000');
921
- let start = Date.now();
922
- while (Date.now() - start < timeoutMs) {
923
- try {
924
- let err_result = yield (yield fetch(url)).json();
925
- if (err_result && err_result.length > 0) {
926
- (0, dist_1.log_warn)('get_bundle_error, res=', { url, txid, check_interval, timeoutMs, err_result });
927
- let appConfig = global.appConfig;
928
- let mock_failed_tx = {
929
- params: {
930
- result: {
931
- signature: txid,
932
- slot: 0,
933
- transaction: {
934
- transaction: {
935
- signatures: [txid]
936
- },
937
- version: 0,
938
- meta: {
939
- err: JSON.stringify(err_result),
940
- logMessages: [],
941
- preBalances: [0],
942
- postBalances: [0]
943
- }
944
- }
945
- }
946
- }
947
- };
948
- appConfig.emit(common_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + txid, JSON.stringify(mock_failed_tx));
949
- break;
950
- }
951
- else {
952
- (0, dist_1.log_debug)('get_bundle_error, res=', { url, check_interval, rs: err_result });
953
- }
954
- }
955
- catch (err) {
956
- console.error('get_bundle_error, error!', err);
957
- break;
958
- }
959
- yield new Promise(resolve => setTimeout(resolve, check_interval));
960
- }
961
- });
962
- }
963
- send_tx_to_all_jito_region(serializedTransaction, encoding) {
964
- return __awaiter(this, void 0, void 0, function* () {
965
- let jito_block_engine_urls = [
966
- `${types_1.JITO_API_URLS['Default']}/api/v1/transactions?bundleOnly=true`,
967
- `${types_1.JITO_API_URLS['NY']}/api/v1/transactions?bundleOnly=true`,
968
- `${types_1.JITO_API_URLS['Amsterdam']}/api/v1/transactions?bundleOnly=true`,
969
- `${types_1.JITO_API_URLS['Frankfurt']}/api/v1/transactions?bundleOnly=true`,
970
- `${types_1.JITO_API_URLS['Tokyo']}/api/v1/transactions?bundleOnly=true`,
971
- `${types_1.JITO_API_URLS['Slc']}/api/v1/transactions?bundleOnly=true`,
972
- ];
973
- let bundle_id = yield Promise.race(jito_block_engine_urls.map(address => this.sendJitoTransaction(serializedTransaction, address, encoding)));
974
- return bundle_id;
975
- });
976
- }
977
- }
978
- exports.RpcClient = RpcClient;