Fix typo and improved code readability
This commit is contained in:
parent
e39f001e71
commit
6672378ae2
|
@ -86,7 +86,7 @@ EnsInput.prototype.render = function () {
|
|||
EnsInput.prototype.componentDidMount = function () {
|
||||
const network = this.props.network
|
||||
const networkHasEnsSupport = getNetworkEnsSupport(network)
|
||||
const rnsRegistry = getNetworkRnsSupport(network)
|
||||
const networkHasRnsSupport = getNetworkRnsSupport(network)
|
||||
|
||||
this.setState({ ensResolution: ZERO_ADDRESS })
|
||||
|
||||
|
@ -94,9 +94,10 @@ EnsInput.prototype.componentDidMount = function () {
|
|||
const provider = global.ethereumProvider
|
||||
this.ens = new ENS({ provider, network })
|
||||
this.checkName = debounce(this.lookupEnsName.bind(this, 'ENS'), 200)
|
||||
} else if (rnsRegistry) {
|
||||
} else if (networkHasRnsSupport) {
|
||||
const registryAddress = getRnsRegistryAddress(network);
|
||||
const provider = global.ethereumProvider
|
||||
this.ens = new ENS({ provider, network, registryAddress: rnsRegistry })
|
||||
this.ens = new ENS({ provider, network, registryAddress })
|
||||
this.checkName = debounce(this.lookupEnsName.bind(this, 'RNS'), 200)
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ EnsInput.prototype.lookupEnsName = function (nameService) {
|
|||
&& reason.message === 'ENS name not defined.'
|
||||
) {
|
||||
setStateObj.hoverText = `${nameService} name not found`
|
||||
setStateObj.toError = `${nameService.toLowerCase}NameNotFound`
|
||||
setStateObj.toError = `${nameService.toLowerCase()}NameNotFound`
|
||||
setStateObj.ensFailure = false
|
||||
} else {
|
||||
log.error(reason)
|
||||
|
@ -214,6 +215,10 @@ function getNetworkEnsSupport (network) {
|
|||
}
|
||||
|
||||
function getNetworkRnsSupport (network) {
|
||||
return (network == RSK_CODE || network == RSK_TESTNET_CODE);
|
||||
}
|
||||
|
||||
function getRnsRegistryAddress (network) {
|
||||
if (network == RSK_CODE) {
|
||||
return RNSRegistryData.address.rskMainnet;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ function isValidENSAddress (address) {
|
|||
}
|
||||
|
||||
function isValidRNSAddress (address) {
|
||||
return address.match(/([a-z0-9])+\.(rsk)/)
|
||||
return address.match(/^[a-z0-9]+\.rsk$/)
|
||||
}
|
||||
|
||||
function isInvalidChecksumAddress (address, network) {
|
||||
|
|
Loading…
Reference in New Issue