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

htmx-ext-x402

v1.0.0

Published

Official HTMX community extension convention distribution for @correntelabs/htmx-x402.

Readme

@correntelabs/htmx-x402 ⚡🏛️

Declarative Hypermedia Micropayments for HTMX
Sub-2KB (gzipped), zero-dependency client extension bringing native HTTP 402 Payment Required handling to the hypermedia web.
Eliminates bloated 450KB+ client Web3 script bundles and moves financial state execution to isolated, hardware-attested server environments.

npm version License: MIT Bundle Size Architecture: FINOS CALM


🚀 Why HTMX + x402?

Modern Web3 Single-Page Applications (SPAs) require massive JavaScript bundles (React, Wagmi, Ethers, Viem — often 450KB to 2MB+) running insecurely in the client browser. This introduces severe attack vectors:

  • Client Memory Snooping & DOM Injection: Malicious browser extensions or XSS can intercept private keys and manipulate transaction payloads before signing.
  • Dependency Supply Chain Hazards: Hundreds of transitive npm dependencies in client-side wallet connectors create systemic financial vulnerability.
  • Un-Auditable State Drift: Regulators and counterparties cannot verify whether client-side state machine transitions were executed legitimately.

The Corrente Hypermedia Paradigm: The browser is an unprivileged hypermedia viewer. Financial state mutations, enclave attestation quotes, and settlement verification occur inside hardware enclaves and are returned as clean, declarative HTML fragments.

┌──────────────────────────────────────────────────────────────┐
│  Browser DOM (Zero-Client-Script / HTMX Hypermedia)          │
└──────────────┬───────────────────────────────▲───────────────┘
  1. POST /api │                               │ 4. Verified HTML
     (no auth) │                               │    Fragment Swap
               ▼                               │
┌──────────────────────────────┐ ┌─────────────┴───────────────┐
│ Server / Enclave Gateway     │ │ Isolated Execution Enclave  │
│ 2. HTTP 402 Payment Required ├─► 3. Atomic Settle & Attest   │
│    (Algorand / Base / XRPL)  │ │    (Hardware RTMR quote)    │
└──────────────────────────────┘ └─────────────────────────────┘

📦 Quick Start

1. Direct Script Tag (Zero Bundler Required)

Drop the script tag immediately after HTMX:

<!-- Core HTMX -->
<script src="https://unpkg.com/[email protected]"></script>

<!-- Corrente x402 Extension (<2KB gzipped) -->
<script src="https://cdn.jsdelivr.net/npm/@correntelabs/htmx-x402/dist/htmx-x402.min.js"></script>

<!-- Declarative HTML Micropayment -->
<body hx-ext="x402">
  <div id="result">Click below to unlock live data</div>

  <button hx-post="/api/market-depth"
          hx-target="#result"
          hx-swap="outerHTML">
    Unlock Order Book (0.01 ALGO)
  </button>
</body>

2. Modern Bundlers (Vite, Next.js, Astro)

npm install @correntelabs/htmx-x402 htmx.org
import htmx from 'htmx.org';
import { registerHtmxX402 } from '@correntelabs/htmx-x402';

// Auto-registers the 'x402' extension with your HTMX instance
registerHtmxX402(htmx, {
  defaultRail: 'algorand', // 'algorand' | 'base' | 'flare' | 'xrpl'
  onPaymentSuccess: ({ challenge }) => {
    console.log(`Settled ${challenge.amount} ${challenge.asset} via ${challenge.rail}`);
  },
  onPaymentFailure: ({ error }) => {
    console.error(`Payment failed: ${error}`);
  }
});

⚡ Execution Modes

Mode 1: Fast-Path Micro-Allowance (Zero Friction)

For high-frequency or sub-second interactions (e.g. streaming data, AI inference tokens, real-time order books), grant a local micro-allowance so user prompts are not interrupted by repeated signing modals:

// Pre-authorize up to 5 ALGO across requests (max 0.1 ALGO per click)
window.x402.setAllowance({
  maxPerRequest: 100000n, // micro-units
  totalRemaining: 5000000n,
  asset: 'ALGO',
  signer: async (challenge) => {
    // Return signed transaction or authorization token
    return await myWallet.signFastPath(challenge);
  }
});

Mode 2: Interactive Wallet Approval

If no allowance is active, the extension dispatches a standard DOM CustomEvent x402:challenge allowing your UI or wallet provider to prompt the user:

document.addEventListener('x402:challenge', async (evt) => {
  const { challenge, resolve, reject } = evt.detail;
  
  const approved = await myWalletModal.confirmPayment(
    challenge.amount, 
    challenge.asset, 
    challenge.recipient
  );

  if (approved) {
    const signature = await myWallet.sign(challenge);
    resolve(signature); // Retries request and swaps HTML automatically
  } else {
    reject(); // Aborts swap safely
  }
});

🌐 Universal Multi-Rail Neutrality

The extension parses standard RFC HTTP 402 challenges across diverse financial networks:

| Rail | Header Spec | Asset Default | Finality | | :--- | :--- | :--- | :--- | | Algorand | rail="algorand" | ALGO / ASA | Sub-3s Deterministic | | Base / EVM | rail="base" | USDC / ETH | Sub-2s L2 Rollup | | Flare | rail="flare" | FLR / FXRP | Enclave Attested | | XRPL | rail="xrpl" | XRP / RLUSD | Sub-4s Consensus |


🔒 Security & Architecture

  • Zero Client Financial State: No private keys or financial balances are managed by HTMX or the extension.
  • Hardware Enclave Rooted: Compatible with Intel TDX and AMD SEV-SNP attestation quotes.
  • Two-Phase Inversion: On any rendering failure or payment mismatch, state transactions roll back deterministically before committing.
  • FINOS CALM Ready: Conforms to the FINOS Common Architecture Language Model (CALM) reference architecture for agentic financial workflows.

📄 License & Attribution

Authored and maintained by Corrente Labs, Inc. ([email protected]), a Delaware C-Corporation.
Licensed under the MIT License.