@clonegod/ttd-sol-common 1.0.117 → 1.0.118
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.
|
@@ -610,7 +610,7 @@ class RpcClient {
|
|
|
610
610
|
}
|
|
611
611
|
yield new Promise((resolve) => setTimeout(resolve, interval));
|
|
612
612
|
}
|
|
613
|
-
let err = new Error('Bundle failed to confirm within the timeout period');
|
|
613
|
+
let err = new Error('Bundle failed to confirm within the timeout period:' + timeout + 'ms');
|
|
614
614
|
(0, dist_1.log_error)(`Bundle failed to confirm, txid=${txid}`, err);
|
|
615
615
|
throw err;
|
|
616
616
|
}), 0);
|
|
@@ -713,7 +713,7 @@ class RpcClient {
|
|
|
713
713
|
});
|
|
714
714
|
const currentBlockHeight = yield solana_trade_runtime.connection.getBlockHeight();
|
|
715
715
|
const lastValidBlockHeight = Math.min(blockhash.lastValidBlockHeight, currentBlockHeight + lastValidBlockHeightOffset);
|
|
716
|
-
const timeout =
|
|
716
|
+
const timeout = 10000;
|
|
717
717
|
const interval = 5000;
|
|
718
718
|
const startTime = Date.now();
|
|
719
719
|
while (Date.now() - startTime < timeout ||
|
|
@@ -736,7 +736,7 @@ class RpcClient {
|
|
|
736
736
|
}
|
|
737
737
|
yield new Promise((resolve) => setTimeout(resolve, interval));
|
|
738
738
|
}
|
|
739
|
-
let err = new Error('Bundle failed to confirm within the timeout period');
|
|
739
|
+
let err = new Error('Bundle failed to confirm within the timeout period:' + timeout + 'ms');
|
|
740
740
|
(0, dist_1.log_error)(`Bundle failed to confirm, txid=${txid}`, err);
|
|
741
741
|
throw err;
|
|
742
742
|
}), 0);
|
|
@@ -805,11 +805,11 @@ class RpcClient {
|
|
|
805
805
|
let start = Date.now();
|
|
806
806
|
while (Date.now() - start < timeoutMs) {
|
|
807
807
|
try {
|
|
808
|
-
let
|
|
809
|
-
if (
|
|
810
|
-
(0, dist_1.log_warn)('get_bundle_error, res=', { url, txid, check_interval, timeoutMs,
|
|
808
|
+
let err_result = yield (yield fetch(url)).json();
|
|
809
|
+
if (err_result && err_result.length > 0) {
|
|
810
|
+
(0, dist_1.log_warn)('get_bundle_error, res=', { url, txid, check_interval, timeoutMs, err_result });
|
|
811
811
|
let appConfig = global.appConfig;
|
|
812
|
-
let
|
|
812
|
+
let mock_failed_tx = {
|
|
813
813
|
params: {
|
|
814
814
|
result: {
|
|
815
815
|
signature: txid,
|
|
@@ -820,18 +820,20 @@ class RpcClient {
|
|
|
820
820
|
},
|
|
821
821
|
version: 0,
|
|
822
822
|
meta: {
|
|
823
|
-
err: JSON.stringify(
|
|
824
|
-
logMessages: []
|
|
823
|
+
err: JSON.stringify(err_result),
|
|
824
|
+
logMessages: [],
|
|
825
|
+
preBalances: [0],
|
|
826
|
+
postBalances: [0]
|
|
825
827
|
}
|
|
826
828
|
}
|
|
827
829
|
}
|
|
828
830
|
}
|
|
829
831
|
};
|
|
830
|
-
appConfig.emit(common_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + txid, JSON.stringify(
|
|
832
|
+
appConfig.emit(common_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + txid, JSON.stringify(mock_failed_tx));
|
|
831
833
|
break;
|
|
832
834
|
}
|
|
833
835
|
else {
|
|
834
|
-
(0, dist_1.log_debug)('get_bundle_error, res=', { url, check_interval, rs });
|
|
836
|
+
(0, dist_1.log_debug)('get_bundle_error, res=', { url, check_interval, rs: err_result });
|
|
835
837
|
}
|
|
836
838
|
}
|
|
837
839
|
catch (err) {
|
|
@@ -71,11 +71,9 @@ class TransactionResultChecker {
|
|
|
71
71
|
else {
|
|
72
72
|
this.event_emitter.emit(dist_1.TRANSACTION_STATE_FAILED, trade_result);
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
console.log('---------------------------------------------------->');
|
|
78
|
-
}, 0);
|
|
74
|
+
console.log('<----------------------------------------------------');
|
|
75
|
+
console.dir(trade_result, { depth: 8 });
|
|
76
|
+
console.log('---------------------------------------------------->');
|
|
79
77
|
}
|
|
80
78
|
catch (err) {
|
|
81
79
|
(0, dist_1.log_error)('parse geyser stream message error!', err);
|
|
@@ -114,11 +112,11 @@ class TransactionResultChecker {
|
|
|
114
112
|
this.event_emitter.emit(dist_1.TRANSACTION_STATE_FAILED, trade_result);
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
|
-
|
|
115
|
+
if (dist_1.LOG.debug) {
|
|
118
116
|
console.log('<====================================================');
|
|
119
117
|
console.dir(trade_result, { depth: 8 });
|
|
120
118
|
console.log('====================================================>');
|
|
121
|
-
}
|
|
119
|
+
}
|
|
122
120
|
}
|
|
123
121
|
else {
|
|
124
122
|
clearInterval(intervalId);
|