Try it Live
Run Uint examples in the interactive playground
Uint.fromAbiEncoded(bytes: Uint8Array): BrandedUint256
Create Uint256 from ABI-encoded bytes. Requires exactly 32 bytes.
Parameters:
bytes: Uint8Array- ABI-encoded bytes (exactly 32 bytes, big-endian)
BrandedUint256 - Uint256 as branded Uint8Array
Example:
ABI Encoding Format
Solidity ABI encoding foruint256:
- Always 32 bytes (256 bits)
- Big-endian byte order
- Left-padded with zeros for smaller values
Examples
Strict Length Requirement
UnlikefromBytes (1-32 bytes), fromAbiEncoded requires exactly 32 bytes:
Why Strict?
ABI encoding has fixed-size slots for type safety:Decoding ABI Data
Function Return Values
Event Log Data
Multiple uint256 Values
Usage Patterns
ABI Decoder Helper
Contract Interaction
Type-Safe Validation
Performance
fromAbiEncoded is zero-copy - the input bytes are used directly as internal storage (no allocation needed).
For decoding large batches of uint256 values, this is the most efficient method.
See Also
- toAbiEncoded - Convert to ABI encoding
- fromBytes - From variable-length bytes (1-32)
- Abi primitive - ABI encoding utilities

