@clonegod/ttd-bsc-common 1.0.37 → 1.0.39

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.
@@ -245,16 +245,6 @@ class AbstractEvmDexTradePlus extends dist_1.AbastrcatTrade {
245
245
  const errorMessage = error.message ? error.message.toLowerCase() : '';
246
246
  const nonceErrorKeywords = [
247
247
  'nonce',
248
- 'nonce too low',
249
- 'nonce too high',
250
- 'nonce has already been used',
251
- 'already known',
252
- 'replacement transaction underpriced',
253
- 'transaction with same nonce',
254
- 'transaction nonce is too low',
255
- 'invalid transaction nonce',
256
- 'insufficient funds',
257
- 'sign bundle to get failure details',
258
248
  ];
259
249
  return nonceErrorKeywords.some(keyword => errorMessage.includes(keyword));
260
250
  }
@@ -1,4 +1,4 @@
1
- export declare class BscRpc {
1
+ export declare class BscMainnetRpc {
2
2
  private url;
3
3
  private headers;
4
4
  constructor(rpc_endpoint: string);
@@ -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.BscRpc = void 0;
13
- class BscRpc {
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
- console.log(`Sending transaction to ${this.url}`);
22
- const raw = JSON.stringify({
23
- jsonrpc: "2.0",
24
- method: "eth_sendRawTransaction",
25
- params: [signedTx],
26
- id: 1
27
- });
28
- const requestOptions = {
29
- method: 'POST',
30
- headers: this.headers,
31
- body: raw,
32
- redirect: 'follow'
33
- };
34
- const response = yield fetch(this.url, requestOptions);
35
- const result = yield response.json();
36
- if (result.error) {
37
- throw new Error(result.error.message);
38
- }
39
- return result.result;
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.BscRpc = BscRpc;
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.BscRpc(appConfig.env_args.rpc_endpoint);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",