@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import classnames from 'classnames'
import classnames from 'classnames'
import { debounce } from 'lodash'
import { debounce } from 'lodash'
import Tooltip from '../../../ui/tooltip'
import Tooltip from '../../../ui/tooltip'
import { MIN _GAS _LIMIT _DEC } from '../../../../pages/send/send.constants'
export default class AdvancedGasInputs extends Component {
export default class AdvancedGasInputs extends Component {
static contextTypes = {
static contextTypes = {
@ -18,6 +19,11 @@ export default class AdvancedGasInputs extends Component {
customPriceIsSafe : PropTypes . bool ,
customPriceIsSafe : PropTypes . bool ,
isSpeedUp : PropTypes . bool ,
isSpeedUp : PropTypes . bool ,
customGasLimitMessage : PropTypes . string ,
customGasLimitMessage : PropTypes . string ,
minimumGasLimit : PropTypes . number ,
}
static defaultProps = {
minimumGasLimit : MIN _GAS _LIMIT _DEC ,
}
}
constructor ( props ) {
constructor ( props ) {
@ -84,7 +90,7 @@ export default class AdvancedGasInputs extends Component {
return { }
return { }
}
}
gasLimitError ( { insufficientBalance , gasLimit } ) {
gasLimitError ( { insufficientBalance , gasLimit , minimumGasLimit } ) {
const { t } = this . context
const { t } = this . context
if ( insufficientBalance ) {
if ( insufficientBalance ) {
@ -92,9 +98,9 @@ export default class AdvancedGasInputs extends Component {
errorText : t ( 'insufficientBalance' ) ,
errorText : t ( 'insufficientBalance' ) ,
errorType : 'error' ,
errorType : 'error' ,
}
}
} else if ( gasLimit < 21000 ) {
} else if ( gasLimit < minimumGasLimit ) {
return {
return {
errorText : t ( 'gasLimitTooLow' ) ,
errorText : t ( 'gasLimitTooLowWithDynamicFee ' , [ minimumGasLimit ] ) ,
errorType : 'error' ,
errorType : 'error' ,
}
}
}
}
@ -153,6 +159,7 @@ export default class AdvancedGasInputs extends Component {
customPriceIsSafe ,
customPriceIsSafe ,
isSpeedUp ,
isSpeedUp ,
customGasLimitMessage ,
customGasLimitMessage ,
minimumGasLimit ,
} = this . props
} = this . props
const {
const {
gasPrice ,
gasPrice ,
@ -172,7 +179,7 @@ export default class AdvancedGasInputs extends Component {
const {
const {
errorText : gasLimitErrorText ,
errorText : gasLimitErrorText ,
errorType : gasLimitErrorType ,
errorType : gasLimitErrorType ,
} = this . gasLimitError ( { insufficientBalance , gasLimit } )
} = this . gasLimitError ( { insufficientBalance , gasLimit , minimumGasLimit } )
const gasLimitErrorComponent = gasLimitErrorType ? (
const gasLimitErrorComponent = gasLimitErrorType ? (
< div className = { ` advanced-gas-inputs__gas-edit-row__ ${ gasLimitErrorType } -text ` } >
< div className = { ` advanced-gas-inputs__gas-edit-row__ ${ gasLimitErrorType } -text ` } >
{ gasLimitErrorText }
{ gasLimitErrorText }