@clonegod/ttd-bsc-common 1.0.37 → 1.0.38
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.
|
@@ -9,8 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
|
|
12
|
+
exports.BscMainnetRpc = void 0;
|
|
13
|
+
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
14
|
+
class BscMainnetRpc {
|
|
14
15
|
constructor(rpc_endpoint) {
|
|
15
16
|
this.url = rpc_endpoint || process.env.BSC_RPC_ENDPOINT || '';
|
|
16
17
|
this.headers = new Headers();
|
|
@@ -18,26 +19,29 @@ class BscRpc {
|
|
|
18
19
|
}
|
|
19
20
|
eth_sendRawTransaction(signedTx) {
|
|
20
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
console.log(`Sending transaction to ${this.url}`);
|
|
24
|
+
const raw = JSON.stringify({
|
|
25
|
+
jsonrpc: "2.0",
|
|
26
|
+
method: "eth_sendRawTransaction",
|
|
27
|
+
params: [signedTx],
|
|
28
|
+
id: 1
|
|
29
|
+
});
|
|
30
|
+
const requestOptions = {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: this.headers,
|
|
33
|
+
body: raw,
|
|
34
|
+
redirect: 'follow'
|
|
35
|
+
};
|
|
36
|
+
const response = yield fetch(this.url, requestOptions);
|
|
37
|
+
const result = yield response.json();
|
|
38
|
+
if (result.error) {
|
|
39
|
+
(0, dist_1.log_warn)(result.error.message);
|
|
40
|
+
}
|
|
41
|
+
return result.result;
|
|
42
|
+
}), 0);
|
|
43
|
+
return '';
|
|
40
44
|
});
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
exports.
|
|
47
|
+
exports.BscMainnetRpc = BscMainnetRpc;
|
|
@@ -17,7 +17,7 @@ const _48club_1 = require("./48club");
|
|
|
17
17
|
const _1 = require(".");
|
|
18
18
|
class TransactionSender {
|
|
19
19
|
constructor(appConfig) {
|
|
20
|
-
this.rpc = new bsc_rpc_1.
|
|
20
|
+
this.rpc = new bsc_rpc_1.BscMainnetRpc(appConfig.env_args.rpc_endpoint);
|
|
21
21
|
this.blockRazor = new blockrazor_1.BlockRazorTrade();
|
|
22
22
|
this._48Club = new _48club_1._48ClubTrade();
|
|
23
23
|
}
|