mirror of https://github.com/embarklabs/embark.git
use config password file; tolerate somethign going terribly wrong since it wouldnt' affect the blockchain process generally
This commit is contained in:
parent
69f356b3f0
commit
71e9eed67b
|
@ -5,16 +5,20 @@ const {readFileSync, dappPath} = require('../../core/fs');
|
|||
|
||||
class DevFunds {
|
||||
constructor(blockchainConfig) {
|
||||
this.web3 = null;
|
||||
this.blockchainConfig = blockchainConfig;
|
||||
this.accounts = [];
|
||||
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
|
||||
this.password = readFileSync(dappPath('config/development/password'), 'utf8').replace('\n', '');
|
||||
this.web3 = new Web3();
|
||||
this.networkId = null;
|
||||
this.balance = Web3.utils.toWei("1", "ether");
|
||||
if (this.blockchainConfig.account.balance) {
|
||||
this.balance = getWeiBalanceFromString(this.blockchainConfig.account.balance, this.web3);
|
||||
// TODO: temporary to avoid nasty suprises, should be removed
|
||||
try {
|
||||
this.web3 = null;
|
||||
this.blockchainConfig = blockchainConfig;
|
||||
this.accounts = [];
|
||||
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
|
||||
this.password = readFileSync(dappPath(blockchainConfig.account.password), 'utf8').replace('\n', '');
|
||||
this.web3 = new Web3();
|
||||
this.networkId = null;
|
||||
this.balance = Web3.utils.toWei("1", "ether");
|
||||
if (this.blockchainConfig.account.balance) {
|
||||
this.balance = getWeiBalanceFromString(this.blockchainConfig.account.balance, this.web3);
|
||||
}
|
||||
} catch(_err) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,6 +99,9 @@ class DevFunds {
|
|||
}
|
||||
|
||||
createFundAndUnlockAccounts(cb) {
|
||||
if (!this.web3) {
|
||||
return cb();
|
||||
}
|
||||
async.waterfall([
|
||||
(next) => {
|
||||
this.connectToNode(next);
|
||||
|
|
Loading…
Reference in New Issue