lightning-wallet-mcp 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.js +15 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,6 +199,10 @@ Payments always execute through an agent wallet on the backend, which is where b
|
|
|
199
199
|
|
|
200
200
|
## Changelog
|
|
201
201
|
|
|
202
|
+
### v1.6.1 (2026-09-11)
|
|
203
|
+
|
|
204
|
+
`pay_l402_api` reports a first-party call that the backend refunded (for example an upstream fetch that failed after payment) as not paid, with `refunded_sats`, instead of a paid success. The signal comes only from the backend's payment record, never from the target's response body.
|
|
205
|
+
|
|
202
206
|
### v1.6.0 (2026-09-11)
|
|
203
207
|
Credential persistence, operator-key payments, 1% fee with no minimum, 10-sat withdrawals, pending-payment safety, timeouts, the fixes listed above, eight new CLI commands, README rewrite.
|
|
204
208
|
|
package/dist/index.js
CHANGED
|
@@ -890,18 +890,27 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
890
890
|
case 'pay_l402_api': {
|
|
891
891
|
const parsed = PayL402ApiSchema.parse(args ?? {});
|
|
892
892
|
const result = await session.requireClient().l402Pay(parsed.url, parsed.method, parsed.body, parsed.max_payment_sats);
|
|
893
|
-
// Determine if the target returned a success response
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
893
|
+
// Determine if the target returned a success response. The target body is application
|
|
894
|
+
// data (any URL can be paid), so a refund is only ever read from the backend's own
|
|
895
|
+
// payment record: the wallet sets payment.refunded when it took a payment and gave it
|
|
896
|
+
// back because a first-party service failed after the debit.
|
|
897
|
+
const backendPayment = (result.rawResponse?.payment ?? null);
|
|
898
|
+
const serviceRefunded = backendPayment?.refunded === true;
|
|
899
|
+
const refundedSats = serviceRefunded ? Number(backendPayment?.refund_sats ?? result.amountPaid ?? 0) : 0;
|
|
900
|
+
const targetSuccess = result.statusCode >= 200 && result.statusCode < 300 && !serviceRefunded;
|
|
901
|
+
const message = serviceRefunded
|
|
902
|
+
? `The endpoint failed after payment; the wallet refunded ${refundedSats} sats`
|
|
903
|
+
: targetSuccess
|
|
904
|
+
? (result.amountPaid ? `Request completed with payment of ${result.amountPaid} sats` : 'Request completed (no payment required)')
|
|
905
|
+
: `Target returned HTTP ${result.statusCode}`;
|
|
898
906
|
const responseData = {
|
|
899
907
|
success: targetSuccess,
|
|
900
908
|
message,
|
|
901
909
|
status_code: result.statusCode,
|
|
902
910
|
data: result.data,
|
|
903
911
|
payment_hash: result.paymentHash,
|
|
904
|
-
amount_paid: result.amountPaid,
|
|
912
|
+
amount_paid: serviceRefunded ? 0 : result.amountPaid,
|
|
913
|
+
...(serviceRefunded ? { refunded_sats: refundedSats } : {}),
|
|
905
914
|
fee: result.fee,
|
|
906
915
|
};
|
|
907
916
|
if (result.paymentProtocol) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lightning-wallet-mcp",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"mcpName": "io.github.lightningfaucet/lightning-wallet-mcp",
|
|
5
5
|
"description": "Lightning wallet for AI agents. MCP server + CLI. Works with Claude Code, OpenClaw, Cursor, and any agent framework.",
|
|
6
6
|
"main": "dist/index.js",
|