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

x402-zetrix-client

v0.1.0

Published

x402 client SDK for Zetrix — parse 402, sign, retry

Downloads

129

Readme

x402-zetrix-client

x402 payment client for Zetrix. Wraps the native fetch API with automatic 402-payment handling — detect, sign, and retry with a single call.

Install

npm install x402-zetrix-client
# or
pnpm add x402-zetrix-client

Quick start

import { createX402Fetch } from 'x402-zetrix-client'

const myFetch = createX402Fetch({
  wallet: {
    privateKey: process.env.X402_PRIVATE_KEY!,
    address:    process.env.X402_ADDRESS!,
    network:    'zetrix:testnet',
  },
  node: {
    host: 'test-node.zetrix.com',
    port: '',
  },
})

// Works like fetch — pays automatically on 402
const res = await myFetch('https://api.example.com/paid-resource')
const data = await res.json()

Spend limit

const myFetch = createX402Fetch({
  wallet: { ... },
  node:   { ... },
  policy: {
    maxAmountPerRequest: '50000',  // refuse anything over 0.05 ZTX
  },
})

Environment variables (conventional)

| Variable | Description | |---|---| | X402_PRIVATE_KEY | ED25519 wallet private key | | X402_ADDRESS | Zetrix wallet address (Z…) | | X402_NETWORK | zetrix:mainnet or zetrix:testnet | | X402_NODE_HOST | RPC node hostname | | X402_NODE_PORT | RPC node port (empty for DNS-mapped hosts) |

How it works

Client                    Resource Server           Facilitator
  │                              │                       │
  │──── GET /api/data ──────────>│                       │
  │                              │                       │
  │<─── 402 + accepts[] ─────────│                       │
  │                              │                       │
  │  (sign ZTX transaction)      │                       │
  │                              │                       │
  │──── GET /api/data ──────────>│                       │
  │     X-Payment: <blob>        │                       │
  │                              │──── POST /verify ────>│
  │                              │<─── isValid:true ─────│
  │                              │                       │
  │<─── 200 + data ──────────────│                       │
  │     X-Payment-Response: ...  │                       │
  │                              │──── POST /settle ────>│ (async)

createX402Fetch handles the entire flow transparently — your application code only sees the final 200 response.

Ecosystem

| Package | Purpose | |---|---| | x402-zetrix-server | Server-side: Express middleware to gate routes behind ZTX payment | | x402-zetrix-mcp | MCP server: give AI agents (Claude, etc.) automatic payment capabilities |

Node.js requirement

Node.js ≥ 18 (uses native fetch).

License

MIT — MyEG Services Berhad