diff --git a/lib/compiler.js b/lib/compiler.js index bcac64e6a..63919338b 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -21,9 +21,20 @@ Compiler.prototype.init = function(env) { }; Compiler.prototype.compile_solidity = function(contractFile) { - var cmd, result, output, json, compiled_object; + var cmd, result, output, version, json, compiled_object; - cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; + cmd = "solc --version"; + + result = exec(cmd, {silent: true}); + output = result.output; + version = output.split('\n')[1].split(' ')[1].slice(0,5); + + if (version == '0.1.1') { + cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi"; + } + else { + cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; + } result = exec(cmd, {silent: true}); output = result.output; @@ -41,7 +52,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { compiled_object[className] = {}; compiled_object[className].code = contract.binary; compiled_object[className].info = {}; - compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"]); + compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]); } return compiled_object;