@clonegod/ttd-bsc-common 3.1.12 → 3.1.13

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ttd_core_1 = require("@clonegod/ttd-core");
4
+ (0, ttd_core_1.registerLogRules)([
5
+ { pattern: /websocket.*(disconnect|close|error)|no heartbeat response/i, code: 'CHAIN_RPC_DISCONNECT' },
6
+ { pattern: /\b(rpc|http).*timeout\b|reconnection attempt failed/i, code: 'CHAIN_RPC_TIMEOUT' },
7
+ { pattern: /no messages received.*resubscribe/i, level: 'warn', code: 'CHAIN_POOL_EVENT_GAP' },
8
+ { pattern: /\binsufficient funds\b/i, level: 'error', code: 'TRADE_CALLER_EMPTY' },
9
+ { pattern: /\bnonce too (low|high)\b|nonce-init.*查询失败|nonceWatch.*更新失败/i,
10
+ level: 'error', code: 'TRADE_NONCE_CONFLICT' },
11
+ { pattern: /\breplacement.*underpriced\b/i, level: 'error', code: 'TRADE_GAS_UNDERPRICED' },
12
+ { pattern: /\binsufficient_output_amount|too little received\b/i,
13
+ level: 'error', code: 'TRADE_REVERT_SLIPPAGE' },
14
+ { pattern: /\bexecution reverted\b/i, level: 'error', code: 'TRADE_REVERT_UNKNOWN' },
15
+ { pattern: /failed to load poolkey|failed to encode trade|encode.*calldata.*fail/i,
16
+ level: 'error', code: 'TRADE_ENCODE_FAIL' },
17
+ { pattern: /parse transaction error|error processing trade result|failed to parse.*receipt|failed to parse traderesult/i,
18
+ level: 'error', code: 'TRADE_RECEIPT_MISS' },
19
+ { pattern: /\brate limit|(blockrazor|bloxroute|48club).*(failed|error|reject|not connected)|tiptx required for bundle/i,
20
+ code: 'TRADE_BUILDER_REJECT' },
21
+ { pattern: /failed to init.*(amm|clmm|infinity|tick cache).*pool|failed to init tick cache/i,
22
+ level: 'error', code: 'QUOTE_TICK_FETCH_FAIL' },
23
+ { pattern: /periodic refresh failed|tick cache refresh failed|stateview query failed/i,
24
+ level: 'warn', code: 'QUOTE_TICK_STALE' },
25
+ { pattern: /quote failed|error in (do_quote|calculatequote)|error loading pool data|error getting on-chain pool/i,
26
+ level: 'error', code: 'QUOTE_PRICE_ANOMALY' },
27
+ { pattern: /pancake.*(explorer|api|pools_info|top_tokens).*error/i, code: 'THIRDPARTY_API_FAIL',
28
+ context: { provider: 'pancake-explorer' } },
29
+ ]);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './alert_rules';
1
2
  export * from './common';
2
3
  export * from './config';
3
4
  export * from './quote';
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("./alert_rules");
17
18
  __exportStar(require("./common"), exports);
18
19
  __exportStar(require("./config"), exports);
19
20
  __exportStar(require("./quote"), exports);
@@ -139,7 +139,7 @@ class BaseTxResultChecker extends trade_1.AbstractTransactionResultCheck {
139
139
  (0, ttd_core_1.writeFile)(`./dist/tx_receipt_${this.txid}_${source}.json`, JSON.stringify(txReceipt, null, 2));
140
140
  }
141
141
  if (this.trade_result_already_processed) {
142
- logger.warn(`trade_result_already_processed, ignore result from ${source}!`);
142
+ logger.info(`trade_result_already_processed, ignore result from ${source}`);
143
143
  return;
144
144
  }
145
145
  const parser = this.createParser();
@@ -47,10 +47,10 @@ class TradeTrace {
47
47
  flush() {
48
48
  const timeline = this.buildTimeline();
49
49
  if (this.error) {
50
- logger.info(`[TRADE FAILED] ${this.orderId} | ${this.pair} ${this.direction}`, {
50
+ logger.error(`[TRADE FAILED] ${this.orderId} | ${this.pair} ${this.direction} | stage=${this.error.stage} | ${this.error.message}`, new Error(this.error.message));
51
+ logger.info(`[TRADE FAILED detail] ${this.orderId}`, {
51
52
  timeline,
52
53
  error_stage: this.error.stage,
53
- error: this.error.message,
54
54
  ...this.data,
55
55
  });
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "3.1.12",
3
+ "version": "3.1.13",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",
@@ -14,7 +14,7 @@
14
14
  "push": "npm run build && npm publish"
15
15
  },
16
16
  "dependencies": {
17
- "@clonegod/ttd-core": "3.1.12",
17
+ "@clonegod/ttd-core": "3.1.13",
18
18
  "axios": "^1.12.0",
19
19
  "dotenv": "^16.4.7",
20
20
  "ethers": "^5.8.0",