diff options
author | Dan <danjm.com@gmail.com> | 2017-09-13 21:45:50 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-14 05:22:58 +0800 |
commit | 09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f (patch) | |
tree | 1dfbebeab6ed8e33d7f8beadfd4ce77c9b047bfd /ui/app | |
parent | 55d62190e3ec06b1b21ed3ba24b2f2a9bc137568 (diff) | |
download | tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.tar tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.tar.gz tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.tar.bz2 tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.tar.lz tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.tar.xz tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.tar.zst tangerine-wallet-browser-09a4491bb1fe0acfbc4b55ca1dd2b2a813454c6f.zip |
Fix saving/sending of amounts in USD
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/send.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/app/send.js b/ui/app/send.js index a7e81a847..d223db96f 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -21,6 +21,7 @@ const { const { stripHexPrefix, addHexPrefix } = require('ethereumjs-util') const { isHex, numericBalance } = require('./util') const { conversionUtil } = require('./conversion-util') +const BigNumber = require('bignumber.js') const ARAGON = '960b236A07cf122663c4303350609A66A7B288C0' @@ -243,7 +244,7 @@ SendTransactionScreen.prototype.render = function () { ]), h('input.large-input.send-screen-input', { - placeholder: '0 ETH', + placeholder: `0 ${currentCurrency}`, type: 'number', onChange: (event) => { this.setState({ @@ -667,14 +668,19 @@ SendTransactionScreen.prototype.onSubmit = function () { this.props.dispatch(addToAddressBook(recipient, nickname)) + // TODO: need a clean way to integrate this into conversionUtil + const sendConversionRate = this.props.currentCurrency === 'ETH' + ? this.props.conversionRate + : new BigNumber(1.0).div(this.props.conversionRate) + const sendAmount = conversionUtil(this.state.newTx.amount, { fromNumericBase: 'dec', toNumericBase: 'hex', fromCurrency: this.props.currentCurrency, toCurrency: 'ETH', - conversionRate: this.props.conversionRate, + conversionRate: sendConversionRate, }) - + var txParams = { from: this.state.newTx.from, to: this.state.newTx.to, |