1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Show insufficient funds on confirm screen on first render.

This commit is contained in:
Dan 2018-03-29 15:30:03 -02:30
parent d6ebf5d94e
commit a4594f6838
2 changed files with 21 additions and 1 deletions

View File

@ -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()

View File

@ -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 () {