Merge pull request #13 from status-im/readd_provider

rea-add connectToProvider
This commit is contained in:
Iuri Matias 2019-01-31 16:25:12 +01:00 committed by GitHub
commit 3348b15138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,20 @@ class StatusJS {
);
}
public async connectToProvider(provider: any, privateKey: any) {
let web3: any = new Web3();
web3.setProvider(provider);
this.shh = web3.shh;
this.mailservers = new mailservers(web3);
await web3.shh.setMinPoW(constants.post.POW_TARGET);
_sig.set(
this,
privateKey ? await this.generateWhisperKeyFromWallet(privateKey) : await web3.shh.newKeyPair()
);
}
public isConnected() {
return this.shh.isListening();
}