I'm looking at the code example as shown in https://github.com/eris-ltd/eris-contracts.js
var myAbi = [...];
var myCompiledCode = "...";
// Create a factory for the contract with the JSON interface 'myAbi'.
var myContractFactory = contractManager.newContractFactory(myAbi);
// To create a new instance and simultaneously deploy a contract use `new`:
var myNewContract;
myContractFactory.new({data: myCompiledCode}, function(error, contract){
if (error) {
// Something.
throw error;
}
myNewContract = contract;
});
But I've no idea how to do the compilation. I understand that the eris-contracts.js is built on web3.js But I'm not sure what the provider I've got to enter when instantiating web3 object.
var edbFactory = require('eris-db');
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://simplechain:1337/rpc'));
var edb = edbFactory.createInstance("http://simplechain:1337/rpc");
var source = "" +
"contract test {\n" +
" function multiply(uint a) returns(uint d) {\n" +
" return a * 7;\n" +
" }\n" +
"}\n";
var compiled = web3.eth.compile.solidity(source);
console.log(compiled);