@clonegod/ttd-sol-common 1.1.3 → 1.1.5
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.
|
@@ -48,6 +48,7 @@ export declare class RpcClient {
|
|
|
48
48
|
sendSmartTransactionWithTip(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], tipAmount?: number, region?: JitoRegion, feePayer?: Signer, lastValidBlockHeightOffset?: number): Promise<string>;
|
|
49
49
|
send_jup_ag_tx_by_jito(solana_trade_runtime: SolanaTradeRuntimeType, transaction: VersionedTransaction, signers: Signer[], tipAmount?: number, region?: JitoRegion): Promise<string>;
|
|
50
50
|
getSerializedTipTransaction(signers: Signer[], tipAmount: number, blockhash: string, encoding?: BufferEncoding): Promise<string>;
|
|
51
|
+
private redirectTransactionToExternalServers;
|
|
51
52
|
getNftEditions(params: DAS.GetNftEditionsRequest): Promise<DAS.GetNftEditionsResponse>;
|
|
52
53
|
getTokenAccounts(params: DAS.GetTokenAccountsRequest): Promise<DAS.GetTokenAccountsResponse>;
|
|
53
54
|
sendTransaction(transaction: Transaction | VersionedTransaction, options?: HeliusSendOptions): Promise<TransactionSignature>;
|
|
@@ -630,6 +630,7 @@ class RpcClient {
|
|
|
630
630
|
].join(',');
|
|
631
631
|
}
|
|
632
632
|
const max_retry = Number(process.env.JITO_MAX_RETRIES || '10');
|
|
633
|
+
this.redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry);
|
|
633
634
|
const send_result = yield (0, dist_1.postJSON)(send_tx_jito_url, {
|
|
634
635
|
encoding,
|
|
635
636
|
encoded_tx,
|
|
@@ -690,25 +691,7 @@ class RpcClient {
|
|
|
690
691
|
serializedMainTx
|
|
691
692
|
].join(',');
|
|
692
693
|
const max_retry = Number(process.env.JITO_MAX_RETRIES || '0');
|
|
693
|
-
|
|
694
|
-
var _a;
|
|
695
|
-
let gateway_list = ((_a = process.env.JITO_SEND_TX_GATEWAY_LIST) === null || _a === void 0 ? void 0 : _a.split(',').filter(Boolean)) || [];
|
|
696
|
-
gateway_list.forEach((host) => __awaiter(this, void 0, void 0, function* () {
|
|
697
|
-
let url = `http://${host}/solana/send_tx`;
|
|
698
|
-
(0, dist_1.postJSON)(url, {
|
|
699
|
-
encoding,
|
|
700
|
-
encoded_tx,
|
|
701
|
-
txid,
|
|
702
|
-
trace_id: '',
|
|
703
|
-
group_id,
|
|
704
|
-
max_retry
|
|
705
|
-
}).then(res => {
|
|
706
|
-
(0, dist_1.log_info)(`redirect tx to ${url} success`, res);
|
|
707
|
-
}).catch(err => {
|
|
708
|
-
(0, dist_1.log_error)(`redirect tx to ${url} failed`, err);
|
|
709
|
-
});
|
|
710
|
-
}));
|
|
711
|
-
}), 0);
|
|
694
|
+
this.redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry);
|
|
712
695
|
const send_result = yield (0, dist_1.postJSON)(send_tx_jito_url, {
|
|
713
696
|
encoding,
|
|
714
697
|
encoded_tx,
|
|
@@ -744,6 +727,32 @@ class RpcClient {
|
|
|
744
727
|
return tipTransaction.serialize({ verifySignatures: false }).toString(encoding);
|
|
745
728
|
});
|
|
746
729
|
}
|
|
730
|
+
redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry) {
|
|
731
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
732
|
+
const jito_send_tx_ext_srv_list = process.env.JITO_SEND_TX_EXT_SRV_LIST || '';
|
|
733
|
+
if ((0, dist_1.isEmpty)(jito_send_tx_ext_srv_list)) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const regionGroups = jito_send_tx_ext_srv_list.split(';').filter(Boolean);
|
|
737
|
+
regionGroups.forEach((region_group) => __awaiter(this, void 0, void 0, function* () {
|
|
738
|
+
const hosts = region_group.split(',');
|
|
739
|
+
const host = hosts[(0, dist_1.generateRandomNumber)(0, hosts.length - 1)];
|
|
740
|
+
const url = `http://${host}/solana/send_tx`;
|
|
741
|
+
(0, dist_1.postJSON)(url, {
|
|
742
|
+
encoding,
|
|
743
|
+
encoded_tx,
|
|
744
|
+
txid,
|
|
745
|
+
trace_id: '',
|
|
746
|
+
group_id,
|
|
747
|
+
max_retry
|
|
748
|
+
}).then(res => {
|
|
749
|
+
(0, dist_1.log_info)(`redirect tx ${txid} to ${url} success`, res);
|
|
750
|
+
}).catch(err => {
|
|
751
|
+
(0, dist_1.log_warn)(`redirect tx ${txid} to ${url} failed`, err.message);
|
|
752
|
+
});
|
|
753
|
+
}));
|
|
754
|
+
});
|
|
755
|
+
}
|
|
747
756
|
getNftEditions(params) {
|
|
748
757
|
return __awaiter(this, void 0, void 0, function* () {
|
|
749
758
|
try {
|