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

@paytoll/sdk

v0.2.0

Published

Developer toolkit for accepting machine payments on Solana via the Machine Payments Protocol (MPP)

Downloads

168

Readme

@paytoll/sdk

Developer toolkit for accepting machine payments on Solana via the Machine Payments Protocol (MPP).

Install

npm install @paytoll/sdk

Quick Start

1. Create config

npx paytoll init

This creates paytoll.config.ts:

import { defineConfig } from '@paytoll/sdk'

export default defineConfig({
  recipient: 'YOUR_SOLANA_WALLET_ADDRESS',
  network: 'devnet',
  endpoints: [
    {
      path: '/api/search',
      price: '0.01',
      currency: 'USDC',
      mode: 'charge',
    },
  ],
})

2. Add middleware

Express:

import express from 'express'
import { paytoll } from '@paytoll/sdk/express'
import config from './paytoll.config'

const app = express()
app.use(paytoll(config))

app.get('/api/search', (req, res) => {
  // This only runs after payment is verified
  // Access payment info via req.paytoll
  console.log(`Paid by: ${req.paytoll?.payer}`)
  res.json({ results: ['result1', 'result2'] })
})

app.listen(3000)

Hono:

import { Hono } from 'hono'
import { paytoll } from '@paytoll/sdk/hono'
import config from './paytoll.config'

const app = new Hono()
app.use('*', paytoll(config))

app.get('/api/search', (c) => {
  const { payer, amount } = c.get('paytoll')
  return c.json({ results: ['result1', 'result2'] })
})

export default app

3. Gate a single route (no config file)

import { paytollRoute } from '@paytoll/sdk/express'

app.use(
  '/api/premium',
  paytollRoute({
    recipient: 'YOUR_WALLET',
    price: '0.05',
    currency: 'USDC',
  })
)

How It Works

  1. Agent sends GET /api/search
  2. PayToll middleware returns 402 Payment Required with a challenge
  3. Agent signs a Solana transaction and retries with Authorization: Payment header
  4. PayToll verifies payment on-chain and passes the request to your handler
  5. Your handler runs and the response includes a Payment-Receipt header

Payment Modes

Charge — One-time payment per request. Best for discrete API calls.

Session — Streaming payment channel with micropayments. Best for metered/streaming access.

CLI

npx paytoll init          # Create config file
npx paytoll dev           # Start dev server (coming soon)
npx paytoll test [path]   # Simulate payment (coming soon)
npx paytoll status        # Show stats (coming soon)

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | recipient | string | — | Solana wallet address (required) | | network | string | 'devnet' | 'devnet' or 'mainnet-beta' | | endpoints | array | [] | Endpoint configs | | feePayer | string? | — | Base58 keypair for fee sponsorship | | rpcUrl | string? | auto | Custom Solana RPC URL | | secretKey | string? | auto | HMAC key for challenge signing |

Endpoint Config

| Option | Type | Description | |--------|------|-------------| | path | string | URL path to gate | | price | string | Amount (e.g. '0.01') | | currency | string | 'USDC', 'SOL', or mint address | | mode | string | 'charge' or 'session' | | meter | string? | Session meter name |

Status

This is v0.1.0 — the middleware framework, types, config, and CLI scaffold are functional. On-chain payment verification is pending integration with @solana/mpp as the spec stabilizes.

License

MIT