@clonegod/ttd-sol-common 1.1.4 → 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,29 +691,7 @@ class RpcClient {
|
|
|
690
691
|
serializedMainTx
|
|
691
692
|
].join(',');
|
|
692
693
|
const max_retry = Number(process.env.JITO_MAX_RETRIES || '0');
|
|
693
|
-
|
|
694
|
-
let jito_send_tx_ext_srv_list = process.env.JITO_SEND_TX_EXT_SRV_LIST || '';
|
|
695
|
-
if ((0, dist_1.isEmpty)(jito_send_tx_ext_srv_list)) {
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
jito_send_tx_ext_srv_list.split(';').filter(Boolean).forEach((region_group) => __awaiter(this, void 0, void 0, function* () {
|
|
699
|
-
let index = (0, dist_1.generateRandomNumber)(0, region_group.split(',').length - 1);
|
|
700
|
-
let host = region_group.split(',')[index];
|
|
701
|
-
let url = `http://${host}/solana/send_tx`;
|
|
702
|
-
(0, dist_1.postJSON)(url, {
|
|
703
|
-
encoding,
|
|
704
|
-
encoded_tx,
|
|
705
|
-
txid,
|
|
706
|
-
trace_id: '',
|
|
707
|
-
group_id,
|
|
708
|
-
max_retry
|
|
709
|
-
}).then(res => {
|
|
710
|
-
(0, dist_1.log_info)(`redirect tx ${txid} to ${url} success`, res);
|
|
711
|
-
}).catch(err => {
|
|
712
|
-
(0, dist_1.log_error)(`redirect tx ${txid} to ${url} failed`, err);
|
|
713
|
-
});
|
|
714
|
-
}));
|
|
715
|
-
}), 0);
|
|
694
|
+
this.redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry);
|
|
716
695
|
const send_result = yield (0, dist_1.postJSON)(send_tx_jito_url, {
|
|
717
696
|
encoding,
|
|
718
697
|
encoded_tx,
|
|
@@ -748,6 +727,32 @@ class RpcClient {
|
|
|
748
727
|
return tipTransaction.serialize({ verifySignatures: false }).toString(encoding);
|
|
749
728
|
});
|
|
750
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
|
+
}
|
|
751
756
|
getNftEditions(params) {
|
|
752
757
|
return __awaiter(this, void 0, void 0, function* () {
|
|
753
758
|
try {
|