diff --git a/src/index.ts b/src/index.ts index 415050c..84c23e8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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(); }