Skip to content

Conversation

rolznz
Copy link
Contributor

@rolznz rolznz commented Mar 20, 2025

Closes #343 and #342

This PR adds a simpler way for new developers to interact with a lightning wallet. You only need a couple lines to do cool stuff. Unlike the NWCClient, the LNClient uses satoshi values (is this confusing?)

Alby JS SDK is now dependent on the lightning tools package. (Pros: devs don't need to install both and could have some of the functions easily available here)

Most of the README is now moved into separate readme files (see docs)

Separate components (NWC, WebLN, LNClient, OAuth) are now in separate folders. This is an update to 5.0.0 as some of the imports are breaking changes.

OAuth examples are now moved into a subfolder.

I haven't proxied all the methods yet, I wonder if it's better to just make the internal nwcClient publicly accesible (as it is now)

TODOs:

Copy link
Contributor

@bumi bumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great!

import { nwc } from "@getalby/sdk";
const nwcClient = new nwc.NWCClient({
nostrWalletConnectUrl: loadNWCUrl(),
}); // loadNWCUrl is some function to get the NWC URL from some (encrypted) storage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should sync the naming here.
connection URI vs. credentials vs. secret, ... 🙈

bumi added 2 commits April 6, 2025 13:08
This example shows how to receive a payment and split it to other recipients
@bumi
Copy link
Contributor

bumi commented Apr 6, 2025

maybe some more Money inspiration: https://www.npmjs.com/package/ts-money (not for here as a dependency though)

bumi and others added 2 commits April 6, 2025 14:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bumi bumi temporarily deployed to github-pages April 7, 2025 13:54 — with GitHub Actions Inactive
Co-authored-by: Michael Bumann <hello@michaelbumann.com>
* feat: allow comment and payerdata in LNClient pay method

* fix: apply transaction metadata to all related transaction method types

* chore: update example and lnclient docs to pay ln address with extra metadata
* docs: add some comments to the examples

* docs: comments

* feat: add lnclient receive timeout for ReceiveInvoice class (#357)

* chore: remove unnecessary comment

* chore: remove unnecessary comment

---------

Co-authored-by: Roland <33993199+rolznz@users.noreply.github.com>
* @param args additional options, e.g. to set a description on the payment request, or store metadata for the received payment
* @returns the invoice to be paid, along with methods to easily listen for a payment and act upon it.
*/
async receive(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the name receive is misleading since it actually returns an invoice which could be paid. But I can't think of a better name.

@rolznz rolznz merged commit 03042df into master Apr 11, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify fiat amount usage

2 participants