import 'dotenv/config' ; export function getNodeUrl ( networkName ) { if ( networkName ) { const uri = process . env [ `NODE_URI_${ networkName . toUpperCase ( ) }` ] ; if ( uri && uri !== '' ) { return uri ; } } if ( networkName === 'localhost' ) { return 'http://localhost:8545' ; } let uri = process . env . NODE_URI ; if ( uri ) { uri = uri . replace ( '{{networkName}}' , networkName ) ; } if ( ! uri || uri === '' ) { return '' ; } if ( uri . indexOf ( '{{' ) >= 0 ) { throw new Error ( `invalid uri or network not supported by node provider : ${ uri }` ) ; } return uri ; } export function getMnemonic ( networkName ? ) { if ( networkName ) { const mnemonic = process . env [ `MNEMONIC_${ networkName . toUpperCase ( ) }` ] ; if ( mnemonic && mnemonic !== '' ) { return mnemonic ; } } const mnemonic = process . env . MNEMONIC ; if ( ! mnemonic || mnemonic === '' ) { return 'test test test test test test test test test test test junk' ; } return mnemonic ; } export function accounts ( networkName ? ) { return { mnemonic : getMnemonic ( networkName ) } ; }