aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/hex-as-decimal-input.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-03-08 02:37:31 +0800
committerKevin Serrano <kevgagser@gmail.com>2017-03-08 02:37:31 +0800
commit08ca7dac5a15e104084c6da3eb6015136b316809 (patch)
tree3e0b1a61f3be3aa1e01824512b4df0a793dc6a17 /ui/app/components/hex-as-decimal-input.js
parent01f2ec4823e83d986e7ecfd268f6b293f38a13e8 (diff)
parent2acf991b67bc42fb904ff77af6ff6a7ca3a683fd (diff)
downloadtangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.tar
tangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.tar.gz
tangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.tar.bz2
tangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.tar.lz
tangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.tar.xz
tangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.tar.zst
tangerine-wallet-browser-08ca7dac5a15e104084c6da3eb6015136b316809.zip
Merge branch 'master' into i1144-moarrpc
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)
+ }
}