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

@getalby/sdk

v5.0.0

Published

The SDK to integrate with Nostr Wallet Connect and the Alby API

Downloads

18,240

Readme

Alby JS SDK

Introduction

Build zero-custody bitcoin payments into apps with a few lines of code.

This JavaScript SDK is for interacting with a bitcoin lightning wallet via Nostr Wallet Connect or the Alby Wallet API.

Installing

npm install @getalby/sdk

or

yarn add @getalby/sdk

or for use without any build tools:

<script type="module">
  import { nwc, webln } from "https://esm.sh/@getalby/sdk@5.0.0"; // jsdelivr.net, skypack.dev also work

  // ... then use nwc.NWCClient or webln.NWC (see documentation below)
</script>

Lightning Network Client (LN) Documentation

Quickly get started adding lightning payments to your app.

The easiest way to provide credentials is with an NWC connection secret. Get one in minutes by connecting to Alby Hub, coinos, Primal, lnwallet.app, Yakihonne, or other NWC-enabled wallets.

For example, to make a payment:

import { LN, USD } from "@getalby/sdk";
const credentials = "nostr+walletconnect://..."; // the NWC connection credentials
await new LN(credentials).pay("lnbc..."); // pay a lightning invoice
await new LN(credentials).pay("hello@getalby.com", USD(1)); // or pay $1 USD to a lightning address

Or to request to receive a payment:

const request = await new LN(credentials).requestPayment(USD(1.0));
// give request.invoice to someone...
request.onPaid(giveAccess);

Read more

For more flexibility you can access the underlying NWC wallet directly. Continue to read the Nostr Wallet Connect documentation below.

Nostr Wallet Connect Documentation

Nostr Wallet Connect is an open protocol enabling applications to interact with bitcoin lightning wallets. It allows users to connect their existing wallets to your application allowing developers to easily integrate bitcoin lightning functionality.

For apps, see NWC client and NWA client documentation

For wallet services, see NWC wallet service documentation

Alby Wallet API Documentation

The Alby OAuth API allows you to integrate bitcoin lightning functionality provided by the Alby Wallet into your applications, with the Alby Wallet API. Send & receive payments, create invoices, setup payment webhooks, access Podcasting 2.0 and more!

Read more

NodeJS

Fetch

This library relies on a global fetch() function which will work in browsers and node v18.x or newer. (In older versions you have to use a polyfill.)

Websocket polyfill

To use this on Node.js you first must install websocket-polyfill@0.0.3 and import it:

import "websocket-polyfill";
// or: require('websocket-polyfill');

WebLN Documentation

The JS SDK also has some implementations for WebLN. See the NostrWebLNProvider documentation and OAuthWebLNProvider documentation.

More Documentation

Read the auto-generated documentation

Need help?

We are happy to help, please contact us or create an issue.

Thanks

The client and the setup is inspired and based on the twitter-api-typescript-sdk.

License

MIT