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:
parent
424e98f6a8
commit
5cdaf270f7
@ -18,6 +18,7 @@ GasFeeDisplay.prototype.render = function () {
|
|||||||
onClick,
|
onClick,
|
||||||
primaryCurrency = 'ETH',
|
primaryCurrency = 'ETH',
|
||||||
convertedCurrency,
|
convertedCurrency,
|
||||||
|
gasLoadingError,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
return h('div.send-v2__gas-fee-display', [
|
return h('div.send-v2__gas-fee-display', [
|
||||||
@ -31,11 +32,13 @@ GasFeeDisplay.prototype.render = function () {
|
|||||||
convertedPrefix: '$',
|
convertedPrefix: '$',
|
||||||
readOnly: true,
|
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', {
|
h('button.send-v2__sliders-icon-container', {
|
||||||
onClick,
|
onClick,
|
||||||
disabled: !gasTotal,
|
disabled: !gasTotal && !gasLoadingError,
|
||||||
}, [
|
}, [
|
||||||
h('i.fa.fa-sliders.send-v2__sliders-icon'),
|
h('i.fa.fa-sliders.send-v2__sliders-icon'),
|
||||||
]),
|
]),
|
||||||
|
@ -48,6 +48,7 @@ function mapStateToProps (state) {
|
|||||||
primaryCurrency,
|
primaryCurrency,
|
||||||
convertedCurrency: getCurrentCurrency(state),
|
convertedCurrency: getCurrentCurrency(state),
|
||||||
data,
|
data,
|
||||||
|
selectedAddress,
|
||||||
amountConversionRate: selectedToken ? tokenToFiatRate : conversionRate,
|
amountConversionRate: selectedToken ? tokenToFiatRate : conversionRate,
|
||||||
tokenContract: getSelectedTokenContract(state),
|
tokenContract: getSelectedTokenContract(state),
|
||||||
unapprovedTxs: state.metamask.unapprovedTxs,
|
unapprovedTxs: state.metamask.unapprovedTxs,
|
||||||
|
@ -660,6 +660,12 @@
|
|||||||
|
|
||||||
&__gas-fee-display {
|
&__gas-fee-display {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
.currency-display--message {
|
||||||
|
padding: 8px 38px 8px 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__sliders-icon-container {
|
&__sliders-icon-container {
|
||||||
|
@ -42,6 +42,7 @@ function SendTransactionScreen () {
|
|||||||
to: null,
|
to: null,
|
||||||
amount: null,
|
amount: null,
|
||||||
},
|
},
|
||||||
|
gasLoadingError: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handleToChange = this.handleToChange.bind(this)
|
this.handleToChange = this.handleToChange.bind(this)
|
||||||
@ -128,6 +129,10 @@ SendTransactionScreen.prototype.updateGas = function () {
|
|||||||
.then(([gasPrice, gas]) => {
|
.then(([gasPrice, gas]) => {
|
||||||
const newGasTotal = this.getGasTotal(gas, gasPrice)
|
const newGasTotal = this.getGasTotal(gas, gasPrice)
|
||||||
updateGasTotal(newGasTotal)
|
updateGasTotal(newGasTotal)
|
||||||
|
this.setState({ gasLoadingError: false })
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
this.setState({ gasLoadingError: true })
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const newGasTotal = this.getGasTotal(gasLimit, gasPrice)
|
const newGasTotal = this.getGasTotal(gasLimit, gasPrice)
|
||||||
@ -436,6 +441,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
|
|||||||
showCustomizeGasModal,
|
showCustomizeGasModal,
|
||||||
gasTotal,
|
gasTotal,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
const { gasLoadingError } = this.state
|
||||||
|
|
||||||
return h('div.send-v2__form-row', [
|
return h('div.send-v2__form-row', [
|
||||||
|
|
||||||
@ -448,6 +454,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
|
|||||||
conversionRate,
|
conversionRate,
|
||||||
convertedCurrency,
|
convertedCurrency,
|
||||||
onClick: showCustomizeGasModal,
|
onClick: showCustomizeGasModal,
|
||||||
|
gasLoadingError,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
]),
|
]),
|
||||||
|
Loading…
Reference in New Issue
Block a user