mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-10 05:56:00 +00:00
pre-dploy using the same function as register
This commit is contained in:
parent
c89a554fd8
commit
1654ae63db
@ -252,7 +252,11 @@ __embarkENS.registerSubDomain = function (name, address, callback) {
|
|||||||
|
|
||||||
// Register function generated by the index
|
// Register function generated by the index
|
||||||
registerSubDomain(this.ens, this.registrar, this.resolver, web3.eth.defaultAccount, name, this.registration.rootDomain,
|
registerSubDomain(this.ens, this.registrar, this.resolver, web3.eth.defaultAccount, name, this.registration.rootDomain,
|
||||||
|
<<<<<<< HEAD
|
||||||
web3.utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix), address, console, EmbarkJS.Utils.secureSend, callback);
|
web3.utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix), address, console, EmbarkJS.Utils.secureSend, callback);
|
||||||
|
=======
|
||||||
|
web3.utils.soliditySha3(address.toLowerCase().substr(2) + '.addr.reverse'), address, console, callback);
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
};
|
};
|
||||||
|
|
||||||
__embarkENS.isAvailable = function () {
|
__embarkENS.isAvailable = function () {
|
||||||
|
@ -165,15 +165,20 @@ class ENS {
|
|||||||
registerConfigDomains(config, cb) {
|
registerConfigDomains(config, cb) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const register = require('./register');
|
const register = require('./register');
|
||||||
|
<<<<<<< HEAD
|
||||||
const secureSend = embarkJsUtils.secureSend;
|
const secureSend = embarkJsUtils.secureSend;
|
||||||
self.events.request("blockchain:defaultAccount:get", (defaultAccount) => {
|
self.events.request("blockchain:defaultAccount:get", (defaultAccount) => {
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
self.events.request("blockchain:defaultAccount:get", (defaultAccount) => {
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
async.parallel([
|
async.parallel([
|
||||||
function createRegistryContract(paraCb) {
|
function createRegistryContract(paraCb) {
|
||||||
self.events.request("blockchain:contract:create",
|
self.events.request("blockchain:contract:create",
|
||||||
{abi: config.registryAbi, address: config.registryAddress},
|
{abi: config.registryAbi, address: config.registryAddress},
|
||||||
(registry) => {
|
(registry) => {
|
||||||
paraCb(null, registry);
|
paraCb(null, registry);
|
||||||
|
<<<<<<< HEAD
|
||||||
=======
|
=======
|
||||||
self.events.request("blockchain:contract:create",
|
self.events.request("blockchain:contract:create",
|
||||||
{abi: config.registrarAbi, address: config.registrarAddress},
|
{abi: config.registrarAbi, address: config.registrarAddress},
|
||||||
@ -193,6 +198,8 @@ class ENS {
|
|||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
eachCb("Register would error. Is it already registered? Do you have token balance? Is Allowance set? " + (err.message || err));
|
eachCb("Register would error. Is it already registered? Do you have token balance? Is Allowance set? " + (err.message || err));
|
||||||
>>>>>>> if no register config, dont register anything
|
>>>>>>> if no register config, dont register anything
|
||||||
|
=======
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function createRegistrarContract(paraCb) {
|
function createRegistrarContract(paraCb) {
|
||||||
@ -209,7 +216,11 @@ class ENS {
|
|||||||
paraCb(null, resolver);
|
paraCb(null, resolver);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
], function(err, contracts) {
|
], function(err, contracts) {
|
||||||
|
=======
|
||||||
|
], function (err, contracts) {
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
@ -217,9 +228,15 @@ 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];
|
||||||
|
<<<<<<< HEAD
|
||||||
const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix);
|
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, secureSend, eachCb);
|
reverseNode, address, self.logger, secureSend, eachCb);
|
||||||
|
=======
|
||||||
|
const reverseNode = utils.soliditySha3(address.toLowerCase().substr(2) + '.addr.reverse');
|
||||||
|
register(ens, registrar, resolver, defaultAccount, subDomainName, self.registration.rootDomain,
|
||||||
|
reverseNode, address, self.logger, eachCb);
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
}, cb);
|
}, cb);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
/*global web3*/
|
/*global web3*/
|
||||||
const namehash = require('eth-ens-namehash');
|
const namehash = require('eth-ens-namehash');
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, logger, secureSend, callback) {
|
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, logger, secureSend, callback) {
|
||||||
=======
|
=======
|
||||||
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, callback) {
|
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, callback) {
|
||||||
>>>>>>> if no register config, dont register anything
|
>>>>>>> if no register config, dont register anything
|
||||||
|
=======
|
||||||
|
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, logger, callback) {
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
const subnode = namehash.hash(subdomain);
|
const subnode = namehash.hash(subdomain);
|
||||||
const rootNode = namehash.hash(rootDomain);
|
const rootNode = namehash.hash(rootDomain);
|
||||||
const node = namehash.hash(`${subdomain}.${rootDomain}`);
|
const node = namehash.hash(`${subdomain}.${rootDomain}`);
|
||||||
@ -14,7 +18,15 @@ function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain,
|
|||||||
const toSend = ens.methods.setSubnodeOwner(rootNode, subnode, defaultAccount);
|
const toSend = ens.methods.setSubnodeOwner(rootNode, subnode, defaultAccount);
|
||||||
let transaction;
|
let transaction;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
secureSend(web3, toSend, {from: defaultAccount}, false)
|
secureSend(web3, toSend, {from: defaultAccount}, false)
|
||||||
|
=======
|
||||||
|
toSend.estimateGas()
|
||||||
|
// Register domain
|
||||||
|
.then(gasEstimated => {
|
||||||
|
return toSend.send({gas: gasEstimated + 1000, from: defaultAccount});
|
||||||
|
})
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
// Set resolver for the node
|
// Set resolver for the node
|
||||||
.then(transac => {
|
.then(transac => {
|
||||||
if (transac.status !== "0x1" && transac.status !== "0x01" && transac.status !== true) {
|
if (transac.status !== "0x1" && transac.status !== "0x01" && transac.status !== true) {
|
||||||
@ -22,6 +34,7 @@ function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain,
|
|||||||
return callback('Failed to register. Check gas cost.');
|
return callback('Failed to register. Check gas cost.');
|
||||||
}
|
}
|
||||||
transaction = transac;
|
transaction = transac;
|
||||||
|
<<<<<<< HEAD
|
||||||
return secureSend(web3, ens.methods.setResolver(node, resolver.options.address), {from: defaultAccount}, false);
|
return secureSend(web3, ens.methods.setResolver(node, resolver.options.address), {from: defaultAccount}, false);
|
||||||
})
|
})
|
||||||
// Set address for node
|
// Set address for node
|
||||||
@ -35,6 +48,21 @@ function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain,
|
|||||||
// Set name for reverse node
|
// Set name for reverse node
|
||||||
.then(_result => {
|
.then(_result => {
|
||||||
return secureSend(web3, resolver.methods.setName(reverseNode, `${subdomain}.${rootDomain}`), {from: defaultAccount}, false);
|
return secureSend(web3, resolver.methods.setName(reverseNode, `${subdomain}.${rootDomain}`), {from: defaultAccount}, false);
|
||||||
|
=======
|
||||||
|
return ens.methods.setResolver(node, resolver.options.address).send({from: defaultAccount});
|
||||||
|
})
|
||||||
|
// Set address for node
|
||||||
|
.then(_result => {
|
||||||
|
return resolver.methods.setAddr(node, address).send({from: defaultAccount});
|
||||||
|
})
|
||||||
|
// Set resolver for the reverse node
|
||||||
|
.then(_result => {
|
||||||
|
return ens.methods.setResolver(reverseNode, resolver.options.address).send({from: defaultAccount});
|
||||||
|
})
|
||||||
|
// Set name for reverse node
|
||||||
|
.then(_result => {
|
||||||
|
return resolver.methods.setName(reverseNode, subdomain + '.embark.eth').send({from: defaultAccount});
|
||||||
|
>>>>>>> pre-dploy using the same function as register
|
||||||
})
|
})
|
||||||
.then(_result => {
|
.then(_result => {
|
||||||
callback(null, transaction);
|
callback(null, transaction);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user