Constructor configuration options #40

Merged
bumi merged 2 commits from feature/constructor-options into master 2018-04-26 10:32:13 +00:00
Showing only changes of commit 3895553e88 - Show all commits

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