allow using legacy versions via npm

pull/1/head
d11e9 9 years ago
parent a9d1cc56bc
commit 8e3677c83a
  1. 9
      README.md
  2. 13
      index.js

@ -29,3 +29,12 @@ Starting from version 0.1.6, multiple files are supported with automatic import
console.log(contractName + ': ' + output.contracts[contractName].bytecode);
Note that all input files that are imported have to be supplied, the compiler will not load any additional files on its own.
###Using a legacy version
In order to allow compiling contracts using a specific version of solidity, the `solc.setVersion` method is available.
var solc = require('solc');
solc.setVersion( 'latest' ); // this is used by default
solc.setVersion( 'v0.1.1-2015-08-04-6ff4cd6' );
var output = solc.compile( "contract t { function g() {} }", 1 );

@ -1,5 +1,5 @@
var soljson = require('./bin/soljson-latest.js');
function setupMethods (soljson){
var compileJSON = soljson.cwrap("compileJSON", "string", ["string", "number"]);
var compileJSONMulti =
@ -16,8 +16,15 @@ var compile = function(input, optimise) {
return JSON.parse(result);
}
var version = soljson.cwrap("version", "string", []);
module.exports = {
return {
version: version,
compile: compile,
version: soljson.cwrap("version", "string", [])
useVersion: function( versionString ){
return setupMethods( require('./bin/soljson-' + versionString + '.js' ) );
}
}
}
module.exports = setupMethods( require('./bin/soljson-latest.js') );

Loading…
Cancel
Save