@tevm/voltaire / primitives/StorageValue
primitives/StorageValue
Type Aliases
StorageValueLike
StorageValueLike =Defined in: src/primitives/StorageValue/StorageValueType.ts:22 Inputs that can be converted to StorageValueStorageValueType|bigint|string|Uint8Array
StorageValueType
StorageValueType =Defined in: src/primitives/StorageValue/StorageValueType.ts:14 Branded StorageValue type - represents a 32-byte EVM storage slot value. In the EVM, each contract has 2^256 storage slots, and each slot stores a 32-byte (256-bit) value. Storage is the persistent key-value store used by smart contracts to maintain state between transactions. Storage slots start at zero and are lazily allocated - reading an uninitialized slot returns zero, and writing zero to a slot can trigger a gas refund.Uint8Array&object
Type Declaration
[brand]
readonly[brand]:"StorageValue"
length
readonlylength:32
Variables
SIZE
Defined in: src/primitives/StorageValue/StorageValueType.ts:24constSIZE:32=32
Functions
equals()
equals(Defined in: src/primitives/StorageValue/equals.js:18 Compares two StorageValues for equality. Uses constant-time comparison to prevent timing attacks.a,b):boolean
Parameters
a
StorageValueType
First StorageValue
b
StorageValueType
Second StorageValue
Returns
boolean
- True if equal
Example
from()
from(Defined in: src/primitives/StorageValue/from.js:22 Creates a StorageValue from various input types. Accepts bigint, hex strings, Uint8Array, or existing StorageValue instances.value):StorageValueType
Parameters
value
StorageValueLike
The value to convert
Returns
StorageValueType
- A branded StorageValue
Example
fromHex()
fromHex(Defined in: src/primitives/StorageValue/fromHex.js:18 Creates a StorageValue from a hex string.hex):StorageValueType
Parameters
hex
string
Hex string (with or without 0x prefix)
Returns
StorageValueType
- A branded StorageValue
Example
toHex()
toHex(Defined in: src/primitives/StorageValue/toHex.js:19 Converts a StorageValue to a hex string.value):string
Parameters
value
StorageValueType
The StorageValue to convert
Returns
string
- Hex string with 0x prefix
Example
toUint256()
toUint256(Defined in: src/primitives/StorageValue/toUint256.js:18 Converts a StorageValue to a bigint (Uint256).value):bigint
Parameters
value
StorageValueType
The StorageValue to convert
Returns
bigint
- The numeric value as bigint

