diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-21 09:26:18 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-21 09:26:18 +0800 |
commit | 8f3b762461ada222f82089e686a61183dd167428 (patch) | |
tree | 1efbdbc2f91c7b7468dda469de53e0cccf8e9ac4 /ui/app/components/send/currency-display.js | |
parent | 5eb3cf43bfab3728dde151bc84439993b1a93184 (diff) | |
download | tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.tar tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.tar.gz tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.tar.bz2 tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.tar.lz tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.tar.xz tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.tar.zst tangerine-wallet-browser-8f3b762461ada222f82089e686a61183dd167428.zip |
Fix Conversions bugs; Fiat value bugs
Diffstat (limited to 'ui/app/components/send/currency-display.js')
-rw-r--r-- | ui/app/components/send/currency-display.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js index 2c9a2d33b..7180b94d3 100644 --- a/ui/app/components/send/currency-display.js +++ b/ui/app/components/send/currency-display.js @@ -36,6 +36,16 @@ function toHexWei (value) { }) } +CurrencyDisplay.prototype.getAmount = function (value) { + const { selectedToken } = this.props + const { decimals } = selectedToken || {} + const multiplier = Math.pow(10, Number(decimals || 0)) + const sendAmount = '0x' + Number(value * multiplier).toString(16) + return selectedToken + ? sendAmount + : toHexWei(value) +} + CurrencyDisplay.prototype.render = function () { const { className = 'currency-display', @@ -102,7 +112,7 @@ CurrencyDisplay.prototype.render = function () { this.setState({ value: newValue }) } }, - onBlur: event => !readOnly && handleChange(toHexWei(event.target.value.split(' ')[0])), + onBlur: event => !readOnly && handleChange(this.getAmount(event.target.value.split(' ')[0])), onKeyUp: event => { if (!readOnly) { validate(toHexWei(value || initValueToRender)) |