From e46a85aa284325bd8fa6d3b7cac3625159582fa5 Mon Sep 17 00:00:00 2001 From: Sasha <118575614+weboko@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:13:46 +0200 Subject: [PATCH] chore: update Filter API (#199) --- docs/guides/js-waku/light-send-receive.md | 7 ++++++- docs/guides/js-waku/manage-filter.md | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/guides/js-waku/light-send-receive.md b/docs/guides/js-waku/light-send-receive.md index ae1ce5e..c14585d 100644 --- a/docs/guides/js-waku/light-send-receive.md +++ b/docs/guides/js-waku/light-send-receive.md @@ -129,7 +129,12 @@ const callback = (wakuMessage) => { }; // Create a Filter subscription -const subscription = await node.filter.createSubscription(); +const { error, subscription } = await node.filter.createSubscription({ contentTopics: [contentTopic] }); + +if (error) { + // handle errors if happens + throw Error(error); +} // Subscribe to content topics and process new messages await subscription.subscribe([decoder], callback); diff --git a/docs/guides/js-waku/manage-filter.md b/docs/guides/js-waku/manage-filter.md index 1019b9f..815a201 100644 --- a/docs/guides/js-waku/manage-filter.md +++ b/docs/guides/js-waku/manage-filter.md @@ -21,7 +21,12 @@ The `@waku/sdk` package provides a `Filter.ping()` function to ping subscription ```js // Create a Filter subscription -const subscription = await node.filter.createSubscription(); +const { error, subscription } = await node.filter.createSubscription({ contentTopics: [contentTopic] }); + +if (error) { + // handle errors if happens + throw Error(error); +} // Subscribe to content topics and process new messages await subscription.subscribe([decoder], callback);