From f5595adb436ba78e48f7b6e1ca219d23081f8dfb Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Mon, 26 Oct 2015 18:42:56 -0500 Subject: [PATCH] Update compiler.js --- lib/compiler.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 74816d5a0..daf6b4121 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -13,14 +13,15 @@ Compiler.prototype.init = function(env) { }; Compiler.prototype.compile_solidity = function(contractFiles) { -console.log(contractFiles.length); - var sources = {} + + var input = {} for (var i = 0; i < contractFiles.length; i++){ - sources[contractFiles[i]] = fs.readFileSync(contractFiles[i]).toString(); + input[contractFiles[i].substring(14)] = fs.readFileSync(contractFiles[i]).toString(); } - - var output = solc.compile(source, 1); + + + var output = solc.compile({sources: input}, 1); var json = output.contracts; @@ -31,7 +32,6 @@ console.log(contractFiles.length); compiled_object[className] = {}; compiled_object[className].code = contract.bytecode; - compiled_object[className].info = {}; compiled_object[className].info.abiDefinition = JSON.parse(contract.interface); } @@ -96,7 +96,7 @@ Compiler.prototype.compile = function(contractFiles) { throw new Error("extension not known, got " + extension); } } - console.log(solidity); + if (solidity.length > 0) return this.compile_solidity(solidity); if (serpent.length > 0) return this.compile_serpent(serpent); };