Merge pull request #29 from 67P/fallback-provider

Fallback to provider if no contract signer is given
This commit is contained in:
fsmanuel 2018-04-21 09:19:43 +00:00 committed by GitHub
commit 3e4d270bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,9 @@ class Kredits {
if (!address || !abi) {
throw new Error(`Address or ABI not found for ${contractName}`);
}
let contract = new ethers.Contract(address, abi, this.signer);
let signerOrProvider = this.signer || this.provider;
let contract = new ethers.Contract(address, abi, signerOrProvider);
this.contracts[name] = new Contracts[contractName](contract);
this.contracts[name].ipfs = this.ipfs;