Remove useless try on ws connect
This commit is contained in:
parent
81c914b5a2
commit
fe3e4690f6
|
@ -13,20 +13,25 @@ __embarkWhisperNewWeb3.setProvider = function (options) {
|
|||
}
|
||||
// TODO: take into account type
|
||||
self.web3 = new Web3(new Web3.providers.WebsocketProvider("ws://" + provider, options.providerOptions));
|
||||
self.getWhisperVersion(function (err, version) {
|
||||
if (err) {
|
||||
console.log("whisper not available");
|
||||
} else if (version >= 5) {
|
||||
self.web3.shh.newSymKey().then((id) => {
|
||||
self.symKeyID = id;
|
||||
});
|
||||
self.web3.shh.newKeyPair().then((id) => {
|
||||
self.sig = id;
|
||||
});
|
||||
} else {
|
||||
throw new Error("version of whisper not supported");
|
||||
}
|
||||
self.whisperVersion = self.web3.version.whisper;
|
||||
self.web3.currentProvider.on('connect', () => {
|
||||
self.getWhisperVersion(function (err, version) {
|
||||
if (err) {
|
||||
console.log("whisper not available");
|
||||
} else if (version >= 5) {
|
||||
self.web3.shh.newSymKey().then((id) => {
|
||||
self.symKeyID = id;
|
||||
});
|
||||
self.web3.shh.newKeyPair().then((id) => {
|
||||
self.sig = id;
|
||||
});
|
||||
} else {
|
||||
throw new Error("version of whisper not supported");
|
||||
}
|
||||
self.whisperVersion = self.web3.version.whisper;
|
||||
});
|
||||
});
|
||||
self.web3.currentProvider.on('error', () => {
|
||||
console.log("whisper not available");
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue