@clonegod/ttd-core 2.0.10 → 2.0.12
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/app_config.js +0 -1
- package/dist/app_config/app_trade_config.js +1 -0
- package/dist/app_config/index.d.ts +1 -0
- package/dist/app_config/index.js +1 -0
- package/dist/cache/arb_cache.js +4 -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
|
@@ -28,7 +28,6 @@ class AppConfig extends events_1.default {
|
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
this.arb_cache = (0, __1.getArbCache)(this.env_args);
|
|
30
30
|
yield this.arb_cache.init();
|
|
31
|
-
this.arb_cache.listen_trade_result(this);
|
|
32
31
|
let common_service_config = yield this.arb_cache.get_common_service();
|
|
33
32
|
if ((0, __1.isEmpty)(common_service_config)) {
|
|
34
33
|
throw new Error(`get_common_service from cache failed! read from cache=${(0, __1.to_json_str)(common_service_config)}`);
|
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) {
|
package/dist/cache/arb_cache.js
CHANGED
|
@@ -39,6 +39,10 @@ class ArbCache {
|
|
|
39
39
|
]);
|
|
40
40
|
this.redis_event_publisher = (0, index_1.getArbEventPublisher)(this);
|
|
41
41
|
(0, index_1.mkdirSync)(path_1.default.join('config', this.chain_id, 'bak').toLowerCase(), true);
|
|
42
|
+
yield Promise.all([
|
|
43
|
+
this.get_token_list_no_cache(),
|
|
44
|
+
this.get_pool_list_no_cache()
|
|
45
|
+
]);
|
|
42
46
|
if (((_a = process.env.APP_NAME) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'config-center') {
|
|
43
47
|
yield this.init_configs();
|
|
44
48
|
}
|
|
@@ -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) {
|