@clonegod/ttd-core 2.0.11 → 2.0.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.
- package/dist/app_config/env_args.d.ts +7 -9
- package/dist/app_config/env_args.js +8 -10
- package/dist/app_config/index.d.ts +1 -0
- package/dist/app_config/index.js +1 -0
- package/dist/trade/abstract_tx_check.d.ts +3 -1
- package/dist/trade/abstract_tx_check.js +10 -4
- package/dist/trade/handle_order_message.js +1 -1
- package/package.json +1 -1
|
@@ -6,23 +6,21 @@ export declare class EnvArgs {
|
|
|
6
6
|
app_name: string;
|
|
7
7
|
redis_host: string;
|
|
8
8
|
redis_port: string;
|
|
9
|
+
config_center_host: string;
|
|
10
|
+
trade_analyze_url: string;
|
|
9
11
|
rpc_endpoint: string;
|
|
10
12
|
ws_endpoint: string;
|
|
11
13
|
grpc_endpoint: string;
|
|
12
14
|
grpc_token: string;
|
|
13
|
-
config_center_host: string;
|
|
14
|
-
token_market_price_url: string;
|
|
15
|
-
trade_analyze_url: string;
|
|
16
|
-
quote_pair: string;
|
|
17
|
-
quote_amount_usd: number;
|
|
18
15
|
auto_quote_enable: boolean;
|
|
19
16
|
auto_quote_interval_mills: number;
|
|
17
|
+
quote_pair: string;
|
|
18
|
+
quote_amount_usd: number;
|
|
19
|
+
quote_pool_address: string;
|
|
20
|
+
quote_pool_name: string;
|
|
21
|
+
quote_pool_fee_rate: number;
|
|
20
22
|
trade_group_id: string;
|
|
21
23
|
trade_pair: string;
|
|
22
|
-
trade_dex_id: DEX_ID;
|
|
23
|
-
trade_pool_address: string;
|
|
24
|
-
trade_pool_name: string;
|
|
25
|
-
trade_pool_fee_rate: number;
|
|
26
24
|
token_price_cache_seconds: number;
|
|
27
25
|
constructor(chain_id?: CHAIN_ID, dex_id?: DEX_ID);
|
|
28
26
|
}
|
|
@@ -4,7 +4,7 @@ exports.EnvArgs = void 0;
|
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
class EnvArgs {
|
|
6
6
|
constructor(chain_id, dex_id) {
|
|
7
|
-
var _a, _b
|
|
7
|
+
var _a, _b;
|
|
8
8
|
this.app_name = process.env.APP_NAME || '';
|
|
9
9
|
this.chain_id = chain_id || ((_a = process.env.CHAIN_ID) === null || _a === void 0 ? void 0 : _a.toUpperCase());
|
|
10
10
|
if ((0, __1.isEmpty)(this.chain_id)) {
|
|
@@ -16,23 +16,21 @@ class EnvArgs {
|
|
|
16
16
|
this.app_base_dir = process.env.APP_BASE_DIR || '';
|
|
17
17
|
this.redis_host = process.env.REDIS_HOST;
|
|
18
18
|
this.redis_port = process.env.REDIS_PORT;
|
|
19
|
+
this.config_center_host = process.env.CONFIG_CENTER_HOST;
|
|
20
|
+
this.trade_analyze_url = process.env.TRADE_ANALYZE_URL;
|
|
19
21
|
this.rpc_endpoint = process.env.RPC_ENDPOINT;
|
|
20
22
|
this.ws_endpoint = process.env.WS_ENDPOINT;
|
|
21
23
|
this.grpc_endpoint = process.env.GRPC_ENDPOINT;
|
|
22
24
|
this.grpc_token = process.env.GRPC_TOKEN;
|
|
23
|
-
this.config_center_host = process.env.CONFIG_CENTER_HOST;
|
|
24
|
-
this.token_market_price_url = process.env.TOKEN_PRICE_URL || process.env.TOKEN_MARKET_PRICE_URL;
|
|
25
|
-
this.trade_analyze_url = process.env.TRADE_ANALYZE_URL;
|
|
26
|
-
this.quote_pair = process.env.QUOTE_PAIR;
|
|
27
|
-
this.quote_amount_usd = parseInt(process.env.QUOTE_AMOUNT_USD || '100');
|
|
28
25
|
this.auto_quote_enable = process.env.AUTO_QUOTE_ENABLE === 'true';
|
|
29
26
|
this.auto_quote_interval_mills = parseInt(process.env.AUTO_QUOTE_INTERVAL_MILLS || '60000');
|
|
27
|
+
this.quote_pair = process.env.QUOTE_PAIR;
|
|
28
|
+
this.quote_amount_usd = parseInt(process.env.QUOTE_AMOUNT_USD || '100');
|
|
29
|
+
this.quote_pool_address = process.env.QUOTE_POOL_ADDRESS;
|
|
30
|
+
this.quote_pool_name = process.env.QUOTE_POOL_NAME;
|
|
31
|
+
this.quote_pool_fee_rate = parseInt(process.env.QUOTE_POOL_FEE_RATE || '25');
|
|
30
32
|
this.trade_group_id = process.env.TRADE_GROUP_ID;
|
|
31
33
|
this.trade_pair = process.env.TRADE_PAIR;
|
|
32
|
-
this.trade_dex_id = (_c = process.env.TRADE_DEX_ID) === null || _c === void 0 ? void 0 : _c.toUpperCase();
|
|
33
|
-
this.trade_pool_address = process.env.TRADE_POOL_ADDRESS;
|
|
34
|
-
this.trade_pool_name = process.env.TRADE_POOL_NAME;
|
|
35
|
-
this.trade_pool_fee_rate = parseInt(process.env.TRADE_POOL_FEE_RATE || '0');
|
|
36
34
|
this.token_price_cache_seconds = parseInt(process.env.TOKEN_PRICE_CACHE_SECONDS || '600');
|
|
37
35
|
(0, __1.log_info)('EnvArgs init finish', this);
|
|
38
36
|
}
|
package/dist/app_config/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.getGlobalAppConfig = void 0;
|
|
18
18
|
__exportStar(require("./env_args"), exports);
|
|
19
19
|
__exportStar(require("./app_config"), exports);
|
|
20
|
+
__exportStar(require("./app_trade_config"), exports);
|
|
20
21
|
const getGlobalAppConfig = () => {
|
|
21
22
|
let app_config = global.app_config;
|
|
22
23
|
if (!app_config) {
|
|
@@ -16,7 +16,9 @@ export declare abstract class AbstractTransactionResultCheck {
|
|
|
16
16
|
intervalId: any;
|
|
17
17
|
check_count: number;
|
|
18
18
|
trade_result_already_processed: boolean;
|
|
19
|
-
constructor(env_args: EnvArgs, event_emitter: EventEmitter
|
|
19
|
+
constructor(env_args: EnvArgs, event_emitter: EventEmitter);
|
|
20
|
+
set_context(context: TradeContext): this;
|
|
21
|
+
set_txid(txid: string): this;
|
|
20
22
|
init_tx_status(): this;
|
|
21
23
|
check(): Promise<void>;
|
|
22
24
|
abstract check_tx_result_interval(): void;
|
|
@@ -12,19 +12,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AbstractTransactionResultCheck = void 0;
|
|
13
13
|
const __1 = require("..");
|
|
14
14
|
class AbstractTransactionResultCheck {
|
|
15
|
-
constructor(env_args, event_emitter
|
|
15
|
+
constructor(env_args, event_emitter) {
|
|
16
16
|
this.env_args = env_args;
|
|
17
17
|
this.event_emitter = event_emitter;
|
|
18
|
+
this.check_count = 0;
|
|
19
|
+
this.trade_result_already_processed = false;
|
|
20
|
+
}
|
|
21
|
+
set_context(context) {
|
|
18
22
|
this.context = context;
|
|
19
23
|
this.group_id = context.group_id;
|
|
20
24
|
this.wallet = context.trade_runtime.wallet.public_key;
|
|
21
|
-
this.txid = txid;
|
|
22
25
|
this.price_msg = context.price_msg;
|
|
23
26
|
this.order_msg = context.order_msg;
|
|
24
27
|
this.pool_info = context.pool_info;
|
|
25
28
|
this.trace_id = context.order_msg.order_trace_id;
|
|
26
|
-
this
|
|
27
|
-
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
set_txid(txid) {
|
|
32
|
+
this.txid = txid;
|
|
33
|
+
return this;
|
|
28
34
|
}
|
|
29
35
|
init_tx_status() {
|
|
30
36
|
let empty_trade_result = JSON.parse(JSON.stringify({
|
|
@@ -94,7 +94,7 @@ const handle_order_message = (trade_appconfig, trade_instance, tx_result_checker
|
|
|
94
94
|
txid
|
|
95
95
|
};
|
|
96
96
|
global.event_emitter = trade_appconfig;
|
|
97
|
-
tx_result_checker.init_tx_status().check();
|
|
97
|
+
tx_result_checker.set_context(context).set_txid(txid).init_tx_status().check();
|
|
98
98
|
trade_appconfig.subscribe_wallet_raw_txn_event();
|
|
99
99
|
}
|
|
100
100
|
catch (err) {
|