import { address, bool, bytes, fn, number, Parser, string, tuple } from '../parsers'; declare type BytesType = `bytes` | `bytes${number}`; declare type IntegerType = `int` | `int${number}` | `uint` | `uint${number}`; declare type TupleType = `(${string})`; /** * Infer the type of `Parser`. This results in an object containing the `input` * and `output` types of the parser. */ declare type ParserType = Type extends Parser ? { input: I; output: O; } : never; /** * Map the `input` and `output` types of a parser to an array of types. */ declare type ArrayParserType = Type extends { input: infer I; output: infer O; } ? { input: I[]; output: O[]; } : never; /** * "Simple" types, i.e., types that are not arrays. */ declare type SimpleType = Record> & Record> & Record> & { address: ParserType; bool: ParserType; function: ParserType; string: ParserType; }; /** * Dynamic array types, i.e., types that are arrays without a fixed length. */ declare type DynamicArray = { [Key in keyof SimpleType as `${Key}[]`]: ArrayParserType; }; /** * Fixed array types, i.e., types that are arrays with a fixed length. */ declare type FixedArray = { [Key in keyof SimpleType as `${Key}[${number}]`]: ArrayParserType; }; /** * All simple ABI types, and some basic array types. This does not include * nested arrays or tuples. Those are supported by the library, but the types * for those are not included here, and will result in `unknown` types. * * @see https://docs.soliditylang.org/en/v0.8.17/abi-spec.html#types */ export declare type Type = SimpleType & DynamicArray & FixedArray; /** * Map an array of types to an array of their `input` or `output` types. * * Refer to {@link Type} to see which types are supported. * * @example * ```typescript * type OutputTypes = Map<[`uint256`, `bytes[]`, `string[2]`], 'output'>; * // Results in: [bigint, Uint8Array[], string[]] * ``` */ export declare type TypeMap = { [Key in keyof Input]: Input[Key] extends keyof Type ? Type[Input[Key]][IO] : unknown; }; export {};