Commit graph

3445 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
Patrick Mulligan
72c9872b23 fix(watchdog): handle LND restarts without locking outgoing operations
Some checks failed
Docker Compose Actions Workflow / test (push) Has been cancelled
When the payment index advances (e.g. after an LND restart or external
payment), update the cached offset instead of immediately locking.
Only lock if both a history mismatch AND a balance discrepancy are
detected — indicating a real security concern rather than a benign
LND restart.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 15:19:20 -05:00
Patrick Mulligan
5e5e30c7a2 fix(lnd): wait for chain/graph sync before marking LND ready
Warmup() previously only checked that LND responded to GetInfo(), but
did not verify syncedToChain/syncedToGraph. This caused LP to accept
requests while LND was still syncing, leading to "not synced" errors
on every Health() check. Now waits for full sync with a 10min timeout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 15:18:06 -05:00
Patrick Mulligan
611eb4fc04 fix(nostr): close SimplePool after publishing to prevent connection leak
Each sendEvent() call created a new SimplePool() but never closed it,
causing relay WebSocket connections to accumulate indefinitely (~20/min).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 15:16:28 -05:00
Patrick Mulligan
6512e10f08 fix(handlers): await NostrSend calls throughout codebase
Update all NostrSend call sites to properly handle the async nature
of the function now that it returns Promise<void>.

Changes:
- handler.ts: Add async to sendResponse, await nostrSend calls
- debitManager.ts: Add logging for Kind 21002 response sending
- nostrMiddleware.ts: Update nostrSend signature
- tlvFilesStorageProcessor.ts: Update nostrSend signature
- webRTC/index.ts: Add async/await for nostrSend calls

This ensures Kind 21002 (ndebit) responses are properly sent to
wallet clients, fixing the "Debit request failed" issue in ShockWallet.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-04 15:16:28 -05:00
Patrick Mulligan
e9b5dacb3b fix(nostr): update NostrSend type to Promise<void> with error handling
The NostrSend type was incorrectly typed as returning void when it actually
returns Promise<void>. This caused async errors to be silently swallowed.

Changes:
- Update NostrSend type signature to return Promise<void>
- Make NostrSender._nostrSend default to async function
- Add .catch() error handling in NostrSender.Send() to log failures
- Add logging to track event publishing status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-04 15:16:28 -05:00
Justin (shocknet)
a2b7ac1673
Merge pull request #903 from shocknet/bump-fee-api
bimp fee
2026-03-04 13:27:32 -05:00
boufni95
70544bd551
rate fix 2026-03-04 18:26:21 +00:00
boufni95
74513a1412
bimp fee 2026-03-04 17:57:50 +00:00
Justin (shocknet)
266f526453
Merge pull request #901 from shocknet/bump-fee
bump fee api
2026-03-04 12:38:46 -05:00
boufni95
169284021f
bump fee api 2026-03-04 17:19:42 +00:00
Justin (shocknet)
67f9dfde8b
Merge pull request #900 from shocknet/refund-filed-swps
refund failed swaps
2026-03-03 21:04:18 -05:00
boufni95
7c8cca0a55
refund failed swaps 2026-03-03 19:49:54 +00:00
Justin (shocknet)
0a30cf537f
Merge pull request #899 from shocknet/activate-users-cleanup
fk fix
2026-03-02 15:21:42 -05:00
shocknet-justin
595e5bb257
fk fix 2026-03-02 15:16:08 -05:00
Justin (shocknet)
8576a1d138
Merge pull request #898 from shocknet/activate-users-cleanup
cleanup fix
2026-03-02 15:13:23 -05:00
shocknet-justin
c18b79dc50
use number 2026-03-02 15:10:24 -05:00
shocknet-justin
bfa71f7439
cleanup fix 2026-03-02 15:08:56 -05:00
Justin (shocknet)
a0b77ec1ca
Merge pull request #897 from shocknet/activate-users-cleanup
clean users table
2026-03-02 15:05:45 -05:00
shocknet-justin
cfb7dd1e6e
serial id 2026-03-02 15:01:12 -05:00
shocknet-justin
be6f48427f
clean users table 2026-03-02 14:56:48 -05:00
Justin (shocknet)
21cb960c2e
Merge pull request #896 from shocknet/activate-users-cleanup
cleanup db fix
2026-03-02 14:46:53 -05:00
shocknet-justin
7af841c330
cleanup db fix 2026-03-02 14:44:32 -05:00
Justin (shocknet)
71b55c06d4
Merge pull request #894 from shocknet/activate-users-cleanup
activte cleanup
2026-03-02 14:34:37 -05:00
shocknet-justin
432f9d0b42
bump never active to 90 2026-03-02 14:33:53 -05:00
boufni95
574f229cee
activte cleanup 2026-03-02 18:49:22 +00:00
Justin (shocknet)
f0418fb389
Merge pull request #891 from shocknet/assets_liabilities
assets and liabilities
2026-02-27 00:42:29 -05:00
Justin (shocknet)
dcfa9250fe
Merge pull request #889 from shocknet/tx-swaps
tx swaps polish
2026-02-27 00:42:02 -05:00
boufni95
ef14ec9ddf
assets and liabilities 2026-02-26 21:54:28 +00:00
boufni95
2c8d57dd6e
address amt validation 2026-02-25 18:14:56 +00:00
boufni95
f8fe946b40
tx swaps polish 2026-02-24 18:36:03 +00:00
Justin (shocknet)
e411b7aa7f
Merge pull request #887 from shocknet/test
notification types and topic id
2026-02-20 14:51:58 -05:00
Justin (shocknet)
d949addb16
Merge pull request #886 from shocknet/lnd-log-level
use debug log level,  no level = ERROR
2026-02-20 14:39:17 -05:00
boufni95
9e66f7d72e
use debug log level, no level = ERROR 2026-02-20 19:37:11 +00:00
Justin (shocknet)
ae3b39ee04
Merge pull request #885 from shocknet/fix-pending-tx
fetch each pending tx to validate
2026-02-20 13:46:48 -05:00
boufni95
c83028c419
fetch each pending tx to validate 2026-02-20 18:40:40 +00:00