1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01: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) 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 () { ConfirmSendEther.prototype.getAmount = function () {
const { conversionRate, currentCurrency } = this.props const { conversionRate, currentCurrency } = this.props
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()

View File

@ -142,12 +142,20 @@ function ConfirmSendToken () {
} }
ConfirmSendToken.prototype.componentWillMount = function () { 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 tokenContract && tokenContract
.balanceOf(selectedAddress) .balanceOf(selectedAddress)
.then(usersToken => { .then(usersToken => {
}) })
this.props.updateTokenExchangeRate() this.props.updateTokenExchangeRate()
updateSendErrors({
insufficientFunds: balanceIsSufficient
? false
: this.props.t('insufficientFunds')
})
} }
ConfirmSendToken.prototype.getAmount = function () { ConfirmSendToken.prototype.getAmount = function () {