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

@shulam/x402

v0.1.0

Published

@shulam/x402 — x402 payment SDK: server middleware, auto-pay client, compliance receipts, dynamic pricing

Readme

@shulam/x402

The x402 payment SDK for the Shulam facilitator. Server middleware, auto-pay client, React hooks, compliance receipts, and dynamic pricing — all in one package.

Install

npm install @shulam/x402

Quick Start — Paywall an Express Endpoint (Server)

import express from "express";
import { createShulamServer } from "@shulam/x402/server";

const app = express();

const paywall = createShulamServer({
  facilitatorUrl: "https://api.shulam.io",
  sellerAddress: "0xYourWalletAddress",
  apiKey: process.env.SHULAM_API_KEY!,
  endpoints: {
    "GET /api/premium": { price: "0.001", description: "Premium content" },
  },
});

app.use(paywall);

app.get("/api/premium", (req, res) => {
  res.json({ content: "premium data", paidBy: req.payment?.payer });
});

app.listen(8080);

Auto-Pay Client (Browser / Node)

import { createShulamClient } from "@shulam/x402/client";

const client = createShulamClient({
  facilitatorUrl: "https://api.shulam.io",
  signer: yourSignerAdapter,
  walletAddress: "0xYourWallet",
  maxPaymentUSDC: "1.00",
  maxDailyUSDC: "10.00",
});

// Automatically handles 402 responses — signs and pays
const response = await client.fetch("https://api.example.com/premium");
const data = await response.json();

React Hook

import { useShulamPayment } from "@shulam/x402/react";

function PremiumContent() {
  const { pay, paying, lastReceipt, error, dailySpending } = useShulamPayment({
    facilitatorUrl: "https://api.shulam.io",
    signer: adapter,
    walletAddress: "0x...",
    maxDailyUSDC: "10.00",
  });

  return (
    <button onClick={() => pay("https://api.example.com/premium")} disabled={paying}>
      {paying ? "Paying..." : "Access Premium"}
    </button>
  );
}

Subpath Imports

| Import | Purpose | |--------|---------| | @shulam/x402 | Core exports, types, signer adapters | | @shulam/x402/server | createShulamServer() Express middleware | | @shulam/x402/client | createShulamClient() auto-pay fetch client | | @shulam/x402/react | useShulamPayment() React hook | | @shulam/x402/compliance | Compliance receipt parsing + validation | | @shulam/x402/pricing | Dynamic pricing utilities | | @shulam/x402/types | TypeScript type definitions | | @shulam/x402/chains | Chain configuration (Base, Base Sepolia) |

Compliance Headers

Every settled payment includes compliance headers on the response:

| Header | Description | |--------|-------------| | X-Shulam-Compliance-Receipt | Base64url-encoded compliance receipt | | X-Shulam-Trust-Score | Payer's trust score (0–100) | | X-Shulam-Trust-Tier | Payer's trust tier (unknown | new | established | trusted | exemplary) | | X-Shulam-Audit-Hash | SHA-256 hash of the audit trail entry |

What is x402?

x402 is an open protocol for machine-to-machine payments using HTTP status code 402. When a client requests a paid resource without payment, the server returns 402 Payment Required with payment instructions. The client signs a USDC authorization (EIP-3009), attaches it as an X-Payment header, and retries. The facilitator verifies compliance and settles on-chain.

Documentation

Full documentation at docs.shulam.io.

License

MIT — Shulam, Inc.