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

primitives/ValidatorIndex

Type Aliases

ValidatorIndexType

ValidatorIndexType = number & object
Defined in: src/primitives/ValidatorIndex/ValidatorIndexType.ts:13 ValidatorIndex type Represents a validator’s index in the beacon state registry. Each validator has a unique, immutable index assigned when they activate.

Type Declaration

[brand]
readonly [brand]: "ValidatorIndex"

See

Since

0.0.0

Variables

ValidatorIndex

const ValidatorIndex: object
Defined in: src/primitives/ValidatorIndex/index.ts:9

Type Declaration

equals()
equals: (a, b) => boolean
Check if ValidatorIndex values are equal
Parameters
a
ValidatorIndexType First validator index
b
ValidatorIndexType Second validator index
Returns
boolean true if equal
See
https://voltaire.tevm.sh/primitives/validator-index for ValidatorIndex documentation
Since
0.0.0
Throws
Example
import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const a = ValidatorIndex.from(123456);
const b = ValidatorIndex.from(123456);
const result = ValidatorIndex.equals(a, b); // true
from()
from: (value) => ValidatorIndexType
Create ValidatorIndex from number, bigint, or string
Parameters
value
Validator index (number, bigint, or decimal/hex string) string | number | bigint
Returns
ValidatorIndexType ValidatorIndex value
See
https://voltaire.tevm.sh/primitives/validator-index for ValidatorIndex documentation
Since
0.0.0
Throws
If value is negative, not an integer, or out of range
Example
import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const idx1 = ValidatorIndex.from(123456);
const idx2 = ValidatorIndex.from(123456n);
const idx3 = ValidatorIndex.from("0x1e240");
toNumber()
toNumber: (index) => number
Convert ValidatorIndex to number
Parameters
index
ValidatorIndexType ValidatorIndex value
Returns
number Number representation
See
https://voltaire.tevm.sh/primitives/validator-index for ValidatorIndex documentation
Since
0.0.0
Throws
Example
import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const idx = ValidatorIndex.from(123456);
const num = ValidatorIndex.toNumber(idx); // 123456

Functions

equals()

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

Parameters

a
ValidatorIndexType First validator index
b
ValidatorIndexType Second validator index

Returns

boolean true if equal

See

https://voltaire.tevm.sh/primitives/validator-index for ValidatorIndex documentation

Since

0.0.0

Throws

Example

import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const a = ValidatorIndex.from(123456);
const b = ValidatorIndex.from(123456);
const result = ValidatorIndex.equals(a, b); // true

from()

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

Parameters

value
Validator index (number, bigint, or decimal/hex string) string | number | bigint

Returns

ValidatorIndexType ValidatorIndex value

See

https://voltaire.tevm.sh/primitives/validator-index for ValidatorIndex documentation

Since

0.0.0

Throws

If value is negative, not an integer, or out of range

Example

import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const idx1 = ValidatorIndex.from(123456);
const idx2 = ValidatorIndex.from(123456n);
const idx3 = ValidatorIndex.from("0x1e240");

toNumber()

toNumber(index): number
Defined in: src/primitives/ValidatorIndex/toNumber.js:16 Convert ValidatorIndex to number

Parameters

index
ValidatorIndexType ValidatorIndex value

Returns

number Number representation

See

https://voltaire.tevm.sh/primitives/validator-index for ValidatorIndex documentation

Since

0.0.0

Throws

Example

import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const idx = ValidatorIndex.from(123456);
const num = ValidatorIndex.toNumber(idx); // 123456