From 8425e9b69b912718f0a923557b9a0daf88795399 Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Wed, 20 Jun 2018 14:14:06 -0500 Subject: [PATCH] bare bones bulk registration example spec Signed-off-by: VoR0220 add registrars to system Signed-off-by: VoR0220 --- lib/core/config.js | 5 ++++- lib/modules/ens/index.js | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/core/config.js b/lib/core/config.js index 3ca8fda6..543a1c71 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -281,7 +281,10 @@ Config.prototype.loadNameSystemConfigFile = function() { "default": { "available_providers": ["ens"], "provider": "ens", - "enabled": true + "enabled": true, + "register": { + "rootDomain": "embark" + } } }; diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 8aae1047..17bbca4f 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -14,8 +14,6 @@ class ENS { this.namesConfig = embark.config.namesystemConfig; this.registration = this.namesConfig.register || {}; this.embark = embark; - this.ensRegistry = null; - this.ensResolver = null; if (this.namesConfig === {} || this.namesConfig.enabled !== true || @@ -312,6 +310,22 @@ class ENS { } } + configureRootRegistrar() { + const self = this; + let rootNode = namehash.hash(self.registration.rootDomain); + self.embark.registerContractConfiguration({ + "default": { + "gas": "auto", + "FIFSRegistrar": { + "deploy": true, + "args": ["$ENSRegistry", rootNode], + "onDeploy": ["ENSRegistry.methods.setOwner(0, FIFSRegistrar.options.address).send()"] + } + } + }); + self.embark.events.request("config:contractsFiles:add", self.embark.pathToFile('./contracts/FIFSRegistrar.sol')); + } + addSetProvider(config) { let code = "\nEmbarkJS.Names.setProvider('ens'," + JSON.stringify(config) + ");";