diff --git a/lib/modules/console_listener/index.js b/lib/modules/console_listener/index.js index 6a6e557e9..5d8896c2b 100644 --- a/lib/modules/console_listener/index.js +++ b/lib/modules/console_listener/index.js @@ -28,6 +28,7 @@ class ConsoleListener { } contractsList.forEach(contract => { if (!contract.deployedAddress) return; + if (!contract.abiDefinition) return; let address = contract.deployedAddress.toLowerCase(); if (!this.addressToContract[address]) { diff --git a/lib/modules/contracts_manager/index.js b/lib/modules/contracts_manager/index.js index 5f4023e9b..aaf9528cf 100644 --- a/lib/modules/contracts_manager/index.js +++ b/lib/modules/contracts_manager/index.js @@ -206,6 +206,7 @@ class ContractsManager { } callback(); }, + /* function removeContractsWithNoCode(callback) { let className, contract; let dictionary = Object.keys(self.contracts); @@ -224,6 +225,7 @@ class ContractsManager { self.logger.trace(self.contracts); callback(); }, + */ // TODO: needs refactoring, has gotten too complex /*eslint complexity: ["error", 16]*/ /*eslint max-depth: ["error", 16]*/ @@ -232,6 +234,9 @@ class ContractsManager { for (className in self.contracts) { contract = self.contracts[className]; + if(contract.code === undefined) + continue; + // look in code for dependencies let libMatches = (contract.code.match(/:(.*?)(?=_)/g) || []); for (let match of libMatches) { @@ -294,6 +299,7 @@ class ContractsManager { callback(); } ], function (err) { + console.dir(self.contractsConfig); if (err) { self.compileError = true; self.events.emit("status", __("Compile/Build error")); diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 5339e6d07..391293598 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -85,6 +85,7 @@ class ENS { const self = this; // Code inspired by https://github.com/monkybrain/ipfs-to-ens const {name, storageHash} = options; + console.dir(options); if (!utils.isValidEthDomain(name)) { return cb('Invalid domain name ' + name); @@ -93,8 +94,12 @@ class ENS { let hashedName = namehash.hash(name); let contentHash; try { + console.dir('storageHash'); + console.dir(storageHash); contentHash = utils.hashTo32ByteHexString(storageHash); } catch (e) { + console.dir('ens error with ipfs'); + console.dir(e); return cb('Invalid IPFS hash'); } diff --git a/lib/modules/ipfs/upload.js b/lib/modules/ipfs/upload.js index 23b410f55..7ad4cf56b 100644 --- a/lib/modules/ipfs/upload.js +++ b/lib/modules/ipfs/upload.js @@ -2,6 +2,8 @@ require('colors'); let async = require('async'); let shelljs = require('shelljs'); +const path = require('path'); + class IPFS { constructor(options) { @@ -35,11 +37,10 @@ class IPFS { }); }, function getHashFromOutput(result, callback) { - let rows = result.split("\n"); - let dir_row = rows[rows.length - 2]; - let dir_hash = dir_row.split(" ")[1]; + let regexPattern = `added ([a-zA-Z1-9]{46}) ${path.basename(self.buildDir)}\n`; + let dirHash = result.match(RegExp(regexPattern, 'm'))[1]; - callback(null, dir_hash); + callback(null, dirHash); }, function printUrls(dir_hash, callback) { console.log(("=== " + __("DApp available at") + " http://localhost:8080/ipfs/" + dir_hash + "/").green);