@clonegod/ttd-bsc-send-tx 2.0.6 → 2.0.8
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.
- package/dist/transaction_sender.js +9 -3
- package/dist/ws_client.js +1 -1
- package/package.json +2 -2
|
@@ -31,17 +31,20 @@ class TransactionSender {
|
|
|
31
31
|
const results = [];
|
|
32
32
|
const errors = [];
|
|
33
33
|
if (appconfig_1.envArgs.send_tx_blox_bundle_ws) {
|
|
34
|
+
const t0 = Date.now();
|
|
34
35
|
try {
|
|
35
36
|
const tipTx = tipTxMap.get(constants_1.BSC_EOA_ADDRESS.BLXR);
|
|
36
37
|
this.sendBundleProxy.sendTransaction('bloxroute', pair, signedMainTx, tipTx);
|
|
37
38
|
results.push('sent to bloxroute ws');
|
|
39
|
+
(0, ttd_core_1.log_info)(`[send] provider=bloxroute_ws trace=${order_trace_id} ${Date.now() - t0}ms ok (fire-and-forget)`);
|
|
38
40
|
}
|
|
39
41
|
catch (error) {
|
|
40
42
|
errors.push(`bloxroute_ws: ${error.message}`);
|
|
41
|
-
(0, ttd_core_1.
|
|
43
|
+
(0, ttd_core_1.log_warn)(`[send] provider=bloxroute_ws trace=${order_trace_id} ${Date.now() - t0}ms FAIL: ${error.message}`);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
if (appconfig_1.envArgs.send_tx_48club_bundle_ws) {
|
|
47
|
+
const t0 = Date.now();
|
|
45
48
|
try {
|
|
46
49
|
const tipTx = tipTxMap.get(constants_1.BSC_EOA_ADDRESS._48CLUB);
|
|
47
50
|
let spSignature;
|
|
@@ -54,10 +57,11 @@ class TransactionSender {
|
|
|
54
57
|
catch (_a) { }
|
|
55
58
|
this.sendBundleProxy.sendTransaction('48club', pair, signedMainTx, tipTx, spSignature);
|
|
56
59
|
results.push('sent to 48club ws');
|
|
60
|
+
(0, ttd_core_1.log_info)(`[send] provider=48club_ws trace=${order_trace_id} ${Date.now() - t0}ms ok (fire-and-forget)`);
|
|
57
61
|
}
|
|
58
62
|
catch (error) {
|
|
59
63
|
errors.push(`48club_ws: ${error.message}`);
|
|
60
|
-
(0, ttd_core_1.
|
|
64
|
+
(0, ttd_core_1.log_warn)(`[send] provider=48club_ws trace=${order_trace_id} ${Date.now() - t0}ms FAIL: ${error.message}`);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
trace === null || trace === void 0 ? void 0 : trace.mark('ws_sent');
|
|
@@ -103,13 +107,15 @@ class TransactionSender {
|
|
|
103
107
|
.filter(p => p.enable)
|
|
104
108
|
.filter(p => only_bundle ? p.is_bundle : true)
|
|
105
109
|
.map((provider) => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const t0 = Date.now();
|
|
106
111
|
try {
|
|
107
112
|
const txHash = yield provider.send();
|
|
108
113
|
results.push(txHash);
|
|
114
|
+
(0, ttd_core_1.log_info)(`[send] provider=${provider.name} trace=${order_trace_id} ${Date.now() - t0}ms ok tx=${txHash}`);
|
|
109
115
|
}
|
|
110
116
|
catch (error) {
|
|
111
117
|
errors.push(`${provider.name}: ${error.message}`);
|
|
112
|
-
(0, ttd_core_1.
|
|
118
|
+
(0, ttd_core_1.log_warn)(`[send] provider=${provider.name} trace=${order_trace_id} ${Date.now() - t0}ms FAIL: ${error.message}`);
|
|
113
119
|
}
|
|
114
120
|
})));
|
|
115
121
|
if (results.length > 0) {
|
package/dist/ws_client.js
CHANGED
|
@@ -8,7 +8,7 @@ class BscSendTxProxy {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
this.connected = false;
|
|
10
10
|
this.pendingQueue = [];
|
|
11
|
-
const host = appconfig_1.envArgs.send_tx_ws_host;
|
|
11
|
+
const host = appconfig_1.envArgs.send_tx_ws_host || '127.0.0.1';
|
|
12
12
|
this.wsUrl = `ws://${host}:${ttd_core_1.SERVICE_PORT.SEND_TX_WS}/bsc/send_tx`;
|
|
13
13
|
this.clientName = process.env.APP_NAME
|
|
14
14
|
|| process.env.name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-bsc-send-tx",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "BSC 交易发送模块(HTTP直发 + WS bundle 转发)",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"push": "npm run build && npm publish"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@clonegod/ttd-core": "3.1.
|
|
15
|
+
"@clonegod/ttd-core": "3.1.55",
|
|
16
16
|
"axios": "1.15.0",
|
|
17
17
|
"dotenv": "^16.4.7",
|
|
18
18
|
"ethers": "^5.8.0",
|