From dfe3b8a1111c992d39f3b5a0d6f2d25824dc7cb3 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 25 May 2026 14:05:13 +0700 Subject: [PATCH 1/2] feat: take invoice as positional arg in pay-invoice Closes #23. The invoice is now passed directly (`pay-invoice lnbc...`) instead of via `-i, --invoice`, matching the `fetch ` pattern. Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 4 ++-- src/commands/pay-invoice.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e1aaadd..12dd76f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Then pass `--wallet-name` to any command to use that wallet: ```bash npx @getalby/cli --wallet-name work get-balance -npx @getalby/cli --wallet-name personal pay-invoice --invoice lnbc... +npx @getalby/cli --wallet-name personal pay-invoice lnbc... ``` ### Connection secret resolution (in order of priority) @@ -105,7 +105,7 @@ npx @getalby/cli get-wallet-service-info npx @getalby/cli make-invoice --amount 1000 --description "Payment" # Pay an invoice -npx @getalby/cli pay-invoice --invoice "lnbc..." +npx @getalby/cli pay-invoice "lnbc..." # Send a keysend payment npx @getalby/cli pay-keysend --pubkey "02abc..." --amount 100 diff --git a/src/commands/pay-invoice.ts b/src/commands/pay-invoice.ts index ef88e1c..351e158 100644 --- a/src/commands/pay-invoice.ts +++ b/src/commands/pay-invoice.ts @@ -6,13 +6,13 @@ export function registerPayInvoiceCommand(program: Command) { program .command("pay-invoice") .description("Pay a lightning invoice") - .requiredOption("-i, --invoice ", "Invoice to pay") + .argument("", "Invoice to pay") .option("-a, --amount ", "Amount (for zero-amount invoices)", parseInt) - .action(async (options) => { + .action(async (invoice, options) => { await handleError(async () => { const client = await getClient(program); const result = await payInvoice(client, { - invoice: options.invoice, + invoice, amount_in_sats: options.amount, }); output(result); From 6d442294c689f45665ae31b23cb1d2f7cb68d581 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 25 May 2026 14:41:32 +0700 Subject: [PATCH 2/2] chore: update pay-invoice usages to positional bolt11 arg Update test invocations and CLI help example to use the new positional argument instead of the removed -i/--invoice flag. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/index.ts | 2 +- src/test/nwc-payments.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index f677d36..468ffa6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,7 @@ program " $ npx @getalby/cli auth https://my.albyhub.com --app-name OpenClaw\n" + ' $ npx @getalby/cli connect "nostr+walletconnect://..."\n' + " $ npx @getalby/cli get-balance\n" + - " $ npx @getalby/cli pay-invoice --invoice lnbc...", + " $ npx @getalby/cli pay-invoice lnbc...", ) .version("0.6.1") .option( diff --git a/src/test/nwc-payments.test.ts b/src/test/nwc-payments.test.ts index 87062d1..393812e 100644 --- a/src/test/nwc-payments.test.ts +++ b/src/test/nwc-payments.test.ts @@ -26,7 +26,7 @@ describe("NWC Payment Commands", () => { // Pay with sender wallet const paymentResult = runCli( - `-c "${sender.nwcUrl}" pay-invoice -i "${invoiceResult.output.invoice}"` + `-c "${sender.nwcUrl}" pay-invoice "${invoiceResult.output.invoice}"` ); expect(paymentResult.success).toBe(true); expect(paymentResult.output.preimage).toBeDefined(); @@ -41,7 +41,7 @@ describe("NWC Payment Commands", () => { // Pay the invoice first (unpaid invoices may not be found) const payResult = runCli( - `-c "${sender.nwcUrl}" pay-invoice -i "${invoiceResult.output.invoice}"` + `-c "${sender.nwcUrl}" pay-invoice "${invoiceResult.output.invoice}"` ); expect(payResult.success).toBe(true);