âĄNWC JS SDK
The Alby JS SDK allows you to quickly integrate NWC into any JavaScript based application.
The NostrWebLNProvider
exposes the WebLN interface to execute lightning wallet functionality through NWC, such as sending payments, making invoices and getting the node balance.
NostrWebLNProvider (aliased as NWC) Options
providerName
: name of the provider to load the default options. currentlyalby
(default)nostrWalletConnectUrl
: full Nostr Wallet Connect URL as defined by the specrelayUrl
: URL of the Nostr relay to be used (e.g. wss://nostr-relay.getalby.com)walletPubkey
: pubkey of the Nostr Wallet Connect appsecret
: secret key to sign the request event (if not available window.nostr will be used)authorizationUrl
: URL to the NWC interface for the user to and the app connection
Example NWC URL
Note: A lightning address that clients can use to automatically setup the lud16
field on the user's profile if they have none configured is optional
If you need an own NWC connection string for testing:
Get an Alby Account with this link.
Create your NWC connection string at nwc.getalby.com.
Payments with an existing NWC URL
Allowing Users to Create a new NWC URL
If you wish your users to create a brand new NWC connection for using your service, you can launch a NWC modal where your user can confirm the connection:
NostrWebLNProvider Functions
See more functions in the NWC JS SDK GitHub repository.
More Examples
See more examples in the NWC JS SDK GitHub repository.
Last updated