mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Truncate extra decimal places from token amount for sending (#12169)
This commit is contained in:
parent
c9ce848f47
commit
9e7b52b7df
@ -78,8 +78,13 @@ export default class TokenInput extends PureComponent {
|
|||||||
handleChange = (decimalValue) => {
|
handleChange = (decimalValue) => {
|
||||||
const { token: { decimals } = {}, onChange } = this.props;
|
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 multiplier = Math.pow(10, Number(decimals || 0));
|
||||||
const hexValue = multiplyCurrencies(decimalValue || 0, multiplier, {
|
const hexValue = multiplyCurrencies(newDecimalValue || 0, multiplier, {
|
||||||
multiplicandBase: 10,
|
multiplicandBase: 10,
|
||||||
multiplierBase: 10,
|
multiplierBase: 10,
|
||||||
toNumericBase: 'hex',
|
toNumericBase: 'hex',
|
||||||
|
Loading…
Reference in New Issue
Block a user