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

@oceanalt/x402

v0.3.0

Published

Pre-payment checks for x402 clients. ./hook: an onBeforePaymentCreation hook for @x402/core that asks for allow, review or decline before the payment is signed and aborts when there is no answer (zero dependencies). Main entry: a fetch wrapper that screen

Readme

@oceanalt/x402

Hook for the x402 client (@oceanalt/x402/hook, new in 0.3.0)

One line in an existing @x402/core client. Before the payment is signed, the hook sends the selected requirement's payTo, network, asset, amount and the URL that asked for payment to POST https://oceanalt.com/api/decide (free, no key) and gets back allow, review or decline.

import { x402Client } from "@x402/fetch";
import { oceanaltBeforePaymentHook } from "@oceanalt/x402/hook";

const client = new x402Client()
  .register("eip155:*", new ExactEvmScheme(signer))
  .onBeforePaymentCreation(oceanaltBeforePaymentHook());
  • allow: returns nothing; the client signs and pays.
  • decline: returns { abort: true, reason }; nothing is signed. onReview cannot override it.
  • review: aborts unless onReview(result, context) returns exactly true (for example after a person approved).
  • No answer in time, network or HTTP error, malformed answer, or an answer about a different address: treated as review. The hook fails closed.
  • onDecision(result) receives the Ed25519-signed receipt; verify it offline with https://oceanalt.com/.well-known/oceanalt-keys.json.

Zero dependencies (global fetch; Node 18+, browsers, Deno, Bun). Tested against @x402/core 2.28.0 with a stub scheme: the scheme is never called on decline, review or timeout. Not affiliated with or endorsed by Coinbase or the x402 Foundation.

Fetch wrapper (main entry, needs @oceanalt/core)

Wrap fetch so that, at the moment a 402 asks for money, three things happen before your payer signs:

  1. the endpoint is screened (impersonated merchant endpoints hand agents freshly generated payee addresses — address lists never catch those);
  2. the seller's signed payment requirements are verified offline (extensions.signedRequirements, Ed25519) — a payTo swapped by a proxy, CDN or compromised SDK is rejected;
  3. the payee gets a pre-settlement decision (allow | review | decline).

Secrets never leave the agent (outgoing bodies are scanned). You keep your own x402 payer; OceanAlt holds no keys and moves no money.

import { OceanAltClient } from "@oceanalt/core";
import { wrapFetch } from "@oceanalt/x402";
const client = new OceanAltClient();
const fetchGuarded = wrapFetch(fetch, { client, requireSignature: false, pay: (pr) => myPayer.headersFor(pr) });
const res = await fetchGuarded("https://seller.example/api/thing");

mode: "block" (default) throws on risky endpoints, tampered requirements, declined or under-review payees; mode: "advise" records and lets you decide. Every call leaves an intent → decision → outcome record via client.record().