feat(extensions): add extension loader infrastructure #3

Merged
padreug merged 15 commits from feature/extension-loader into dev 2026-04-02 18:47:55 +00:00

15 commits

Author SHA1 Message Date
Patrick Mulligan
a574a5b817 fix(extensions): add HTTP route types and getHttpRoutes to Extension interface
Some checks failed
Docker Compose Actions Workflow / test (push) Has been cancelled
HttpRoute, HttpRequest, and HttpResponse types were used by extensions
(withdraw, nip05) but not defined in the shared types.ts. Adds them
here so extensions import from the shared module instead of defining
locally. Also adds getHttpRoutes() as an optional method on the
Extension interface for extensions that expose HTTP endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
Patrick Mulligan
81f199a18a fix: use fresh balance in PayAppUserInvoice notification
notifyAppUserPayment was sending the stale cached balance from the
entity loaded before PayInvoice decremented it. Update the entity's
balance_sats from the PayInvoice response so LiveUserOperation events
contain the correct post-payment balance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
Patrick Mulligan
e3ec8676fb chore: update Docker build and dependencies
- Add .dockerignore for runtime state files (sqlite, logs, secrets)
- Bump Node.js base image from 18 to 20
- Add @types/better-sqlite3 dev dependency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
Patrick Mulligan
b115712c87 fix: correct nip44v1 secp256k1 getSharedSecret argument types
The @noble/curves secp256k1.getSharedSecret expects Uint8Array arguments,
not hex strings. Use hex.decode() to convert the private and public keys.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
Patrick Mulligan
51ce89234e feat(extensions): add getLnurlPayInfo to ExtensionContext
Enables extensions to get LNURL-pay info for users by pubkey,
supporting Lightning Address (LUD-16) and zap (NIP-57) functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
Patrick Mulligan
f048e71821 docs(extensions): add comprehensive extension loader documentation
Covers architecture, API reference, lifecycle, database isolation,
RPC methods, HTTP routes, event handling, and complete examples.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
Patrick Mulligan
b2dbcd6a20 feat(extensions): add extension loader infrastructure
Adds a modular extension system for Lightning.Pub that allows
third-party functionality to be added without modifying core code.

Features:
- ExtensionLoader: discovers and loads extensions from directory
- ExtensionContext: provides extensions with access to Lightning.Pub APIs
- ExtensionDatabase: isolated SQLite database per extension
- Lifecycle management: initialize, shutdown, health checks
- RPC method registration: extensions can add new RPC methods
- Event dispatching: routes payments and Nostr events to extensions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 14:46:15 -04:00
boufni95
48bfc45bcf fix imports 2026-04-02 14:46:15 -04:00
boufni95
6725d4620b metrics cache + update proto + queue fix 2026-04-02 14:46:15 -04:00
boufni95
680cca6852 refund swap info 2026-04-02 14:46:15 -04:00
boufni95
b08e7c134a undo ineffective change 2026-04-02 14:46:15 -04:00
boufni95
adb581a018 fix zaps amt validation 2026-04-02 14:46:15 -04:00
boufni95
21e3fc6ac0 zaps fix 2026-04-02 14:46:15 -04:00
boufni95
7ef33441e3 cleaup logs 2026-04-02 14:46:15 -04:00
boufni95
0466ee673b fix swap crash 2026-04-02 14:46:15 -04:00