-
Notifications
You must be signed in to change notification settings - Fork 38
Add Lightning Address payment and verification support #225
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
base: main
Are you sure you want to change the base?
Add Lightning Address payment and verification support #225
Conversation
Introduces types and methods for Lightning Address payment flows, including verification, metadata parsing, and invoice handling in LightningService. Exports new types for Lightning Address operations and updates the wallet types to support LNURL-pay requests and responses.
|
|
Hi @Aniket-pd! Thanks for the PR and welcome to the project. Our rust client already contains much of the lnurl logic. It just needs to be exported. (see here) So I think we can avoid rewriting the logic in JS. cc: @MrImmortal09 |
|
Got it ,I’ll look into the section you linked and adjust the PR accordingly. |
Replaces manual Lightning address verification and payment logic with RPC calls to 'verify_lightning_address' and 'pay_lightning_address'. Removes local validation, normalization, and fetch methods, delegating these responsibilities to the backend service for improved maintainability and consistency.
Updated LightningAddressPayerData to use JSONValue for better type safety and extended LightningAddressVerification from JSONObject. Also removed unnecessary whitespace from LightningService.
| ): Promise<LightningAddressVerification> { | ||
| return await this.client.rpcSingle<LightningAddressVerification>( | ||
| 'ln', | ||
| 'verify_lightning_address', |
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 method doesn't exist in the fedimint-ln-client as of now, could you please mention the corresponding PR where you have added the required functions?
|
|
||
| return await this.client.rpcSingle<PayLightningAddressResult>( | ||
| 'ln', | ||
| 'pay_lightning_address', |
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.
same here as well.
|
Thanks for flagging this. These SDK methods rely on two new LN RPCs (verify_lightning_address and pay_lightning_address) that aren’t in the current fedimint-client yet , they’re being added in a separate backend PR. I’ll update the changes in this PR once that backend PR is ready |
Implements functions to resolve, validate, and pay Lightning Addresses, including new message handlers for 'verify_lightning_address' and 'pay_lightning_address' client RPC methods. This enables the worker to interact with LNURL-pay endpoints and process Lightning Address payments.
Deleted an unnecessary blank line before the comment block in worker.js to improve code formatting.
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.
From fedimint-ln-client I meant this.
So the workflow we have is:
- We get a WASM binary compiled from Rust and use it in the fedimint-sdk
- The main entry point in the WASM is the code present in fedimint-client-wasm
- Through the RPC function in the RPC handler, we route to fedimint-client-rpc
- Then we have base/core functions like parsing, or module-specific functions like
pay_bolt11_invoicethrough the handle_client_rpc
If you want to call module functions, you need to pass type: 'client-rpc' and specify the module (e.g., module: 'ln' for Lightning) along with the required payload using sendSingleRPC in TypeScript.
So if you want to add functions for Lightning Address and Lightning verification, you would add them in fedimint-ln-client (in the handle_rpc method).
If you need further help with how to integrate the WASM in fedimint-sdk for testing or anything else, feel free to ping me on Discord.
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.
Also the worker.js needs no change in all of this and it shouldn't be touched at all as scope of this PR.
|
Sorry for the misunderstanding , that was my mistake. |
Updated the payLightningAddress method to first fetch an invoice using the 'get_invoice' RPC call, then pay the invoice using payInvoice. This change separates invoice retrieval from payment and returns additional information such as the invoice and successAction.
addressing token #221
This update introduces full Lightning Address support across the SDK. It adds verification and payment helpers to
LightningService, along with new types and methods for handling the entire Lightning Address payment flow — including metadata parsing, invoice negotiation, and payment execution.What's Included
Lightning Address type definitions
Defines LNURL-pay metadata, callback responses, and success actions.
Extended
LightningServicehelpersAdds reusable methods for verifying a Lightning Address and paying it through its negotiated invoice.
Re-exported helper types
Makes Lightning Address operations easier to access and use across the SDK.