Overview
CallDataType is the functional layer underlying the CallData class. It provides:
- Zero-overhead branded type wrapping
Uint8Array - Tree-shakeable individual function exports
- Data-first unopinionated methods taking calldata as first parameter
- Bundle optimization through selective imports
Type Definition
CallDataType (Uint8Array)
The core CallData type is a brandedUint8Array:
- Size: Variable length (minimum 4 bytes for selector)
- Branding: Uses Symbol branding via
brandsymbol - Conceptual relation: Subtypes Hex (variable-length hex-encoded byte data)
- Type safety: Prevents accidental mixing with other Uint8Arrays or arbitrary Hex values
primitives/CallData/CallDataType.ts
Relationship to Hex
CallData is conceptually a Hex subtype with additional semantics:CallData uses Uint8Array internally for performance, it represents hex-encoded data that:
- Starts with a 4-byte function selector
- Follows with ABI-encoded parameters
- Validates to proper calldata structure
CallDataDecoded Structure
The decoded form represents parsed calldata:- selector - Required 4-byte function identifier
- signature - Optional human-readable function signature
- parameters - Decoded parameters as structured ABI values
- allocator - Memory management (Zig implementation)
Available Functions
All CallData functionality available as tree-shakeable functions:Constructors
Conversions
Selectors
Validation
Comparisons
Usage Patterns
Tree-Shakeable Imports
Import only what you need:Functional Style
Data-first API for composition:With Class API
Mix with class API when convenient:Dual API Pattern
CallData provides both functional and class-based APIs:- Functional API
- Class API
- Tree-shakeable
- Functional composition
- Minimal bundle impact
TypeScript vs Zig
- TypeScript
- Zig
See Also
- Fundamentals - How calldata works in the EVM
- Decoded Form - CallDataDecoded structure details
- Branded Types - Understanding the branded type pattern
- Hex - Parent type for hex-encoded data

