mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Update the correct values in state when estimates are received.
This commit is contained in:
parent
541b69dda9
commit
39365f2cc4
@ -93,8 +93,8 @@ SendTokenScreen.prototype.componentWillMount = function () {
|
|||||||
])
|
])
|
||||||
.then(([blockGasPrice, estimatedGas]) => {
|
.then(([blockGasPrice, estimatedGas]) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
blockGasPrice,
|
gasPrice: blockGasPrice,
|
||||||
estimatedGas,
|
gasLimit: estimatedGas,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -305,8 +305,6 @@ SendTokenScreen.prototype.renderGasInput = function () {
|
|||||||
isGasTooltipOpen,
|
isGasTooltipOpen,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
gasLimit,
|
gasLimit,
|
||||||
blockGasPrice,
|
|
||||||
estimatedGas,
|
|
||||||
selectedCurrency,
|
selectedCurrency,
|
||||||
errors: {
|
errors: {
|
||||||
gasPrice: gasPriceErrorMessage,
|
gasPrice: gasPriceErrorMessage,
|
||||||
@ -327,8 +325,8 @@ SendTokenScreen.prototype.renderGasInput = function () {
|
|||||||
}, [
|
}, [
|
||||||
isGasTooltipOpen && h(GasTooltip, {
|
isGasTooltipOpen && h(GasTooltip, {
|
||||||
className: 'send-tooltip',
|
className: 'send-tooltip',
|
||||||
gasPrice: gasPrice || blockGasPrice || '0x0',
|
gasPrice: gasPrice || '0x0',
|
||||||
gasLimit: gasLimit || estimatedGas || '0x0',
|
gasLimit: gasLimit || '0x0',
|
||||||
onClose: () => this.setState({ isGasTooltipOpen: false }),
|
onClose: () => this.setState({ isGasTooltipOpen: false }),
|
||||||
onFeeChange: ({ gasLimit, gasPrice }) => {
|
onFeeChange: ({ gasLimit, gasPrice }) => {
|
||||||
this.setState({ gasLimit, gasPrice, errors: {} })
|
this.setState({ gasLimit, gasPrice, errors: {} })
|
||||||
@ -351,9 +349,9 @@ SendTokenScreen.prototype.renderGasInput = function () {
|
|||||||
h(GasFeeDisplay, {
|
h(GasFeeDisplay, {
|
||||||
conversionRate,
|
conversionRate,
|
||||||
tokenExchangeRate,
|
tokenExchangeRate,
|
||||||
gasPrice: gasPrice || blockGasPrice || '0x0',
|
gasPrice: gasPrice || '0x0',
|
||||||
activeCurrency: selectedCurrency,
|
activeCurrency: selectedCurrency,
|
||||||
gas: gasLimit || estimatedGas || '0x0',
|
gas: gasLimit || '0x0',
|
||||||
blockGasLimit: currentBlockGasLimit,
|
blockGasLimit: currentBlockGasLimit,
|
||||||
}),
|
}),
|
||||||
h(
|
h(
|
||||||
|
@ -35,8 +35,6 @@ function mapStateToProps (state) {
|
|||||||
addressBook,
|
addressBook,
|
||||||
conversionRate,
|
conversionRate,
|
||||||
currentBlockGasLimit: blockGasLimit,
|
currentBlockGasLimit: blockGasLimit,
|
||||||
estimatedGas,
|
|
||||||
blockGasPrice,
|
|
||||||
} = state.metamask
|
} = state.metamask
|
||||||
const { warning } = state.appState
|
const { warning } = state.appState
|
||||||
const selectedIdentity = getSelectedIdentity(state)
|
const selectedIdentity = getSelectedIdentity(state)
|
||||||
@ -76,8 +74,6 @@ function SendTransactionScreen () {
|
|||||||
txData: null,
|
txData: null,
|
||||||
memo: '',
|
memo: '',
|
||||||
},
|
},
|
||||||
blockGasPrice: null,
|
|
||||||
estimatedGas: null,
|
|
||||||
activeCurrency: 'USD',
|
activeCurrency: 'USD',
|
||||||
tooltipIsOpen: false,
|
tooltipIsOpen: false,
|
||||||
errors: {},
|
errors: {},
|
||||||
@ -103,14 +99,19 @@ function SendTransactionScreen () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendTransactionScreen.prototype.componentWillMount = function () {
|
SendTransactionScreen.prototype.componentWillMount = function () {
|
||||||
|
const { newTx } = this.state
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.props.dispatch(getGasPrice()),
|
this.props.dispatch(getGasPrice()),
|
||||||
this.props.dispatch(estimateGas()),
|
this.props.dispatch(estimateGas()),
|
||||||
])
|
])
|
||||||
.then(([blockGasPrice, estimatedGas]) => {
|
.then(([blockGasPrice, estimatedGas]) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
blockGasPrice,
|
newTx: {
|
||||||
estimatedGas,
|
...newTx,
|
||||||
|
gasPrice: blockGasPrice,
|
||||||
|
gas: estimatedGas,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -329,8 +330,6 @@ SendTransactionScreen.prototype.render = function () {
|
|||||||
newTx,
|
newTx,
|
||||||
activeCurrency,
|
activeCurrency,
|
||||||
isValid,
|
isValid,
|
||||||
blockGasPrice,
|
|
||||||
estimatedGas,
|
|
||||||
} = this.state
|
} = this.state
|
||||||
const { gas, gasPrice } = newTx
|
const { gas, gasPrice } = newTx
|
||||||
|
|
||||||
@ -353,8 +352,8 @@ SendTransactionScreen.prototype.render = function () {
|
|||||||
this.renderAmountInput(activeCurrency),
|
this.renderAmountInput(activeCurrency),
|
||||||
|
|
||||||
this.renderGasInput(
|
this.renderGasInput(
|
||||||
gasPrice || blockGasPrice || '0x0',
|
gasPrice || '0x0',
|
||||||
gas || estimatedGas || '0x0',
|
gas || '0x0',
|
||||||
activeCurrency,
|
activeCurrency,
|
||||||
conversionRate,
|
conversionRate,
|
||||||
blockGasLimit
|
blockGasLimit
|
||||||
|
Loading…
Reference in New Issue
Block a user