> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# primitives/ValidatorIndex

> Auto-generated API documentation

[**@tevm/voltaire**](../index.mdx)

***

[@tevm/voltaire](../index.mdx) / primitives/ValidatorIndex

# primitives/ValidatorIndex

## Type Aliases

### ValidatorIndexType

> **ValidatorIndexType** = `number` & `object`

Defined in: [src/primitives/ValidatorIndex/ValidatorIndexType.ts:13](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/ValidatorIndex/ValidatorIndexType.ts#L13)

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

* [https://voltaire.tevm.sh/primitives/validator-index](https://voltaire.tevm.sh/primitives/validator-index) for ValidatorIndex documentation
* [https://github.com/ethereum/consensus-specs](https://github.com/ethereum/consensus-specs) for Consensus specifications

#### Since

0.0.0

## Variables

### ValidatorIndex

> `const` **ValidatorIndex**: `object`

Defined in: [src/primitives/ValidatorIndex/index.ts:9](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/ValidatorIndex/index.ts#L9)

#### Type Declaration

##### equals()

> **equals**: (`a`, `b`) => `boolean`

Check if ValidatorIndex values are equal

###### Parameters

###### a

[`ValidatorIndexType`](#validatorindextype)

First validator index

###### b

[`ValidatorIndexType`](#validatorindextype)

Second validator index

###### Returns

`boolean`

true if equal

###### See

[https://voltaire.tevm.sh/primitives/validator-index](https://voltaire.tevm.sh/primitives/validator-index) for ValidatorIndex documentation

###### Since

0.0.0

###### Throws

###### Example

```javascript theme={null}
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`](#validatorindextype)

Create ValidatorIndex from number, bigint, or string

###### Parameters

###### value

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

`string` | `number` | `bigint`

###### Returns

[`ValidatorIndexType`](#validatorindextype)

ValidatorIndex value

###### See

[https://voltaire.tevm.sh/primitives/validator-index](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

```javascript theme={null}
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`](#validatorindextype)

ValidatorIndex value

###### Returns

`number`

Number representation

###### See

[https://voltaire.tevm.sh/primitives/validator-index](https://voltaire.tevm.sh/primitives/validator-index) for ValidatorIndex documentation

###### Since

0.0.0

###### Throws

###### Example

```javascript theme={null}
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](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/ValidatorIndex/equals.js#L18)

Check if ValidatorIndex values are equal

#### Parameters

##### a

[`ValidatorIndexType`](#validatorindextype)

First validator index

##### b

[`ValidatorIndexType`](#validatorindextype)

Second validator index

#### Returns

`boolean`

true if equal

#### See

[https://voltaire.tevm.sh/primitives/validator-index](https://voltaire.tevm.sh/primitives/validator-index) for ValidatorIndex documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
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`](#validatorindextype)

Defined in: [src/primitives/ValidatorIndex/from.js:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/ValidatorIndex/from.js#L17)

Create ValidatorIndex from number, bigint, or string

#### Parameters

##### value

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

`string` | `number` | `bigint`

#### Returns

[`ValidatorIndexType`](#validatorindextype)

ValidatorIndex value

#### See

[https://voltaire.tevm.sh/primitives/validator-index](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

```javascript theme={null}
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](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/ValidatorIndex/toNumber.js#L16)

Convert ValidatorIndex to number

#### Parameters

##### index

[`ValidatorIndexType`](#validatorindextype)

ValidatorIndex value

#### Returns

`number`

Number representation

#### See

[https://voltaire.tevm.sh/primitives/validator-index](https://voltaire.tevm.sh/primitives/validator-index) for ValidatorIndex documentation

#### Since

0.0.0

#### Throws

#### Example

```javascript theme={null}
import * as ValidatorIndex from './primitives/ValidatorIndex/index.js';
const idx = ValidatorIndex.from(123456);
const num = ValidatorIndex.toNumber(idx); // 123456
```
