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

@onchainfi/hyperlink

v0.1.6

Published

Turn any text into a payment link with x402. One-click payments for content, donations, and more.

Readme

@onchainfi/hyperlink

Turn any text into a payment link. One click, instant x402 payments.

<p>
  Enjoyed this article? 
  <PaymentLink to="0x..." amount="0.50">
    Buy me a coffee ☕
  </PaymentLink>
</p>

Features

  • 💸 One-Click Payments - Text links that trigger instant payments
  • 🎨 Looks Like Text - Seamlessly integrates into content
  • Confirmation Modal - Shows payment details before executing
  • 🔗 Shareable Links - Generate payment URLs to share anywhere
  • 🚀 Zero Navigation - Payments happen inline, no page changes
  • 🔐 Built on Connect - Uses @onchainfi/connect for wallet + payments

Installation

npm install @onchainfi/hyperlink @onchainfi/connect

Prerequisites: Requires @onchainfi/connect to be installed and configured.

Quick Start

1. Set Up Connect (if not already done)

import { OnchainConnect } from '@onchainfi/connect';

<OnchainConnect privyAppId="..." onchainApiKey="...">
  <App />
</OnchainConnect>

2. Use PaymentLink Anywhere

import { PaymentLink } from '@onchainfi/hyperlink';

export default function BlogPost() {
  return (
    <article>
      <h1>My Article</h1>
      <p>Great content here...</p>
      
      <p>
        Enjoyed this? 
        <PaymentLink 
          to="0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
          amount="0.50"
        >
          Buy me a coffee ☕
        </PaymentLink>
      </p>
    </article>
  );
}

That's it! Users click the link, see a confirmation modal, approve, and payment completes - all without leaving the page.

API Reference

<PaymentLink>

A text link that triggers an inline payment.

Props:

{
  // Required
  to: string;        // Recipient address
  amount: string;    // Amount in token units
  children: ReactNode;  // Link text
  
  // Optional
  network?: string;     // Default: 'base'
  token?: string;       // Default: 'USDC'
  memo?: string;        // Payment description
  priority?: 'speed' | 'cost' | 'reliability' | 'balanced';
  className?: string;   // Custom link styling
  
  // Callbacks
  onSuccess?: (txHash: string) => void;
  onError?: (error: Error) => void;
  
  // Behavior
  confirmMessage?: string;  // Custom confirmation text
  skipConfirm?: boolean;    // Skip modal, pay immediately
  disabled?: boolean;
}

Example:

<PaymentLink
  to="0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
  amount="1.00"
  memo="Premium article access"
  onSuccess={(txHash) => unlockContent()}
>
  Unlock for $1
</PaymentLink>

createPaymentLink()

Generate shareable payment URLs.

import { createPaymentLink } from '@onchainfi/hyperlink';

const link = createPaymentLink({
  to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
  amount: '0.50',
  memo: 'Coffee donation',
  baseUrl: 'https://myblog.com/donate'
});

// Returns: https://myblog.com/donate?x402=eyJ0b...

Options:

{
  to: string;
  amount: string;
  network?: string;
  token?: string;
  memo?: string;
  priority?: string;
  baseUrl?: string;    // URL to append payment data to
  useHash?: boolean;   // Use hash fragment instead of query param
}

Use Cases

Content Paywalls

function PremiumArticle() {
  const [unlocked, setUnlocked] = useState(false);
  
  if (!unlocked) {
    return (
      <div>
        <h2>Premium Content</h2>
        <p>
          <PaymentLink 
            to="0x..." 
            amount="0.10"
            onSuccess={() => setUnlocked(true)}
          >
            Pay $0.10 to unlock
          </PaymentLink>
        </p>
      </div>
    );
  }
  
  return <Article />;
}

Creator Tips

function CreatorProfile() {
  return (
    <div>
      <h1>@creator</h1>
      <p>
        Support my work: 
        <PaymentLink to="0x..." amount="1.00">$1</PaymentLink> | 
        <PaymentLink to="0x..." amount="5.00">$5</PaymentLink> | 
        <PaymentLink to="0x..." amount="10.00">$10</PaymentLink>
      </p>
    </div>
  );
}

Donation Buttons

<footer>
  <p>
    This site is free. If you found it helpful, consider
    <PaymentLink to="0x..." amount="0.50" memo="Site donation">
      donating
    </PaymentLink>
    to keep it running.
  </p>
</footer>

Shareable Payment Links

function ShareDonationLink() {
  const link = createPaymentLink({
    to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
    amount: '0.50',
    memo: 'Support the project',
    baseUrl: 'https://myproject.com'
  });
  
  return (
    <button onClick={() => navigator.clipboard.writeText(link)}>
      Copy Donation Link
    </button>
  );
}

Styling

PaymentLink accepts className for custom styling:

<PaymentLink 
  to="0x..." 
  amount="0.10"
  className="font-bold text-blue-500 hover:text-blue-400"
>
  Custom styled link
</PaymentLink>

Default style: Purple link with underline (matches Onchain aesthetic)

Advanced Features

Skip Confirmation (Instant Payment)

<PaymentLink 
  to="0x..." 
  amount="0.01" 
  skipConfirm={true}
>
  Quick tip $0.01
</PaymentLink>

Custom Confirmation Message

<PaymentLink
  to="0x..."
  amount="5.00"
  confirmMessage="This will unlock premium features for 30 days"
>
  Upgrade to Premium
</PaymentLink>

Payment Callbacks

<PaymentLink
  to="0x..."
  amount="0.50"
  onSuccess={(txHash) => {
    console.log('Payment sent!', txHash);
    // Unlock content, track analytics, etc.
  }}
  onError={(error) => {
    console.error('Payment failed:', error);
    // Show error message, log for support
  }}
>
  Pay here
</PaymentLink>

How It Works

  1. User clicks the payment link
  2. Modal shows payment details (amount, recipient, network)
  3. User confirms
  4. Connect wallet handles signature + payment
  5. Payment routes through Onchain aggregator
  6. Success! User stays on the same page

All payments flow through api.onchain.fi - same infrastructure as Connect.

Requirements

  • @onchainfi/connect installed and configured
  • ✅ User has Connect wallet connected
  • ✅ Sufficient token balance

TypeScript

Fully typed:

import type { 
  PaymentLinkProps,
  PaymentLinkData,
  CreatePaymentLinkOptions 
} from '@onchainfi/hyperlink';

Examples

See examples/ folder for complete working examples:

  • Content paywall
  • Tip buttons
  • Donation links
  • Shopping cart integration

License

AGPL-3.0

Links

Support