aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/hex-as-decimal-input.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-03-02 06:37:51 +0800
committerKevin Serrano <kevgagser@gmail.com>2017-03-02 06:37:51 +0800
commit0ac1f749fd68244682d0f2c763028cdf6aa29486 (patch)
tree1ce3ebac2f18f119dc12ad09b35bd1a8a6af9f38 /ui/app/components/hex-as-decimal-input.js
parent5f378d382e008ef577223055c9674c25e2e6bba4 (diff)
downloadtangerine-wallet-browser-0ac1f749fd68244682d0f2c763028cdf6aa29486.tar.gz
tangerine-wallet-browser-0ac1f749fd68244682d0f2c763028cdf6aa29486.tar.zst
tangerine-wallet-browser-0ac1f749fd68244682d0f2c763028cdf6aa29486.zip
Various improvements to gas input.
Diffstat (limited to 'ui/app/components/hex-as-decimal-input.js')
-rw-r--r--ui/app/components/hex-as-decimal-input.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js
index ecf232640..c89ed0416 100644
--- a/ui/app/components/hex-as-decimal-input.js
+++ b/ui/app/components/hex-as-decimal-input.js
@@ -39,16 +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',
- type: 'number',
+
}, style),
value: decimalValue,
onChange: (event) => {
- const hexString = hexify(event.target.value)
+ const hexString = (event.target.value === '') ? '' : hexify(event.target.value)
onChange(hexString)
},
}),
@@ -71,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)
+ }
}