lightning-wallet-mcp 1.5.2 → 1.5.3
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/dist/index.js +9 -3
- package/dist/lightning-faucet.d.ts +10 -0
- package/dist/lightning-faucet.js +31 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -581,7 +581,7 @@ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
|
581
581
|
// ==========================================
|
|
582
582
|
{
|
|
583
583
|
name: 'get_info',
|
|
584
|
-
description: 'Get service information including version, status, limits, and supported features.',
|
|
584
|
+
description: 'Get service information including version, status, limits, and supported features. No API key required — works before registering.',
|
|
585
585
|
inputSchema: {
|
|
586
586
|
type: 'object',
|
|
587
587
|
properties: {},
|
|
@@ -590,7 +590,7 @@ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
|
590
590
|
},
|
|
591
591
|
{
|
|
592
592
|
name: 'decode_invoice',
|
|
593
|
-
description: 'Decode a BOLT11 invoice without paying it. Returns amount, description, expiry, and destination.',
|
|
593
|
+
description: 'Decode a BOLT11 invoice without paying it. Returns amount, description, expiry, and destination. No API key required — works before registering.',
|
|
594
594
|
inputSchema: {
|
|
595
595
|
type: 'object',
|
|
596
596
|
properties: {
|
|
@@ -1353,7 +1353,13 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
case 'decode_invoice': {
|
|
1355
1355
|
const parsed = DecodeInvoiceSchema.parse(args ?? {});
|
|
1356
|
-
|
|
1356
|
+
// Invoice decoding is a public endpoint — fall back to an
|
|
1357
|
+
// unauthenticated request so agents can inspect invoices before
|
|
1358
|
+
// registering / configuring a key.
|
|
1359
|
+
const decodeClient = session.getClient();
|
|
1360
|
+
const result = decodeClient
|
|
1361
|
+
? await decodeClient.decodeInvoice(parsed.bolt11)
|
|
1362
|
+
: await (0, lightning_faucet_js_1.getPublicDecodedInvoice)(parsed.bolt11);
|
|
1357
1363
|
return {
|
|
1358
1364
|
content: [
|
|
1359
1365
|
{
|
|
@@ -566,4 +566,14 @@ export declare function getPublicInfo(): Promise<{
|
|
|
566
566
|
supportedFeatures: string[];
|
|
567
567
|
rawResponse: ApiResponse;
|
|
568
568
|
}>;
|
|
569
|
+
export declare function getPublicDecodedInvoice(bolt11: string): Promise<{
|
|
570
|
+
amountSats: number;
|
|
571
|
+
description: string;
|
|
572
|
+
paymentHash: string;
|
|
573
|
+
destination: string;
|
|
574
|
+
expiresAt: string;
|
|
575
|
+
isExpired: boolean;
|
|
576
|
+
createdAt?: string;
|
|
577
|
+
rawResponse: ApiResponse;
|
|
578
|
+
}>;
|
|
569
579
|
export {};
|
package/dist/lightning-faucet.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.LightningFaucetClient = void 0;
|
|
9
9
|
exports.registerOperator = registerOperator;
|
|
10
10
|
exports.getPublicInfo = getPublicInfo;
|
|
11
|
+
exports.getPublicDecodedInvoice = getPublicDecodedInvoice;
|
|
11
12
|
const pre_payment_hook_js_1 = require("./pre-payment-hook.js");
|
|
12
13
|
const bolt11_js_1 = require("./bolt11.js");
|
|
13
14
|
const API_BASE_URL = process.env.LIGHTNING_WALLET_API_URL || 'https://lightningfaucet.com/ai-agents/api';
|
|
@@ -953,3 +954,33 @@ async function getPublicInfo() {
|
|
|
953
954
|
rawResponse: result,
|
|
954
955
|
};
|
|
955
956
|
}
|
|
957
|
+
// Public invoice decode (no API key needed — the backend just parses the invoice)
|
|
958
|
+
async function getPublicDecodedInvoice(bolt11) {
|
|
959
|
+
const response = await fetch(API_BASE_URL, {
|
|
960
|
+
method: 'POST',
|
|
961
|
+
headers: { 'Content-Type': 'application/json' },
|
|
962
|
+
body: JSON.stringify({ action: 'decode_invoice', invoice: bolt11 }),
|
|
963
|
+
});
|
|
964
|
+
if (!response.ok) {
|
|
965
|
+
throw new Error(`Request failed (HTTP ${response.status})`);
|
|
966
|
+
}
|
|
967
|
+
const result = (await response.json());
|
|
968
|
+
if (!result.success) {
|
|
969
|
+
throw new Error(result.error || 'Unknown API error');
|
|
970
|
+
}
|
|
971
|
+
const amountSats = result.amount_sats || parseInt(result.num_satoshis || '0', 10);
|
|
972
|
+
const timestamp = result.timestamp ? parseInt(result.timestamp, 10) : 0;
|
|
973
|
+
const expiry = result.expiry ? parseInt(result.expiry, 10) : 3600;
|
|
974
|
+
const expiresAt = result.expires_at || new Date((timestamp + expiry) * 1000).toISOString();
|
|
975
|
+
const isExpired = result.is_expired ?? (timestamp + expiry < Date.now() / 1000);
|
|
976
|
+
return {
|
|
977
|
+
amountSats,
|
|
978
|
+
description: result.description || '',
|
|
979
|
+
paymentHash: result.payment_hash || '',
|
|
980
|
+
destination: result.destination || '',
|
|
981
|
+
expiresAt,
|
|
982
|
+
isExpired,
|
|
983
|
+
createdAt: timestamp ? new Date(timestamp * 1000).toISOString() : undefined,
|
|
984
|
+
rawResponse: result,
|
|
985
|
+
};
|
|
986
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lightning-wallet-mcp",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
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",
|