fix lookup and also enable lookup for new subdomains

This commit is contained in:
Jonathan Rainville 2018-07-23 17:11:21 -04:00 committed by Iuri Matias
parent 72cf9f2430
commit 9eb6e9a949
3 changed files with 7 additions and 3 deletions

View File

@ -34,13 +34,13 @@ contract FIFSRegistrar {
* @param subnode The hash of the label to register.
* @param owner The address of the new owner.
*/
function register(bytes32 subnode, address owner, address _account) public only_owner(subnode) {
function register(bytes32 subnode, address owner, address nodeAddress) public only_owner(subnode) {
bytes32 subdomainHash = sha3(rootNode, subnode);
ens.setSubnodeOwner(rootNode, subnode, owner);
ens.setResolver(subdomainHash, resolver); //default resolver
bool resolveAccount = _account != address(0);
bool resolveAccount = nodeAddress != address(0);
if (resolveAccount) {
resolver.setAddr(subdomainHash, _account);
resolver.setAddr(subdomainHash, nodeAddress);
}
}
}

View File

@ -236,6 +236,7 @@ __embarkENS.lookup = function (address, callback) {
};
__embarkENS.registerSubDomain = function (name, address, callback) {
const self = this;
callback = callback || function () {};
if (this.env !== 'development' && this.env !== 'privatenet') {

View File

@ -350,7 +350,10 @@ class ENS {
"onDeploy": [
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
var reverseNode = web3.utils.sha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '.addr.reverse');
ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send();
Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send();
Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send();
})`
]
}