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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nostr-dev-kit/ndk-wallet

v0.7.1

Published

NDK Wallet

Readme

@nostr-dev-kit/ndk-wallet

A wallet toolkit for the Nostr ecosystem, providing implementations for NIP-47 (NWC), NIP-57 (Zaps), and NIP-60 (Cashu eCash) wallets.

Overview

The ndk-wallet package extends NDK with wallet capabilities, allowing applications to manage and interact with various wallet types in the Nostr ecosystem. Key features include:

  • NIP-60 Wallet: Implementation of Cashu eCash wallets for Nostr
  • Nutzap Monitor: Automated monitoring and redemption of Nutzaps (NIP-60 zaps)
  • NWC Client: For interacting with wallets via Nostr Wallet Connect (NIP-47)
  • Zap Support: For sending and receiving Lightning zaps (NIP-57)

Components

Wallet Base (NDKWallet)

The NDKWallet interface serves as the foundation for all wallet implementations, providing a common API for:

  • Retrieving balances
  • Sending and receiving payments
  • Interacting with wallet events
  • Managing wallet status

Cashu Wallet (NDKCashuWallet)

The NDKCashuWallet implements the NIP-60 specification, providing a fully-featured Cashu eCash wallet:

  • Token management and validation
  • Sending and receiving tokens via nutzaps
  • Mint interaction and token issuance
  • Proofs handling and validation
  • Backup and restore functionality
import { NDKCashuWallet } from "@nostr-dev-kit/ndk-wallet";

// Create a Cashu wallet
const wallet = new NDKCashuWallet(ndk);

// Add mints
wallet.addMint("https://mint.example.com");

// Get wallet balance
const balance = await wallet.getBalance();

Nutzap Monitor (NDKNutzapMonitor)

The NDKNutzapMonitor automatically monitors and processes nutzaps (NIP-60 zaps) for a user:

  • Listens for incoming nutzaps
  • Manages nutzap states
  • Redeems tokens when appropriate private keys are available
  • Persists nutzap states across sessions using a customizable store
import { NDKNutzapMonitor } from "@nostr-dev-kit/ndk-wallet";

// Create a monitor
const monitor = new NDKNutzapMonitor(ndk, user, { mintList, store });

// Set wallet and start monitoring
monitor.wallet = myCashuWallet;
await monitor.start();

For detailed information on using the Nutzap Monitor, see Nutzap Monitor Documentation.

NWC Client (NDKWalletNWC)

The NDKWalletNWC implements the NIP-47 specification for Nostr Wallet Connect:

  • Connect to NWC-compatible wallets
  • Send payment requests
  • Query wallet information
  • Handle payment responses
import { NDKWalletNWC } from "@nostr-dev-kit/ndk-wallet";

// Create an NWC wallet
const wallet = new NDKWalletNWC(ndk, nwcConnectionInfo);

// Pay an invoice
await wallet.pay({ invoice: "lnbc..." });

State Management

The wallet components use state management patterns to track the status of operations:

  • NDKCashuWallet tracks token states, mint connections, and wallet status
  • NDKNutzapMonitor implements a state machine for tracking nutzap processing
  • State stores provide persistent storage options

Events

All wallet components emit events that applications can listen to:

  • Balance changes
  • Payment events
  • State transitions
  • Errors and warnings
wallet.on("balance_changed", (newBalance) => {
    console.log(`New balance: ${newBalance}`);
});

Documentation

For more detailed documentation on specific components:

Installation

npm install @nostr-dev-kit/ndk-wallet

Requirements

  • @nostr-dev-kit/ndk: Peer dependency
  • Modern browser or Node.js environment

License

MIT