padHex

Pads a hexadecimal string with zeros to a specified size.

Example

import { padHex } from "thirdweb/utils";
const paddedHex = padHex("0x1a4", { size: 32 });
console.log(paddedHex); // "0x000000000000000000000000000001a4"
function padHex(
hex_: `0x${string}`,
options: PadOptions,
): `0x${string}`;

Parameters

The hexadecimal string to pad.

Type

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

The padding options.

Type

let options: PadOptions;

Returns

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

The padded hexadecimal string.