/** * Utility functions for Wagmi event handling * * Provides ABI encoding utilities for extracting transaction data from * writeContract mutations without requiring viem as a direct dependency. */ /** * Flatten a nested object into a flat object with underscore-separated keys. * Only leaf values (primitives) are included; intermediate objects are not. * * Example: * Input: { o: { x: "100", inner: { a: "42", b: "0xRecipient" } } } * Output: { o_x: "100", o_inner_a: "42", o_inner_b: "0xRecipient" } * * @param obj - The object to flatten * @param prefix - Optional prefix for keys (used in recursion) * @returns A flat object with underscore-separated keys */ export declare function flattenObject(obj: Record, prefix?: string): Record; /** * ABI function item type */ export interface AbiItem { type: string; name?: string; inputs?: AbiInput[]; outputs?: AbiOutput[]; stateMutability?: string; } export interface AbiInput { name: string; type: string; indexed?: boolean; components?: AbiInput[]; internalType?: string; } export interface AbiOutput { name: string; type: string; components?: AbiOutput[]; internalType?: string; } /** * Concatenate encoded calldata with an optional ERC-8021 dataSuffix (e.g. builder codes). * Uses viem's concatHex when available for correct hex handling. */ export declare function concatCalldataWithSuffix(encodedData: string, dataSuffix: string | undefined): string; /** * Encode writeContract data using viem's encodeFunctionData * * @param abi - The contract ABI * @param functionName - The function name to encode * @param args - The function arguments * @returns The encoded calldata or undefined if encoding fails */ export declare function encodeWriteContractData(abi: AbiItem[], functionName: string, args?: unknown[]): string | undefined; /** * Extract function arguments as a name-value map from ABI and args array * * @param abi - The contract ABI * @param functionName - The function name * @param args - The function arguments array * @returns A map of argument names to values, or undefined if extraction fails */ export declare function extractFunctionArgs(abi: AbiItem[], functionName: string, args?: unknown[]): Record | undefined; /** * Build safe function args with collision handling and struct flattening. * * This function: * 1. Prefixes top-level args that collide with reserved fields (e.g., 'to' -> 'arg_to') * 2. Flattens nested struct values for easier querying (e.g., order.maker -> order_maker) * 3. Skips flattened keys that would collide with existing top-level args * * @param functionArgs - The extracted function arguments * @param reservedFields - Set of reserved field names that need prefixing * @returns Safe function args object, or undefined if input is undefined */ export declare function buildSafeFunctionArgs(functionArgs: Record | undefined, reservedFields: Set): Record | undefined; //# sourceMappingURL=utils.d.ts.map