|
|
@ -222,6 +222,17 @@ export default class NetworkForm extends PureComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validateBlockExplorerUrl = (url, stateKey) => { |
|
|
|
|
|
|
|
if (url === '' || validUrl.isWebUri(url)) { |
|
|
|
|
|
|
|
this.setErrorTo(stateKey, '') |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const appendedRpc = `http://${url}` |
|
|
|
|
|
|
|
const validWhenAppended = validUrl.isWebUri(appendedRpc) && !url.match(/^https?:\/\/$/) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setErrorTo(stateKey, this.context.t(validWhenAppended ? 'uriErrorMsg' : 'invalidRPC')) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
|
const { t } = this.context |
|
|
|
const { t } = this.context |
|
|
|
const { |
|
|
|
const { |
|
|
@ -272,7 +283,7 @@ export default class NetworkForm extends PureComponent { |
|
|
|
{this.renderFormTextField( |
|
|
|
{this.renderFormTextField( |
|
|
|
'blockExplorerUrl', |
|
|
|
'blockExplorerUrl', |
|
|
|
'block-explorer-url', |
|
|
|
'block-explorer-url', |
|
|
|
this.setStateWithValue('blockExplorerUrl', this.validateUrl), |
|
|
|
this.setStateWithValue('blockExplorerUrl', this.validateBlockExplorerUrl), |
|
|
|
blockExplorerUrl, |
|
|
|
blockExplorerUrl, |
|
|
|
'optionalBlockExplorerUrl', |
|
|
|
'optionalBlockExplorerUrl', |
|
|
|
)} |
|
|
|
)} |
|
|
|