diff --git a/lib/kredits.js b/lib/kredits.js index b0aa7f7..541d362 100644 --- a/lib/kredits.js +++ b/lib/kredits.js @@ -23,14 +23,15 @@ function capitalize(word) { class Kredits { constructor(provider, signer, options = {}) { + let { addresses, abis, ipfsConfig } = options; + this.provider = provider; this.signer = signer; - // by default we only need the registry address. // the rest is loaded from there in the init() function - this.addresses = options['addresses'] || { Registry: RegistryAddress[this.provider.chainId.toString()] }; // chaiID must be a string - this.abis = options['abis'] || ABIS; - this.ipfs = new IPFS(options['ipfsConfig']); + this.addresses = addresses || { Registry: RegistryAddress[this.provider.chainId.toString()] }; // chaiID must be a string + this.abis = abis || ABIS; + this.ipfs = new IPFS(ipfsConfig); this.contracts = {}; }