Merge pull request #58 from d11e9/legacyNpm

Legacy npm
pull/1/head
chriseth 9 years ago
commit 01b761c698
  1. 12
      README.md
  2. 14
      index.js
  3. 2
      package.json

@ -29,3 +29,15 @@ 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.useVersion` method is available. This returns a new solc object using the version provided. **Note**: version strings must match the version substring of the files availble in `/bin/soljson-*.js`. See below for an example.
var solc = require('solc');
// by default the latest version is used
// ie: solc.useVersion('latest')
// getting a legacy version
var solcV011 = solc.useVersion( 'v0.1.1-2015-08-04-6ff4cd6' );
var output = solcV011.compile( "contract t { function g() {} }", 1 );

@ -1,5 +1,4 @@
var soljson = require('./bin/soljson-latest.js');
function setupMethods (soljson){
var compileJSON = soljson.cwrap("compileJSON", "string", ["string", "number"]);
var compileJSONMulti =
@ -16,8 +15,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') );

@ -1,6 +1,6 @@
{
"name": "solc",
"version": "0.1.6",
"version": "0.1.6-2",
"description": "Solidity compiler",
"main": "index.js",
"scripts": {

Loading…
Cancel
Save