diff options
author | Daniel Tsui <szehungdanieltsui@gmail.com> | 2017-10-24 19:32:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 19:32:19 +0800 |
commit | 09445ef692f5a63b1a4bd418962dca2892e4cda9 (patch) | |
tree | 155484d2dfade59955f888f729b631581527475e /ui/app/send-v2.js | |
parent | 0a436dcf9a1283a8452966fea2508801de589ab7 (diff) | |
parent | de3a48ec66f044d4116f8dbd25c358ab30d073a9 (diff) | |
download | tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.tar tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.tar.gz tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.tar.bz2 tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.tar.lz tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.tar.xz tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.tar.zst tangerine-wallet-browser-09445ef692f5a63b1a4bd418962dca2892e4cda9.zip |
Merge branch 'NewUI-flat' into NewUI-flat-disable-send-next-in-error
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r-- | ui/app/send-v2.js | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 4986edf5f..7fa8ca18a 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -2,6 +2,7 @@ const { inherits } = require('util') const PersistentForm = require('../lib/persistent-form') const h = require('react-hyperscript') const connect = require('react-redux').connect +const classnames = require('classnames') const Identicon = require('./components/identicon') const FromDropdown = require('./components/send/from-dropdown') @@ -19,6 +20,9 @@ const { conversionGreaterThan, addCurrencies, } = require('./conversion-util') +const { + isBalanceSufficient, +} = require('./components/send/send-utils.js') const { isValidAddress } = require('./util') module.exports = SendTransactionScreen @@ -237,28 +241,16 @@ SendTransactionScreen.prototype.validateAmount = function (value) { let amountError = null - const totalAmount = addCurrencies(amount, gasTotal, { - aBase: 16, - bBase: 16, - toNumericBase: 'hex', + const sufficientBalance = isBalanceSufficient({ + amount, + gasTotal, + balance, + primaryCurrency, + selectedToken, + amountConversionRate, + conversionRate, }) - const sufficientBalance = conversionGreaterThan( - { - value: balance, - fromNumericBase: 'hex', - fromCurrency: primaryCurrency, - conversionRate, - }, - { - value: totalAmount, - fromNumericBase: 'hex', - conversionRate: amountConversionRate, - fromCurrency: selectedToken || primaryCurrency, - conversionRate: amountConversionRate, - }, - ) - const amountLessThanZero = conversionGreaterThan( { value: 0, fromNumericBase: 'dec' }, { value: amount, fromNumericBase: 'hex' }, @@ -399,7 +391,6 @@ SendTransactionScreen.prototype.renderFooter = function () { }, }, 'Cancel'), h(`button.send-v2__next-btn${errorClass}`, { - onClick: event => noErrors && this.onSubmit(event), }, 'Next'), ]) } |