@clonegod/ttd-sol-common 1.0.52 → 1.0.54
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/common/context.js
CHANGED
|
@@ -35,10 +35,11 @@ class TradeContext {
|
|
|
35
35
|
}
|
|
36
36
|
let { inputToken, outputToken } = (0, dist_1.get_input_out_token)(this.pool_info, this.order_msg.aToB);
|
|
37
37
|
let { amount } = this.order_msg;
|
|
38
|
-
let
|
|
39
|
-
if (
|
|
40
|
-
|
|
38
|
+
let amount_dot_index = amount.indexOf('.');
|
|
39
|
+
if (amount_dot_index != -1) {
|
|
40
|
+
let uiAmount = amount.substring(0, amount_dot_index + inputToken.decimals + 1);
|
|
41
41
|
this.order_msg.amount = uiAmount;
|
|
42
|
+
(0, dist_1.log_warn)(`Fix input token's amount decimal: from ${amount} to ${uiAmount}`);
|
|
42
43
|
}
|
|
43
44
|
this.slippage_bps = Math.min(100, Math.max(30, this.trade_runtime.settings.slippage_bps));
|
|
44
45
|
this.aToB = this.pool_info.is_reverse_token ? !this.order_msg.aToB : this.order_msg.aToB;
|
|
@@ -6,8 +6,8 @@ const constants_1 = require("../common/constants");
|
|
|
6
6
|
function create_solana_trade_runtime(connection, trade_runtime, pool_info) {
|
|
7
7
|
let trade_strategy = trade_runtime.settings.strategy;
|
|
8
8
|
let { cu_limit } = pool_info;
|
|
9
|
-
if (isNaN(cu_limit) || cu_limit <
|
|
10
|
-
cu_limit =
|
|
9
|
+
if (isNaN(cu_limit) || cu_limit < 35000) {
|
|
10
|
+
cu_limit = 35000;
|
|
11
11
|
}
|
|
12
12
|
let priority_fee = calculate_gas_fee(trade_strategy);
|
|
13
13
|
let cu_price = Math.ceil(priority_fee * constants_1.ONE_MILLION / cu_limit);
|