-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add simpler LNClient class #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lling, fix exports
There was a problem hiding this 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 |
There was a problem hiding this comment.
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, ... 🙈
This example shows how to receive a payment and split it to other recipients
maybe some more Money inspiration: https://www.npmjs.com/package/ts-money (not for here as a dependency though) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add another ln client example
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( |
There was a problem hiding this comment.
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.
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
, theLNClient
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: