Fallback to provider if no contract signer is given #29

Merged
bumi merged 2 commits from fallback-provider into master 2018-04-21 09:19:43 +00:00
Showing only changes of commit 42bfb3d24e - Show all commits

View File

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