Fallback to provider if no contract signer is given #29
@ -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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user