- encodeSingle<Type>(type: Type, value: Type extends "string" | "function" | "address" | "bytes[]" | "address[]" | "string[]" | "int[]" | "uint[]" | "bool" | "bool[]" | BytesType | IntegerType | `(${string})` | "function[]" | `bytes${number}[]` | `int${number}[]` | `uint${number}[]` | `(${string})[]` | `bytes[${number}]` | `int[${number}]` | `uint[${number}]` | `address[${number}]` | `bool[${number}]` | `function[${number}]` | `string[${number}]` | `bytes${number}[${number}]` | `int${number}[${number}]` | `uint${number}[${number}]` | `(${string})[${number}]` ? Type[Type]["input"] : unknown): Uint8Array
-
Parameters
-
type: Type
-
value: Type extends "string" | "function" | "address" | "bytes[]" | "address[]" | "string[]" | "int[]" | "uint[]" | "bool" | "bool[]" | BytesType | IntegerType | `(${string})` | "function[]" | `bytes${number}[]` | `int${number}[]` | `uint${number}[]` | `(${string})[]` | `bytes[${number}]` | `int[${number}]` | `uint[${number}]` | `address[${number}]` | `bool[${number}]` | `function[${number}]` | `string[${number}]` | `bytes${number}[${number}]` | `int${number}[${number}]` | `uint${number}[${number}]` | `(${string})[${number}]` ? Type[Type]["input"] : unknown
Returns Uint8Array
Encode the data with the provided type. The type must be a valid Solidity ABI type.
See encode for more information on how values are parsed.
Example
See
https://docs.soliditylang.org/en/v0.8.17/abi-spec.html#types
Returns
The ABI encoded bytes.