stringToHex

Converts a string to its hexadecimal representation.

Example

import { stringToHex } from "thirdweb/utils";
const hex = stringToHex("Hello, world!");
console.log(hex); // "0x48656c6c6f2c20776f726c6421"
function stringToHex(value_: string, opts: StringToHexOpts): Hex;

Parameters

The string to convert to hexadecimal.

Type

let value_: string;

Options for the conversion.

Type

let opts: { size?: number };

Returns

let returnType: `0x${string}`;

The hexadecimal representation of the input string.