Schemas
Hex.String
Validates hex strings with0x prefix. Returns branded HexType.
Hex.Bytes
Validates and converts to/fromUint8Array:
Constructors
from (Effect)
Creates hex from string or bytes. Returns Effect.fromBytes (Infallible)
Creates hex from bytes directly:fromString (Infallible)
Creates hex from UTF-8 string (encodes string bytes):fromBoolean (Infallible)
Converts boolean to hex:fromNumber (Effect)
Convert number to hex:fromBigInt (Effect)
Convert bigint to hex:Conversion
toBytes (Infallible)
Convert hex to bytes:toStringHex (Effect)
Decode hex as UTF-8 string:toNumber (Effect)
Convert hex to number:toBigInt (Infallible)
Convert hex to bigint:toBoolean (Effect)
Convert hex to boolean:Utilities
size (Infallible)
Returns byte length:isSized (Infallible)
Check if hex is exactly the specified size:assertSize (Effect)
Assert hex is exactly the specified size. ReturnsSized<T> type on success:
slice (Effect)
Extract portion of hex:pad / padRight (Effect)
Pad to specified byte length:concat (Effect)
Concatenate hex values:trim (Infallible)
Trim leading zeros:validate (Effect)
Validate and return hex:xor (Effect)
XOR two hex strings:equals (Infallible)
Compare hex values (case-insensitive):clone (Infallible)
Create a copy:isHex (Infallible)
Check if string is valid hex:zero (Infallible)
Create zero-filled hex:random (Infallible)
Generate random hex:Common Patterns
Encode Function Calldata
Parse RPC Response
Zero-Pad Address
Error Handling
Effect operations return typed errors:Error Types
| Error | Description |
|---|---|
InvalidFormatError | Missing 0x prefix or invalid format |
InvalidCharacterError | Invalid hex characters |
InvalidLengthError | Invalid length |
OddLengthError | Odd number of hex characters |
SizeExceededError | Hex exceeds target size |
InvalidBooleanHexError | Not a valid boolean hex |
NegativeNumberError | Negative number in conversion |
UnsafeIntegerError | Number exceeds MAX_SAFE_INTEGER |
NonIntegerError | Non-integer number |
InvalidSizeError | Invalid size parameter |
Types
See Also
- Bytes — Raw byte arrays
- Bytes32 — Fixed 32-byte values
- Address — 20-byte addresses
- Hash — 32-byte hashes
- Voltaire Hex — Core Hex documentation
- Effect Schema — Effect Schema validation

