diff --git a/lib/kredits.js b/lib/kredits.js index 8182137..4e37b9b 100644 --- a/lib/kredits.js +++ b/lib/kredits.js @@ -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;