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

hedera-react-pay

v0.2.0

Published

Plug-and-play React component for accepting HBAR payments via WalletConnect.

Downloads

188

Readme

Hedera React Pay

npm downloads license typescript

Plug-and-play React component and hook for accepting HBAR payments via WalletConnect (powered by @hashgraph/hedera-wallet-connect).

v0.2.0 — migrated from the deprecated HashConnect to the official @hashgraph/hedera-wallet-connect DAppConnector, which is the Hedera-endorsed WalletConnect integration.

Features

  • HederaPayButton — drop-in button with light / dark / custom themes.
  • useHederaPayment — hook for fully custom payment flows.
  • Automatic session restore on page reload.
  • TypeScript-first, zero UI framework dependencies.

Install

npm install hedera-react-pay

Peer dependencies (installed automatically by npm v7+):

npm install react react-dom

Quick Start

import { HederaPayButton } from 'hedera-react-pay';

export const Checkout = () => (
  <HederaPayButton
    projectId="YOUR_WALLETCONNECT_PROJECT_ID"
    receiverAccountId="0.0.1234"
    amount={1}
    network="testnet"
    memo="Order #1001"
    onTransactionSuccess={(txId) => console.log('Paid:', txId)}
    onError={(msg) => console.error(msg)}
  />
);

Get a free WalletConnect project ID at cloud.reown.com.

Props

interface HederaPayButtonProps {
  projectId: string;              // WalletConnect project ID (required)
  receiverAccountId: string;      // e.g. "0.0.1234"
  amount: number;                 // HBAR amount (positive)
  memo?: string;
  network?: 'testnet' | 'mainnet'; // default: 'testnet'
  theme?: 'light' | 'dark' | 'custom'; // default: 'light'
  text?: string;                  // button label override
  onTransactionSuccess?: (txId: string) => void;
  onError?: (error: string) => void;
  style?: React.CSSProperties;
}

Hook Usage

import { useHederaPayment } from 'hedera-react-pay';

function PayPage() {
  const { accountId, isConnected, loading, error, connectWallet, sendPayment } =
    useHederaPayment({ projectId: 'YOUR_PROJECT_ID', network: 'testnet' });

  return (
    <>
      {!isConnected && (
        <button onClick={connectWallet} disabled={loading}>
          Connect Wallet
        </button>
      )}
      {isConnected && (
        <button
          onClick={() =>
            sendPayment({ receiverAccountId: '0.0.1234', amount: 1, memo: 'Test' })
          }
          disabled={loading}
        >
          Send 1 HBAR
        </button>
      )}
      {error && <p>{error}</p>}
    </>
  );
}

Hook Return Values

interface UseHederaPaymentResult {
  accountId: string | null;      // connected Hedera account, e.g. "0.0.12345"
  isConnected: boolean;
  loading: boolean;
  error: string | null;
  connectWallet: () => Promise<string>;  // resolves with accountId
  sendPayment: (params: {
    receiverAccountId: string;
    amount: number;
    memo?: string;
  }) => Promise<string>;                 // resolves with transaction ID
}

Supported Wallets

Any wallet that supports WalletConnect v2 + Hedera HIP-820, including:

Local Playground

Create .env:

VITE_WALLETCONNECT_PROJECT_ID=your_project_id

Run:

npm run dev

Open http://localhost:5173.

Build

npm run build

Migration from v0.1.x

v0.2.0 replaces the hashconnect dependency with @hashgraph/hedera-wallet-connect. The component and hook API is unchanged — no code changes are required in your app.

License

MIT