@clonegod/ttd-core 3.1.15 → 3.1.17

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.
@@ -38,7 +38,7 @@ function on_quote_response(opts) {
38
38
  });
39
39
  }
40
40
  if (tickLiquidity) {
41
- const poolAddr = price_msg.pool_id || '';
41
+ const poolAddr = String(price_msg.pool_id || '').trim().toLowerCase();
42
42
  const now = Date.now();
43
43
  const lastPush = _tickLiquidityLastPush.get(poolAddr) || 0;
44
44
  if (now - lastPush >= TICK_LIQUIDITY_INTERVAL_MS) {
@@ -16,13 +16,12 @@ const get_fixed_symbol_address = () => {
16
16
  }
17
17
  const filepath = process.env.BSC_FIXED_SYMBOL_ADDRESS_FILE ||
18
18
  path_1.default.join(os_1.default.homedir(), 'data', 'onchain_data', chain_id.toLowerCase(), 'fixed_symbol_address.json');
19
- const print_log = process.env.PRINT_FIXED_SYMBOL_ADDRESS === 'true';
20
19
  let list = [];
21
20
  try {
22
- list = (0, index_1.readFile)(filepath, true, true);
23
- if (print_log && !_first_load_logged) {
24
- (0, index_1.log_info)(`[fixed_symbol_address] loaded ${list.length} entries from ${filepath}`);
21
+ list = (0, index_1.readFile)(filepath, true, false);
22
+ if (!_first_load_logged) {
25
23
  _first_load_logged = true;
24
+ (0, index_1.log_info)(`[fixed_symbol_address] loaded ${list.length} entries from ${filepath}`);
26
25
  }
27
26
  }
28
27
  catch (error) {
@@ -48,6 +48,7 @@ const fetchPriceFromCache = (token_address_list) => __awaiter(void 0, void 0, vo
48
48
  address: token_info.address,
49
49
  price: token_info.market_price,
50
50
  update_time: token_info.update_time,
51
+ decimals: token_info.decimals,
51
52
  });
52
53
  (0, __1.log_debug)(`get token price from cache(token_info) success: ${token_info.symbol} ${token_info.address}, price=${token_info.market_price} (${diff_seconds}s ago)`);
53
54
  }
@@ -65,6 +66,7 @@ const fetchPriceFromCache = (token_address_list) => __awaiter(void 0, void 0, vo
65
66
  address: token_info.address,
66
67
  price: price_info.market_price,
67
68
  update_time: price_info.update_time,
69
+ decimals: price_info.decimals,
68
70
  });
69
71
  let diff_seconds = get_diff_seconds(price_info.update_time, Date.now());
70
72
  (0, __1.log_debug)(`get token price from cache(market_price) success: ${token_info.symbol} ${token_info.address}, price=${price_info.market_price} (${diff_seconds}s ago)`);
@@ -32,4 +32,5 @@ export interface FormattedTokenPrice {
32
32
  update_time: string;
33
33
  symbol?: string;
34
34
  name?: string;
35
+ decimals?: number;
35
36
  }
@@ -17,13 +17,12 @@ const get_zh_pinyin_map = () => {
17
17
  }
18
18
  const filepath = process.env.ZH_PINYIN_MAP_FILE ||
19
19
  path_1.default.join(os_1.default.homedir(), 'data', 'onchain_data', chain_id.toLowerCase(), 'zh_pinyin_map.json');
20
- const print_log = process.env.PRINT_ZH_PINYIN_MAP === 'true';
21
20
  let list = [];
22
21
  try {
23
- list = (0, index_1.readFile)(filepath, true, true);
24
- if (print_log && !_first_load_logged) {
25
- (0, index_1.log_info)(`[zh_pinyin_map] loaded ${list.length} entries from ${filepath}`);
22
+ list = (0, index_1.readFile)(filepath, true, false);
23
+ if (!_first_load_logged) {
26
24
  _first_load_logged = true;
25
+ (0, index_1.log_info)(`[zh_pinyin_map] loaded ${list.length} entries from ${filepath}`);
27
26
  }
28
27
  }
29
28
  catch (error) {
@@ -0,0 +1 @@
1
+ export declare function getConfigCenterHttpOrigin(): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getConfigCenterHttpOrigin = getConfigCenterHttpOrigin;
4
+ const service_ports_1 = require("../constants/service_ports");
5
+ function getConfigCenterHttpOrigin() {
6
+ const raw = (process.env.CONFIG_CENTER_HOST || '127.0.0.1').trim();
7
+ if (!raw) {
8
+ return `http://127.0.0.1:${service_ports_1.SERVICE_PORT.CONFIG_CENTER_HTTP}`;
9
+ }
10
+ if (/:\d+$/.test(raw) || /\]:\d+$/.test(raw)) {
11
+ return `http://${raw}`;
12
+ }
13
+ return `http://${raw}:${service_ports_1.SERVICE_PORT.CONFIG_CENTER_HTTP}`;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-core",
3
- "version": "3.1.15",
3
+ "version": "3.1.17",
4
4
  "description": "Common types and utilities for trading systems - use `npm run push` to publish",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",