aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/currency-display.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/send/currency-display.js')
-rw-r--r--ui/app/components/send/currency-display.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js
index 3bc9ad226..5e2c5fdf6 100644
--- a/ui/app/components/send/currency-display.js
+++ b/ui/app/components/send/currency-display.js
@@ -57,6 +57,7 @@ CurrencyDisplay.prototype.getValueToRender = function ({ selectedToken, conversi
return selectedToken
? conversionUtil(ethUtil.addHexPrefix(value), {
fromNumericBase: 'hex',
+ toNumericBase: 'dec',
toCurrency: symbol,
conversionRate: multiplier,
invertConversionRate: true,
@@ -91,8 +92,12 @@ CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValu
: convertedValue
}
+function removeLeadingZeroes (str) {
+ return str.replace(/^0*(?=\d)/, '')
+}
+
CurrencyDisplay.prototype.handleChange = function (newVal) {
- this.setState({ valueToRender: newVal })
+ this.setState({ valueToRender: removeLeadingZeroes(newVal) })
this.props.onChange(this.getAmount(newVal))
}
@@ -113,6 +118,7 @@ CurrencyDisplay.prototype.render = function () {
readOnly = false,
inError = false,
onBlur,
+ step,
} = this.props
const { valueToRender } = this.state
@@ -147,6 +153,7 @@ CurrencyDisplay.prototype.render = function () {
width: this.getInputWidth(valueToRender, readOnly),
},
min: 0,
+ step,
}),
h('span.currency-display__currency-symbol', primaryCurrency),