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

@primersystems/x402

v1.1.0

Published

Primer ecosystem toolkit for x402

Readme

@primersystems/x402

npm version License

Primer ecosystem toolkit for x402. Built on the official x402 SDK.

This package extends the official x402 SDK with Primer-specific infrastructure: our facilitator, SKALE network support, Robinhood Chain support, and Prism ERC-20 settlement.

Installation

npm install @primersystems/x402

This automatically installs @x402/core as a peer dependency.

Quick Start

Using Primer's Facilitator

import { paymentMiddleware } from '@x402/express';
import { primerFacilitator } from '@primersystems/x402';

// Use Primer's facilitator (x402.primer.systems)
app.use(paymentMiddleware(routes, server, {
  facilitator: primerFacilitator()
}));

SKALE Networks (Gas-Free)

import { skaleNetworks } from '@primersystems/x402';

const routes = {
  '/api/data': {
    price: '$0.001',
    network: skaleNetworks.base,  // eip155:1187947933
    // No gas fees for payers on SKALE
  }
};

Robinhood Chain

import { robinhoodNetworks } from '@primersystems/x402';

const routes = {
  '/api/data': {
    price: '$0.001',
    network: robinhoodNetworks.mainnet,  // eip155:4663
  }
};

Prism ERC-20 Settlement

For standard ERC-20 tokens (not USDC/EURC), use Prism:

import { createPrismPayload, PRISM_CONTRACT_ADDRESS } from '@primersystems/x402';
import { createWalletClient, createPublicClient, http } from 'viem';
import { base } from 'viem/chains';

const publicClient = createPublicClient({ chain: base, transport: http() });
const walletClient = createWalletClient({ chain: base, transport: http(), account });

// Create a signed payment payload
const payload = await createPrismPayload(walletClient, publicClient, {
  token: '0x...', // ERC-20 token address
  to: '0x...',    // Recipient
  value: 1000000n // Amount in smallest unit
}, 'eip155:8453');

Note: Payers must first approve the Prism contract (0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86) to spend their tokens.

CLI

The package includes a CLI for scaffolding new x402 projects.

Create a Paid AI Proxy (Chutes)

Scaffold a Cloudflare Worker that proxies Chutes (Bittensor Subnet 64) AI endpoints with x402 micropayments:

npx @primersystems/x402 create chutes-proxy my-ai-api
cd my-ai-api
npm install

Edit src/worker.ts to set your wallet address:

const RECIPIENT = "0xYourWalletAddress";

Set your Chutes API key and deploy:

wrangler secret put CHUTES_API_KEY
npm run deploy

The generated proxy exposes these paid endpoints:

| Endpoint | Default Price | |----------|---------------| | /v1/chat/completions | $0.001 | | /v1/completions | $0.001 | | /v1/embeddings | $0.0001 | | /v1/images/generations | $0.01 |

Payments are verified via Primer's facilitator and accepted on Base mainnet. Edit the generated code to customize pricing, networks, or add additional endpoints.

API Reference

Facilitator

| Export | Description | |--------|-------------| | primerFacilitator(config?) | Returns FacilitatorClient for x402.primer.systems | | PRIMER_FACILITATOR_URL | "https://x402.primer.systems" |

Networks

| Export | Value | |--------|-------| | skaleNetworks.base | "eip155:1187947933" | | skaleNetworks.baseSepolia | "eip155:324705682" | | skaleRpcUrls.base | "https://skale-base.skalenodes.com/v1/base" | | skaleRpcUrls.baseSepolia | "https://base-sepolia-testnet.skalenodes.com/v1/..." | | robinhoodNetworks.mainnet | "eip155:4663" | | robinhoodNetworks.testnet | "eip155:46630" | | robinhoodRpcUrls.mainnet | "https://rpc.mainnet.chain.robinhood.com" | | robinhoodRpcUrls.testnet | "https://rpc.testnet.chain.robinhood.com" |

Prism Settlement

| Export | Description | |--------|-------------| | createPrismPayload(wallet, public, params, network) | Create signed ERC-20 payment | | getPrismNonce(publicClient, user, token) | Get current nonce for user/token | | PRISM_CONTRACT_ADDRESS | "0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86" | | PRISM_ABI | Contract ABI (minimal) | | ERC20_PAYMENT_TYPES | EIP-712 type definitions |

Supported Networks

| Network | Chain ID | Facilitator | |---------|----------|-------------| | Base | eip155:8453 | ✓ Primer | | Base Sepolia | eip155:84532 | ✓ Primer | | SKALE Base | eip155:1187947933 | ✓ Primer | | SKALE Base Sepolia | eip155:324705682 | ✓ Primer | | Robinhood Chain | eip155:4663 | ✓ Primer | | Robinhood Chain Testnet | eip155:46630 | ✓ Primer |

Architecture

This SDK is a companion to the official x402 SDK, not a replacement:

┌─────────────────────────────────────────┐
│           Your Application              │
├─────────────────────────────────────────┤
│  @x402/express, @x402/hono, etc.        │  ← Official SDK (protocol)
├─────────────────────────────────────────┤
│  @primersystems/x402                    │  ← This package (ecosystem)
│  • Primer facilitator                   │
│  • SKALE networks                       │
│  • Robinhood Chain                      │
│  • Prism settlement                     │
│  • CLI scaffolding (Chutes proxy, etc.) │
└─────────────────────────────────────────┘

Links

License

Apache-2.0 — Primer Systems