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

knox-wallet

v0.0.5

Published

CLI payment client for x402 and MPP paid APIs

Readme

Knox

Knox is a Bun-based CLI payment client for paid HTTP APIs that support 402 Payment Required with:

  • x402
  • MPP

It provides a curl-like request command, a local account store, and a plugin system with hooks throughout the request lifecycle.

Install

npm install -g knox-wallet
knox --help

Core Commands

# account management
knox account create --force
knox account import --private-key <hex> --force
knox account status

# request execution
knox request https://httpbin.org/get
knox request --protocol x402 "https://lorem.steer.fun/generate?count=2&units=paragraphs&format=plain"
knox request --protocol mpp "https://lorem.steer.fun/generate?count=2&units=paragraphs&format=plain"

# dry run (no signature, no payment)
knox --dry-run request --protocol x402 "https://lorem.steer.fun/generate?count=2&units=paragraphs&format=plain"

# transactions and plugins
knox tx list
knox tx show <id>
knox plugins list
knox plugins setup <plugin-name>

Global Flags

  • --protocol auto|x402|mpp
  • --dry-run
  • --no-plugins

Account Model

  • Knox supports one local account for now.
  • Running account create or account import replaces the existing account.
  • If an account already exists, use --force with account create and account import to confirm replacement.

Plugin Locations

  • ~/.knox/plugins/*.{ts,js,mjs,cjs}
  • .knox/plugins/*.{ts,js,mjs,cjs}

Plugins API

Plugin module shape:

type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };

type PluginKvStore = {
  get: (params: { key: string }) => Promise<JsonValue | undefined>;
  set: (params: { key: string; value: JsonValue }) => Promise<void>;
};

export type AccountPlugin = {
  name: string;
  setup?: (event: PluginSetupEvent) => Promise<PluginSetupResult | undefined>;
  beforeTransaction?: (event: BeforeTransactionEvent) => Promise<BeforeTransactionResult | undefined>;
  beforeSign?: (event: BeforeSignEvent) => Promise<BeforeSignResult | undefined>;
  afterTransaction?: (event: AfterTransactionEvent) => Promise<void>;
  accountStatus?: (event: AccountStatusEvent) => Promise<AccountStatusResult | undefined>;
};

Event contracts:

type BeforeTransactionResult =
  | { action: "continue" }
  | { action: "abort"; reason: string };

type BeforeSignResult =
  | { action: "continue"; intentOverride?: Partial<PaymentIntent> }
  | { action: "abort"; reason: string };

type AccountStatusResult = { output: string };

type PluginSetupResult = { output?: string };

type PluginSetupEvent = {
  userAddress: `0x${string}` | null;
  kv: PluginKvStore;
};

type BeforeTransactionEvent = {
  userAddress: `0x${string}`;
  intent: PaymentIntent;
  attempt: number;
  kv: PluginKvStore;
};

type BeforeSignEvent = {
  userAddress: `0x${string}`;
  intent: PaymentIntent;
  challengeRaw: unknown;
  attempt: number;
  kv: PluginKvStore;
};

type AfterTransactionEvent = {
  userAddress: `0x${string}`;
  intent: PaymentIntent;
  success: boolean;
  responseStatus?: number;
  error?: string;
  kv: PluginKvStore;
};

type AccountStatusEvent = {
  userAddress: `0x${string}`;
  accountSource: string;
  kv: PluginKvStore;
};

Behavior:

  • beforeTransaction: fail-closed, can block payment.
  • beforeSign: fail-closed, can block payment and optionally mutate PaymentIntent via intentOverride.
  • afterTransaction: fail-open, errors are logged.
  • accountStatus: runs during knox account status; output is rendered as multiline text under plugin name.
  • setup: runs when invoking knox plugins setup <plugin-name> and receives userAddress (or null).
  • kv: persistent, plugin-scoped JSON key-value store available in all hook events.

Minimal plugin example:

export default {
  name: "status-note",
  async setup({ kv }) {
    await kv.set({ key: "message", value: "All systems nominal" });
  },
  async accountStatus({ kv }) {
    const message = await kv.get({ key: "message" });
    return {
      output: `${message ?? "Ready"}\nReady to pay`,
    };
  },
};

Example plugins:

  • examples/plugins/confirm-before-sign.ts: interactive blocking confirmation before signing.
  • examples/plugins/account-status-balances.ts: reports Base USDC and Tempo token balances in knox account status.

To activate an example plugin, copy it to one of the plugin directories:

mkdir -p .knox/plugins
cp examples/plugins/confirm-before-sign.ts .knox/plugins/
cp examples/plugins/account-status-balances.ts .knox/plugins/

Development

bun install
bun run typecheck

Releasing

Knox uses Changesets with a manually triggered GitHub Actions workflow.

  1. Add a changeset in your PR:
bun run changeset
  1. Merge the PR into main.
  2. In GitHub, run the Release workflow manually from Actions.
  3. If there are unpublished changesets, the workflow creates or updates a version PR (chore: version packages).
  4. Merge the version PR, then run the Release workflow again to publish.

Trusted publishing is configured for npm via GitHub OIDC, so no long-lived NPM_TOKEN is required for normal releases.