@clonegod/ttd-sol-common 1.0.28 → 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,15 +423,16 @@ 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
  }
425
434
  }), 0);
426
- let units = solana_trade_runtime.cu_limit;
427
- const customersCU = units < 1000 ? 1000 : Math.ceil(units * 1.1);
435
+ const customersCU = Math.ceil(solana_trade_runtime.cu_limit);
428
436
  const computeUnitsIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({
429
437
  units: customersCU,
430
438
  });
@@ -468,6 +476,7 @@ class RpcClient {
468
476
  throw new Error('expiryBlockOffset must be a positive integer');
469
477
  try {
470
478
  const { transaction, blockhash, minContextSlot } = yield this.createSmartTransaction(solana_trade_runtime, instructions, signers, lookupTables, sendOptions.feePayer);
479
+ (0, dist_1.log_debug)(`>>> createSmartTransaction, end`);
471
480
  let txid = (0, get_signature_1.getSignature)(transaction);
472
481
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
473
482
  const commitment = (sendOptions === null || sendOptions === void 0 ? void 0 : sendOptions.preflightCommitment) || 'confirmed';
@@ -56,7 +56,7 @@ function get_excat_fee_by_speed(speed, fee_exact) {
56
56
  function get_dynamic_fee_by_speed(speed, estimate_priority_fee, fee_max_cap) {
57
57
  let factor = 1;
58
58
  if (speed === 'fast') {
59
- factor = 1.2;
59
+ factor = 1;
60
60
  }
61
61
  if (speed === 'turbo') {
62
62
  factor = 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.28",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",