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

mppx-xpr-network

v1.3.8

Published

XPR Network payment method for the Machine Payments Protocol (mppx)

Downloads

1,546

Readme

mppx-xpr-network

XPR Network payment method for the Machine Payments Protocol (MPP).

Zero gas fees. Sub-second finality. Human-readable accounts. Built for machine-to-machine payments.

Installation

npm install mppx-xpr-network mppx

Server Usage

import { Mppx } from 'mppx/server'
import { xpr } from 'mppx-xpr-network'

const mppx = Mppx.create({
  methods: [
    xpr.charge({ recipient: 'charliebot' }),
  ],
  secretKey: process.env.MPP_SECRET_KEY,
})

// In your route handler (Next.js, Express, etc.)
export async function GET(request: Request) {
  const result = await mppx.xpr.charge({
    amount: '1.0000 XPR',
  })(request)

  if (result.status === 402) return result.challenge

  return result.withReceipt(
    Response.json({ joke: 'Why did the AI cross the blockchain?' })
  )
}

The server automatically:

  • Returns 402 with WWW-Authenticate: Payment challenge header
  • Parses Authorization: Payment credentials from retry requests
  • Verifies the on-chain transfer via Hyperion
  • Attaches Payment-Receipt header to successful responses
  • Rejects replay attacks (duplicate transaction hashes)

Client Usage

import { Mppx } from 'mppx/client'
import { xprClient } from 'mppx-xpr-network'

const mppx = Mppx.create({
  methods: [
    xprClient({
      signTransaction: async (actions) => {
        // Use WebAuth SDK, @nicknguyen/proton-web-sdk, or any EOSIO wallet
        const result = await session.transact({ actions }, { broadcast: true })
        return { transactionId: result.processed.id }
      },
    }),
  ],
})

Payment Flow

Client                          Server                      XPR Network
  |                               |                              |
  |  GET /api/resource            |                              |
  |------------------------------>|                              |
  |                               |                              |
  |  402 + WWW-Authenticate:      |                              |
  |  Payment (challenge)          |                              |
  |<------------------------------|                              |
  |                               |                              |
  |  eosio.token::transfer        |                              |
  |  to=charliebot, memo=uuid     |                              |
  |------------------------------------------------------------->|
  |                               |                              |
  |  GET /api/resource            |                              |
  |  Authorization: Payment       |                              |
  |  (credential with txHash)     |                              |
  |------------------------------>|                              |
  |                               |  verify tx via Hyperion      |
  |                               |----------------------------->|
  |                               |                              |
  |  200 OK + Payment-Receipt     |                              |
  |  (content + receipt header)   |                              |
  |<------------------------------|                              |

Sessions (Streaming Payments)

Sessions use the XPR Network vest contract for time-locked streaming payments. The client deposits XPR into a vest stream; the server verifies on-chain and streams content. Either party can stop the session early — remaining funds are refunded.

import { Mppx } from 'mppx/server'
import { xpr } from 'mppx-xpr-network'

const mppx = Mppx.create({
  methods: [
    xpr.session({
      recipient: 'myservice',
      rpc: 'https://api.protonnz.com',
    }),
  ],
  secretKey: process.env.MPP_SECRET_KEY,
})

// Streaming endpoint
export async function GET(request: Request) {
  const result = await mppx.xpr.session({
    maxAmount: '10.0000 XPR',
    duration: 300, // 5 minutes
  })(request)

  if (result.status === 402) return result.challenge

  // Stream content to the client
  const stream = new ReadableStream({ ... })
  return result.withReceipt(new Response(stream))
}

Session Flow

