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

> Auto-generated API documentation

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

***

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

# primitives/EncodedData

## Classes

### InvalidHexFormatError

Defined in: [src/primitives/EncodedData/errors.ts:6](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/errors.ts#L6)

Error thrown when hex string format is invalid

#### Extends

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

#### Constructors

##### Constructor

> **new InvalidHexFormatError**(`message`, `context?`): [`InvalidHexFormatError`](#invalidhexformaterror)

Defined in: [src/primitives/EncodedData/errors.ts:7](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/errors.ts#L7)

###### Parameters

###### message

`string`

###### context?

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

###### Returns

[`InvalidHexFormatError`](#invalidhexformaterror)

###### 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)

***

### InvalidValueError

Defined in: [src/primitives/EncodedData/errors.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/errors.ts#L16)

Error thrown when value type is unsupported

#### Extends

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

#### Constructors

##### Constructor

> **new InvalidValueError**(`message`, `context?`): [`InvalidValueError`](#invalidvalueerror)

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

###### Parameters

###### message

`string`

###### context?

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

###### Returns

[`InvalidValueError`](#invalidvalueerror)

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

### EncodedDataType

> **EncodedDataType** = `` `0x${string}` `` & `object`

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

EncodedData - ABI-encoded hex data

Branded hex string representing ABI-encoded data.
Can be decoded using ABI specifications.

#### Type Declaration

##### \[brand]

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

## Functions

### \_equals()

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

Defined in: [src/primitives/EncodedData/equals.js:13](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/equals.js#L13)

Check if two EncodedData instances are equal

#### Parameters

##### a

[`EncodedDataType`](#encodeddatatype)

First EncodedData

##### b

[`EncodedDataType`](#encodeddatatype)

Second EncodedData

#### Returns

`boolean`

True if equal

#### Example

```typescript theme={null}
const isEqual = EncodedData.equals(data1, data2);
```

***

### \_from()

> **\_from**(`value`): [`EncodedDataType`](#encodeddatatype)

Defined in: [src/primitives/EncodedData/from.js:18](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/from.js#L18)

Create EncodedData from various input types

#### Parameters

##### value

Hex string or Uint8Array

`string` | `Uint8Array`\<`ArrayBufferLike`>

#### Returns

[`EncodedDataType`](#encodeddatatype)

EncodedData

#### Throws

If value type is unsupported

#### Throws

If hex string is invalid

#### Example

```typescript theme={null}
const data1 = EncodedData.from("0x0000...");
const data2 = EncodedData.from(new Uint8Array([0, 0, ...]));
```

***

### \_fromBytes()

> **\_fromBytes**(`value`): [`EncodedDataType`](#encodeddatatype)

Defined in: [src/primitives/EncodedData/fromBytes.js:14](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/fromBytes.js#L14)

Create EncodedData from Uint8Array

#### Parameters

##### value

`Uint8Array`\<`ArrayBufferLike`>

Byte array

#### Returns

[`EncodedDataType`](#encodeddatatype)

EncodedData

#### Example

```typescript theme={null}
const data = EncodedData.fromBytes(new Uint8Array([0, 0, 0, 1]));
```

***

### \_toBytes()

> **\_toBytes**(`data`): `Uint8Array`\<`ArrayBufferLike`>

Defined in: [src/primitives/EncodedData/toBytes.js:14](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/toBytes.js#L14)

Convert EncodedData to Uint8Array

#### Parameters

##### data

[`EncodedDataType`](#encodeddatatype)

EncodedData

#### Returns

`Uint8Array`\<`ArrayBufferLike`>

Byte array

#### Example

```typescript theme={null}
const bytes = EncodedData.toBytes(data);
```

***

### equals()

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

Defined in: [src/primitives/EncodedData/index.ts:34](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/index.ts#L34)

Check if two EncodedData instances are equal

#### Parameters

##### a

[`EncodedDataType`](#encodeddatatype)

##### b

[`EncodedDataType`](#encodeddatatype)

#### Returns

`boolean`

***

### from()

> **from**(`value`): [`EncodedDataType`](#encodeddatatype)

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

Create EncodedData from various input types

#### Parameters

##### value

`string` | `Uint8Array`\<`ArrayBufferLike`>

#### Returns

[`EncodedDataType`](#encodeddatatype)

***

### fromBytes()

> **fromBytes**(`value`): [`EncodedDataType`](#encodeddatatype)

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

Create EncodedData from Uint8Array

#### Parameters

##### value

`Uint8Array`

#### Returns

[`EncodedDataType`](#encodeddatatype)

***

### toBytes()

> **toBytes**(`data`): `Uint8Array`

Defined in: [src/primitives/EncodedData/index.ts:27](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/EncodedData/index.ts#L27)

Convert EncodedData to Uint8Array

#### Parameters

##### data

[`EncodedDataType`](#encodeddatatype)

#### Returns

`Uint8Array`
