@tevm/voltaire / primitives/Slot
primitives/Slot
Type Aliases
SlotType
SlotType =Defined in: src/primitives/Slot/SlotType.ts:13 Slot type Represents a consensus layer slot number (12 seconds per slot). Slots are the fundamental unit of time in Ethereum’s proof-of-stake consensus.bigint&object
Type Declaration
[brand]
readonly[brand]:"Slot"
See
- https://voltaire.tevm.sh/primitives/slot for Slot documentation
- https://github.com/ethereum/consensus-specs for Consensus specifications
Since
0.0.0Variables
Slot
Defined in: src/primitives/Slot/index.ts:11constSlot:object
Type Declaration
equals()
equals: (Check if Slot values are equala,b) =>boolean
Parameters
a
SlotType
First slot
b
SlotType
Second slot
Returns
boolean
true if equal
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
Example
from()
from: (Create Slot from number, bigint, or stringvalue) =>SlotType
Parameters
value
Slot number (number, bigint, or decimal/hex string)string | number | bigint
Returns
SlotType
Slot value
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
If value is negative or invalidExample
toBigInt()
toBigInt: (Convert Slot to bigintslot) =>bigint
Parameters
slot
SlotType
Slot value
Returns
bigint
BigInt representation
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
Example
toEpoch()
toEpoch: (Convert Slot to its corresponding Epoch Each epoch contains 32 slots. This function performs integer division: epoch = slot / 32.slot) =>EpochType
Parameters
slot
SlotType
Slot value
Returns
EpochType
Epoch value
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
Example
toNumber()
toNumber: (Convert Slot to numberslot) =>number
Parameters
slot
SlotType
Slot value
Returns
number
Number representation
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
If slot exceeds safe integer rangeExample
Functions
equals()
equals(Defined in: src/primitives/Slot/equals.js:18 Check if Slot values are equala,b):boolean
Parameters
a
SlotType
First slot
b
SlotType
Second slot
Returns
boolean
true if equal
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
Example
from()
from(Defined in: src/primitives/Slot/from.js:17 Create Slot from number, bigint, or stringvalue):SlotType
Parameters
value
Slot number (number, bigint, or decimal/hex string)string | number | bigint
Returns
SlotType
Slot value
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
If value is negative or invalidExample
toBigInt()
toBigInt(Defined in: src/primitives/Slot/toBigInt.js:16 Convert Slot to bigintslot):bigint
Parameters
slot
SlotType
Slot value
Returns
bigint
BigInt representation
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
Example
toEpoch()
toEpoch(Defined in: src/primitives/Slot/toEpoch.js:20 Convert Slot to its corresponding Epoch Each epoch contains 32 slots. This function performs integer division: epoch = slot / 32.slot):EpochType
Parameters
slot
SlotType
Slot value
Returns
EpochType
Epoch value
See
https://voltaire.tevm.sh/primitives/slot for Slot documentationSince
0.0.0Throws
Example
toNumber()
toNumber(Defined in: src/primitives/Slot/toNumber.js:16 Convert Slot to numberslot):number
Parameters
slot
SlotType
Slot value
Returns
number
Number representation

