Skip to content

lightning: add initial lightning address receive support#4224

Merged
Beerosagos merged 1 commit into
BitBoxSwiss:staging-sparkfrom
Beerosagos:lnurl-receive
Jul 8, 2026
Merged

lightning: add initial lightning address receive support#4224
Beerosagos merged 1 commit into
BitBoxSwiss:staging-sparkfrom
Beerosagos:lnurl-receive

Conversation

@Beerosagos

Copy link
Copy Markdown
Collaborator

Configure the Breez SDK with the LNURL domain and expose the registered Lightning address through the backend and receive screen. If no address exists yet, the backend registers a random username and retries when a candidate becomes unavailable during registration.

This is the first integration step for LNURL receive support. The ability to generate a new random address or choose a custom address will be added in a future commit.

Before asking for reviews, here is a check list of the most common things you might need to consider:

  • updating the Changelog
  • writing unit tests
  • checking if your changes affect other coins or tokens in unintended ways
  • testing on multiple environments (Qt, Android, ...)
  • having an AI review your changes

@Beerosagos

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds Lightning address support. The backend generates and registers a lightning address username (adjective+noun+number) via the Breez SDK, exposes it through a new LightningAddress() method, a GET /address HTTP handler, and an event-driven observer notification on address change. It also introduces a devServers flag controlling LNURL domain selection (dev vs prod) in the Lightning constructor and connection config, updating the corresponding call site in backend.go. On the frontend, new API functions fetch and subscribe to the lightning address, which is displayed as a copyable field on the receive screen, with accompanying locale and style additions. Tests cover username generation, address extraction, event notification, and domain selection.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/lightning/address.go`:
- Around line 52-109: The core retry and race-handling logic in
ensureLightningAddress is not covered by tests, so make the lightning-address
SDK interactions injectable like sparkStatus to unit test this path. Refactor
Lightning to route GetLightningAddress, CheckLightningAddressAvailable, and
RegisterLightningAddress through function fields or a small interface, then add
tests for the existing-address fast path, retry on unavailable usernames, and
the registration-failure recheck that continues when the username was claimed
concurrently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e33ddb04-412f-4adc-856d-afa1daf2a6d7

📥 Commits

Reviewing files that changed from the base of the PR and between e0e0ddc and e21edf0.

📒 Files selected for processing (12)
  • backend/backend.go
  • backend/lightning/address.go
  • backend/lightning/address_test.go
  • backend/lightning/address_words.go
  • backend/lightning/event.go
  • backend/lightning/handlers.go
  • backend/lightning/lightning.go
  • backend/lightning/lightning_test.go
  • frontends/web/src/api/lightning.ts
  • frontends/web/src/locales/en/app.json
  • frontends/web/src/routes/lightning/receive/receive.module.css
  • frontends/web/src/routes/lightning/receive/receive.tsx

Comment thread backend/lightning/address.go
@Beerosagos Beerosagos requested a review from bznein July 8, 2026 09:25
@Beerosagos Beerosagos marked this pull request as ready for review July 8, 2026 09:25
@Beerosagos Beerosagos requested a review from a team as a code owner July 8, 2026 09:25

@bznein bznein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

backend untested LGTM

I also took a look at the frontend and LGTM but up to you if you want someone else to review

@Beerosagos

Copy link
Copy Markdown
Collaborator Author

backend untested LGTM

I also took a look at the frontend and LGTM but up to you if you want someone else to review

thanks! Frontend is temporary anyway, I'll merge as is and then we'll need a separate PR to improve the send flow

Configure the Breez SDK with the LNURL domain and expose the
registered Lightning address through the backend and receive screen.
If no address exists yet, the backend registers a random username and
retries when a candidate becomes unavailable during registration.

This is the first integration step for LNURL receive support. The
ability to generate a new random address or choose a custom address
will be added in a future commit.
@Beerosagos Beerosagos merged commit 8292db0 into BitBoxSwiss:staging-spark Jul 8, 2026
8 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.

2 participants