SDK
Actions
watchAnnouncementsForUser

watchAnnouncementsForUser

Watches for announcements relevant to the user.

checkStealthAddress is used to determine if the announcement is intended for the specific user.

Usage

import { stealthClient } from "./client";
 
const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

Return Value

  • Type: function

    A function that can be called to stop watching for announcements.

Parameters

args

  • Type: AnnouncementArgs

    The arguments used to filter all announcements.

    Includes the scheme ID, stealth address, and caller.

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

spendingPublicKey

  • Type: HexString

    The spending public key of the user.

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

viewingPrivateKey

  • Type: HexString

    The viewing private key of the user.

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

ERC5564Address

  • Type: HexString

    The address of the ERC5564Announcer contract.

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

excludeList (optional)

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

includeList (optional)

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

handleLogsForUser

  • Type: function

    A function to transform relevant announcements.

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});

pollOptions (optional)

const unwatch = await stealthClient.watchAnnouncementsForUser({
  args,
  spendingPublicKey,
  viewingPrivateKey,
  ERC5564Address,
  excludeList,
  includeList,
  handleLogsForUser,
  pollOptions,
});