#108 Feature: Implement Lightning Address#113
Draft
andycreed0x wants to merge 6 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Implements Lightning Address support for JAN3/AQUA accounts. Closes #108 Feature: Implement Lightning Address.
Each AQUA user has a Lightning Address (
ln_username@<domain>) assigned by the backend. This PR exposes the full LN-address lifecycle as MCP tools and CLI commands: check username availability, purchase a username with an on-chain L-BTC payment, enable/disable delivery, and keep the unused Liquid address pool healthy so the backend can deliver inbound Lightning payments.Description
The backend delivers inbound Lightning payments to a rotating batch of off-chain Liquid receive addresses registered by the client. Because these addresses are handed out before any on-chain activity,
lwk's next-unused tip can't track them —WalletDatanow persists a monotonically-increasingnext_address_indexcounter so two flows never share an address. The pool self-heals:jan3_user_infoandjan3_enable_lightning_addressboth callensure_ln_pool(best-effort, never failing the primary operation).Main Changes
jan3_user_info— account profile + auto pool top-up when LN-address is activejan3_enable_lightning_address— opt in/out; on enable immediately registers a Liquid address batchjan3_ln_check_username— availability check before paying L-BTCjan3_purchase_ln_username— on-chain L-BTC payment to buy/update the LN username; computes txid locally from the raw tx since the API omits itregister_ln_addresses/ensure_ln_pool/_auto_ensure_ln_poolinternal manager methods (jan3_accounts.py) for pool lifecycle; not exposed as MCP toolsJan3AccountsClientAPI methods:get_user,ln_address_toggle,ln_username_available,register_addresses,create_ln_username_payment_request,submit_raw_txWalletData.next_address_index(storage.py) with migration from legacyln_addr_next_indexkey; advances viaWalletManager.reserve_addressesaqua jan3 user-info,enable-lightning-address,ln-check-username,purchase-ln-username(cli/jan3.py)features.pyCLI→MCP mappings for new commandsnext_stephint tojan3_verify/jan3_login_completeresults to cue agents to offer LN-address opt-in post-logintest_jan3_accounts.py,test_storage.py,test_tools.py,test_wallet.py(~600 lines)Checklist