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,
|
||||
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,
|
||||
})
|
||||
: 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'),
|
||||
]),
|
||||
|
@ -48,6 +48,7 @@ function mapStateToProps (state) {
|
||||
primaryCurrency,
|
||||
convertedCurrency: getCurrentCurrency(state),
|
||||
data,
|
||||
selectedAddress,
|
||||
amountConversionRate: selectedToken ? tokenToFiatRate : conversionRate,
|
||||
tokenContract: getSelectedTokenContract(state),
|
||||
unapprovedTxs: state.metamask.unapprovedTxs,
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
}),
|
||||
|
||||
]),
|
||||
|
Loading…
Reference in New Issue
Block a user