aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/send-v2.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-06 11:53:29 +0800
committerDan <danjm.com@gmail.com>2018-03-06 11:53:29 +0800
commit462d57cb6aaeab233bcade5ef1804eeaa290bae2 (patch)
tree38fb3bb7a25f6d4dd6003178bc40d8c53412e755 /ui/app/send-v2.js
parent1bd18cebd7e08edbbcf35407b962e71dcd2c3399 (diff)
downloadtangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.tar
tangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.tar.gz
tangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.tar.bz2
tangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.tar.lz
tangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.tar.xz
tangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.tar.zst
tangerine-wallet-browser-462d57cb6aaeab233bcade5ef1804eeaa290bae2.zip
Gracefully handle null token balance in new ui send.
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r--ui/app/send-v2.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js
index 1d67150e3..6ee7c0ca5 100644
--- a/ui/app/send-v2.js
+++ b/ui/app/send-v2.js
@@ -361,8 +361,9 @@ SendTransactionScreen.prototype.validateAmount = function (value) {
})
}
+ const verifyTokenBalance = selectedToken && tokenBalance !== null
let sufficientTokens
- if (selectedToken) {
+ if (verifyTokenBalance) {
sufficientTokens = isTokenBalanceSufficient({
tokenBalance,
amount,
@@ -377,7 +378,7 @@ SendTransactionScreen.prototype.validateAmount = function (value) {
if (conversionRate && !sufficientBalance) {
amountError = 'Insufficient funds.'
- } else if (selectedToken && !sufficientTokens) {
+ } else if (verifyTokenBalance && !sufficientTokens) {
amountError = 'Insufficient tokens.'
} else if (amountLessThanZero) {
amountError = 'Can not send negative amounts of ETH.'
@@ -491,9 +492,12 @@ SendTransactionScreen.prototype.renderFooter = function () {
goHome,
clearSend,
gasTotal,
+ tokenBalance,
+ selectedToken,
errors: { amount: amountError, to: toError },
} = this.props
+ const missingTokenBalance = selectedToken && !tokenBalance
const noErrors = !amountError && toError === null
return h('div.page-container__footer', [
@@ -504,7 +508,7 @@ SendTransactionScreen.prototype.renderFooter = function () {
},
}, 'Cancel'),
h('button.btn-clear.page-container__footer-button', {
- disabled: !noErrors || !gasTotal,
+ disabled: !noErrors || !gasTotal || missingTokenBalance,
onClick: event => this.onSubmit(event),
}, 'Next'),
])