password read from config file and fix for gasprice

This commit is contained in:
emizzle 2018-07-16 21:19:01 +02:00
parent 11d6980f70
commit 296663edc7
2 changed files with 6 additions and 8 deletions

View File

@ -9,9 +9,7 @@ class DevFunds {
this.blockchainConfig = blockchainConfig;
this.accounts = [];
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
this.password = readFileSync(dappPath('config/development/password'));
this.password = 'dev_password';
this.existingNumAccounts = 0;
this.password = readFileSync(dappPath('config/development/password'), 'utf8').replace('\n', '');
this.web3 = new Web3();
this.balance = Web3.utils.toWei("1", "ether");
if(this.blockchainConfig.account.balance){
@ -27,14 +25,14 @@ class DevFunds {
this.web3.eth.getAccounts().then((accounts) => {
this.web3.eth.defaultAccount = accounts[0];
this.existingNumAccounts = accounts.length;
this.accounts = accounts;
cb();
});
}
createAccounts(numAccounts, password, cb) {
console.dir("creating " + (numAccounts - this.existingNumAccounts) + " new accounts with password " + password);
async.timesLimit((numAccounts - this.existingNumAccounts), 1, (_, next) => {
console.dir("creating " + (numAccounts - this.accounts.length) + " new accounts with password " + password);
async.timesLimit((numAccounts - this.accounts.length), 1, (_, next) => {
console.dir("--- creating new account");
this.web3.eth.personal.newAccount(password, next);
}, (err, accounts) => {
@ -89,7 +87,7 @@ class DevFunds {
this.fundAccounts(this.balance, next);
}
], (err) => {
console.trace(`--- COMPLETED THE ACCOUNTS (${this.accounts.join(', ')} and funded with ${this.balance} wei)`);
console.dir(`--- COMPLETED THE ACCOUNTS (${this.accounts.join(', ')} and funded with ${this.balance} wei)`);
if(err) console.error('Error creating, unlocking, and funding accounts', err);
// this.web3.eth.getAccounts().then((accounts) => {

View File

@ -100,7 +100,7 @@ class ContractsManager {
}
self.events.request("blockchain:gasPrice", (gasprice) => {
console.dir('[contracts/contracts]: got gasPrice of ' + gasprice);
callback(gasprice);
callback(null, gasprice);
});
},
function prepareContractsFromCompilation(gasPrice, callback) {