aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/hex-as-decimal-input.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/hex-as-decimal-input.js')
-rw-r--r--ui/app/components/hex-as-decimal-input.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js
index 523c1264b..c89ed0416 100644
--- a/ui/app/components/hex-as-decimal-input.js
+++ b/ui/app/components/hex-as-decimal-input.js
@@ -39,15 +39,17 @@ HexAsDecimalInput.prototype.render = function () {
},
}, [
h('input.ether-balance.ether-balance-amount', {
+ type: 'number',
style: extend({
display: 'block',
textAlign: 'right',
backgroundColor: 'transparent',
border: '1px solid #bdbdbd',
+
}, style),
value: decimalValue,
onChange: (event) => {
- const hexString = hexify(event.target.value)
+ const hexString = (event.target.value === '') ? '' : hexify(event.target.value)
onChange(hexString)
},
}),
@@ -70,7 +72,11 @@ function hexify (decimalString) {
}
function decimalize (input, toEth) {
- const strippedInput = ethUtil.stripHexPrefix(input)
- const inputBN = new BN(strippedInput, 'hex')
- return inputBN.toString(10)
+ if (input === '') {
+ return ''
+ } else {
+ const strippedInput = ethUtil.stripHexPrefix(input)
+ const inputBN = new BN(strippedInput, 'hex')
+ return inputBN.toString(10)
+ }
}