Skip to content

Commit

Permalink
Added WebSocketProvider support for ENS names in filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 24, 2020
1 parent aeeb75f commit 6707754
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/providers/src.ts/websocket-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ export class WebSocketProvider extends JsonRpcProvider {
async _subscribe(tag: string, param: Array<any>, processFunc: (result: any) => void): Promise<void> {
let subIdPromise = this._subIds[tag];
if (subIdPromise == null) {
subIdPromise = this.send("eth_subscribe", param);
subIdPromise = Promise.all(param).then((param) => {
return this.send("eth_subscribe", param);
});
this._subIds[tag] = subIdPromise;
}
const subId = await subIdPromise;
Expand All @@ -188,11 +190,12 @@ export class WebSocketProvider extends JsonRpcProvider {
});
break;

case "filter":
this._subscribe(event.tag, [ "logs", event.filter ], (result: any) => {
case "filter": {
this._subscribe(event.tag, [ "logs", this._getFilter(event.filter) ], (result: any) => {
this.emit(event.filter, result);
});
break;
}

case "tx": {
const emitReceipt = (event: Event) => {
Expand Down

0 comments on commit 6707754

Please sign in to comment.