Adds simulation failure error messages to confirm screen.

feature/default_network_editable
Dan 7 years ago
parent 1dc3c51b54
commit 7ccf6163fd
  1. 3
      app/_locales/en/messages.json
  2. 15
      ui/app/components/pending-tx/confirm-send-ether.js
  3. 15
      ui/app/components/pending-tx/confirm-send-token.js
  4. 11
      ui/app/css/itcss/components/confirm.scss

@ -826,6 +826,9 @@
"transactions": { "transactions": {
"message": "transactions" "message": "transactions"
}, },
"transactionError": {
"message": "Transaction Error. Exception thrown in contract code."
},
"transactionMemo": { "transactionMemo": {
"message": "Transaction memo (optional)" "message": "Transaction memo (optional)"
}, },

@ -118,6 +118,11 @@ ConfirmSendEther.prototype.updateComponentSendErrors = function (prevProps) {
updateSendErrors, updateSendErrors,
balance, balance,
conversionRate, conversionRate,
send: {
errors: {
simulationFails,
},
},
} = this.props } = this.props
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
@ -132,6 +137,14 @@ ConfirmSendEther.prototype.updateComponentSendErrors = function (prevProps) {
insufficientFunds: balanceIsSufficient ? false : this.context.t('insufficientFunds'), insufficientFunds: balanceIsSufficient ? false : this.context.t('insufficientFunds'),
}) })
} }
const shouldUpdateSimulationSendError = Boolean(txMeta.simulationFails) !== Boolean(simulationFails)
if (shouldUpdateSimulationSendError) {
updateSendErrors({
simulationFails: !txMeta.simulationFails ? false : this.context.t('transactionError'),
})
}
} }
ConfirmSendEther.prototype.componentWillMount = function () { ConfirmSendEther.prototype.componentWillMount = function () {
@ -478,8 +491,10 @@ ConfirmSendEther.prototype.render = function () {
]), ]),
h('form#pending-tx-form', { h('form#pending-tx-form', {
className: 'confirm-screen-form',
onSubmit: this.onSubmit, onSubmit: this.onSubmit,
}, [ }, [
this.renderErrorMessage('simulationFails'),
h('.page-container__footer', [ h('.page-container__footer', [
// Cancel Button // Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', { h('button.btn-cancel.page-container__footer-button.allcaps', {

@ -156,6 +156,11 @@ ConfirmSendToken.prototype.updateComponentSendErrors = function (prevProps) {
updateSendErrors, updateSendErrors,
balance, balance,
conversionRate, conversionRate,
send: {
errors: {
simulationFails,
},
},
} = this.props } = this.props
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
@ -170,6 +175,14 @@ ConfirmSendToken.prototype.updateComponentSendErrors = function (prevProps) {
insufficientFunds: balanceIsSufficient ? false : this.context.t('insufficientFunds'), insufficientFunds: balanceIsSufficient ? false : this.context.t('insufficientFunds'),
}) })
} }
const shouldUpdateSimulationSendError = Boolean(txMeta.simulationFails) !== Boolean(simulationFails)
if (shouldUpdateSimulationSendError) {
updateSendErrors({
simulationFails: !txMeta.simulationFails ? false : this.context.t('transactionError'),
})
}
} }
ConfirmSendToken.prototype.componentWillMount = function () { ConfirmSendToken.prototype.componentWillMount = function () {
@ -489,8 +502,10 @@ ConfirmSendToken.prototype.render = function () {
]), ]),
h('form#pending-tx-form', { h('form#pending-tx-form', {
className: 'confirm-screen-form',
onSubmit: this.onSubmit, onSubmit: this.onSubmit,
}, [ }, [
this.renderErrorMessage('simulationFails'),
h('.page-container__footer', [ h('.page-container__footer', [
// Cancel Button // Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', { h('button.btn-cancel.page-container__footer-button.allcaps', {

@ -312,6 +312,17 @@ section .confirm-screen-account-number,
} }
} }
.confirm-screen-form {
position: relative;
.confirm-screen-error {
right: 0;
width: 100%;
margin-top: 7px;
text-align: center;
}
}
.confirm-screen-confirm-button { .confirm-screen-confirm-button {
height: 50px; height: 50px;
border-radius: 4px; border-radius: 4px;

Loading…
Cancel
Save