Converts a hexadecimal string to the specified type.
import { fromHex } from "thirdweb/utils";const string = fromHex("0x48656c6c6f2c20776f726c6421", "string");console.log(string); // "Hello, world!"
function fromHex< TTo extends "string" | "number" | "bigint" | "boolean" | "bytes",>( hex: `0x${string}`, toOrOpts: FromHexParameters<TTo>,): FromHexReturnType<TTo>;
The hexadecimal string to convert.
let hex: `0x${string}`;
The target type or conversion options.
let toOrOpts: FromHexParameters<TTo>;
let returnType: FromHexReturnType<TTo>;
The converted value of the specified type.