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

Fallback to provider if no contract signer is given
This commit was merged in pull request #29.
This commit is contained in:
2018-04-21 09:19:43 +00:00
committed by GitHub

View File

@@ -90,7 +90,9 @@ class Kredits {
if (!address || !abi) { if (!address || !abi) {
throw new Error(`Address or ABI not found for ${contractName}`); 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] = new Contracts[contractName](contract);
this.contracts[name].ipfs = this.ipfs; this.contracts[name].ipfs = this.ipfs;