/**
 * Typed argument coercion for the generic `submitContractCall` action.
 *
 * Problem: a
 * compiled Compact circuit guards a `Bytes<N>` parameter strictly as a real
 * `Uint8Array(N)` (`.buffer instanceof ArrayBuffer && BYTES_PER_ELEMENT === 1
 * && length === N`). The public `submitContractCall` takes `args` as a JSON
 * string, and JSON cannot carry a `Uint8Array` — so a hex string or a
 * `number[]` both fail the guard, and the only circuits callable generically
 * were the JSON-native ones (numbers/bools). The built-in actions
 * (`anchorDocument` etc.) dodged this by hex-decoding internally before the
 * submitter; that conversion was unreachable through the generic action.
 *
 * This module bridges the gap: between `JSON.parse(args)` in the handler and
 * the worker's `fn(...callArgs)`, each arg is coerced to the value shape the
 * circuit actually expects. Coerced `Uint8Array` / `BigInt` values survive the
 * worker's structured-clone boundary (postMessage, NOT JSON), so the submitter
 * and worker need no changes.
 *
 * Two encodings are supported, tag-wins-then-introspect:
 *   - Tagged (always honored, no metadata needed):
 *       { "$bytes": "<hex>" }  → Uint8Array
 *       { "$uint":  "<dec>" | 123 } → BigInt
 *   - Untagged + introspected: the circuit's declared param types are read from
 *     the compiled artifact's `contract-info.json`; a hex string / number[] is
 *     coerced to Bytes<N> (exact-length checked), a number / decimal-string to
 *     BigInt for Uint<N>. A param of an unhandled Compact type (Vector, struct,
 *     Field, …) passes through unchanged.
 *   - Untagged + no metadata for the argument: rejected with a clear 400. We
 *     do NOT silently pass it through — that would reproduce the deep
 *     circuit-type failure this layer exists to prevent. The caller fixes it by
 *     tagging the value or correcting the registered artifact path.
 */
/** A single circuit parameter's type, distilled from contract-info.json. */
export interface CircuitArgType {
    name: string;
    kind: 'Bytes' | 'Uint' | 'Boolean' | 'other';
    /** Byte length for Bytes<N>. */
    length?: number;
    /** Upper bound for Uint<N> (omitted when the compiler's value exceeds JS safe-integer range). */
    maxval?: number;
}
/**
 * Bad-input error for a single argument. Carries the arg index so the handler
 * can surface a clear 400 ("args[1]: …") rather than letting a value reach the
 * circuit and fail deep inside the compiled runtime's type guard.
 */
export declare class CoercionError extends Error {
    readonly index: number;
    constructor(index: number, reason: string);
}
/**
 * Coerce a parsed `args` array against the circuit's declared parameter types.
 * `argTypes` may be undefined (no introspection) — tagged values still work and
 * everything else passes through unchanged.
 */
export declare function coerceCircuitArgs(rawArgs: unknown[], argTypes?: CircuitArgType[]): unknown[];
/**
 * Resolve the declared parameter types for `circuit` from the compiled
 * artifact at `zkConfigPath` (reads `<zkConfigPath>/compiler/contract-info.json`).
 * Returns undefined when the metadata or the circuit entry is unavailable —
 * coercion then falls back to tagged-values-only / passthrough.
 */
export declare function loadCircuitArgTypes(zkConfigPath: string, circuit: string): CircuitArgType[] | undefined;
/** Test-only: clear the contract-info parse cache. */
export declare function clearArgTypeCache(): void;
