import { type AuditWriter } from '../audit/index.js'; import type { ConfirmGate } from '../confirm/index.js'; import { type PolicyResolver, type SpendLedger } from '../policy/index.js'; import { type HandleTable } from './handles.js'; export declare const RPC_INVALID_PARAMS = -32602; export declare const RPC_METHOD_NOT_FOUND = -32601; export declare const RPC_PORTAL_NOT_FOUND = -32000; export declare const RPC_POLICY_DENIED = -32001; export declare const RPC_INVALID_PAYLOAD = -32002; export declare const RPC_DAEMON_LOCKED = -32003; export declare class RpcMethodError extends Error { readonly code: number; readonly data: unknown; constructor(code: number, message: string, data?: unknown); } export interface MethodContext { handles: HandleTable; audit: AuditWriter; /** * Resolves the per-portal policy at evaluation time. Wrapped in an * interface so tests can inject a constant policy without touching the * filesystem. */ policy: PolicyResolver; /** * Out-of-band confirm gate. Optional: only consulted when the policy * evaluator returns a `confirm` decision (today, only sign_transaction * can trigger this). When undefined, a confirm decision becomes a hard * deny — fail closed. */ confirm?: ConfirmGate; /** * Per-portal spend ledger backing the rolling-window value caps * (max_value_per_hour_wei etc.). Optional so tests can omit it; a policy * that sets a window cap while no ledger is configured is a hard deny — * fail closed, never silently uncapped. */ ledger?: SpendLedger; } export type MethodHandler = (params: unknown, ctx: MethodContext) => unknown | Promise; export declare const METHODS: Readonly>; /** * Dispatch a parsed RPC request to the matching method. Always async — even * for handlers that are synchronous — so callers can await uniformly. * * Throws RpcMethodError on user errors or method-not-found, or other Error * for unexpected internals. */ export declare function dispatch(method: string, params: unknown, ctx: MethodContext): Promise; //# sourceMappingURL=methods.d.ts.map