@clonegod/ttd-sol-common 1.0.108 → 1.0.109
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.
|
@@ -32,7 +32,6 @@ const get_quote_token_decimals = (pool_info) => {
|
|
|
32
32
|
exports.get_quote_token_decimals = get_quote_token_decimals;
|
|
33
33
|
function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price, quote_bid_price, pool_info, time) {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
let quote_token_decimals = (0, exports.get_quote_token_decimals)(pool_info);
|
|
36
35
|
let { pool_address, tokenA, tokenB } = pool_info;
|
|
37
36
|
let { dex_id, pool_name, fee_rate, is_reverse_token } = yield appConfig.arb_cache.get_one_pool_info(pool_address);
|
|
38
37
|
let _dex_id = dex_id;
|
|
@@ -41,8 +40,8 @@ function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price
|
|
|
41
40
|
let unique_orderbook_id = (0, dist_1.format_unique_orderbook_id)(chain_id, _dex_id, pool_address, fee_rate);
|
|
42
41
|
time.price_time = new Date().getTime();
|
|
43
42
|
let fee_rate_bps = fee_rate / 100100;
|
|
44
|
-
let ask_price = getAskPrice(new decimal_js_1.default(quote_ask_price), fee_rate_bps * 0
|
|
45
|
-
let bid_price = getBidPrice(new decimal_js_1.default(quote_bid_price), fee_rate_bps * 0
|
|
43
|
+
let ask_price = getAskPrice(new decimal_js_1.default(quote_ask_price), fee_rate_bps * 0);
|
|
44
|
+
let bid_price = getBidPrice(new decimal_js_1.default(quote_bid_price), fee_rate_bps * 0);
|
|
46
45
|
let price_message = {
|
|
47
46
|
chain_id,
|
|
48
47
|
dex_id,
|
|
@@ -69,7 +68,7 @@ function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price
|
|
|
69
68
|
name: tokenB.name,
|
|
70
69
|
enable: true,
|
|
71
70
|
},
|
|
72
|
-
tx_price: tx_price === null || tx_price === void 0 ? void 0 : tx_price.toFixed(
|
|
71
|
+
tx_price: tx_price === null || tx_price === void 0 ? void 0 : tx_price.toFixed(12),
|
|
73
72
|
quote_amount_usd,
|
|
74
73
|
ask: {
|
|
75
74
|
price: ask_price,
|
|
@@ -85,11 +84,11 @@ function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price
|
|
|
85
84
|
return price_message;
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
|
-
const getAskPrice = (price, feeRate
|
|
89
|
-
return price.mul(1 + feeRate).toFixed(
|
|
87
|
+
const getAskPrice = (price, feeRate) => {
|
|
88
|
+
return price.mul(1 + feeRate).toFixed(12);
|
|
90
89
|
};
|
|
91
|
-
const getBidPrice = (price, feeRate
|
|
92
|
-
return price.mul(1 - feeRate).toFixed(
|
|
90
|
+
const getBidPrice = (price, feeRate) => {
|
|
91
|
+
return price.mul(1 - feeRate).toFixed(12);
|
|
93
92
|
};
|
|
94
93
|
function normalize_pair_name(priceMessage) {
|
|
95
94
|
let { pool_name, is_reverse_token } = priceMessage;
|