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

soulink402

v0.2.0

Published

One-call x402 Express middleware — turn any route into a paid API

Readme

soulink402

One-call x402 Express middleware. Turn any route into a paid API.

Install

npm install soulink402

Quick Start

import express from 'express'
import { x402 } from 'soulink402'

const app = express()

app.use(await x402({
  payTo: '0xYourWalletAddress',
  network: 'base',
  routes: {
    'POST /api/register': {
      price: '1',
      description: 'Register an agent',
    },
    'GET /api/premium': {
      price: '0.5',
      description: 'Premium content',
    },
  },
}))

API

x402(config): Promise<ExpressMiddleware>

Creates Express middleware that enforces x402 payments on matched routes.

| Field | Type | Description | |-------|------|-------------| | payTo | string | Wallet address to receive payments | | network | 'base' \| 'base-sepolia' \| NetworkId | Target blockchain network | | routes | Record<string, SimpleRouteConfig> | Route pattern to payment config map |

SimpleRouteConfig

| Field | Type | Description | |-------|------|-------------| | price | string \| (ctx) => string | USDC price (static or dynamic) | | description | string | Human-readable route description |

buildRoutes(config): RoutesConfig

Transforms X402Config into the low-level RoutesConfig format used by @x402/express. Useful if you need the route config without the middleware.

resolveNetwork(name): NetworkId

Resolves a friendly network name to a CAIP-2 identifier.

Networks

| Name | CAIP-2 ID | |------|-----------| | base | eip155:8453 | | base-sepolia | eip155:84532 |

Raw CAIP-2 strings (e.g. eip155:1) pass through unchanged.

Dynamic Pricing

Price can be a function that receives the HTTP request context:

app.use(await x402({
  payTo: '0x...',
  network: 'base',
  routes: {
    'POST /api/register': {
      price: (context) => {
        const body = context.adapter.getBody?.() as { tier?: string }
        return body?.tier === 'premium' ? '10' : '1'
      },
      description: 'Register with tiered pricing',
    },
  },
}))

What it replaces

Before (25 lines of ceremony):

import { paymentMiddlewareFromHTTPServer, x402HTTPResourceServer, x402ResourceServer } from '@x402/express'
import { HTTPFacilitatorClient } from '@x402/core/http'
import { ExactEvmScheme } from '@x402/evm/exact/server'
import { facilitator } from '@coinbase/x402'

const client = new HTTPFacilitatorClient(facilitator)
const routes = { 'POST /api/register': { accepts: { scheme: 'exact', network: 'eip155:8453', payTo: '0x...', price: '1' }, description: '...' } }
const server = new x402ResourceServer(client).register('eip155:8453', new ExactEvmScheme())
const http = new x402HTTPResourceServer(server, routes)
app.use(paymentMiddlewareFromHTTPServer(http))

After (6 lines):

import { x402 } from 'soulink402'

app.use(await x402({
  payTo: '0x...',
  network: 'base',
  routes: { 'POST /api/register': { price: '1', description: '...' } },
}))

License

MIT