Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/Epoch

primitives/Epoch

Type Aliases

EpochType

EpochType = bigint & object
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.

Type Declaration

[brand]
readonly [brand]: "Epoch"

See

Since

0.0.0

Variables

Epoch

const Epoch: object
Defined in: src/primitives/Epoch/index.ts:11

Type Declaration

equals()
equals: (a, b) => boolean
Check if Epoch values are equal
Parameters
a
EpochType First epoch
b
EpochType Second epoch
Returns
boolean true if equal
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentation
Since
0.0.0
Throws
Example
from()
from: (value) => EpochType
Create Epoch from number, bigint, or string
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 documentation
Since
0.0.0
Throws
If value is negative or invalid
Example
toBigInt()
toBigInt: (epoch) => bigint
Convert Epoch to bigint
Parameters
epoch
EpochType Epoch value
Returns
bigint BigInt representation
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentation
Since
0.0.0
Throws
Example
toNumber()
toNumber: (epoch) => number
Convert Epoch to number
Parameters
epoch
EpochType Epoch value
Returns
number Number representation
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentation
Since
0.0.0
Throws
If epoch exceeds safe integer range
Example
toSlot()
toSlot: (epoch) => SlotType
Convert Epoch to the first Slot of that epoch Each epoch contains 32 slots. This function returns the first slot: slot = epoch * 32.
Parameters
epoch
EpochType Epoch value
Returns
SlotType First slot of the epoch
See
https://voltaire.tevm.sh/primitives/epoch for Epoch documentation
Since
0.0.0
Throws
Example

Functions

equals()

equals(a, b): boolean
Defined in: src/primitives/Epoch/equals.js:18 Check if Epoch values are equal

Parameters

a
EpochType First epoch
b
EpochType Second epoch

Returns

boolean true if equal

See

https://voltaire.tevm.sh/primitives/epoch for Epoch documentation

Since

0.0.0

Throws

Example


from()

from(value): EpochType
Defined in: src/primitives/Epoch/from.js:17 Create Epoch from number, bigint, or string

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 documentation

Since

0.0.0

Throws

If value is negative or invalid

Example


toBigInt()

toBigInt(epoch): bigint
Defined in: src/primitives/Epoch/toBigInt.js:16 Convert Epoch to bigint

Parameters

epoch
EpochType Epoch value

Returns

bigint BigInt representation

See

https://voltaire.tevm.sh/primitives/epoch for Epoch documentation

Since

0.0.0

Throws

Example


toNumber()

toNumber(epoch): number
Defined in: src/primitives/Epoch/toNumber.js:16 Convert Epoch to number

Parameters

epoch
EpochType Epoch value

Returns

number Number representation

See

https://voltaire.tevm.sh/primitives/epoch for Epoch documentation

Since

0.0.0

Throws

If epoch exceeds safe integer range

Example


toSlot()

toSlot(epoch): SlotType
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.

Parameters

epoch
EpochType Epoch value

Returns

SlotType First slot of the epoch

See

https://voltaire.tevm.sh/primitives/epoch for Epoch documentation

Since

0.0.0

Throws

Example