diff --git a/src.ts/providers/provider-socket.ts b/src.ts/providers/provider-socket.ts index e5ec69f4e2..db14b70e84 100644 --- a/src.ts/providers/provider-socket.ts +++ b/src.ts/providers/provider-socket.ts @@ -69,6 +69,7 @@ export class SocketSubscriber implements Subscriber { stop(): void { (>(this.#filterId)).then((filterId) => { + if (this.#provider.destroyed) { return; } this.#provider.send("eth_unsubscribe", [ filterId ]); }); this.#filterId = null; diff --git a/src.ts/providers/subscriber-filterid.ts b/src.ts/providers/subscriber-filterid.ts index 466cc2ce78..ecc1334d48 100644 --- a/src.ts/providers/subscriber-filterid.ts +++ b/src.ts/providers/subscriber-filterid.ts @@ -118,6 +118,7 @@ export class FilterIdSubscriber implements Subscriber { if (filterIdPromise) { this.#filterIdPromise = null; filterIdPromise.then((filterId) => { + if (this.#provider.destroyed) { return; } this.#provider.send("eth_uninstallFilter", [ filterId ]); }); }