Skip to content

Make BOLT12 CLI more ergonomic - #308

Merged
tankyleo merged 2 commits into
lightningdevkit:mainfrom
benthecarman:document-reusable-bolt12-offer-cli
Oct 9, 2026
Merged

tankyleo merged 2 commits into
lightningdevkit:mainfrom
benthecarman:document-reusable-bolt12-offer-cli

Conversation

@benthecarman

Copy link
Copy Markdown
Collaborator

It was unclear how to create a reusable offer, and bolt12-receive 1000sat silently used the amount as the description. Take the amount positionally with an optional -d description, like bolt11-receive, and document that offers can be paid repeatedly until they expire.

@ldk-reviews-bot

ldk-reviews-bot commented Oct 9, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tankyleo
tankyleo requested review from tankyleo and removed request for valentinewallace October 9, 2026 21:30

@tankyleo tankyleo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple points from codex i found worthwhile:

  1. [P2] The amount is per item, not per payment. The new amount help text (ldk-server-cli/src/main.rs:352) is misleading when quantity is used. bolt12-receive 1000sat -q 3 allows a payer buying three items to pay 3000 sat. LDK multiplies the offer amount by the requested quantity. Describe this as
    Amount to request per item.

  2. Quantity without an amount is silently ignored. The CLI (ldk-server-cli/src/main.rs:363) accepts bolt12-receive --quantity 3, but the server_s variable-amount branch (ldk-server/src/api/bolt12_receive.rs:28) drops quantity. This predates the commit, but is worth fixing while improving
    ergonomics: add requires = "amount" and reject the invalid combination server-side.

  3. MCP still advertises description as required. The schema (ldk-server-mcp/src/tools/schema.rs:444) retains "required": ["description"], although request deserialization defaults an omitted description to an empty string. Making it optional would align MCP with the new CLI behavior; this is a
    consistency improvement, not a new regression.

It was unclear how to create a reusable offer, and `bolt12-receive
1000sat` silently used the amount as the description. Take the amount
positionally with an optional -d description, like bolt11-receive, and
document that offers can be paid repeatedly until they expire.
The variable-amount path silently dropped quantity, so callers got an
offer that didn't match what they asked for. Return an invalid request
error instead.
@benthecarman
benthecarman force-pushed the document-reusable-bolt12-offer-cli branch from f162517 to 556adfb Compare October 9, 2026 21:45
@tankyleo
tankyleo merged commit 6a048e4 into lightningdevkit:main Oct 9, 2026
10 of 11 checks passed
@benthecarman
benthecarman deleted the document-reusable-bolt12-offer-cli branch October 9, 2026 22:05
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.

3 participants