@clonegod/ttd-core 3.1.58 → 3.1.59
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/alert/registry.d.ts +0 -1
- package/dist/alert/registry.js +0 -1
- package/dist/quote/on_quote_response.js +2 -2
- package/dist/quote/to_price_message.d.ts +1 -1
- package/dist/quote/to_price_message.js +2 -3
- package/dist/trade/abstract_tx_check.js +2 -1
- package/package.json +1 -1
- package/types/index.d.ts +6 -10
package/dist/alert/registry.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export declare const ALERT_TYPES: {
|
|
|
24
24
|
readonly QUOTE_POOL_INIT_FAILED: AlertTypeDef;
|
|
25
25
|
readonly QUOTE_V2_STALL: AlertTypeDef;
|
|
26
26
|
readonly QUOTE_VERIFY_HIGH_DRIFT: AlertTypeDef;
|
|
27
|
-
readonly QUOTE_HOOK_FEE_CHANGE: AlertTypeDef;
|
|
28
27
|
readonly TRADE_NONCE_DESYNC: AlertTypeDef;
|
|
29
28
|
readonly TRADE_CALLER_LOW_BALANCE: AlertTypeDef;
|
|
30
29
|
readonly TRADE_TX_PENDING_TOO_LONG: AlertTypeDef;
|
package/dist/alert/registry.js
CHANGED
|
@@ -138,7 +138,6 @@ exports.ALERT_TYPES = {
|
|
|
138
138
|
QUOTE_POOL_INIT_FAILED: def('quote.pool_init_failed', 'critical', { display: '池子初始化失败', ttl_ms: 0, enable: true }),
|
|
139
139
|
QUOTE_V2_STALL: def('quote.v2_stall', 'warn', { display: 'V2 事件流停摆(降级 V1)', ttl_ms: 60000, enable: true, auto_resolve_on_recheck: true }),
|
|
140
140
|
QUOTE_VERIFY_HIGH_DRIFT: def('quote.verify_high_drift', 'warn', { display: '报价反校验偏差超阈值', ttl_ms: 300000, enable: true }),
|
|
141
|
-
QUOTE_HOOK_FEE_CHANGE: def('quote.hook_fee_change', 'info', { display: 'Hook 动态 fee 变化', ttl_ms: 0, enable: true, kind: 'event' }),
|
|
142
141
|
TRADE_NONCE_DESYNC: def('trade.nonce_desync', 'critical', { display: 'Nonce 不同步', ttl_ms: 30000, enable: true, auto_resolve_on_recheck: true }),
|
|
143
142
|
TRADE_CALLER_LOW_BALANCE: def('trade.caller_low_balance', 'warn', { display: 'Caller 余额不足', ttl_ms: 300000, enable: true }),
|
|
144
143
|
TRADE_TX_PENDING_TOO_LONG: def('trade.tx_pending_too_long', 'warn', { display: '交易长时间未上链', ttl_ms: 60000, enable: true }),
|
|
@@ -21,13 +21,13 @@ function on_quote_response(opts) {
|
|
|
21
21
|
price_time: priceTime,
|
|
22
22
|
total_quote_time: priceTime - streamTime
|
|
23
23
|
};
|
|
24
|
-
(0, to_price_message_1.to_price_message)(appConfig, quoteAmountUsd, 0, quoteAskPrice, quoteBidPrice, poolInfo, time,
|
|
24
|
+
(0, to_price_message_1.to_price_message)(appConfig, quoteAmountUsd, 0, quoteAskPrice, quoteBidPrice, poolInfo, time, blockNumber, source, depth)
|
|
25
25
|
.then((price_msg) => {
|
|
26
26
|
if (pushPriceMessage) {
|
|
27
27
|
(0, publish_quote_price_1.publish_quote_price)(appConfig, price_msg);
|
|
28
28
|
}
|
|
29
29
|
(0, log_quote_price_1.log_quote_price)(String(blockNumber), price_msg, txid);
|
|
30
|
-
(0, analyze_1.report_data_to_analyze)('PriceMessageType', Object.assign(Object.assign({}, price_msg), { quote_source: {
|
|
30
|
+
(0, analyze_1.report_data_to_analyze)('PriceMessageType', Object.assign(Object.assign({}, price_msg), { quote_source: { block_number: blockNumber, txid } }));
|
|
31
31
|
if (depth) {
|
|
32
32
|
(0, analyze_1.report_data_to_analyze)('DepthLevels', {
|
|
33
33
|
price_id: price_msg.price_id,
|
|
@@ -2,5 +2,5 @@ import { StandardPoolInfoType, QuoteTimeInfoType, PriceMessageType } from '../..
|
|
|
2
2
|
import { AppConfig } from '../appconfig';
|
|
3
3
|
import { QuoteDepthOutput } from './depth_tier';
|
|
4
4
|
export declare const get_quote_token_decimals: (pool_info: StandardPoolInfoType) => number;
|
|
5
|
-
export declare function to_price_message(appConfig: AppConfig, quote_amount_usd: number, tx_price: number, quote_ask_price: number, quote_bid_price: number, pool_info: StandardPoolInfoType, time: QuoteTimeInfoType,
|
|
5
|
+
export declare function to_price_message(appConfig: AppConfig, quote_amount_usd: number, tx_price: number, quote_ask_price: number, quote_bid_price: number, pool_info: StandardPoolInfoType, time: QuoteTimeInfoType, blockNumber: number, source: string, depth?: QuoteDepthOutput): Promise<PriceMessageType>;
|
|
6
6
|
export declare function normalize_pair_name(priceMessage: PriceMessageType): void;
|
|
@@ -26,7 +26,7 @@ const get_quote_token_decimals = (pool_info) => {
|
|
|
26
26
|
return decimals;
|
|
27
27
|
};
|
|
28
28
|
exports.get_quote_token_decimals = get_quote_token_decimals;
|
|
29
|
-
function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price, quote_bid_price, pool_info, time,
|
|
29
|
+
function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price, quote_bid_price, pool_info, time, blockNumber, source, depth) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
let { pool_address, tokenA, tokenB } = pool_info;
|
|
32
32
|
let { dex_id, pool_name, fee_rate, is_reverse_token } = yield appConfig.arb_cache.get_one_pool_info(pool_address);
|
|
@@ -84,8 +84,7 @@ function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price
|
|
|
84
84
|
ask,
|
|
85
85
|
bid,
|
|
86
86
|
time,
|
|
87
|
-
|
|
88
|
-
blockNumber: slot ? parseInt(slot, 10) || undefined : undefined,
|
|
87
|
+
blockNumber: blockNumber > 0 ? blockNumber : undefined,
|
|
89
88
|
source: source !== null && source !== void 0 ? source : '',
|
|
90
89
|
};
|
|
91
90
|
normalize_pair_name(price_message);
|
|
@@ -51,7 +51,7 @@ class AbstractTransactionResultCheck {
|
|
|
51
51
|
}
|
|
52
52
|
map_swap_result_to_tx_result(swap_result) {
|
|
53
53
|
var _a;
|
|
54
|
-
let { success, error_code, wallet, block_number, block_time: order_block_time, txid, tx_price, tokenA, tokenB, gas_fee } = swap_result;
|
|
54
|
+
let { success, error_code, wallet, block_number, tx_index, block_time: order_block_time, txid, tx_price, tokenA, tokenB, gas_fee } = swap_result;
|
|
55
55
|
if (this.context.ui_tip_amount) {
|
|
56
56
|
gas_fee.priority_fee = this.context.ui_tip_amount;
|
|
57
57
|
gas_fee.total_fee = gas_fee.base_fee + gas_fee.priority_fee;
|
|
@@ -81,6 +81,7 @@ class AbstractTransactionResultCheck {
|
|
|
81
81
|
total_order_time,
|
|
82
82
|
};
|
|
83
83
|
time.order_block_number = block_number || 0;
|
|
84
|
+
time.order_tx_index = tx_index || 0;
|
|
84
85
|
const _marks = (_a = this.context) === null || _a === void 0 ? void 0 : _a._execution_marks;
|
|
85
86
|
if (_marks) {
|
|
86
87
|
;
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -285,15 +285,15 @@ export interface PriceMessageType {
|
|
|
285
285
|
/** 买方报价:同上,两种形态共存 */
|
|
286
286
|
bid: QuoteEntry | PriceType
|
|
287
287
|
time: QuoteTimeInfoType // quote 耗时数据
|
|
288
|
-
|
|
289
|
-
blockNumber
|
|
288
|
+
/** 报价基于的区块号;0 / 缺失表示无 block 信息(如 PriceFeed 路径) */
|
|
289
|
+
blockNumber: number
|
|
290
290
|
quote_source?: QuoteSourceType // 触发本次询价的事件源信息
|
|
291
291
|
source?: string // 报价来源:rpc:v1, QuickNode:v2, YYWS:v3
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
export interface QuoteSourceType {
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
/** 触发本次询价的事件所在 block;0 表示无 block 信息 */
|
|
296
|
+
block_number: number
|
|
297
297
|
txid: string
|
|
298
298
|
}
|
|
299
299
|
|
|
@@ -355,12 +355,6 @@ export interface Ladder {
|
|
|
355
355
|
/** 多档完整数据(按 pct 升序:0.1, 0.2, 0.3, 0.5, 1.0) */
|
|
356
356
|
tiers: { pct: number; price: string; qty: string; usd_value: string }[]
|
|
357
357
|
|
|
358
|
-
// 询价生成的价格,所对应的slot (account, vaultA, vaultB)
|
|
359
|
-
slot: string
|
|
360
|
-
|
|
361
|
-
// 区块号
|
|
362
|
-
block_number?: string
|
|
363
|
-
|
|
364
358
|
// 价格来源: "rpc:v1" | "{provider_id}:v2" | "{provider_id}:v3"
|
|
365
359
|
source?: string
|
|
366
360
|
|
|
@@ -430,6 +424,8 @@ export interface StandardSwapDetailType {
|
|
|
430
424
|
txid: string,
|
|
431
425
|
block_time: number
|
|
432
426
|
block_number: number
|
|
427
|
+
/** 交易在区块内的位置(从 receipt.transactionIndex 读);解析失败则 0 */
|
|
428
|
+
tx_index: number
|
|
433
429
|
|
|
434
430
|
pool_address: string
|
|
435
431
|
tokenA: TokenBalanceChangeType
|