2
0
mirror of synced 2025-02-24 03:58:06 +00:00

Better WebSocket compatibilities with Parity (#)849.

This commit is contained in:
Richard Moore 2020-05-26 06:42:19 -04:00
parent f8777d0986
commit 180a1aff3a
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

View File

@ -179,7 +179,7 @@ export class WebSocketProvider extends JsonRpcProvider {
_startEvent(event: Event): void { _startEvent(event: Event): void {
switch (event.type) { switch (event.type) {
case "block": case "block":
this._subscribe("block", [ "newHeads", { } ], (result: any) => { this._subscribe("block", [ "newHeads" ], (result: any) => {
this.emit("block", BigNumber.from(result.number).toNumber()); this.emit("block", BigNumber.from(result.number).toNumber());
}); });
break; break;
@ -213,7 +213,7 @@ export class WebSocketProvider extends JsonRpcProvider {
// to keep an eye out for transactions we are watching for. // to keep an eye out for transactions we are watching for.
// Starting a subscription for an event (i.e. "tx") that is already // Starting a subscription for an event (i.e. "tx") that is already
// running is (basically) a nop. // running is (basically) a nop.
this._subscribe("tx", [ "newHeads", { } ], (result: any) => { this._subscribe("tx", [ "newHeads" ], (result: any) => {
this._events.filter((e) => (e.type === "tx")).forEach(emitReceipt); this._events.filter((e) => (e.type === "tx")).forEach(emitReceipt);
}); });
break; break;