small cleanups

This commit is contained in:
Jonathan Rainville 2018-07-25 16:12:17 -04:00 committed by Iuri Matias
parent 01de35aab9
commit bb9f058b15
2 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,8 @@ const utils = require('../../utils/utils.js');
const namehash = require('eth-ens-namehash'); const namehash = require('eth-ens-namehash');
const async = require('async'); const async = require('async');
const reverseAddrSuffix = '.addr.reverse';
class ENS { class ENS {
constructor(embark, _options) { constructor(embark, _options) {
this.logger = embark.logger; this.logger = embark.logger;
@ -90,7 +92,7 @@ class ENS {
async.each(Object.keys(self.registration.subdomains), (subDomainName, eachCb) => { async.each(Object.keys(self.registration.subdomains), (subDomainName, eachCb) => {
const address = self.registration.subdomains[subDomainName]; const address = self.registration.subdomains[subDomainName];
const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + '.addr.reverse'); const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix);
register(ens, registrar, resolver, defaultAccount, subDomainName, self.registration.rootDomain, register(ens, registrar, resolver, defaultAccount, subDomainName, self.registration.rootDomain,
reverseNode, address, self.logger, eachCb); reverseNode, address, self.logger, eachCb);
}, cb); }, cb);
@ -197,7 +199,7 @@ class ENS {
"onDeploy": [ "onDeploy": [
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => { `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send(); ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '.addr.reverse'); var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}');
ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send(); ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send();
Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send(); Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send();
Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send(); Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send();

View File

@ -32,7 +32,7 @@ contract("ENS", function () {
// Wait for onDeploy to finish // Wait for onDeploy to finish
setTimeout(function () { setTimeout(function () {
done(); done();
}, 100); }, 500);
}); });
it("should have registered embark.eth", async function () { it("should have registered embark.eth", async function () {