@clonegod/ttd-sol-common 1.0.132 → 1.0.134

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.
@@ -583,40 +583,24 @@ class RpcClient {
583
583
  const serializedTransaction = transaction.serialize({ verifySignatures: false }).toString(encoding);
584
584
  let jito_region = process.env.JITO_REGION || region;
585
585
  let jitoApiUrl = `${types_1.JITO_API_URLS[jito_region]}/api/v1/bundles`;
586
- const bundleId = yield this.sendJitoBundle([serializedTransaction], encoding, jitoApiUrl);
586
+ const send_tx_jito_url = process.env.SEND_TX_JITO_URL;
587
+ const send_tx_jito_stratgy = process.env.SEND_TX_JITO_STRATEGY;
588
+ if (send_tx_jito_url && send_tx_jito_stratgy === 'mul_ips') {
589
+ (0, dist_1.postJSON)(send_tx_jito_url, {
590
+ encoding,
591
+ encoded_tx: serializedTransaction,
592
+ txid,
593
+ trace_id: ''
594
+ });
595
+ return;
596
+ }
597
+ let bundleId = yield this.sendJitoBundle([serializedTransaction], encoding, jitoApiUrl);
587
598
  (0, dist_1.log_info)(`sendJitoBundle`, {
588
599
  txid,
589
600
  jitoApiUrl,
590
601
  encoding,
591
602
  bundleId
592
603
  });
593
- this.try_get_bundle_failed_result(txid, bundleId);
594
- const currentBlockHeight = yield solana_trade_runtime.connection.getBlockHeight();
595
- const lastValidBlockHeight = Math.min(blockhash.lastValidBlockHeight, currentBlockHeight + lastValidBlockHeightOffset);
596
- const timeout = 10000;
597
- const interval = 2000;
598
- const startTime = Date.now();
599
- while (Date.now() - startTime < timeout) {
600
- const bundleStatuses = yield this.getBundleStatuses([bundleId], jitoApiUrl);
601
- (0, dist_1.log_debug)(`getBundleStatuses success`, {
602
- txid,
603
- bundleId,
604
- jitoApiUrl,
605
- bundleStatuses
606
- });
607
- if (bundleStatuses &&
608
- bundleStatuses.value &&
609
- bundleStatuses.value.length > 0 &&
610
- bundleStatuses.value[0]) {
611
- const status = bundleStatuses.value[0].confirmation_status;
612
- if (status === 'confirmed') {
613
- return bundleStatuses.value[0].transactions[0];
614
- }
615
- }
616
- yield new Promise((resolve) => setTimeout(resolve, interval));
617
- }
618
- let err = new Error('Bundle failed to confirm within the timeout period:' + timeout + 'ms');
619
- (0, dist_1.log_error)(`Bundle failed to confirm, txid=${txid}`, err);
620
604
  }), 0);
621
605
  return txid;
622
606
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.132",
3
+ "version": "1.0.134",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",