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

@ever_amsterdam/x402-euro-eurd

v0.1.1

Published

Fetch wrapper that automatically pays x402 challenges using Quantoz EURO (off-chain) and EURD on Algorand (on-chain)

Readme

@ever_amsterdam/x402-euro-eurd

A fetch wrapper that automatically pays x402 payment challenges using Quantoz managed accounts. When your agent hits a paywalled resource, this package pays and retries — transparently.

Supports two payment schemes:

  • euro — off-chain, instant. Both sides need a Quantoz managed account.
  • exact on algorand:mainnet — on-chain EURD via the EURO→Algorand bridge. Only the agent needs a Quantoz account; the merchant just needs a whitelisted Algorand address.

Install

npm install @ever_amsterdam/x402-euro-eurd

Usage

import { withEurPayment } from "@ever_amsterdam/x402-euro-eurd";

const fetch = withEurPayment(globalThis.fetch, {
  apiKey: process.env.QUANTOZ_API_KEY,
  fromAccount: process.env.QUANTOZ_ACCOUNT, // e.g. "ACC_xxxxx"
});

// 402 challenges are paid and retried automatically
const res = await fetch("https://merchant.example.com/premium-resource");
const data = await res.json();

All other responses (200, 4xx, 5xx) pass through untouched.

How it works

  1. Makes the original request
  2. If the response is 402, inspects the accepts array:
    • euro scheme → pays via POST /transaction/payment with toType: "PaymentRequestCode", builds proof with paymentRequestCode
    • exact + algorand:mainnet → pays via the EURO→Algorand bridge (toType: "BlockchainAddress"), builds proof with transactionCode
  3. Retries the original request with the X-PAYMENT header
  4. Returns the retry response

Options

withEurPayment(fetch, {
  apiKey: string;        // Quantoz API key
  fromAccount: string;   // Account code to pay from (ACC_xxxxx)
  baseUrl?: string;      // Defaults to https://api.quantozpay.com

  // Return false to cancel a payment (e.g. spending limits)
  onBeforePayment?: (accept: EurdAccept) => boolean | Promise<boolean>;

  // Called after payment, before the retry
  onPaymentComplete?: (accept: EurdAccept) => void | Promise<void>;
})

Spending limit example

const fetch = withEurPayment(globalThis.fetch, {
  apiKey: process.env.QUANTOZ_API_KEY,
  fromAccount: process.env.QUANTOZ_ACCOUNT,
  onBeforePayment: (accept) => {
    if (parseFloat(accept.amount) > 0.10) {
      console.warn(`Skipping: €${accept.amount} exceeds limit`);
      return false; // original 402 is returned
    }
    return true;
  },
});

Low-level exports

import { buildProof, parseProof, buildBridgeProof } from "@ever_amsterdam/x402-euro-eurd";

// Build X-PAYMENT header for euro scheme
const proof = buildProof(accept);

// Parse X-PAYMENT header back to a proof object
const decoded = parseProof(xPaymentHeader);

// Build X-PAYMENT header for Algorand bridge scheme
const bridgeProof = buildBridgeProof(accept, transactionCode);

Requirements

  • A Quantoz account with a funded managed account
  • Node.js 18+ (uses global fetch and Buffer)

Environment variables

QUANTOZ_API_KEY=qpay_live_...
QUANTOZ_ACCOUNT=ACC_xxxxx
QUANTOZ_BASE_URL=https://api.quantozpay.com  # optional

Docs

docs.ai.quantozpay.com