mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-25 06:28:51 +00:00
if no register config, dont register anything
This commit is contained in:
parent
7af786e095
commit
b1663af485
@ -15,6 +15,7 @@ class ENS {
|
||||
this.registration = this.namesConfig.register || {};
|
||||
this.embark = embark;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (this.namesConfig === {} ||
|
||||
this.namesConfig.enabled !== true ||
|
||||
this.namesConfig.available_providers.indexOf('ens') < 0) {
|
||||
@ -22,6 +23,8 @@ class ENS {
|
||||
}
|
||||
this.doSetENSProvider = this.namesConfig.provider === 'ens';
|
||||
|
||||
=======
|
||||
>>>>>>> if no register config, dont register anything
|
||||
this.addENSToEmbarkJS();
|
||||
this.configureContracts();
|
||||
this.registerEvents();
|
||||
@ -74,10 +77,18 @@ class ENS {
|
||||
self.addSetProvider(config);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if ((!self.isDev && self.env !== 'privatenet') || !self.registration || !self.registration.subdomains || !Object.keys(self.registration.subdomains).length) {
|
||||
return cb();
|
||||
}
|
||||
self.registerConfigDomains(config, cb);
|
||||
=======
|
||||
if (!self.registration || !self.registration.subdomains || !Object.keys(self.registration.subdomains).length) {
|
||||
return cb();
|
||||
}
|
||||
self.registerConfigDomains(config, cb);
|
||||
});
|
||||
>>>>>>> if no register config, dont register anything
|
||||
});
|
||||
}
|
||||
|
||||
@ -156,12 +167,32 @@ class ENS {
|
||||
const register = require('./register');
|
||||
const secureSend = embarkJsUtils.secureSend;
|
||||
self.events.request("blockchain:defaultAccount:get", (defaultAccount) => {
|
||||
<<<<<<< HEAD
|
||||
async.parallel([
|
||||
function createRegistryContract(paraCb) {
|
||||
self.events.request("blockchain:contract:create",
|
||||
{abi: config.registryAbi, address: config.registryAddress},
|
||||
(registry) => {
|
||||
paraCb(null, registry);
|
||||
=======
|
||||
self.events.request("blockchain:contract:create",
|
||||
{abi: config.registrarAbi, address: config.registrarAddress},
|
||||
(registrar) => {
|
||||
async.each(Object.keys(self.registration.subdomains), (subDomainName, eachCb) => {
|
||||
const toSend = registrar.methods.register(utils.soliditySha3(subDomainName), defaultAccount);
|
||||
|
||||
toSend.estimateGas().then(gasEstimated => {
|
||||
return toSend.send({gas: gasEstimated + 1000, from: defaultAccount}).then(transaction => {
|
||||
if (transaction.status !== "0x1" && transaction.status !== "0x01" && transaction.status !== true) {
|
||||
return eachCb('Failed to register. Check gas cost.');
|
||||
}
|
||||
eachCb(null, transaction);
|
||||
}).catch(err => {
|
||||
eachCb('Failed to register with error: ' + (err.message || err));
|
||||
});
|
||||
}).catch(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
|
||||
});
|
||||
},
|
||||
function createRegistrarContract(paraCb) {
|
||||
@ -218,7 +249,9 @@ class ENS {
|
||||
configureContracts() {
|
||||
const config = {
|
||||
"default": {
|
||||
"gas": "auto",
|
||||
"gas": "auto"
|
||||
},
|
||||
"development": {
|
||||
"contracts": {
|
||||
"ENS": {
|
||||
"deploy": false,
|
||||
@ -248,6 +281,9 @@ class ENS {
|
||||
"Resolver": {
|
||||
"deploy": false
|
||||
},
|
||||
"Resolver": {
|
||||
"deploy": false
|
||||
},
|
||||
"FIFSRegistrar": {
|
||||
"deploy": false
|
||||
}
|
||||
@ -262,6 +298,9 @@ class ENS {
|
||||
"Resolver": {
|
||||
"deploy": false
|
||||
},
|
||||
"Resolver": {
|
||||
"deploy": false
|
||||
},
|
||||
"FIFSRegistrar": {
|
||||
"deploy": false
|
||||
}
|
||||
@ -276,13 +315,39 @@ class ENS {
|
||||
"Resolver": {
|
||||
"deploy": false
|
||||
},
|
||||
"Resolver": {
|
||||
"deploy": false
|
||||
},
|
||||
"FIFSRegistrar": {
|
||||
"deploy": false
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
config.testnet = config.ropsten;
|
||||
=======
|
||||
|
||||
if (this.registration && this.registration.rootDomain) {
|
||||
// Register root domain if it is defined
|
||||
const rootNode = namehash.hash(this.registration.rootDomain);
|
||||
config.development.contracts['FIFSRegistrar'] = {
|
||||
"deploy": true,
|
||||
"args": ["$ENSRegistry", rootNode],
|
||||
"onDeploy": [
|
||||
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
|
||||
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
|
||||
var reverseNode = web3.utils.soliditySha3(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();
|
||||
})`
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
this.embark.registerContractConfiguration(config);
|
||||
>>>>>>> if no register config, dont register anything
|
||||
|
||||
if (this.registration && this.registration.rootDomain) {
|
||||
// Register root domain if it is defined
|
||||
|
@ -1,7 +1,11 @@
|
||||
/*global web3*/
|
||||
const namehash = require('eth-ens-namehash');
|
||||
|
||||
<<<<<<< HEAD
|
||||
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, logger, secureSend, callback) {
|
||||
=======
|
||||
function registerSubDomain(ens, registrar, resolver, defaultAccount, subdomain, rootDomain, reverseNode, address, callback) {
|
||||
>>>>>>> if no register config, dont register anything
|
||||
const subnode = namehash.hash(subdomain);
|
||||
const rootNode = namehash.hash(rootDomain);
|
||||
const node = namehash.hash(`${subdomain}.${rootDomain}`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user