Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let checkAddress = addr.address ? addr.address : addr;
checkAddress = await this.checkForEns(checkAddress);
if (EthereumTokens[this.currency]) {
this.validAddress = WAValidator.validate(checkAddress, 'ETH');
this.validityResult(this.validAddress);
} else {
try {
this.validAddress = WAValidator.validate(
checkAddress,
this.currency
);
this.validityResult(this.validAddress);
} catch (e) {
if (canValidate(this.currency)) {
try {
this.validAddress = MAValidator.validate(
checkAddress,
this.currency
);
this.validityResult(this.validAddress);
} catch (e) {
errorLogger(e);
this.validityResult('INVALID');
this.validAddress = false;
}
} else {
this.validityResult('MAYBE_VALID');
this.validAddress = true;
this.unableToValidate = true;
}
}
}
static checkAddress(address, currency) {
let validAddress = false;
try {
validAddress = WAValidator.validate(address, currency);
} catch (e) {
try {
validAddress = MAValidator.validate(address, currency);
} catch (e) {
validAddress = false;
}
}
return validAddress;
}
}
_this.isValidAddress = false;
_this.hexAddress = '';
vnode.elm.parentNode.parentNode.appendChild(errorPar);
}
});
}
}
} else if (e !== '') {
const isValid = WAValidator.validate(e, parentCurrency);
if (isValid) {
_this.isValidAddress = isValid;
_this.hexAddress =
parentCurrency === 'ETH' ? toChecksumAddress(e) : e;
} else {
if (canValidate(parentCurrency)) {
const isValid = MAValidator.validate(e, parentCurrency);
if (isValid) {
_this.isValidAddress = isValid;
_this.hexAddress = e;
} else {
_this.isValidAddress = false;
_this.hexAddress = '';
removeElements();
if (e.length > 0) {
if (
parentCurrency === 'ETH' &&
(e.length !== 42 || !utils.isHexStrict(e))
) {
errorPar.innerText = _this.$t(
'ens.ens-resolver.invalid-eth-addr'
);