more fixes

Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
VoR0220 2018-05-23 13:00:34 -05:00
parent bf40bdb93b
commit 793a618c12
2 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,5 @@
const namehash = require('eth-ens-namehash'); const namehash = require('eth-ens-namehash');
const Web3 = require('web3');
/*global web3*/ /*global web3*/
let __embarkENS = {}; let __embarkENS = {};
@ -250,8 +251,9 @@ var registryAddresses = {
"4": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A" "4": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A"
}; };
__embarkENS.setProvider = function (options) { __embarkENS.setProvider = function () {
const self = this; const self = this;
// get network id and then assign ENS contract based on that // get network id and then assign ENS contract based on that
self.ens = web3.eth.net.getId().then(id => { self.ens = web3.eth.net.getId().then(id => {
if (registryAddresses[id] !== undefined) { if (registryAddresses[id] !== undefined) {
@ -265,8 +267,7 @@ __embarkENS.setProvider = function (options) {
__embarkENS.resolve = function(name) { __embarkENS.resolve = function(name) {
const self = this; const self = this;
if (self.ens === undefined) if (self.ens === undefined) return undefined;
return undefined;
let node = namehash(name); let node = namehash(name);

View File

@ -41,15 +41,12 @@ class ENS {
} }
addSetProvider() { addSetProvider() {
let config = JSON.stringify({ let config = JSON.stringify({});
server: this.storageConfig.host,
port: this.storageConfig.port
});
let code = "\nEmbarkJS.Names.setProvider('ens'," + config + ");"; let code = "\nEmbarkJS.Names.setProvider('ens'," + config + ");";
let shouldInit = (storageConfig) => { let shouldInit = (namesConfig) => {
return (namesConfig.provider === 'ens' && storageConfig.enabled === true); return (namesConfig.provider === 'ens' && namesConfig.enabled === true);
}; };
this.embark.addProviderInit('names', code, shouldInit); this.embark.addProviderInit('names', code, shouldInit);