mirror of https://github.com/embarklabs/embark.git
disable preregister in privatenet and fix conditions
This commit is contained in:
parent
70d71b190c
commit
5f3dd25e06
|
@ -8,6 +8,7 @@ const reverseAddrSuffix = '.addr.reverse';
|
||||||
class ENS {
|
class ENS {
|
||||||
constructor(embark, _options) {
|
constructor(embark, _options) {
|
||||||
this.env = embark.env;
|
this.env = embark.env;
|
||||||
|
this.isDev = embark.config.blockchainConfig.isDev;
|
||||||
this.logger = embark.logger;
|
this.logger = embark.logger;
|
||||||
this.events = embark.events;
|
this.events = embark.events;
|
||||||
this.namesConfig = embark.config.namesystemConfig;
|
this.namesConfig = embark.config.namesystemConfig;
|
||||||
|
@ -21,6 +22,12 @@ class ENS {
|
||||||
}
|
}
|
||||||
this.doSetENSProvider = this.namesConfig.provider === 'ens';
|
this.doSetENSProvider = this.namesConfig.provider === 'ens';
|
||||||
|
|
||||||
|
if (this.env === 'privatenet') {
|
||||||
|
this.logger.warn(__('ENS is disabled in privatenet'));
|
||||||
|
this.logger.info(__('To use ENS, use development, one of the testnets or mainnet'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.addENSToEmbarkJS();
|
this.addENSToEmbarkJS();
|
||||||
this.configureContracts();
|
this.configureContracts();
|
||||||
this.registerEvents();
|
this.registerEvents();
|
||||||
|
@ -67,7 +74,7 @@ class ENS {
|
||||||
self.addSetProvider(config);
|
self.addSetProvider(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.env === 'development' || !self.registration || !self.registration.subdomains || !Object.keys(self.registration.subdomains).length) {
|
if (!self.isDev || !self.registration || !self.registration.subdomains || !Object.keys(self.registration.subdomains).length) {
|
||||||
return cb();
|
return cb();
|
||||||
}
|
}
|
||||||
self.registerConfigDomains(config, cb);
|
self.registerConfigDomains(config, cb);
|
||||||
|
@ -279,6 +286,7 @@ class ENS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
config.testnet = config.ropsten;
|
||||||
|
|
||||||
if (this.registration && this.registration.rootDomain) {
|
if (this.registration && this.registration.rootDomain) {
|
||||||
// Register root domain if it is defined
|
// Register root domain if it is defined
|
||||||
|
@ -298,12 +306,13 @@ class ENS {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.embark.registerContractConfiguration(config);
|
this.embark.registerContractConfiguration(config);
|
||||||
|
|
||||||
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/ENSRegistry.sol'));
|
if (this.isDev) {
|
||||||
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/FIFSRegistrar.sol'));
|
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/ENSRegistry.sol'));
|
||||||
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/Resolver.sol'));
|
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/FIFSRegistrar.sol'));
|
||||||
|
this.embark.events.request("config:contractsFiles:add", this.embark.pathToFile('./contracts/Resolver.sol'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addSetProvider(config) {
|
addSetProvider(config) {
|
||||||
|
|
Loading…
Reference in New Issue