aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-30 02:00:03 +0800
committerDan <danjm.com@gmail.com>2018-03-30 02:00:03 +0800
commita4594f6838a9ff38a9a6f1998850b27beebb2fbb (patch)
tree24086a2ea89ef199ab4c90a186706a7f2b7678bf
parentd6ebf5d94e374adbd2c2a66e8e5fb7f35fe5b6b2 (diff)
downloadtangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.tar
tangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.tar.gz
tangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.tar.bz2
tangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.tar.lz
tangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.tar.xz
tangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.tar.zst
tangerine-wallet-browser-a4594f6838a9ff38a9a6f1998850b27beebb2fbb.zip
Show insufficient funds on confirm screen on first render.
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js12
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js10
2 files changed, 21 insertions, 1 deletions
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index c91911c3d..78dae266d 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -103,6 +103,18 @@ function ConfirmSendEther () {
this.onSubmit = this.onSubmit.bind(this)
}
+ConfirmSendEther.prototype.componentWillMount = function () {
+ const { updateSendErrors } = this.props
+ const txMeta = this.gatherTxMeta()
+ const balanceIsSufficient = this.isBalanceSufficient(txMeta)
+
+ updateSendErrors({
+ insufficientFunds: balanceIsSufficient
+ ? false
+ : this.props.t('insufficientFunds')
+ })
+}
+
ConfirmSendEther.prototype.getAmount = function () {
const { conversionRate, currentCurrency } = this.props
const txMeta = this.gatherTxMeta()
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index dd115e890..ed0be601e 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -142,12 +142,20 @@ function ConfirmSendToken () {
}
ConfirmSendToken.prototype.componentWillMount = function () {
- const { tokenContract, selectedAddress } = this.props
+ const { tokenContract, selectedAddress, updateSendErrors} = this.props
+ const txMeta = this.gatherTxMeta()
+ const balanceIsSufficient = this.isBalanceSufficient(txMeta)
tokenContract && tokenContract
.balanceOf(selectedAddress)
.then(usersToken => {
})
this.props.updateTokenExchangeRate()
+
+ updateSendErrors({
+ insufficientFunds: balanceIsSufficient
+ ? false
+ : this.props.t('insufficientFunds')
+ })
}
ConfirmSendToken.prototype.getAmount = function () {