define default account for each contract

This commit is contained in:
Iuri Matias 2018-01-12 18:06:51 -05:00
parent 7cac969f16
commit e2aa46eac8
3 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
__mainContext.web3 = undefined;
web3 = new Web3(new Web3.providers.HttpProvider("<%- url -%>"));
web3.eth.getAccounts(function(err, accounts) {
if (err) {
return done(new Error(err));
}
web3.defaultAccount = accounts[0];
<%- done %>
});

View File

@ -2,3 +2,4 @@
<%- className %> = new web3.eth.Contract(<%- className %>Abi);
<%- className %>.options.address = '<%- contract.deployedAddress %>';
<%- className %>.address = '<%- contract.deployedAddress %>';
<%- className %>.options.from = web3.eth.defaultAccount;

View File

@ -110,6 +110,7 @@ class Engine {
codeGeneratorService(_options) {
let self = this;
let generateCode = function (contractsManager) {
let codeGenerator = new CodeGenerator({
blockchainConfig: self.config.blockchainConfig,