/** * @fileoverview Shared /local preflight helpers. * * The v0.2 read-only tools (`read_table`, `keys`, `principal_namespace`) and * the write tools (`deploy_module`, `continue_pact`) all funnel through * `/local?preflight=true`. This module encapsulates the path construction, * response unwrapping, and error-shape sanitization so each tool remains * a thin wrapper over a consistent core. */ import type { ChainwebClient } from './fetch.js'; import { type PactValue } from './unwrap.js'; export interface PreflightResponse { status: 'success' | 'failure'; /** Unwrapped success data, or unwrapped+sanitized error shape. */ result: PactValue; gasUsed: number; logs: PactValue; } /** * Build the `/local` URL with the standard MVP query params. * `signatureVerification=false` is the correct default for unsigned * read-only probes; signed `/send` callers must pass `true` explicitly. */ export declare function buildLocalPath(networkId: string, chainId: string, opts?: { preflight?: boolean; signatureVerification?: boolean; }): string; /** * POST a prepared transaction (signed or unsigned) to `/local`, * unwrap the Pact value tree, and surface failures through the standard * {@link sanitizeToolOutput} chain. Does NOT throw on Pact-level failures; * the caller inspects `response.status`. */ export declare function runLocalPreflight(client: ChainwebClient, chainId: string, tx: unknown, opts?: { preflight?: boolean; signatureVerification?: boolean; }): Promise; /** * Walk a Pact-value tree and run every string through the * injection-marker sanitizer. Chainweb node error strings can echo * user-submitted tx data — attacker-controllable. */ export declare function sanitizeErrorShape(v: PactValue): PactValue; /** * Extract a short, sanitized human string from a preflight * failure's `result` field for error messages. */ export declare function extractErrorMessage(result: PactValue): string; //# sourceMappingURL=preflight.d.ts.map