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.
61 lines • 2.76 kB
TypeScript
/**
* The agent's Lightning wallet on the local machine: mint the budgeted wallet
* on Run402's Hub, keep its pairing in the active profile's `wallet.json`
* beside the Base key, report its balance, revoke it. Shared by `r.init`
* (`run402 init lightning`) and `run402 wallets lightning …`. The pairing
* secret is never returned by anything here.
*/
import { type WalletData } from "../../core-dist/wallet.js";
import type { AgentLightningWallet } from "../namespaces/agent.types.js";
export declare const LIGHTNING_MINT_TIMEOUT_MS = 45000;
type LightningAgent = {
lightningWallet: {
mint(opts?: {
timeoutMs?: number;
}): Promise<AgentLightningWallet>;
get(): Promise<AgentLightningWallet>;
revoke(): Promise<unknown>;
};
};
export interface LightningBalance {
balance_sats: number;
budget_remaining_sats: number | null;
}
export interface LightningDescription {
wallet_id: string | null;
status: string | null;
custody: "run402_hub";
custody_note: string;
lightning_address: string | null;
budget_sats: number | null;
starter_sats: number | null;
has_pairing: boolean;
minted_at: string | null;
balance_sats?: number;
budget_remaining_sats?: number | null;
}
export type LightningOutcome = "stored" | "present" | "minting" | "unavailable" | "pairing_lost" | string;
export interface EnsureLightningResult {
localWallet: WalletData;
wallet: AgentLightningWallet | null;
outcome: LightningOutcome;
error?: unknown;
}
/** Public facts only: never the pairing. */
export declare function describeLightning(localWallet: WalletData | null | undefined, wallet?: Partial<AgentLightningWallet> | null, balance?: LightningBalance | null): LightningDescription | null;
/** Balance and remaining budget over NWC, best-effort (null on any failure). */
export declare function readLightningBalance(localWallet: WalletData | null | undefined): Promise<LightningBalance | null>;
/**
* Ensure the active profile holds an active Lightning wallet. `outcome` is
* `stored` (pairing just saved), `present` (already held locally), `minting`
* (the platform is still minting; rerun later), `unavailable` (no Hub on this
* gateway), `pairing_lost` (active, but its one-time pairing went to another
* machine: revoke and mint again), or the wallet's own non-active status.
*/
export declare function ensureLightningWallet(agent: LightningAgent, options?: {
timeoutMs?: number;
}): Promise<EnsureLightningResult>;
/** Revoke on the platform and forget the pairing locally; the rail returns to x402. */
export declare function revokeLightningWallet(agent: LightningAgent): Promise<unknown>;
export {};
//# sourceMappingURL=lightning-wallet.d.ts.map