From 64c6f58497fa2e04a30dc295d3a8c20d82cc8b5c Mon Sep 17 00:00:00 2001 From: StevenJNPearce Date: Sat, 29 Sep 2018 22:39:39 +0200 Subject: [PATCH] add ENS console commands --- lib/modules/ens/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index e01f2f9cb..d0e7b4d99 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -96,6 +96,34 @@ class ENS { this.addENSToEmbarkJS(); this.registerEvents(); + this.registerConsoleCommands(); + } + + + registerConsoleCommands() { + this.embark.registerConsoleCommand((cmd, _options) => { + let [cmdName, domain] = cmd.split(' '); + return { + match: () => cmdName === 'resolve', + process: (cb) => global.EmbarkJS.Names.resolve(domain, cb) + }; + }); + + this.embark.registerConsoleCommand((cmd, _options) => { + let [cmdName, address] = cmd.split(' '); + return { + match: () => cmdName === 'lookup', + process: (cb) => global.EmbarkJS.Names.lookup(address, cb) + }; + }); + + this.embark.registerConsoleCommand((cmd, _options) => { + let [cmdName, name, address] = cmd.split(' '); + return { + match: () => cmdName === 'registerSubDomain', + process: (cb) => global.EmbarkJS.Names.registerSubDomain(name, address, cb) + }; + }); } registerEvents() {