@tevm/voltaire / primitives/Epoch
primitives/Epoch
Type Aliases
EpochType
EpochType =Defined in: src/primitives/Epoch/EpochType.ts:13 Epoch type Represents a consensus layer epoch (32 slots = 6.4 minutes). Epochs are used for validator duties, finality, and checkpoint organization.bigint&object
Type Declaration
[brand]
readonly[brand]:"Epoch"
See
- https://voltaire.tevm.sh/primitives/epoch for Epoch documentation
- https://github.com/ethereum/consensus-specs for Consensus specifications
Since
0.0.0Variables
Epoch
Defined in: src/primitives/Epoch/index.ts:11constEpoch:object
Type Declaration
equals()
equals: (Check if Epoch values are equala,b) =>boolean
Parameters
a
EpochType
First epoch
b
EpochType
Second epoch
Returns
boolean
true if equal
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
Example
from()
from: (Create Epoch from number, bigint, or stringvalue) =>EpochType
Parameters
value
Epoch number (number, bigint, or decimal/hex string)string | number | bigint
Returns
EpochType
Epoch value
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
If value is negative or invalidExample
toBigInt()
toBigInt: (Convert Epoch to bigintepoch) =>bigint
Parameters
epoch
EpochType
Epoch value
Returns
bigint
BigInt representation
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
Example
toNumber()
toNumber: (Convert Epoch to numberepoch) =>number
Parameters
epoch
EpochType
Epoch value
Returns
number
Number representation
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
If epoch exceeds safe integer rangeExample
toSlot()
toSlot: (Convert Epoch to the first Slot of that epoch Each epoch contains 32 slots. This function returns the first slot: slot = epoch * 32.epoch) =>SlotType
Parameters
epoch
EpochType
Epoch value
Returns
SlotType
First slot of the epoch
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
Example
Functions
equals()
equals(Defined in: src/primitives/Epoch/equals.js:18 Check if Epoch values are equala,b):boolean
Parameters
a
EpochType
First epoch
b
EpochType
Second epoch
Returns
boolean
true if equal
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
Example
from()
from(Defined in: src/primitives/Epoch/from.js:17 Create Epoch from number, bigint, or stringvalue):EpochType
Parameters
value
Epoch number (number, bigint, or decimal/hex string)string | number | bigint
Returns
EpochType
Epoch value
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
If value is negative or invalidExample
toBigInt()
toBigInt(Defined in: src/primitives/Epoch/toBigInt.js:16 Convert Epoch to bigintepoch):bigint
Parameters
epoch
EpochType
Epoch value
Returns
bigint
BigInt representation
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
Example
toNumber()
toNumber(Defined in: src/primitives/Epoch/toNumber.js:16 Convert Epoch to numberepoch):number
Parameters
epoch
EpochType
Epoch value
Returns
number
Number representation
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentationSince
0.0.0Throws
If epoch exceeds safe integer rangeExample
toSlot()
toSlot(Defined in: src/primitives/Epoch/toSlot.js:20 Convert Epoch to the first Slot of that epoch Each epoch contains 32 slots. This function returns the first slot: slot = epoch * 32.epoch):SlotType
Parameters
epoch
EpochType
Epoch value
Returns
SlotType
First slot of the epoch

