Encodes the given ABI parameters and values into a hexadecimal string.
import { encodeAbiParameters } from "viem"; const params = [ { name: "param1", type: "uint256" }, { name: "param2", type: "string" },];const values = [123, "hello"]; const data = encodeAbiParameters(params, values);console.log(data);
function encodeAbiParameters(params: TParams, values: TParams extends readonly Array<AbiParameter> ? {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType<TParams<TParams>[key<key>], AbiParameterKind>}[key]} : never) : Hex
The ABI parameters.
let params: TParams;
The corresponding values for the ABI parameters.
let values: TParams extends readonly Array<AbiParameter> ? {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType<TParams<TParams>[key<key>], AbiParameterKind>}[key]} : never
let returnType: `0x${string}`;
The encoded ABI parameters as a hexadecimal string.