only enabble register in dev

This commit is contained in:
Jonathan Rainville 2018-07-25 16:27:30 -04:00
parent 82bbbd6f87
commit 1f02461af1
2 changed files with 7 additions and 3 deletions

View File

@ -149,9 +149,10 @@ __embarkENS.registryAddresses = {
__embarkENS.setProvider = function (config) {
const self = this;
const ERROR_MESSAGE = 'ENS is not available in this chain';
EmbarkJS.onReady(() => {
self.registration = config.registration;
self.registration = config.registration;
self.env = config.env;
EmbarkJS.onReady(() => {
web3.eth.net.getId()
.then((id) => {
const registryAddress = self.registryAddresses[id] || config.registryAddress;
@ -228,10 +229,12 @@ __embarkENS.lookup = function (address, callback) {
__embarkENS.registerSubDomain = function (name, address, callback) {
callback = callback || function () {};
if (this.env !== 'development') {
return callback('Sub-domain registration is only available in development mode');
}
if (!this.registration || !this.registration.rootDomain) {
return callback('No rootDomain is declared in config/namesystem.js (register.rootDomain). Unable to register a subdomain until then.');
}
if (!address || !web3.utils.isAddress(address)) {
return callback('You need to specify a valid address for the subdomain');
}

View File

@ -41,6 +41,7 @@ class ENS {
], (err, results) => {
// result[0] => ENSRegistry; result[1] => FIFSRegistrar; result[2] => FIFSRegistrar
let config = {
env: self.env,
registration: self.registration,
registryAbi: results[0].abiDefinition,
registryAddress: results[0].deployedAddress,