diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-03-28 10:42:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-28 10:42:42 +0800 |
commit | b324a9c29506661c18034df37f2cb17e66972915 (patch) | |
tree | 8d122128b5e43251a2275d6f2108178ab74897ff /ui/app/send-v2.js | |
parent | 74ac3bb2a7130675a10e1701d569b2c35a948f8f (diff) | |
parent | 871edfe12ad37545c596e2e926afc458c0efa559 (diff) | |
download | tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.tar tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.tar.gz tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.tar.bz2 tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.tar.lz tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.tar.xz tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.tar.zst tangerine-wallet-browser-b324a9c29506661c18034df37f2cb17e66972915.zip |
Merge branch 'master' into i3471-checkbalanceonconfirmscreen
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r-- | ui/app/send-v2.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 497d0b147..df3ec6585 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -1,7 +1,6 @@ const { inherits } = require('util') const PersistentForm = require('../lib/persistent-form') const h = require('react-hyperscript') -const t = require('../i18n') const ethAbi = require('ethereumjs-abi') const ethUtil = require('ethereumjs-util') @@ -182,9 +181,9 @@ SendTransactionScreen.prototype.renderHeader = function () { return h('div.page-container__header', [ - h('div.page-container__title', selectedToken ? t('sendTokens') : t('sendETH')), + h('div.page-container__title', selectedToken ? this.props.t('sendTokens') : this.props.t('sendETH')), - h('div.page-container__subtitle', t('onlySendToEtherAddress')), + h('div.page-container__subtitle', this.props.t('onlySendToEtherAddress')), h('div.page-container__header-close', { onClick: () => { @@ -255,11 +254,11 @@ SendTransactionScreen.prototype.handleToChange = function (to, nickname = '') { let toError = null if (!to) { - toError = t('required') + toError = this.props.t('required') } else if (!isValidAddress(to)) { - toError = t('invalidAddressRecipient') + toError = this.props.t('invalidAddressRecipient') } else if (to === from) { - toError = t('fromToSame') + toError = this.props.t('fromToSame') } updateSendTo(to, nickname) @@ -275,9 +274,9 @@ SendTransactionScreen.prototype.renderToRow = function () { h('div.send-v2__form-label', [ - t('to'), + this.props.t('to'), - this.renderErrorMessage(t('to')), + this.renderErrorMessage(this.props.t('to')), ]), @@ -378,11 +377,11 @@ SendTransactionScreen.prototype.validateAmount = function (value) { ) if (conversionRate && !sufficientBalance) { - amountError = t('insufficientFunds') + amountError = this.props.t('insufficientFunds') } else if (verifyTokenBalance && !sufficientTokens) { - amountError = t('insufficientTokens') + amountError = this.props.t('insufficientTokens') } else if (amountLessThanZero) { - amountError = t('negativeETH') + amountError = this.props.t('negativeETH') } updateSendErrors({ amount: amountError }) @@ -412,7 +411,7 @@ SendTransactionScreen.prototype.renderAmountRow = function () { setMaxModeTo(true) this.setAmountToMax() }, - }, [ !maxModeOn ? t('max') : '' ]), + }, [ !maxModeOn ? this.props.t('max') : '' ]), ]), h('div.send-v2__form-field', [ @@ -511,11 +510,11 @@ SendTransactionScreen.prototype.renderFooter = function () { clearSend() goHome() }, - }, t('cancel')), + }, this.props.t('cancel')), h('button.btn-primary--lg.page-container__footer-button', { disabled: !noErrors || !gasTotal || missingTokenBalance, onClick: event => this.onSubmit(event), - }, t('next')), + }, this.props.t('next')), ]) } @@ -590,7 +589,7 @@ SendTransactionScreen.prototype.onSubmit = function (event) { event.preventDefault() const { from: {address: from}, - to, + to: _to, amount, gasLimit: gas, gasPrice, @@ -609,6 +608,8 @@ SendTransactionScreen.prototype.onSubmit = function (event) { return } + const to = ethUtil.addHexPrefix(_to) + this.addToAddressBookIfNew(to, toNickname) if (editingTransactionId) { |