add ENS console commands

This commit is contained in:
StevenJNPearce 2018-09-29 22:39:39 +02:00 committed by Pascal Precht
parent 7e12f80eda
commit 64c6f58497
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 28 additions and 0 deletions

View File

@ -96,6 +96,34 @@ class ENS {
this.addENSToEmbarkJS(); this.addENSToEmbarkJS();
this.registerEvents(); 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() { registerEvents() {