/** Just enough of fetch for a JSON-RPC POST. Injectable for tests. */ export type RpcFetchLike = (url: string, init: { method: 'POST'; headers: Record; body: string; signal?: AbortSignal; }) => Promise<{ ok: boolean; status: number; json(): Promise; }>; /** * Minimal JSON-RPC 2.0 client for the upstream node the signing proxy * forwards to. Deliberately tiny: one method, no batching, no subscriptions — * the proxy re-issues each client request individually so nothing but a * `{method, params}` pair we constructed ourselves ever reaches the upstream * (no header or field smuggling from the proxy's clients). */ export interface JsonRpcUpstream { call(method: string, params: readonly unknown[]): Promise; } /** * The upstream node answered with a JSON-RPC error object. Carries the * node's code/message/data so the proxy can hand them back to its own client * verbatim (forge's revert decoding depends on `data` surviving the trip). */ export declare class UpstreamRpcError extends Error { readonly code: number; readonly data: unknown; constructor(code: number, message: string, data?: unknown); } /** Transport-level failure: unreachable, HTTP non-200, timeout, bad JSON. */ export declare class UpstreamTransportError extends Error { readonly cause?: unknown; constructor(message: string, cause?: unknown); } export interface HttpUpstreamOpts { /** Per-call timeout. Default 30s — covers slow public RPC endpoints. */ timeoutMs?: number; /** Injectable for tests. Default: global fetch. */ fetchImpl?: RpcFetchLike; } export declare class HttpUpstream implements JsonRpcUpstream { #private; constructor(url: string, opts?: HttpUpstreamOpts); call(method: string, params: readonly unknown[]): Promise; } //# sourceMappingURL=upstream.d.ts.map