Skip to content

Commit

Permalink
Merge pull request #623 from poanetwork/gasPrice-custom-preventInvali…
Browse files Browse the repository at this point in the history
…d-#573

(Fix) Gas price custom prevent invalid
  • Loading branch information
vbaranov committed Feb 26, 2018
2 parents 25ac38e + 2d53de2 commit 4198f36
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/Common/InputField.js
Expand Up @@ -23,6 +23,7 @@ export const InputField = props => {
className="input"
onBlur={props.onBlur}
value={props.value}
style={props.style}
onChange={props.onChange}
onKeyPress={props.onKeyPress}
onPaste={props.onPaste}
Expand Down
1 change: 1 addition & 0 deletions src/components/Common/NumericInput.js
Expand Up @@ -79,6 +79,7 @@ export class NumericInput extends Component {
pristine={this.state.pristine}
value={this.state.value}
title={this.props.title}
style={this.props.style}
onKeyPress={e => this.onKeyPress(e)}
onChange={e => this.onChange(e)}
onPaste={e => this.onPaste(e)}
Expand Down
Expand Up @@ -16,6 +16,7 @@ exports[`NumericInput Should render the component 1`] = `
onChange={[Function]}
onKeyPress={[Function]}
onPaste={[Function]}
style={undefined}
type="number"
value=""
/>
Expand Down
Expand Up @@ -25,6 +25,7 @@ exports[`ReservedTokensInputBlock Should render the component 1`] = `
onChange={[Function]}
onKeyPress={undefined}
onPaste={undefined}
style={undefined}
type="text"
value=""
/>
Expand Down Expand Up @@ -97,6 +98,7 @@ exports[`ReservedTokensInputBlock Should render the component 1`] = `
onChange={[Function]}
onKeyPress={undefined}
onPaste={undefined}
style={undefined}
type="number"
value=""
/>
Expand Down
14 changes: 10 additions & 4 deletions src/components/stepThree/index.js
Expand Up @@ -217,6 +217,10 @@ export class stepThree extends React.Component {
}
}

updateGasPrice = value => {
this.props.generalStore.setGasPrice(gweiToWei(value))
}

renderGasPriceInput() {
const { generalStore, gasPriceStore } = this.props

Expand Down Expand Up @@ -274,12 +278,14 @@ export class stepThree extends React.Component {

{
this.state.gasPriceSelected === gasPriceStore.custom.id ?
<input
className="input"
<NumericInput
style={{ display: 'inline-block' }}
type="number"
min={0.1}
maxDecimals={9}
acceptFloat={true}
value={weiToGwei(generalStore.gasPrice)}
onChange={(e) => generalStore.setGasPrice(gweiToWei(e.target.value))}
errorMessage="Gas Price must be greater than 0.1 with up to 9 decimals"
onValueUpdate={this.updateGasPrice}
/> :
null
}
Expand Down

0 comments on commit 4198f36

Please sign in to comment.