mirror of https://github.com/embarklabs/embark.git
chore(cockpit/estimator): always return an integer for getGasPrice
This commit is contained in:
parent
1759aac8aa
commit
c708bad8bb
|
@ -63,7 +63,8 @@ class ContractFunction extends Component {
|
|||
autoSetGasPrice(e) {
|
||||
e.preventDefault();
|
||||
const newInputs = this.state.inputs;
|
||||
newInputs.gasPrice = this.gasStation.getCurrentGas();
|
||||
const currentPrice = this.gasStation.getCurrentGas();
|
||||
newInputs.gasPrice = currentPrice >= 0 ? currentPrice : 'Estimate unavailable';
|
||||
this.setState({inputs: newInputs});
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class GasStation extends Component {
|
|||
getCurrentGas() {
|
||||
const formattedGas = this.getGasOracleFormatted();
|
||||
if (!formattedGas.length) {
|
||||
return 'Too few blocks';
|
||||
return -1;
|
||||
}
|
||||
return this.getGasOracleFormatted()[this.state.gasOracleSliderIndex].gasPrice / this.PRICE_UNIT_DIVIDER;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class GasStationContainer extends Component {
|
|||
|
||||
getCurrentGas() {
|
||||
if (!this.gasStation) {
|
||||
return 'Unavailable';
|
||||
return -1;
|
||||
}
|
||||
return this.gasStation.getCurrentGas();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue