@clonegod/ttd-sol-common 1.0.53 → 1.0.55
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 +5 -3
- package/package.json +1 -1
package/dist/common/context.js
CHANGED
|
@@ -35,10 +35,12 @@ 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 amount_with_exact_decimals = amount.substring(0, amount_dot_index + inputToken.decimals + 1);
|
|
41
|
+
let uiAmount = parseFloat(amount_with_exact_decimals).toString();
|
|
41
42
|
this.order_msg.amount = uiAmount;
|
|
43
|
+
(0, dist_1.log_warn)(`Fix input token's amount decimal: from ${amount} to ${uiAmount}`);
|
|
42
44
|
}
|
|
43
45
|
this.slippage_bps = Math.min(100, Math.max(30, this.trade_runtime.settings.slippage_bps));
|
|
44
46
|
this.aToB = this.pool_info.is_reverse_token ? !this.order_msg.aToB : this.order_msg.aToB;
|