1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Don't block user from setting gas if estimating gas returns errors. (#3627)

This commit is contained in:
Dan J Miller 2018-03-20 06:47:45 -02:30 committed by GitHub
parent 424e98f6a8
commit 5cdaf270f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View File

@ -18,6 +18,7 @@ GasFeeDisplay.prototype.render = function () {
onClick,
primaryCurrency = 'ETH',
convertedCurrency,
gasLoadingError,
} = this.props
return h('div.send-v2__gas-fee-display', [
@ -31,11 +32,13 @@ GasFeeDisplay.prototype.render = function () {
convertedPrefix: '$',
readOnly: true,
})
: h('div.currency-display', t('loading')),
: gasLoadingError
? h('div..currency-display.currency-display--message', 'Set with the gas price customizer.')
: h('div.currency-display', t('loading')),
h('button.send-v2__sliders-icon-container', {
onClick,
disabled: !gasTotal,
disabled: !gasTotal && !gasLoadingError,
}, [
h('i.fa.fa-sliders.send-v2__sliders-icon'),
]),

View File

@ -48,6 +48,7 @@ function mapStateToProps (state) {
primaryCurrency,
convertedCurrency: getCurrentCurrency(state),
data,
selectedAddress,
amountConversionRate: selectedToken ? tokenToFiatRate : conversionRate,
tokenContract: getSelectedTokenContract(state),
unapprovedTxs: state.metamask.unapprovedTxs,

View File

@ -660,6 +660,12 @@
&__gas-fee-display {
width: 100%;
.currency-display--message {
padding: 8px 38px 8px 10px;
display: flex;
align-items: center;
}
}
&__sliders-icon-container {

View File

@ -42,6 +42,7 @@ function SendTransactionScreen () {
to: null,
amount: null,
},
gasLoadingError: false,
}
this.handleToChange = this.handleToChange.bind(this)
@ -128,6 +129,10 @@ SendTransactionScreen.prototype.updateGas = function () {
.then(([gasPrice, gas]) => {
const newGasTotal = this.getGasTotal(gas, gasPrice)
updateGasTotal(newGasTotal)
this.setState({ gasLoadingError: false })
})
.catch(err => {
this.setState({ gasLoadingError: true })
})
} else {
const newGasTotal = this.getGasTotal(gasLimit, gasPrice)
@ -436,6 +441,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
showCustomizeGasModal,
gasTotal,
} = this.props
const { gasLoadingError } = this.state
return h('div.send-v2__form-row', [
@ -448,6 +454,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
conversionRate,
convertedCurrency,
onClick: showCustomizeGasModal,
gasLoadingError,
}),
]),