mirror of https://github.com/embarklabs/embark.git
fix(ENS): register subdomain when not registered
was introduced when we did para deploy We didn't register on error, but the error is the queue to register
This commit is contained in:
parent
801932b726
commit
ca212e3ffb
|
@ -9,6 +9,7 @@ import { ZERO_ADDRESS } from '../../utils/addressUtils';
|
||||||
import {ens} from '../../constants';
|
import {ens} from '../../constants';
|
||||||
|
|
||||||
const ENS_WHITELIST = ens.whitelist;
|
const ENS_WHITELIST = ens.whitelist;
|
||||||
|
const NOT_REGISTERED_ERROR = 'Name not yet registered';
|
||||||
|
|
||||||
const MAINNET_ID = '1';
|
const MAINNET_ID = '1';
|
||||||
const ROPSTEN_ID = '3';
|
const ROPSTEN_ID = '3';
|
||||||
|
@ -183,7 +184,7 @@ class ENS {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
if (resolverAddress === ZERO_ADDRESS) {
|
if (resolverAddress === ZERO_ADDRESS) {
|
||||||
return cb('Name not yet registered');
|
return cb(NOT_REGISTERED_ERROR);
|
||||||
}
|
}
|
||||||
next(null, resolverAddress);
|
next(null, resolverAddress);
|
||||||
});
|
});
|
||||||
|
@ -227,9 +228,9 @@ class ENS {
|
||||||
return eachCb();
|
return eachCb();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error !== NOT_REGISTERED_ERROR) {
|
||||||
this.logger.error(error);
|
this.logger.error(__('Error resolving %s', `${subDomainName}.${this.registration.rootDomain}`));
|
||||||
return eachCb();
|
return eachCb(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix);
|
const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix);
|
||||||
|
@ -485,7 +486,7 @@ class ENS {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
if(resolverAddress === ZERO_ADDRESS) {
|
if(resolverAddress === ZERO_ADDRESS) {
|
||||||
return next('Name not yet registered');
|
return next(NOT_REGISTERED_ERROR);
|
||||||
}
|
}
|
||||||
next(null, resolverAddress);
|
next(null, resolverAddress);
|
||||||
});
|
});
|
||||||
|
@ -500,13 +501,7 @@ class ENS {
|
||||||
function resolveName(resolverContract, next) {
|
function resolveName(resolverContract, next) {
|
||||||
resolverContract.methods.addr(hashedName).call(next);
|
resolverContract.methods.addr(hashedName).call(next);
|
||||||
}
|
}
|
||||||
], (err, result) => {
|
], cb);
|
||||||
if (err) {
|
|
||||||
self.logger.error(__('Failed to resolve the ENS name: %s', name));
|
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
cb(null, result);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isENSName(name, callback = () => {}) {
|
isENSName(name, callback = () => {}) {
|
||||||
|
|
Loading…
Reference in New Issue