@tevm/voltaire / primitives/Hex
primitives/Hex
Classes
InvalidCharacterError
Defined in: src/primitives/Hex/errors.ts:15Extends
Error
Constructors
Constructor
new InvalidCharacterError(Defined in: src/primitives/Hex/errors.ts:16message):InvalidCharacterError
Parameters
message
string = "Invalid hex character"
Returns
InvalidCharacterError
Overrides
Error.constructor
InvalidFormatError
Defined in: src/primitives/Hex/errors.ts:1Extends
Error
Constructors
Constructor
new InvalidFormatError(Defined in: src/primitives/Hex/errors.ts:2message):InvalidFormatError
Parameters
message
string = "Invalid hex format: missing 0x prefix"
Returns
InvalidFormatError
Overrides
Error.constructor
InvalidLengthError
Defined in: src/primitives/Hex/errors.ts:8Extends
Error
Constructors
Constructor
new InvalidLengthError(Defined in: src/primitives/Hex/errors.ts:9message):InvalidLengthError
Parameters
message
string = "Invalid hex length"
Returns
InvalidLengthError
Overrides
Error.constructor
OddLengthError
Defined in: src/primitives/Hex/errors.ts:22Extends
Error
Constructors
Constructor
new OddLengthError(Defined in: src/primitives/Hex/errors.ts:23message):OddLengthError
Parameters
message
string = "Odd length hex string"
Returns
OddLengthError
Overrides
Error.constructor
Type Aliases
Bytes
Bytes<Defined in: src/primitives/Hex/HexType.ts:25 Hex string of exactly N bytesN> =Sized<N>
Type Parameters
N
N extends number
HexBrand
HexBrand = HexType
Defined in: src/primitives/Hex/HexType.ts:11
Alias for HexType
HexType
HexType =Defined in: src/primitives/Hex/HexType.ts:6 Branded Hex type (unsized)`0x${string}`&object
Type Declaration
[brand]
readonly[brand]:"Hex"
Sized
Sized<Defined in: src/primitives/Hex/HexType.ts:17 Sized Hex type with specific byte sizeTSize> =`0x${string}`&object
Type Declaration
[brand]
readonly[brand]:"Hex"
size
readonlysize:TSize
Type Parameters
TSize
TSize extends number = number
Example
Variables
fromBytes()
Defined in: src/primitives/Hex/Hex.ts:8 Convert bytes to hexconstfromBytes: (bytes) =>HexType=HexFuncs.fromBytes
Parameters
bytes
Uint8Array
Byte array to convert
Returns
HexType
Hex string
See
https://voltaire.tevm.sh/primitives/hex for Hex documentationSince
0.0.0Throws
Example
InvalidHexCharacterError
Defined in: src/primitives/Hex/errors.ts:31constInvalidHexCharacterError: typeofInvalidCharacterError=InvalidCharacterError
InvalidHexFormatError
Defined in: src/primitives/Hex/errors.ts:30constInvalidHexFormatError: typeofInvalidFormatError=InvalidFormatError
InvalidHexLengthError
Defined in: src/primitives/Hex/errors.ts:33constInvalidHexLengthError: typeofInvalidLengthError=InvalidLengthError
OddLengthHexError
Defined in: src/primitives/Hex/errors.ts:32constOddLengthHexError: typeofOddLengthError=OddLengthError
toBytes()
Defined in: src/primitives/Hex/Hex.ts:9 Convert hex to bytesconsttoBytes: (hex) =>Uint8Array=HexFuncs.toBytes
Parameters
hex
Hex string to convertstring | HexType
Returns
Uint8Array
Byte array

