import type { AbiParameter, AbiParameterToPrimitiveType, AbiType, ParseAbiParameter } from 'abitype'; import { type IsAddressErrorType } from '../address/isAddress.js'; import { type ConcatErrorType } from '../data/concat.js'; import { type PadHexErrorType } from '../data/pad.js'; import { type SizeErrorType } from '../data/size.js'; import { type SliceErrorType } from '../data/slice.js'; import { type BoolToHexErrorType, type NumberToHexErrorType, type StringToHexErrorType } from '../encoding/toHex.js'; import { type AbiEncodingArrayLengthMismatchErrorType, type AbiEncodingBytesSizeMismatchErrorType, type AbiEncodingLengthMismatchErrorType, type InvalidAbiEncodingTypeErrorType, type InvalidArrayErrorType } from '../errors/abi.js'; import { type InvalidAddressErrorType } from '../errors/address.js'; import type { ErrorType } from '../errors/utils.js'; import type { Hex } from '../types/data.js'; import type { Prettify } from '../types/utils.js'; /** @internal */ export type IsomorphicAbiParameter = AbiParameter | AbiType | (string & {}); /** @internal */ export type IsomorphicAbiParametersToPrimitiveTypes = Prettify<{ [key in keyof types]: types[key] extends AbiParameter ? AbiParameterToPrimitiveType : types[key] extends AbiType ? AbiParameterToPrimitiveType<{ type: types[key]; }> : types[key] extends string | readonly string[] | readonly unknown[] ? AbiParameterToPrimitiveType> : never; }>; export type EncodeAbiParametersReturnType = Hex; export type EncodeAbiParametersErrorType = AbiEncodingLengthMismatchErrorType | PrepareParametersErrorType | EncodeParametersErrorType | ErrorType; /** * @description Encodes a list of primitive values into an ABI-encoded hex value. * * - Docs: https://viem.sh/docs/abi/encodeAbiParameters#encodeabiparameters * * Generates ABI encoded data using the [ABI specification](https://docs.soliditylang.org/en/latest/abi-spec), given a set of ABI parameters (inputs/outputs) and their corresponding values. * * @parameter parameters - a set of ABI Parameters (parameters), that can be in the shape of the inputs or outputs attribute of an ABI Item. * @parameter values - a set of values (values) that correspond to the given parameters. * @example * ```typescript * import { Abi } from 'viem' * * const encodedData = Abi.encode( * [{ type: 'string' }, { type: 'uint' }, { type: 'bool' }], * ['wagmi', 420n, true] * ) * ``` * * You can also pass in Human Readable parameters with the `Abi.parse` utility. * * @example * ```typescript * import { Abi } from 'viem' * * const encodedData = Abi.encode( * Abi.parse('string x, uint y, bool z'), * ['wagmi', 420n, true] * ) * ``` */ export declare function encodeAbiParameters(parameters: parameters, values: parameters extends readonly IsomorphicAbiParameter[] ? IsomorphicAbiParametersToPrimitiveTypes : never): EncodeAbiParametersReturnType; type PrepareParametersErrorType = PrepareParameterErrorType | ErrorType; type PrepareParameterErrorType = EncodeAddressErrorType | EncodeArrayErrorType | EncodeBytesErrorType | EncodeBoolErrorType | EncodeNumberErrorType | EncodeStringErrorType | EncodeTupleErrorType | GetArrayComponentsErrorType | InvalidAbiEncodingTypeErrorType | ErrorType; type EncodeParametersErrorType = NumberToHexErrorType | SizeErrorType | ErrorType; type EncodeAddressErrorType = InvalidAddressErrorType | IsAddressErrorType | ErrorType; type EncodeArrayErrorType = AbiEncodingArrayLengthMismatchErrorType | ConcatErrorType | EncodeParametersErrorType | InvalidArrayErrorType | NumberToHexErrorType | ErrorType; type EncodeBytesErrorType = AbiEncodingBytesSizeMismatchErrorType | ConcatErrorType | PadHexErrorType | NumberToHexErrorType | SizeErrorType | ErrorType; type EncodeBoolErrorType = PadHexErrorType | BoolToHexErrorType | ErrorType; type EncodeNumberErrorType = NumberToHexErrorType | ErrorType; type EncodeStringErrorType = ConcatErrorType | NumberToHexErrorType | PadHexErrorType | SizeErrorType | SliceErrorType | StringToHexErrorType | ErrorType; type EncodeTupleErrorType = ConcatErrorType | EncodeParametersErrorType | ErrorType; type GetArrayComponentsErrorType = ErrorType; export declare function getArrayComponents(type: string): [length: number | null, innerType: string] | undefined; export {}; //# sourceMappingURL=encode.d.ts.map