Skip to content

invoice --receipt waits for payment - #1

Merged
shocknet-justin merged 5 commits into
mainfrom
invoice-receipt
Aug 21, 2026
Merged

invoice --receipt waits for payment#1
shocknet-justin merged 5 commits into
mainfrom
invoice-receipt

Conversation

@shocknet-justin

@shocknet-justin shocknet-justin commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • clinkctl invoice --receipt prints the bolt11, then stays until { res: ok }.
  • --json --receipt writes two objects: invoice, then receipt.
  • pay is unchanged — ndebit is already the closed loop.
  • Pins @shocknet/clink-sdk to ^1.7.2 so a replayed invoice is not treated as paid.

Test plan

  • clinkctl invoice --amount 21 prints bolt11 and exits 0
  • --receipt on 1.7.2 prints bolt11 and is still waiting after 30s (no ok)
  • --json --receipt prints the invoice JSON and stays (no second object)
  • SIGINT while waiting exits 130

shocknet-justin and others added 5 commits August 21, 2026 00:05
Pay via ndebit already returns settlement. This is for invoices paid some other way: print the bolt11, hold the socket, then print ok or the preimage.

Co-authored-by: Cursor <cursoragent@cursor.com>
--receipt holds the socket while someone else pays; 1.7.1 asks the relay again if that connection drops mid-wait.

Co-authored-by: Cursor <cursoragent@cursor.com>
1.7.1 re-subscribe can replay the invoice; that is not a payment. Still needs SDK 1.7.2 so the wait is not closed on that replay.

Co-authored-by: Cursor <cursoragent@cursor.com>
Exit codes are independent of stderr, but a status line on stderr is still noise for scripts. The process staying up after the bolt11 is the wait.

Co-authored-by: Cursor <cursoragent@cursor.com>
1.7.1 treated a replayed invoice as paid. 1.7.2 only closes on { res: ok }.

Co-authored-by: Cursor <cursoragent@cursor.com>
@shocknet-justin
shocknet-justin merged commit 7c599a5 into main Aug 21, 2026
@shocknet-justin
shocknet-justin deleted the invoice-receipt branch August 21, 2026 14:53
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.

1 participant