Client                          Server                      XPR Network (vest)
  |                               |                              |
  |  GET /api/stream              |                              |
  |------------------------------>|                              |
  |                               |                              |
  |  402 + WWW-Authenticate:      |                              |
  |  Payment (session challenge)  |                              |
  |  {vestName, maxAmount, dur}   |                              |
  |<------------------------------|                              |
  |                               |                              |
  |  1. transfer XPR to vest      |                              |
  |     memo="deposit"            |                              |
  |  2. startvest(vestName, ...)  |                              |
  |------------------------------------------------------------->|
  |                               |                              |
  |  GET /api/stream              |                              |
  |  Authorization: Payment       |                              |
  |  {vestName}                   |                              |
  |------------------------------>|                              |
  |                               |  verify vest table           |
  |                               |----------------------------->|
  |                               |                              |
  |  200 OK (streaming content)   |                              |
  |  + Payment-Receipt            |                              |
  |<------------------------------|                              |
  |                               |                              |
  |           ... streaming ...   |  claimvest (periodic)        |
  |                               |----------------------------->|
  |                               |                              |
  |  stopvest (session end)       |                              |
  |------------------------------------------------------------->|
  |                               |  final claimvest             |
  |                               |----------------------------->|

Vest Contract Actions

| Action | Who | What | |--------|-----|------| | eosio.token::transfer to vest | Client | Deposit XPR (memo: "deposit") | | vest::startvest | Client | Start streaming session | | vest::claimvest | Server | Withdraw accrued tokens | | vest::stopvest | Either | End session early, refund remainder |

Sessions vs Charges

| | xpr.charge() | xpr.session() | |---|---|---| | Use case | One-time payment | Streaming / metered | | On-chain actions | 1 (transfer) | 2+ (deposit + startvest + claims) | | Refundable | No | Yes (stopvest refunds remainder) | | Verification | Hyperion tx lookup | Vest table query | | Gas fees | $0 | $0 |

XPR Sessions vs Tempo Sessions

| | XPR Network | Tempo (EVM) | |---|---|---| | Gas to open session | $0 | ~$0.001 (EVM tx) | | Gas to close session | $0 | ~$0.001 (EVM tx) | | Gas per claim | $0 | ~$0.001 per claim | | Finality | < 500ms | ~1s | | Accounts | Human-readable | Hex addresses | | Native streaming | vest contract | Custom contract |

XPR Network's zero gas fees mean sessions cost exactly nothing to open, claim, and close — the only cost is the actual payment amount.

Configuration

Charge

xpr.charge({
  recipient: 'charliebot',        // XPR account to receive payments
  hyperion: 'https://proton.eosusa.io',  // Hyperion API for verification
  rpc: 'https://api.protonnz.com',       // XPR Network RPC
  amount: '1.0000 XPR',                  // Default amount
  memo: 'custom-memo',                   // Default memo
})

Session

xpr.session({
  recipient: 'myservice',                // XPR account to receive payments
  rpc: 'https://api.protonnz.com',       // RPC for vest table queries
})

Why XPR Network for Machine Payments?

| Feature | XPR Network | Ethereum | Solana | Tempo | |---------|------------|----------|--------|-------| | Gas fees | $0 (zero) | $0.50-$50+ | $0.001-$0.05 | ~$0.001 | | Finality | < 500ms | ~12 min | ~400ms | ~1s | | Account names | Human-readable (charliebot) | Hex (0x7a58...) | Base58 (Gh9Z...) | Hex | | Identity/KYC | Built-in | None | None | None | | Wallet auth | Biometric (WebAuth) | Seed phrase | Seed phrase | Seed phrase | | Account creation | Free | Free (EOA) | ~$0.002 | Free | | Smart contracts | Yes (C++) | Yes (Solidity) | Yes (Rust) | Yes (Solidity) |

XPR Network advantages for agents and machines:

  • Zero gas fees — the payment amount is exactly what the recipient gets
  • Sub-second finality — no waiting for block confirmations
  • Human-readable accounts — pay charliebot not 0x7a58c3F2...
  • Built-in identity — on-chain KYC verification for compliance
  • WebAuth wallet — biometric authentication, no seed phrases needed
  • Free account creation — onboard users at zero cost
  • On-chain agent registry — trust scores, escrow jobs, A2A protocol

Spec Compliance

This package implements the Payment Authentication IETF draft:

  • WWW-Authenticate: Payment — 402 challenge header
  • Authorization: Payment — credential header with base64-encoded proof
  • Payment-Receipt — receipt header with base64-encoded settlement proof
  • HMAC-bound challenge IDs via mppx secretKey
  • Replay protection via transaction hash deduplication

Links

License

MIT