mirror of
https://github.com/status-im/status-js-api.git
synced 2025-02-16 19:37:08 +00:00
Merge pull request #13 from status-im/readd_provider
rea-add connectToProvider
This commit is contained in:
commit
3348b15138
14
src/index.ts
14
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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user