@clonegod/ttd-sol-common 1.0.53 → 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.
@@ -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 uiAmount = (Number(this.order_msg.amount).toFixed(inputToken.decimals));
39
- if (amount !== uiAmount) {
40
- (0, dist_1.log_warn)(`Fix input token's amount decimal: from ${amount} to ${uiAmount}`);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",