Skip to content

fix: Show failed lightning payments#376

Merged
macterra merged 2 commits intomainfrom
fix/pending-zap-payment-history
Apr 3, 2026
Merged

fix: Show failed lightning payments#376
macterra merged 2 commits intomainfrom
fix/pending-zap-payment-history

Conversation

@macterra
Copy link
Copy Markdown
Collaborator

@macterra macterra commented Apr 3, 2026

Summary

  • switch the lightning mediator LNbits history adapter from GET /api/v1/payments to GET /api/v1/payments/paginated
  • request recent payments sorted by time and handle the paginated response shape
  • restore failed zap payments in Archon wallet history
  • propagate LNbits payment status so zaps can distinguish failed from pending

Verification

  • npm run build
  • npm run build --prefix apps/react-wallet
  • npm run build --prefix apps/browser-extension
  • npm run build --prefix apps/gatekeeper-client
  • npm run build --prefix apps/keymaster-client
  • rebuilt and restarted lightning-mediator and react-wallet
  • verified POST http://localhost:4222/api/v1/lightning/payments now includes recent failed zaps, including:
    • 028dea32c4aac37e666080626e5779f897b8cd1122e9de0869385b58c654dca7
    • c60a2054c1b402925c705b1e91e32241dd15b70796dda0b7428d400b538ea85f
    • 762a8fd42abc96eb9990a54fde1ac0799b23bcc3bf5bb43ea9a02952b3daf8f7
  • verified POST http://localhost:4222/api/v1/lightning/payment now returns failed status for a failed zap, for example:
    • {"paid":false,"status":"failed","paymentHash":"028dea32c4aac37e666080626e5779f897b8cd1122e9de0869385b58c654dca7"}

@macterra macterra changed the title Use paginated LNbits payments history fix: Show failed lightning payments Apr 3, 2026
@macterra macterra requested a review from Copilot April 3, 2026 22:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Lightning payment-status plumbing (mediator → Drawbridge/Gatekeeper types → Keymaster/clients) so that failed Lightning payments (“failed zaps”) are surfaced to users instead of being indistinguishable from pending payments.

Changes:

  • Add an optional status field (success/pending/failed) to Lightning payment status/result types across services and packages.
  • Update the LNbits history adapter to request recent payments from /api/v1/payments/paginated, sorting by time and handling the paginated response shape.
  • Update Keymaster CLI and wallet UIs to display “Failed” and emit a user-facing error message when a zap fails.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
services/mediators/lightning/src/types.ts Extends mediator Lightning payment result type with status.
services/mediators/lightning/src/lnbits.ts Switches LNbits payments fetch to paginated endpoint; adds status mapping and returns it from checkPayment.
services/drawbridge/server/src/types.ts Extends Drawbridge Lightning payment result type with status.
packages/keymaster/src/keymaster.ts Propagates status from Drawbridge to Keymaster’s checkLightningPayment() result.
packages/keymaster/src/cli.ts Includes status in lightning-zap command output.
packages/gatekeeper/src/types.ts Extends shared LightningPaymentStatus type with status.
apps/react-wallet/src/components/LightningTab.tsx Displays failed zap status and shows “Zap failed” error.
apps/keymaster-client/src/KeymasterUI.jsx Displays failed zap status and shows “Zap failed” error.
apps/gatekeeper-client/src/KeymasterUI.jsx Displays failed zap status and shows “Zap failed” error.
apps/browser-extension/src/components/LightningTab.tsx Displays failed zap status and shows “Zap failed” error.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@macterra macterra marked this pull request as ready for review April 3, 2026 22:44
@macterra macterra merged commit 7d3b24f into main Apr 3, 2026
28 checks passed
@macterra macterra deleted the fix/pending-zap-payment-history branch April 3, 2026 22:44
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