@@ -5,16 +5,20 @@ const {readFileSync, dappPath} = require('../../core/fs');
55
66class DevFunds {
77 constructor ( blockchainConfig ) {
8- this . web3 = null ;
9- this . blockchainConfig = blockchainConfig ;
10- this . accounts = [ ] ;
11- this . numAccounts = this . blockchainConfig . account . numAccounts || 0 ;
12- this . password = readFileSync ( dappPath ( 'config/development/password' ) , 'utf8' ) . replace ( '\n' , '' ) ;
13- this . web3 = new Web3 ( ) ;
14- this . networkId = null ;
15- this . balance = Web3 . utils . toWei ( "1" , "ether" ) ;
16- if ( this . blockchainConfig . account . balance ) {
17- this . balance = getWeiBalanceFromString ( this . blockchainConfig . account . balance , this . web3 ) ;
8+ // TODO: temporary to avoid nasty suprises, should be removed
9+ try {
10+ this . web3 = null ;
11+ this . blockchainConfig = blockchainConfig ;
12+ this . accounts = [ ] ;
13+ this . numAccounts = this . blockchainConfig . account . numAccounts || 0 ;
14+ this . password = readFileSync ( dappPath ( blockchainConfig . account . password ) , 'utf8' ) . replace ( '\n' , '' ) ;
15+ this . web3 = new Web3 ( ) ;
16+ this . networkId = null ;
17+ this . balance = Web3 . utils . toWei ( "1" , "ether" ) ;
18+ if ( this . blockchainConfig . account . balance ) {
19+ this . balance = getWeiBalanceFromString ( this . blockchainConfig . account . balance , this . web3 ) ;
20+ }
21+ } catch ( _err ) {
1822 }
1923 }
2024
@@ -95,6 +99,9 @@ class DevFunds {
9599 }
96100
97101 createFundAndUnlockAccounts ( cb ) {
102+ if ( ! this . web3 ) {
103+ return cb ( ) ;
104+ }
98105 async . waterfall ( [
99106 ( next ) => {
100107 this . connectToNode ( next ) ;
0 commit comments