From 8748084a6be0cb5d4c2d77611d967fea8c3bea72 Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Wed, 23 May 2018 11:46:02 -0500 Subject: [PATCH] fix indentations for linting purposes Signed-off-by: VoR0220 --- lib/modules/ens/embarkjs.js | 44 +++++++++++------------ lib/modules/ens/index.js | 71 +++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index bb4079ca..be7cfe41 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -1,5 +1,5 @@ const namehash = require('eth-ens-namehash'); - +const Web3 = require('web3'); /*global web3*/ let __embarkENS = {}; @@ -248,8 +248,8 @@ var registryAddresses = { // Ropsten "3": "0x112234455c3a32fd11230c42e7bccd4a84e02010", // Rinkeby - "4": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A", -} + "4": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A" +}; __embarkENS.setProvider = function (options) { const self = this; @@ -264,24 +264,24 @@ __embarkENS.setProvider = function (options) { self.web3 = web3; // get network id and then assign ENS contract based on that self.ens = web3.eth.net.getId().then(id => { - if (registryAddresses[id] !== undefined) { - return new web3.eth.Contract(registryInterface, registryAddresses[id]); - } - // todo: deploy at this point - return undefined; - }) -} + if (registryAddresses[id] !== undefined) { + return new web3.eth.Contract(registryInterface, registryAddresses[id]); + } + // todo: deploy at this point + return undefined; + }); +}; __embarkENS.resolve = function(name) { - const self = this; - const web3 = this.web3; - if (this.ens === undefined) - return undefined; - let node = namehash(name) - this.ens.methods.resolver(node).call().then((resolverAddress) => { - let resolverContract = new web3.eth.Contract(resolverInterface, resolverAddress); - return resolverContract.methods.addr(node).call() - }).then((addr) => { - return addr - }).catch(err => err); -} \ No newline at end of file + const self = this; + const web3 = this.web3; + if (this.ens === undefined) + return undefined; + let node = namehash(name) + this.ens.methods.resolver(node).call().then((resolverAddress) => { + let resolverContract = new web3.eth.Contract(resolverInterface, resolverAddress); + return resolverContract.methods.addr(node).call() + }).then((addr) => { + return addr + }).catch(err => err); +}; diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index ec63b5e8..e07509e2 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -2,53 +2,54 @@ const fs = require('../../core/fs.js'); const utils = require('../../utils/utils.js'); class ENS { - constructor(embark, options) { - this.logger = embark.logger; - this.events = embark.events; - this.web3 = options.web3; - this.embark = embark; + constructor(embark, options) { + this.logger = embark.logger; + this.events = embark.events; + this.web3 = options.web3; + this.embark = embark; - this.addENSToEmbarkJS(); - this.addSetProvider(); + this.addENSToEmbarkJS(); + this.addSetProvider(); } - addENSToEmbarkJS() { - const self = this; - // TODO: make this a shouldAdd condition - if (this.namesConfig === {}) { - return; - } + 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; - } + if ((this.namesConfig.available_providers.indexOf('ens') < 0) && (this.namesConfig.provider !== 'ens' || this.namesConfig.enabled !== true)) { + return; + } - self.events.request("version:get:eth-ens-namehash", function(namehashVersion) { - let currentEnsNamehashVersion = require('../../../package.json').dependencies["eth-ens-namehash"]; - if (EnsNamehashVersion !== currentEnsNamehashVersion) { - self.events.request("version:getPackageLocation", "eth-ens-namehash", EnsNamehashVersion, function(err, location) { - self.embark.registerImportFile("eth-ens-namehash", fs.dappPath(location)); - }); - } - }); + self.events.request("version:get:eth-ens-namehash", function(namehashVersion) { + let currentEnsNamehashVersion = require('../../../package.json').dependencies["eth-ens-namehash"]; + if (EnsNamehashVersion !== currentEnsNamehashVersion) { + self.events.request("version:getPackageLocation", "eth-ens-namehash", EnsNamehashVersion, function(err, location) { + self.embark.registerImportFile("eth-ens-namehash", fs.dappPath(location)); + }); + } + }); - let code = ""; - code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString(); - code += "\nEmbarkJS.Names.registerProvider('ens', __embarkENS);"; + let code = ""; + code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString(); + code += "\nEmbarkJS.Names.registerProvider('ens', __embarkENS);"; - this.embark.addCodeToEmbarkJS(code); + this.embark.addCodeToEmbarkJS(code); } addSetProvider() { - let config = JSON.stringify({ - web3: this.nameConfig.web3, - }); + 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) => { - return (namesConfig.provider === 'ens' && storageConfig.enabled === true); - }; + let shouldInit = (storageConfig) => { + return (namesConfig.provider === 'ens' && storageConfig.enabled === true); + }; this.embark.addProviderInit('names', code, shouldInit); }