/** * Hex and byte utilities used throughout the SDK. * @remarks * - All normalized hex strings are returned as lowercase with a `0x` prefix. * - Odd-length hex is left-padded with a `0` nibble (e.g. `0xabc` -> `0x0abc`). * - The input prefix `0X` is accepted and normalized to `0x`. */ export type HexLike = string | number | bigint | Uint8Array | { toHexString(): string; } | { _hex: string; }; export declare function bytesToHex(bytes: Uint8Array): string; /** * Normalize an input into a lowercase `0x`-prefixed hex string. * @param value - Hex-like input (string/number/bigint/bytes or ethers-like objects). * @throws If the input is unsupported or invalid (e.g. empty string, non-integer number). */ export declare function normalizeHex(value: HexLike): string; /** * Convert a hex string into bytes. * @remarks The input is normalized before decoding. */ export declare function hexToBytes(value: string): Uint8Array; /** * Ensure a value is a hex string of the expected byte length. * @param value - Hex-like input to validate. * @param expectedBytes - Expected length in bytes. * @param label - Used in error messages. * @throws If the decoded byte length does not match `expectedBytes`. */ export declare function ensureHexLength(value: HexLike, expectedBytes: number, label: string): string; /** * Convert an EVM address string into bytes (20 bytes). * @throws If the address is not exactly 20 bytes. */ export declare function addressToBytes(address: string): Uint8Array; /** * Generate cryptographically secure random bytes. * @throws If secure randomness is not available (missing global `crypto.getRandomValues`). */ export declare function randomBytes(length: number): Uint8Array; /** * Convert a bigint-like value into bigint. * @remarks * - For numbers, only integers are accepted. * - For strings, both decimal and `0x`/`0X`-prefixed hex are accepted. */ export declare function toBigInt(value: number | string | bigint): bigint; /** * Check whether a value is a valid hex string (strictly lowercase `0x`-prefixed). * Matches viem's strict `isHex` behavior — `"0X..."` is rejected. * @internal */ export declare function isHex(value: unknown): value is `0x${string}`; /** * Compute the Keccak-256 hash. * @internal Wraps viem's keccak256 so callers don't import viem directly. */ export declare function keccak256(value: Uint8Array | `0x${string}`): `0x${string}`; //# sourceMappingURL=hex.d.ts.map