import ethers from 'ethers' ; const privateKeyWithEth = '0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d' ; export function getGanacheProvider ( ) { return new ethers . providers . JsonRpcProvider ( `http://${ process . env . GANACHE_HOST }:${ process . env . GANACHE_PORT }` ) ; } export function getPrivateKeyWithEth ( ) { return privateKeyWithEth ; } export function getWalletWithEthAndProvider ( ) { const ganacheProvider = new ethers . providers . JsonRpcProvider ( `http://${ process . env . GANACHE_HOST }:${ process . env . GANACHE_PORT }` ) ; return new ethers . Wallet ( privateKeyWithEth , ganacheProvider ) ; } export async function getNetworkId ( ) { const ganacheProvider = new ethers . providers . JsonRpcProvider ( `http://${ process . env . GANACHE_HOST }:${ process . env . GANACHE_PORT }` ) ; return ( await ganacheProvider . getNetwork ( ) ) . chainId ; } export function getNetworkName ( networkId ) { switch ( Number ( networkId ) ) { case 1 : return 'live' ; case 3 : return 'ropsten' ; case 4 : return 'rinkeby' ; case 5 : return 'goerli' ; case 42 : return 'kovan' ; default : return 'development' ; } }