password read from config file and fix for gasprice
This commit is contained in:
parent
11d6980f70
commit
296663edc7
|
@ -9,9 +9,7 @@ class DevFunds {
|
||||||
this.blockchainConfig = blockchainConfig;
|
this.blockchainConfig = blockchainConfig;
|
||||||
this.accounts = [];
|
this.accounts = [];
|
||||||
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
|
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
|
||||||
this.password = readFileSync(dappPath('config/development/password'));
|
this.password = readFileSync(dappPath('config/development/password'), 'utf8').replace('\n', '');
|
||||||
this.password = 'dev_password';
|
|
||||||
this.existingNumAccounts = 0;
|
|
||||||
this.web3 = new Web3();
|
this.web3 = new Web3();
|
||||||
this.balance = Web3.utils.toWei("1", "ether");
|
this.balance = Web3.utils.toWei("1", "ether");
|
||||||
if(this.blockchainConfig.account.balance){
|
if(this.blockchainConfig.account.balance){
|
||||||
|
@ -27,14 +25,14 @@ class DevFunds {
|
||||||
|
|
||||||
this.web3.eth.getAccounts().then((accounts) => {
|
this.web3.eth.getAccounts().then((accounts) => {
|
||||||
this.web3.eth.defaultAccount = accounts[0];
|
this.web3.eth.defaultAccount = accounts[0];
|
||||||
this.existingNumAccounts = accounts.length;
|
this.accounts = accounts;
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createAccounts(numAccounts, password, cb) {
|
createAccounts(numAccounts, password, cb) {
|
||||||
console.dir("creating " + (numAccounts - this.existingNumAccounts) + " new accounts with password " + password);
|
console.dir("creating " + (numAccounts - this.accounts.length) + " new accounts with password " + password);
|
||||||
async.timesLimit((numAccounts - this.existingNumAccounts), 1, (_, next) => {
|
async.timesLimit((numAccounts - this.accounts.length), 1, (_, next) => {
|
||||||
console.dir("--- creating new account");
|
console.dir("--- creating new account");
|
||||||
this.web3.eth.personal.newAccount(password, next);
|
this.web3.eth.personal.newAccount(password, next);
|
||||||
}, (err, accounts) => {
|
}, (err, accounts) => {
|
||||||
|
@ -89,7 +87,7 @@ class DevFunds {
|
||||||
this.fundAccounts(this.balance, next);
|
this.fundAccounts(this.balance, next);
|
||||||
}
|
}
|
||||||
], (err) => {
|
], (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);
|
if(err) console.error('Error creating, unlocking, and funding accounts', err);
|
||||||
|
|
||||||
// this.web3.eth.getAccounts().then((accounts) => {
|
// this.web3.eth.getAccounts().then((accounts) => {
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ContractsManager {
|
||||||
}
|
}
|
||||||
self.events.request("blockchain:gasPrice", (gasprice) => {
|
self.events.request("blockchain:gasPrice", (gasprice) => {
|
||||||
console.dir('[contracts/contracts]: got gasPrice of ' + gasprice);
|
console.dir('[contracts/contracts]: got gasPrice of ' + gasprice);
|
||||||
callback(gasprice);
|
callback(null, gasprice);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function prepareContractsFromCompilation(gasPrice, callback) {
|
function prepareContractsFromCompilation(gasPrice, callback) {
|
||||||
|
|
Loading…
Reference in New Issue