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) {
|
autoSetGasPrice(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const newInputs = this.state.inputs;
|
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});
|
this.setState({inputs: newInputs});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class GasStation extends Component {
|
||||||
getCurrentGas() {
|
getCurrentGas() {
|
||||||
const formattedGas = this.getGasOracleFormatted();
|
const formattedGas = this.getGasOracleFormatted();
|
||||||
if (!formattedGas.length) {
|
if (!formattedGas.length) {
|
||||||
return 'Too few blocks';
|
return -1;
|
||||||
}
|
}
|
||||||
return this.getGasOracleFormatted()[this.state.gasOracleSliderIndex].gasPrice / this.PRICE_UNIT_DIVIDER;
|
return this.getGasOracleFormatted()[this.state.gasOracleSliderIndex].gasPrice / this.PRICE_UNIT_DIVIDER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class GasStationContainer extends Component {
|
||||||
|
|
||||||
getCurrentGas() {
|
getCurrentGas() {
|
||||||
if (!this.gasStation) {
|
if (!this.gasStation) {
|
||||||
return 'Unavailable';
|
return -1;
|
||||||
}
|
}
|
||||||
return this.gasStation.getCurrentGas();
|
return this.gasStation.getCurrentGas();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue