Add helper to initialize a new instance with provider #128

Merged
bumi merged 4 commits from feature/simple-init into master 2019-05-17 07:37:11 +00:00
Showing only changes of commit e20bda73fb - Show all commits

View File

@ -70,7 +70,7 @@ class Kredits {
let { network, rpcUrl, wallet } = connectionOptions;
if (!rpcUrl && network === 'local') { rpcUrl = 'http://localhost:8545'; }
let ethProvider, signer;
if (rpcUrl || network === 'local') {
if (rpcUrl) {
ethProvider = new ethers.providers.JsonRpcProvider(rpcUrl);
} else {
ethProvider = new ethers.getDefaultProvider(network);