Use destructuring for options

This makes it more readable what options are used
This commit is contained in:
bumi 2018-04-26 10:23:27 +02:00
parent 78b47753b3
commit 3895553e88

View File

@ -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 = {};
}