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

@1xmint/soma-check

v0.1.0

Published

Drop-in fetch wrapper for Soma Check / x402 ETag — automatic 304 caching skips payment when data is unchanged

Readme

@clawnet/soma-check

Drop-in fetch wrapper for Soma Check (aka x402 ETag) — automatic HTTP conditional requests that skip payment when data hasn't changed.

Why

Agents polling x402-gated APIs pay for every byte — even when the data is identical to last call. Soma Check / x402 ETag lets origins return 304 Not Modified instead of re-billing. This SDK makes that free for agents: just use client.fetch and it handles ETag + If-None-Match automatically.

  • Zero config. Works with any origin that emits standard HTTP ETag headers.
  • Zero deps. Native fetch only.
  • Works everywhere. Node 18+, Deno, Bun, browsers, Cloudflare Workers.

Install

npm install @clawnet/soma-check

Usage

import { SomaCheckClient } from '@clawnet/soma-check';

const client = new SomaCheckClient();

// First call: full fetch, stores ETag
const r1 = await client.fetch('https://api.claw-net.org/v1/soma/demo/btc-price');
console.log(r1.somaCached); // false

// Second call: sends If-None-Match, gets 304, serves from cache — no payment
const r2 = await client.fetch('https://api.claw-net.org/v1/soma/demo/btc-price');
console.log(r2.somaCached); // true
console.log(await r2.json()); // same data, zero network cost

console.log(client.stats());
// { hits: 1, misses: 1, hitRate: 0.5, bytesSaved: 812, cacheEntries: 1, ... }

One-liner with the default singleton:

import { somaFetch } from '@clawnet/soma-check';

const res = await somaFetch('https://api.claw-net.org/v1/soma/demo/btc-price');

Options

new SomaCheckClient({
  maxEntries: 1000,           // LRU cap (default 1000)
  maxAgeMs: 24 * 3600 * 1000, // evict after 24h (default)
  sendSomaHashHeader: true,   // also send legacy If-Soma-Hash alias (default true)
  cacheKey: (url, init) => `${init.method} ${url}`, // custom key derivation
  fetchImpl: customFetch,     // bring your own fetch
});

Persisting cache across restarts

// Save
const snapshot = client.dump();
fs.writeFileSync('cache.json', JSON.stringify(snapshot));

// Restore
client.restore(JSON.parse(fs.readFileSync('cache.json', 'utf8')));

How it works

  1. First request to a URL → you get the full response, SDK stores ETag + body.
  2. Next request → SDK adds If-None-Match: <etag> header.
  3. If origin data is unchanged → origin returns 304 Not Modified (empty body, no billing on Soma-aware providers).
  4. SDK serves the cached body. Your code sees a normal Response.

On Soma Check origins, the 304 path skips payment settlement entirely. Provider still gets a smaller fee for the freshness guarantee (90/10 split on cache hits — see Soma Check billing).

Compat

  • Works with any HTTP server that emits standard ETag headers (RFC 9111) — not Soma-specific.
  • Soma-aware origins additionally honor X-Soma-Hash / If-Soma-Hash aliases.

License

MIT