UNPKG

ox

Version:

Ethereum Standard Library

40 lines 1.5 kB
import * as Errors from '../../Errors.js'; /** @internal */ export type Hex = `0x${string}`; /** * Encodes a `Uint8Array` into a `0x`-prefixed lowercase hex string. Uses the * native `Uint8Array.prototype.toHex` (Node 22+, Safari 18+, Firefox 133+) or * Node's `Buffer` when available; otherwise a tight JS loop. * * @internal */ export declare function bytesToHex(value: Uint8Array): Hex; /** * Strictly decodes a `0x`-prefixed even-length hex string into a `Uint8Array`. * Uses the native `Uint8Array.fromHex` (Node 22+, Safari 18+, Firefox 133+) or * Node's `Buffer` when available; otherwise a tight JS loop. * * @internal */ export declare function hexToBytes(value: string): Uint8Array; /** @internal */ export declare function charCodeToBase16(char: number): number | undefined; /** Thrown when a value is not a valid `0x`-prefixed hex string. */ export declare class InvalidHexValueError extends Errors.BaseError { readonly name = "Hex.InvalidHexValueError"; constructor(value: unknown); } /** Thrown when a hex string has an odd nibble count. */ export declare class InvalidLengthError extends Errors.BaseError { readonly name = "Hex.InvalidLengthError"; constructor(value: Hex); } /** @internal */ export declare namespace bytesToHex { type ErrorType = Errors.GlobalErrorType; } /** @internal */ export declare namespace hexToBytes { type ErrorType = InvalidHexValueError | InvalidLengthError | Errors.GlobalErrorType; } //# sourceMappingURL=hex.d.ts.map