npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@odatano/watch

v0.1.8

Published

CAP Plugin for deterministic monitoring of Cardano blockchain events and transactions (via Blockfrost)

Readme

ODATANO-WATCH

npm version License CAP Tests

CAP plugin for monitoring the Cardano blockchain. Watches addresses, payment credentials, and minting policies; emits events with rich UTxO payloads (assets, inline datums, reference scripts) and persists them for replay.

📚 Docs: Quick Start · Setup · Architecture

Install

npm add @odatano/watch

Configure

package.json:

{
  "cds": {
    "requires": {
      "watch": {
        "network": "preview",
        "blockfrostApiKey": "preview_YOUR_KEY",
        "autoStart": true
      }
    }
  }
}

Credential and policy watching are off by default — opt in via credentialPolling / policyPolling. Credential watching also needs a (free-tier-OK) Koios endpoint. See Quick Start for the full config.

Secrets via environment variables

To keep the API key out of package.json, leave the field unset and export the env var instead — the plugin picks it up as a fallback:

{ "cds": { "requires": { "watch": { "network": "preview" } } } }
export BLOCKFROST_API_KEY=preview_YOUR_KEY

Other recognized env vars: BLOCKFROST_CUSTOM_BACKEND, KOIOS_API_KEY, OGMIOS_URL, WATCHER_BACKEND. cds.env.requires.watch.<field> always wins when set.

Self-hosted Blockfrost (Dolos / cardano-node)

Polling burns through the Blockfrost free-tier daily quota quickly. To route the SDK at a self-hosted Blockfrost-compatible endpoint instead, set blockfrostCustomBackend (and drop blockfrostApiKey):

{
  "cds": {
    "requires": {
      "watch": {
        "network": "mainnet",
        "blockfrostCustomBackend": "http://localhost:3100/api/v0",
        "credentialPolling": { "enabled": true, "interval": 30 }
      }
    }
  }
}

http://localhost:3100/api/v0 is the default for Dolos's MiniBF. Equivalent env var: BLOCKFROST_CUSTOM_BACKEND. Public Blockfrost stays the default when this field is unset.

Subscribe to events

import type {
  NewTransactionsEvent,
  CredentialNewTransactionsEvent,
  PolicyAssetMintedEvent,
} from "@odatano/watch";

cds.on("cardano.newTransactions", async (e: NewTransactionsEvent) => {
  // e.address, e.tag?, e.transactions[], e.utxosCreated[], e.utxosSpent[]
  for (const utxo of e.utxosCreated) {
    if (utxo.inlineDatumHex) await applyDatum(utxo.inlineDatumHex);
  }
});

cds.on("cardano.credential.newTransactions", async (e: CredentialNewTransactionsEvent) => { /* ... */ });
cds.on("cardano.policy.assetMinted", async (e: PolicyAssetMintedEvent) => { /* ... */ });

Other emitted events: cardano.policy.assetBurned, and (Phase 2 / Ogmios only) cardano.rollback.

Read Event Delivery Semantics before building stateful consumers — there are guarantees we don't make (no cross-handler ordering, no retry, no backpressure) and a checklist of patterns to follow.

Add a watch

POST /odata/v4/cardano-watcher-admin/addWatchedAddress
Content-Type: application/json

{
  "address": "addr_test1...",
  "tag": "my-pool",
  "includesAssetsJson": "[{\"policyId\":\"...\",\"assetNameHex\":\"\"}]",
  "coalesceMs": 2000
}

Plus addWatchedCredential, addWatchedPolicy, removeWatched*. Optional fields:

  • tag — echoed back on each emit for dispatch routing.
  • includesAssetsJson — asset allowlist; non-matching txs are skipped.
  • coalesceMs — batch bus emits into one event per window with cumulative deltas (1 – 300_000).

Full action list and entity surface in Quick Start and Architecture.

Replay missed events

POST /odata/v4/cardano-watcher-admin/getEventsSince
Content-Type: application/json

{ "scope": "address", "key": "addr_test1...", "fromBlock": 12345 }

Returns persisted BlockchainEvent rows ordered by blockHeight asc. Use the last returned blockHeight as the next call's fromBlock for cursor pagination.

Phase 2 — Ogmios chainSync

Set backend: 'ogmios' and ogmiosUrl: 'ws://localhost:1337' to switch from polling to a chainSync stream with native rollback signal. Backfill from Blockfrost runs once per new watch. See Architecture → Phase 2 for caveats.

License

Apache-2.0