> ## 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/TokenId

> Auto-generated API documentation

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

***

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

# primitives/TokenId

## Classes

### InvalidTokenIdError

Defined in: [src/primitives/TokenId/errors.ts:23](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/errors.ts#L23)

Base validation error

#### Example

```typescript theme={null}
throw new ValidationError('Invalid value', {
  value: '0x123',
  expected: '20 bytes',
  code: 'VALIDATION_ERROR',
  docsPath: '/primitives/address/from-hex#error-handling',
  cause: originalError
})
```

#### Extends

* [`ValidationError`](../index/index.mdx#validationerror)

#### Constructors

##### Constructor

> **new InvalidTokenIdError**(`message`, `options?`): [`InvalidTokenIdError`](#invalidtokeniderror)

Defined in: [src/primitives/TokenId/errors.ts:24](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/errors.ts#L24)

###### Parameters

###### message

`string`

###### options?

###### cause?

`Error`

###### code?

`string`

###### context?

`Record`\<`string`, `unknown`>

###### docsPath?

`string`

###### expected?

`string`

###### value?

`unknown`

###### Returns

[`InvalidTokenIdError`](#invalidtokeniderror)

###### Overrides

[`ValidationError`](../index/index.mdx#validationerror).[`constructor`](../index/index.mdx#constructor-20)

#### Properties

##### cause?

> `optional` **cause**: `Error`

Defined in: [src/primitives/errors/AbstractError.ts:56](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L56)

Root cause of this error (for error chaining)

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`cause`](../index/index.mdx#cause-19)

##### code

> **code**: `string`

Defined in: [src/primitives/errors/AbstractError.ts:39](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L39)

Machine-readable error code for programmatic handling

###### Example

```ts theme={null}
'INVALID_FORMAT', 'INVALID_LENGTH'
```

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`code`](../index/index.mdx#code-19)

##### context?

> `optional` **context**: `Record`\<`string`, `unknown`>

Defined in: [src/primitives/errors/AbstractError.ts:45](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L45)

Additional context metadata for debugging

###### Example

```ts theme={null}
{ value: '0x123', expected: '20 bytes' }
```

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`context`](../index/index.mdx#context-19)

##### docsPath?

> `optional` **docsPath**: `string`

Defined in: [src/primitives/errors/AbstractError.ts:51](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L51)

Path to documentation for this error

###### Example

```ts theme={null}
'/primitives/address/from-hex#error-handling'
```

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`docsPath`](../index/index.mdx#docspath-19)

##### expected

> **expected**: `string`

Defined in: [src/primitives/errors/ValidationError.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/ValidationError.ts#L19)

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`expected`](../index/index.mdx#expected-7)

##### value

> **value**: `unknown`

Defined in: [src/primitives/errors/ValidationError.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/ValidationError.ts#L18)

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`value`](../index/index.mdx#value-7)

#### Methods

##### getErrorChain()

> **getErrorChain**(): `string`

Defined in: [src/primitives/errors/AbstractError.ts:94](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L94)

Get full error chain as string for logging

###### Returns

`string`

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`getErrorChain`](../index/index.mdx#geterrorchain-38)

##### toJSON()

> **toJSON**(): `Record`\<`string`, `unknown`>

Defined in: [src/primitives/errors/AbstractError.ts:110](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L110)

Serialize error to JSON for logging/telemetry

###### Returns

`Record`\<`string`, `unknown`>

###### Inherited from

[`ValidationError`](../index/index.mdx#validationerror).[`toJSON`](../index/index.mdx#tojson-38)

***

### TokenIdError

Defined in: [src/primitives/TokenId/errors.ts:3](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/errors.ts#L3)

Base error for all primitive-related errors

#### Example

```typescript theme={null}
throw new PrimitiveError('Invalid primitive value', {
  code: 'INVALID_PRIMITIVE',
  context: { value: '0x123' },
  docsPath: '/primitives/overview#errors'
})
```

#### Extends

* [`PrimitiveError`](../index/index.mdx#primitiveerror)

#### Constructors

##### Constructor

> **new TokenIdError**(`message`, `options?`): [`TokenIdError`](#tokeniderror)

Defined in: [src/primitives/TokenId/errors.ts:4](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/errors.ts#L4)

###### Parameters

###### message

`string`

###### options?

###### cause?

`Error`

###### code?

`string`

###### context?

`Record`\<`string`, `unknown`>

###### docsPath?

`string`

###### Returns

[`TokenIdError`](#tokeniderror)

###### Overrides

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`constructor`](../index/index.mdx#constructor-16)

#### Properties

##### cause?

> `optional` **cause**: `Error`

Defined in: [src/primitives/errors/AbstractError.ts:56](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L56)

Root cause of this error (for error chaining)

###### Inherited from

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`cause`](../index/index.mdx#cause-16)

##### code

> **code**: `string`

Defined in: [src/primitives/errors/AbstractError.ts:39](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L39)

Machine-readable error code for programmatic handling

###### Example

```ts theme={null}
'INVALID_FORMAT', 'INVALID_LENGTH'
```

###### Inherited from

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`code`](../index/index.mdx#code-16)

##### context?

> `optional` **context**: `Record`\<`string`, `unknown`>

Defined in: [src/primitives/errors/AbstractError.ts:45](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L45)

Additional context metadata for debugging

###### Example

```ts theme={null}
{ value: '0x123', expected: '20 bytes' }
```

###### Inherited from

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`context`](../index/index.mdx#context-16)

##### docsPath?

> `optional` **docsPath**: `string`

Defined in: [src/primitives/errors/AbstractError.ts:51](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L51)

Path to documentation for this error

###### Example

```ts theme={null}
'/primitives/address/from-hex#error-handling'
```

###### Inherited from

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`docsPath`](../index/index.mdx#docspath-16)

#### Methods

##### getErrorChain()

> **getErrorChain**(): `string`

Defined in: [src/primitives/errors/AbstractError.ts:94](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L94)

Get full error chain as string for logging

###### Returns

`string`

###### Inherited from

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`getErrorChain`](../index/index.mdx#geterrorchain-32)

##### toJSON()

> **toJSON**(): `Record`\<`string`, `unknown`>

Defined in: [src/primitives/errors/AbstractError.ts:110](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/errors/AbstractError.ts#L110)

Serialize error to JSON for logging/telemetry

###### Returns

`Record`\<`string`, `unknown`>

###### Inherited from

[`PrimitiveError`](../index/index.mdx#primitiveerror).[`toJSON`](../index/index.mdx#tojson-32)

## Type Aliases

### TokenIdType

> **TokenIdType** = `bigint` & `object`

Defined in: [src/primitives/TokenId/TokenIdType.ts:10](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/TokenIdType.ts#L10)

TokenId type - ERC-721 NFT token identifier

#### Type Declaration

##### \[brand]

> `readonly` **\[brand]**: `"TokenId"`

#### See

* [https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation
* [https://eips.ethereum.org/EIPS/eip-721](https://eips.ethereum.org/EIPS/eip-721) for ERC-721 specification

#### Since

0.0.0

## Variables

### compare()

> `const` **compare**: (`a`, `b`) => `number` = `_compare`

Defined in: [src/primitives/TokenId/index.ts:22](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L22)

Compare two TokenId values

#### Parameters

##### a

[`TokenIdType`](#tokenidtype)

First TokenId

##### b

[`TokenIdType`](#tokenidtype)

Second TokenId

#### Returns

`number`

-1 if a \< b, 0 if a === b, 1 if a > b

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const a = TokenId.from(42n);
const b = TokenId.from(100n);
const result = TokenId.compare(a, b); // -1
```

***

### constants

> `const` **constants**: `object`

Defined in: [src/primitives/TokenId/index.ts:26](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L26)

#### Type Declaration

##### MAX

> **MAX**: `bigint`

Maximum TokenId value (2^256 - 1)

##### MIN

> **MIN**: `bigint`

Minimum TokenId value (0)

***

### equals()

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

Defined in: [src/primitives/TokenId/index.ts:21](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L21)

Check if two TokenId values are equal

#### Parameters

##### a

[`TokenIdType`](#tokenidtype)

First TokenId

##### b

[`TokenIdType`](#tokenidtype)

Second TokenId

#### Returns

`boolean`

true if equal

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const a = TokenId.from(42n);
const b = TokenId.from(42n);
const result = TokenId.equals(a, b); // true
```

***

### ERC721\_SELECTORS

> `const` **ERC721\_SELECTORS**: `object`

Defined in: [src/primitives/TokenId/index.ts:32](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L32)

#### Type Declaration

##### approve

> `readonly` **approve**: `"0x095ea7b3"` = `"0x095ea7b3"`

##### balanceOf

> `readonly` **balanceOf**: `"0x70a08231"` = `"0x70a08231"`

##### getApproved

> `readonly` **getApproved**: `"0x081812fc"` = `"0x081812fc"`

##### isApprovedForAll

> `readonly` **isApprovedForAll**: `"0xe985e9c5"` = `"0xe985e9c5"`

##### ownerOf

> `readonly` **ownerOf**: `"0x6352211e"` = `"0x6352211e"`

##### safeTransferFrom

> `readonly` **safeTransferFrom**: `"0x42842e0e"` = `"0x42842e0e"`

##### setApprovalForAll

> `readonly` **setApprovalForAll**: `"0xa22cb465"` = `"0xa22cb465"`

##### transferFrom

> `readonly` **transferFrom**: `"0x23b872dd"` = `"0x23b872dd"`

***

### from()

> `const` **from**: (`value`) => [`TokenIdType`](#tokenidtype) = `_from`

Defined in: [src/primitives/TokenId/index.ts:17](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L17)

Create TokenId from bigint, number, or string

#### Parameters

##### value

bigint, number, or decimal/hex string

`string` | `number` | `bigint`

#### Returns

[`TokenIdType`](#tokenidtype)

TokenId value

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Throws

If value is out of range or invalid

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const fromNumber = TokenId.from(100);
const fromHex = TokenId.from("0xff");
```

***

### isValid()

> `const` **isValid**: (`tokenId`) => `boolean` = `_isValid`

Defined in: [src/primitives/TokenId/index.ts:23](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L23)

Check if TokenId is valid (non-zero)

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to check

#### Returns

`boolean`

true if valid (non-zero)

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const valid = TokenId.isValid(tokenId); // true
const zero = TokenId.from(0n);
const invalid = TokenId.isValid(zero); // false
```

***

### toBigInt()

> `const` **toBigInt**: (`tokenId`) => `bigint` = `_toBigInt`

Defined in: [src/primitives/TokenId/index.ts:19](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L19)

Convert TokenId to bigint

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to convert

#### Returns

`bigint`

bigint value

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const bigint = TokenId.toBigInt(tokenId); // 42n
```

***

### toHex()

> `const` **toHex**: (`tokenId`) => `string` = `_toHex`

Defined in: [src/primitives/TokenId/index.ts:20](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L20)

Convert TokenId to hex string

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to convert

#### Returns

`string`

Hex string with 0x prefix

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const hex = TokenId.toHex(tokenId); // "0x2a"
```

***

### toNumber()

> `const` **toNumber**: (`tokenId`) => `number` = `_toNumber`

Defined in: [src/primitives/TokenId/index.ts:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/index.ts#L18)

Convert TokenId to number (unsafe for large values)

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to convert

#### Returns

`number`

number value

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Throws

If value exceeds Number.MAX\_SAFE\_INTEGER

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const num = TokenId.toNumber(tokenId); // 42
```

## Functions

### \_compare()

> **\_compare**(`a`, `b`): `number`

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

Compare two TokenId values

#### Parameters

##### a

[`TokenIdType`](#tokenidtype)

First TokenId

##### b

[`TokenIdType`](#tokenidtype)

Second TokenId

#### Returns

`number`

-1 if a \< b, 0 if a === b, 1 if a > b

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const a = TokenId.from(42n);
const b = TokenId.from(100n);
const result = TokenId.compare(a, b); // -1
```

***

### \_equals()

> **\_equals**(`a`, `b`): `boolean`

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

Check if two TokenId values are equal

#### Parameters

##### a

[`TokenIdType`](#tokenidtype)

First TokenId

##### b

[`TokenIdType`](#tokenidtype)

Second TokenId

#### Returns

`boolean`

true if equal

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const a = TokenId.from(42n);
const b = TokenId.from(42n);
const result = TokenId.equals(a, b); // true
```

***

### \_from()

> **\_from**(`value`): [`TokenIdType`](#tokenidtype)

Defined in: [src/primitives/TokenId/from.js:20](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/from.js#L20)

Create TokenId from bigint, number, or string

#### Parameters

##### value

bigint, number, or decimal/hex string

`string` | `number` | `bigint`

#### Returns

[`TokenIdType`](#tokenidtype)

TokenId value

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Throws

If value is out of range or invalid

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const fromNumber = TokenId.from(100);
const fromHex = TokenId.from("0xff");
```

***

### \_isValid()

> **\_isValid**(`tokenId`): `boolean`

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

Check if TokenId is valid (non-zero)

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to check

#### Returns

`boolean`

true if valid (non-zero)

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const valid = TokenId.isValid(tokenId); // true
const zero = TokenId.from(0n);
const invalid = TokenId.isValid(zero); // false
```

***

### \_toBigInt()

> **\_toBigInt**(`tokenId`): `bigint`

Defined in: [src/primitives/TokenId/toBigInt.js:15](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/toBigInt.js#L15)

Convert TokenId to bigint

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to convert

#### Returns

`bigint`

bigint value

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const bigint = TokenId.toBigInt(tokenId); // 42n
```

***

### \_toHex()

> **\_toHex**(`tokenId`): `string`

Defined in: [src/primitives/TokenId/toHex.js:15](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/toHex.js#L15)

Convert TokenId to hex string

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to convert

#### Returns

`string`

Hex string with 0x prefix

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const hex = TokenId.toHex(tokenId); // "0x2a"
```

***

### \_toNumber()

> **\_toNumber**(`tokenId`): `number`

Defined in: [src/primitives/TokenId/toNumber.js:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/TokenId/toNumber.js#L16)

Convert TokenId to number (unsafe for large values)

#### Parameters

##### tokenId

[`TokenIdType`](#tokenidtype)

TokenId value to convert

#### Returns

`number`

number value

#### See

[https://voltaire.tevm.sh/primitives/token-id](https://voltaire.tevm.sh/primitives/token-id) for TokenId documentation

#### Since

0.0.0

#### Throws

If value exceeds Number.MAX\_SAFE\_INTEGER

#### Example

```javascript theme={null}
import * as TokenId from './primitives/TokenId/index.js';
const tokenId = TokenId.from(42n);
const num = TokenId.toNumber(tokenId); // 42
```
