Skip to content

Conversation

@Aniket-pd
Copy link

@Aniket-pd Aniket-pd commented Nov 16, 2025

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 LightningService helpers
    Adds 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.

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.
@changeset-bot
Copy link

changeset-bot bot commented Nov 16, 2025

⚠️ No Changeset found

Latest commit: 249588a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@alexlwn123
Copy link
Member

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

@Aniket-pd
Copy link
Author

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',
Copy link
Member

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',
Copy link
Member

Choose a reason for hiding this comment

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

same here as well.

@Aniket-pd
Copy link
Author

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.
Copy link
Member

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:

  1. We get a WASM binary compiled from Rust and use it in the fedimint-sdk
  2. The main entry point in the WASM is the code present in fedimint-client-wasm
  3. Through the RPC function in the RPC handler, we route to fedimint-client-rpc
  4. Then we have base/core functions like parsing, or module-specific functions like pay_bolt11_invoice through 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.

Copy link
Member

@MrImmortal09 MrImmortal09 Nov 24, 2025

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.

@Aniket-pd
Copy link
Author

Sorry for the misunderstanding , that was my mistake.
I’ve opened a PR that adds the LN RPCs (verify_lightning_address and pay_lightning_address) to the fedimint-ln-client.
Here’s the link to that PR: fedimint/fedimint#7988

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.
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.

3 participants