Apply linter suggestions

This commit is contained in:
Victor Baranov 2020-06-12 10:12:31 +03:00
parent 1c3879f7a8
commit b13e1b8ba6
1 changed files with 12 additions and 12 deletions

View File

@ -5,12 +5,12 @@ const debounce = require('debounce')
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const ENS = require('ethjs-ens') const ENS = require('ethjs-ens')
const networkMap = require('ethjs-ens/lib/network-map.json') const networkMap = require('ethjs-ens/lib/network-map.json')
const RNSRegistryData = require('@rsksmart/rns-registry/RNSRegistryData.json'); const RNSRegistryData = require('@rsksmart/rns-registry/RNSRegistryData.json')
const ensRE = /.+\..+$/ const ensRE = /.+\..+$/
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const log = require('loglevel') const log = require('loglevel')
const { isValidENSAddress, isValidRNSAddress } = require('../util') const { isValidENSAddress, isValidRNSAddress } = require('../util')
const { const {
RSK_CODE, RSK_CODE,
RSK_TESTNET_CODE, RSK_TESTNET_CODE,
} = require('../../../app/scripts/controllers/network/enums') } = require('../../../app/scripts/controllers/network/enums')
@ -95,7 +95,7 @@ EnsInput.prototype.componentDidMount = function () {
this.ens = new ENS({ provider, network }) this.ens = new ENS({ provider, network })
this.checkName = debounce(this.lookupEnsName.bind(this, 'ENS'), 200) this.checkName = debounce(this.lookupEnsName.bind(this, 'ENS'), 200)
} else if (networkHasRnsSupport) { } else if (networkHasRnsSupport) {
const registryAddress = getRnsRegistryAddress(network); const registryAddress = getRnsRegistryAddress(network)
const provider = global.ethereumProvider const provider = global.ethereumProvider
this.ens = new ENS({ provider, network, registryAddress }) this.ens = new ENS({ provider, network, registryAddress })
this.checkName = debounce(this.lookupEnsName.bind(this, 'RNS'), 200) this.checkName = debounce(this.lookupEnsName.bind(this, 'RNS'), 200)
@ -129,8 +129,8 @@ EnsInput.prototype.lookupEnsName = function (nameService) {
toError: null, toError: null,
} }
if ( if (
(isValidENSAddress(recipient) || isValidRNSAddress(recipient)) (isValidENSAddress(recipient) || isValidRNSAddress(recipient)) &&
&& reason.message === 'ENS name not defined.' reason.message === 'ENS name not defined.'
) { ) {
setStateObj.hoverText = `${nameService} name not found` setStateObj.hoverText = `${nameService} name not found`
setStateObj.toError = `${nameService.toLowerCase()}NameNotFound` setStateObj.toError = `${nameService.toLowerCase()}NameNotFound`
@ -215,17 +215,17 @@ function getNetworkEnsSupport (network) {
} }
function getNetworkRnsSupport (network) { function getNetworkRnsSupport (network) {
return (network == RSK_CODE || network == RSK_TESTNET_CODE); return (network === RSK_CODE || network === RSK_TESTNET_CODE)
} }
function getRnsRegistryAddress (network) { function getRnsRegistryAddress (network) {
if (network == RSK_CODE) { if (network === RSK_CODE) {
return RNSRegistryData.address.rskMainnet; return RNSRegistryData.address.rskMainnet
} }
if (network == RSK_TESTNET_CODE) { if (network === RSK_TESTNET_CODE) {
return RNSRegistryData.address.rskTestnet; return RNSRegistryData.address.rskTestnet
}; };
return; return
} }