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

nwckit

v0.1.0

Published

Browser-first TypeScript toolkit for Lightning payments via Nostr Wallet Connect

Downloads

103

Readme

NwcKit

⚡ Lightning payments in the browser via Nostr Wallet Connect (NIP-47)

NwcKit is a browser-first TypeScript toolkit that enables web applications to interact with Lightning wallets using Nostr — completely non-custodial.

No QR codes. No wallet switching. No backend required.

Think: Stripe for Lightning — but non-custodial and Nostr-native


⚡ 30-second example

import { NwcKit, parseNwcUri } from "nwckit";

const connection = parseNwcUri("nostr+walletconnect://...");

const client = new NwcKit({ connection });

await client.connect();

await client.payInvoice({
  invoice: "lnbc..."
});

That's it.


🧠 What it does

NwcKit acts as a bridge between your frontend and a user's Lightning wallet, using Nostr relays as the communication layer (NIP-47).

  • The user keeps full control of their funds
  • The app gets permission to request payments
  • All communication is encrypted and relay-based

✨ Features

⚡ Lightning payments via Nostr Wallet Connect (NIP-47) 🔐 Encrypted request/response flow (NIP-04 compatible) 🌐 Browser-first architecture (no Node-only dependencies) 🧠 Fully typed TypeScript API 🔌 Simple connection model (URI-based) ⏱ Built-in timeout and error handling 🧱 Modular foundation for future extensions


🚧 Status

Alpha (functional, evolving)

✅ Currently implemented

  • NWC URI parsing
  • Relay connection handling
  • Encrypted request/response flow

Full NIP-47 method support:

  • get_info
  • get_balance
  • make_invoice
  • pay_invoice
  • lookup_invoice
  • list_transactions

⚠️ Work in progress

  • API surface may change
  • Not yet production hardened
  • Limited cross-wallet testing

📦 Installation

npm install nwckit

🔗 NWC URI format

nostr+walletconnect://<wallet_pubkey>?relay=<relay_url>&secret=<secret>

Example:

nostr+walletconnect://abcdef123456...?relay=wss%3A%2F%2Frelay.example.com&secret=0123456789abcdef...

🚀 Quick Start (Complete Example)

import { NwcKit, parseNwcUri } from "nwckit";

// 1. Parse connection URI
const connection = parseNwcUri(
  "nostr+walletconnect://abcdef1234...?relay=wss%3A%2F%2Frelay.example.com&secret=012345..."
);

// 2. Create client
const client = new NwcKit({
  connection,
  timeoutMs: 15000,
});

// 3. Connect to relay
await client.connect();

// 4. Get wallet info
const info = await client.getInfo();
console.log("Wallet info:", info);

// 5. Get balance
const balance = await client.getBalance();
console.log("Balance:", balance.balance);

// 6. Create invoice
const invoice = await client.makeInvoice({
  amount: 21000,
  description: "Test payment",
});

// 7. Pay invoice
const payment = await client.payInvoice({
  invoice: invoice.invoice,
});

// 8. Lookup invoice
const lookup = await client.lookupInvoice({
  payment_hash: invoice.payment_hash,
});

// 9. List transactions
const txs = await client.listTransactions({
  limit: 10,
});

// 10. Disconnect
await client.disconnect();

🧠 API Overview

parseNwcUri(uri: string): NwcConnection

Parses a Nostr Wallet Connect URI:

{
  walletPubkey: string;
  relayUrl: string;
  secret: string;
  lud16?: string;
}

new NwcKit(options)

{
  connection: NwcConnection;
  timeoutMs?: number;
}

🔧 Client Methods

connect(): Promise<void>
disconnect(): Promise<void>

getInfo(): Promise<NwcWalletInfo>
getBalance(): Promise<NwcBalanceResponse>

makeInvoice(params): Promise<MakeInvoiceResponse>
payInvoice(params): Promise<PayInvoiceResponse>

lookupInvoice(params): Promise<InvoiceLookupResponse>
listTransactions(params?): Promise<ListTransactionsResponse>

⚠️ Security Model

  • Users never expose their private keys
  • Apps operate via scoped permissions (NWC)
  • All communication is encrypted over Nostr relays
  • No custody, no fund transfers to third parties

🛣️ Roadmap

  • Improve cross-wallet compatibility
  • Add NIP-44 encryption support
  • Add signer abstraction (browser / extension / ephemeral)
  • Improve relay management (multi-relay, fallback)
  • Create browser demo app
  • Publish stable v1

🧩 Vision

NwcKit aims to become the standard browser SDK for Lightning over Nostr.

Planned future modules:

  • Identity resolution layer (Nostr + Lightning)
  • Browser UI components
  • Lightning UX abstractions
  • React integration

🛠️ Development

git clone https://github.com/nmassari/NwcKit.git
cd NwcKit
npm install
npm run build

📄 License

MIT