@hiero-hackers/hiero-notifications - v0.1.0
    Preparing search index...

    Function pollOnce

    hiero-notifications — a small framework to watch Hedera activity and deliver a notification when something matters. A Watcher produces notifications, a Condition decides which ones matter, and a Delivery sends them (console / webhook / Slack / Discord, or your own).

    The built-in watcher is account activity, which delivers a provenance-stamped receipt (via @hiero-hackers/hiero-receipts) when a tracked account transacts. Other watchers plug into the same loop — see examples/topic-watcher.ts.

    import { watch, accountWatcher, consoleDelivery, webhookDelivery, inflowAtLeast, } from "@hiero-hackers/hiero-notifications";

    await watch({ watcher: accountWatcher({ accounts: ["0.0.1234"], statePath: ".state.json", // restarts catch up, not re-baseline }), condition: inflowAtLeast(100), // notify on inflow ≥ 100 ℏ deliveries: [consoleDelivery, webhookDelivery("https://example.com/hook")], deadLetterPath: "dead.jsonl", // failed deliveries kept for --replay });

    Delivery is at-least-once — consumers dedupe on Notification.id.

    • Run one poll: fetch new notifications, filter, deliver. Returns how many were delivered. A delivery that throws is retried with backoff; a channel that still fails is logged (and dead-lettered when configured), never fatal — one broken channel must not stop the others or the watch.

      Parameters

      Returns Promise<number>