feat(extensions): add LNURL-withdraw extension #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/withdraw"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
PayAppUserInvoiceLiveUserOperationNostr eventsKey Changes
Nostr RPC Routing
Extension methods (e.g.
withdraw.createLink) are intercepted innostrMiddlewareand routed to the extension loader before falling through to standardnostrTransport. Extension system is initialized before nostrMiddleware so methods are available.Creator Pubkey Tracking
Withdraw links created via Nostr RPC store the
creator_pubkeyso the LNURL callback debits the correct user's balance — not the app owner's (which may have 0 sats).PayAppUserInvoice Integration
When
userPubkeyis provided, the adapter resolves theApplicationUserand callsapplicationManager.PayAppUserInvoice()instead ofpaymentManager.PayInvoice()directly. This ensuresnotifyAppUserPaymentfires, sendingLiveUserOperationevents for real-time balance updates.Balance Notification Fix
notifyAppUserPaymentwas sending stalebalance_satsfrom the cached entity loaded beforePayInvoicedecremented it. Now updates the entity from thePayInvoiceresponse before notification.RPC Methods
withdraw.createLinkwithdraw.createVoucherswithdraw.getLinkwithdraw.listLinkswithdraw.updateLinkwithdraw.deleteLinkwithdraw.listWithdrawalswithdraw.getStatsHTTP Endpoints (LNURL Protocol)
Companion Changes (lamassu-next)
ATM-side changes pushed to
aiolabs/lamassu-nextmain:billWithinBalanceguard prevents inserting more cash than the ATM's available sats. UI disables denomination buttons and shows informational message when limit reached.nostrClientconnect/disconnect events wired to UI status badge.LiveUserOperationevents.@theme inline+[data-theme]architecture, persisted to localStorage.MINE_INTERVALfrom 120s to 30s to keep LNDsynced_to_chain: true.expressdependency, moved 9 dev scripts topackages/nostr-client/dev/.Test Results
Tested end-to-end with ATM UI:
2b14b06fd8to22e1a348f222e1a348f2to401578b72b80d1117370todcb7dca9b5a933ba2770to0332a5a34f0332a5a34fto46ea632a8746ea632a87to8c8f2d4d3d8c8f2d4d3dtoc08bf4b849c08bf4b849to4c69a4d3904c69a4d390to68c71599f8