Truncate extra decimal places from token amount for sending (#12169)

feature/default_network_editable
Jyoti Puri 3 years ago committed by GitHub
parent c9ce848f47
commit 9e7b52b7df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      ui/components/ui/token-input/token-input.component.js

@ -78,8 +78,13 @@ export default class TokenInput extends PureComponent {
handleChange = (decimalValue) => {
const { token: { decimals } = {}, onChange } = this.props;
let newDecimalValue = decimalValue;
if (decimals) {
newDecimalValue = parseFloat(decimalValue).toFixed(decimals);
}
const multiplier = Math.pow(10, Number(decimals || 0));
const hexValue = multiplyCurrencies(decimalValue || 0, multiplier, {
const hexValue = multiplyCurrencies(newDecimalValue || 0, multiplier, {
multiplicandBase: 10,
multiplierBase: 10,
toNumericBase: 'hex',

Loading…
Cancel
Save