From 9e6ef275a36285822411d6f35e6b8505517167f5 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 3 Aug 2018 08:50:42 -0400 Subject: [PATCH 1/3] disable ens if it is not enabled --- lib/modules/ens/index.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index c51a86ac1..3ac8443b8 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -14,6 +14,13 @@ class ENS { this.registration = this.namesConfig.register || {}; this.embark = embark; + if (this.namesConfig === {} || + this.namesConfig.enabled !== true || + this.namesConfig.available_providers.indexOf('ens') < 0 || + this.namesConfig.provider !== 'ens') { + return; + } + this.addENSToEmbarkJS(); this.configureContracts(); this.registerEvents(); @@ -179,14 +186,6 @@ class ENS { addENSToEmbarkJS() { const self = this; - // TODO: make this a shouldAdd condition - if (this.namesConfig === {}) { - return; - } - - if ((this.namesConfig.available_providers.indexOf('ens') < 0) && (this.namesConfig.provider !== 'ens' || this.namesConfig.enabled !== true)) { - return; - } // get namehash, import it into file self.events.request("version:get:eth-ens-namehash", function (EnsNamehashVersion) { From 828bcabb7b5d4817f7956ff82bfb22bf653b380c Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 3 Aug 2018 15:15:01 -0400 Subject: [PATCH 2/3] remove provider!==ens --- lib/modules/ens/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 3ac8443b8..2f94092e7 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -16,9 +16,10 @@ class ENS { if (this.namesConfig === {} || this.namesConfig.enabled !== true || - this.namesConfig.available_providers.indexOf('ens') < 0 || - this.namesConfig.provider !== 'ens') { + this.namesConfig.available_providers.indexOf('ens') < 0) { return; + } else if (this.namesConfig.provider !== 'ens') { + this.providerNotENS = true; } this.addENSToEmbarkJS(); @@ -186,6 +187,9 @@ class ENS { addENSToEmbarkJS() { const self = this; + if (self.providerNotENS) { + return; + } // get namehash, import it into file self.events.request("version:get:eth-ens-namehash", function (EnsNamehashVersion) { From 9c039fb6e2d2778111d2a27587154e426c3b7eac Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 6 Aug 2018 08:47:27 -0400 Subject: [PATCH 3/3] only set provider if provider is ENS --- lib/modules/ens/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 2f94092e7..472ea3168 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -18,9 +18,8 @@ class ENS { this.namesConfig.enabled !== true || this.namesConfig.available_providers.indexOf('ens') < 0) { return; - } else if (this.namesConfig.provider !== 'ens') { - this.providerNotENS = true; } + this.doSetENSProvider = this.namesConfig.provider === 'ens'; this.addENSToEmbarkJS(); this.configureContracts(); @@ -63,7 +62,10 @@ class ENS { resolverAbi: results[2].abiDefinition, resolverAddress: results[2].deployedAddress }; - self.addSetProvider(config); + + if (self.doSetENSProvider) { + self.addSetProvider(config); + } if (!self.env === 'development' || !self.registration || !self.registration.subdomains || !Object.keys(self.registration.subdomains).length) { return cb(); @@ -187,9 +189,6 @@ class ENS { addENSToEmbarkJS() { const self = this; - if (self.providerNotENS) { - return; - } // get namehash, import it into file self.events.request("version:get:eth-ens-namehash", function (EnsNamehashVersion) {