import * as abitype from 'abitype'; import type * as Errors from './Errors.js'; import type * as AbiItem_internal from './internal/abiItem.js'; import * as formatAbi from './internal/human-readable/formatAbi.js'; import * as parseAbi from './internal/human-readable/parseAbi.js'; /** Root type for an ABI. */ export type Abi = abitype.Abi; export { InvalidSignatureError, InvalidStructSignatureError, UnknownSignatureError, } from './internal/human-readable/errors.js'; export { CircularReferenceError } from './internal/human-readable/errors.js'; /** @internal */ export declare function format(abi: abi): format.ReturnType; /** * Formats an {@link ox#Abi.Abi} into a **Human Readable ABI**. * * @example * ```ts twoslash * import { Abi } from 'ox' * * const formatted = Abi.format([ * { * type: 'function', * name: 'approve', * stateMutability: 'nonpayable', * inputs: [ * { * name: 'spender', * type: 'address' * }, * { * name: 'amount', * type: 'uint256' * } * ], * outputs: [{ type: 'bool' }] * } * ]) * * formatted * // ^? * ``` * * @param abi - The ABI to format. * @returns The formatted ABI. */ export declare function format(abi: Abi | readonly unknown[]): readonly string[]; export declare namespace format { type ReturnType = formatAbi.FormatAbi; type ErrorType = Errors.GlobalErrorType; } /** @internal */ export declare function from(abi: abi & (abi extends readonly string[] ? AbiItem_internal.Signatures : unknown)): from.ReturnType; /** * Parses an arbitrary **JSON ABI** or **Human Readable ABI** into a typed {@link ox#Abi.Abi}. * * @example * ### JSON ABIs * * ```ts twoslash * import { Abi } from 'ox' * * const abi = Abi.from([ * { * type: 'function', * name: 'approve', * stateMutability: 'nonpayable', * inputs: [ * { * name: 'spender', * type: 'address' * }, * { * name: 'amount', * type: 'uint256' * } * ], * outputs: [{ type: 'bool' }] * } * ]) * * abi * //^? * ``` * * @example * ### Human Readable ABIs * * ```ts twoslash * import { Abi } from 'ox' * * const abi = Abi.from([ * 'function approve(address spender, uint256 amount) returns (bool)' * ]) * * abi * //^? * ``` * * @param abi - The ABI to parse. * @returns The typed ABI. */ export declare function from(abi: Abi | readonly string[]): Abi; export declare namespace from { type ReturnType = abi extends readonly string[] ? parseAbi.ParseAbi : abi; type ErrorType = Errors.GlobalErrorType; } //# sourceMappingURL=Abi.d.ts.map