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

@coinexams/lightning

v1.1.2

Published

CoinExams Lightning Payment SDK - A standalone Lightning Network client module that wraps a local Phoenixd node REST API.

Readme

@coinexams/lightning

Lightning Network client wrapping a Phoenixd node REST API. Create invoices, send payments, query balances, handle LNURL-pay requests, and publish Nostr Zap receipts.

Change Log

See changes.md.

Quick Start

1. Install package

yarn add @coinexams/lightning

2. Setup phoenixd

requires Linux with systemd

npx @coinexams/lightning setup
# Optional: --seed "<12-or-24-word phrase>" --port 9740

3. Integrate zap code

import { startLightning, nsecToBytes, npubToHex } from "@coinexams/lightning";

const client = startLightning({
  serverPrvKeyBytes: nsecToBytes("nsec1..."),
  serverPubKeyHex: npubToHex("npub1..."),
});

// Full zap workflow: request invoice → poll until paid → publish kind-9735 receipt
const zap = client.zapProcess({
  lnAddress: `[email protected]`,
  amountMsat: 100_000,
  nostrEvent: `<zap-request-json>`,
});
// → { invoice: { pr: "lnbc...", routes: [] }, invoiceId: "..." }

Error Handling

All methods return undefined on failure and log via console.error with an ISO timestamp prefix.

Invoices

// Create an invoice to receive funds
const invoice = client.invoiceNew({ amountSat: 1000, description: "test" });
// → { invoiceString: "lnbc1...", invoiceId: "abc..." }

// Check if it's been paid
import { PaymentDirection } from "@coinexams/lightning";

const payment = client.invoiceStatus({
  invoiceId: "abc...",
  type: PaymentDirection.Incoming,
});
// → IncomingPayment | OutgoingPayment | undefined

Payments

// Lightning address (auto-detected by address format)
const sent = client.fundsWithdraw({
  amountSat: 500,
  address: "[email protected]",
});
// → { recipientAmountSat: 500, paymentHash: "...", ... }

// On-chain address (auto-detected by address format)
const onchain = client.fundsWithdraw({
  amountSat: 10000,
  address: "bc1...",
});

// Full balance details
const balance = client.fundsBalance();
// → { balanceSat: 50000, feeCreditSat: 100 }

// Incoming payments
const recentIncoming = client.fundsIncoming(10);
// → IncomingPayment[]

// Outgoing payments
const recentOutgoing = client.fundsOutgoing(10);
// → OutgoingPayment[]

// Custom data query (example)
const incoming = client.fundsData({
  type: "payments/incoming",
  params: { limit: 10 },
});
// → IncomingPayment[]

Architecture

dist/
├── node/lightning.node.min.js  # Bundled library
└── code/                       # Compiled CLI entry point
src/
├── index.ts           # Public barrel exports
├── code/
│   ├── client.ts      # startLightning() factory → LightningClient
│   ├── types.ts       # All type definitions
│   ├── utils.ts       # Helpers (regex, timers, Nostr key conversion)
│   └── cli.ts         # CLI handler (arg parsing, setup orchestration)
└── setup/
    ├── index.ts       # Phoenixd setup — auto-install, configure, start as systemd service
    ├── config.ts      # Read/write phoenix config + credentials
    ├── constants.ts   # Paths, ports, systemd unit template
    ├── utils.ts       # Sudo wrappers, service check, concurrent lock
    └── version.ts     # Installed version tracking