- decodeSingle<Type>(type: Type, value: Uint8Array | `0x${string}`): 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]["output"] : unknown
-
Parameters
-
type: Type
-
value: Uint8Array | `0x${string}`
Returns 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]["output"] : unknown
Decode the data with the provided type. The type must be a valid Solidity ABI type.
See decode for more information on how values are parsed.
Example
See
https://docs.soliditylang.org/en/v0.8.17/abi-spec.html#types
Returns
The decoded value.