@clonegod/ttd-sol-common 1.0.30 → 1.0.31

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.
@@ -363,9 +363,14 @@ class RpcClient {
363
363
  if (existingComputeBudgetInstructions.length > 0) {
364
364
  throw new Error('Cannot provide instructions that set the compute unit price and/or limit');
365
365
  }
366
+ (0, dist_1.log_debug)(`>>> getLatestBlockhashAndContext, start`);
366
367
  const payerKey = feePayer ? feePayer.publicKey : signers[0].publicKey;
367
- const { context: { slot: minContextSlot }, value: blockhash, } = yield this.connection.getLatestBlockhashAndContext();
368
+ const { context: { slot: minContextSlot }, value: blockhash, } = yield Promise.race([
369
+ this.connection.getLatestBlockhashAndContext(),
370
+ solana_trade_runtime.connection.getLatestBlockhashAndContext()
371
+ ]);
368
372
  const recentBlockhash = blockhash.blockhash;
373
+ (0, dist_1.log_debug)(`>>> getLatestBlockhashAndContext, end`);
369
374
  const isVersioned = lookupTables.length > 0;
370
375
  let legacyTransaction = null;
371
376
  let versionedTransaction = null;
@@ -391,11 +396,12 @@ class RpcClient {
391
396
  }
392
397
  }
393
398
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
394
- if (Math.random() > 0)
399
+ if (Math.random() > 0.15)
395
400
  return;
396
401
  const serializedTransaction = bs58_1.default.encode(isVersioned
397
402
  ? versionedTransaction.serialize()
398
403
  : legacyTransaction.serialize(serializeOptions));
404
+ (0, dist_1.log_debug)(`>>> getPriorityFeeEstimate, start`);
399
405
  const priorityFeeEstimateResponse = yield this.getPriorityFeeEstimate({
400
406
  transaction: serializedTransaction,
401
407
  options: {
@@ -403,6 +409,7 @@ class RpcClient {
403
409
  },
404
410
  });
405
411
  const { priorityFeeEstimate } = priorityFeeEstimateResponse;
412
+ (0, dist_1.log_debug)(`>>> getPriorityFeeEstimate, end. priorityFeeEstimate=${priorityFeeEstimate}`);
406
413
  if (!priorityFeeEstimate) {
407
414
  throw new Error('Priority fee estimate not available');
408
415
  }
@@ -416,9 +423,11 @@ class RpcClient {
416
423
  });
417
424
  instructions.unshift(computeBudgetIx);
418
425
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
419
- if (Math.random() > 0)
426
+ if (Math.random() > 0.15)
420
427
  return;
428
+ (0, dist_1.log_debug)(`>>> getComputeUnits, start`);
421
429
  const units = yield this.getComputeUnits(instructions, payerKey, isVersioned ? lookupTables : [], signers);
430
+ (0, dist_1.log_debug)(`>>> getComputeUnits, end. ComputeUnits=${units}`);
422
431
  if (!units) {
423
432
  throw new Error(`Error fetching compute units for the instructions provided`);
424
433
  }
@@ -467,6 +476,7 @@ class RpcClient {
467
476
  throw new Error('expiryBlockOffset must be a positive integer');
468
477
  try {
469
478
  const { transaction, blockhash, minContextSlot } = yield this.createSmartTransaction(solana_trade_runtime, instructions, signers, lookupTables, sendOptions.feePayer);
479
+ (0, dist_1.log_debug)(`>>> createSmartTransaction, end`);
470
480
  let txid = (0, get_signature_1.getSignature)(transaction);
471
481
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
472
482
  const commitment = (sendOptions === null || sendOptions === void 0 ? void 0 : sendOptions.preflightCommitment) || 'confirmed';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",