run402-mcp
Version:
MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.
50 lines • 2.11 kB
TypeScript
/**
* The agent's Lightning wallet over Nostr Wallet Connect (NIP-47): the
* budgeted sub-wallet Run402 minted on its Hub (`run402 init lightning`), or
* any wallet the agent pairs. The protocol (pairing URIs, NIP-44 v2, signed
* events, the relay connection) is `@run402/nwc`; this module adds the wallet
* verbs the Lightning rail needs. The pairing URI carries the client's secret
* key: nothing here logs or returns it.
*
* Node ≥ 22 (global `WebSocket`).
*/
import { type NwcTransport } from "@run402/nwc";
export { NWC_TRANSPORT_ERROR_CODES, NwcError, parseNwcUri, type NwcConnection, type NwcTransport } from "@run402/nwc";
/** Nostr wire time: unix seconds (the protocol's own field name). */
export type UnixSeconds = number;
/** Closes every standing relay connection (process exit, tests). */
export declare function closeNwcConnections(): void;
/** The agent-side wallet verbs the Lightning rail needs. Amounts are in sats. */
export declare class NwcWallet {
private readonly options;
private readonly connection;
constructor(pairingUri: string, options?: {
timeoutMs?: number;
transport?: NwcTransport;
});
private call;
/** The node behind the pairing: its network name, pubkey, and permitted methods. */
getInfo(): Promise<{
network: string | null;
pubkey: string | null;
methods: string[];
}>;
getBalanceSats(): Promise<number>;
/** Remaining budget in sats, or null when the wallet has no budget. */
getBudgetSats(): Promise<{
usedSats: number;
totalSats: number | null;
renewsAtSeconds: UnixSeconds | null;
} | null>;
/** Pays a BOLT11 invoice; returns the preimage (hex) the wallet reports. */
payInvoice(bolt11: string): Promise<{
preimage: string;
feesPaidMsat: number | null;
}>;
/** Looks an invoice up by payment hash; a settled outgoing payment carries its preimage. */
lookupInvoice(paymentHash: string): Promise<{
state: string | null;
preimage: string | null;
} | null>;
}
//# sourceMappingURL=nwc.d.ts.map