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

> Auto-generated API documentation

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

***

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

# primitives/CallTrace

## Type Aliases

### CallTraceType

> **CallTraceType** = `object`

Defined in: [src/primitives/CallTrace/CallTraceType.ts:12](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L12)

Call tree structure from callTracer
Represents a single call (or create) and its nested subcalls

#### See

[https://voltaire.tevm.sh/primitives/call-trace](https://voltaire.tevm.sh/primitives/call-trace) for CallTrace documentation

#### Since

0.0.0

#### Properties

##### \[brand]

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

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

##### calls?

> `readonly` `optional` **calls**: readonly [`CallTraceType`](#calltracetype)\[]

Defined in: [src/primitives/CallTrace/CallTraceType.ts:42](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L42)

Nested calls made by this call

##### error?

> `readonly` `optional` **error**: `string`

Defined in: [src/primitives/CallTrace/CallTraceType.ts:38](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L38)

Error message if call failed

##### from

> `readonly` **from**: [`AddressType`](Address.mdx#addresstype)

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

Caller address

##### gas

> `readonly` **gas**: [`Type`](Uint.mdx#type)

Defined in: [src/primitives/CallTrace/CallTraceType.ts:30](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L30)

Gas provided to this call

##### gasUsed

> `readonly` **gasUsed**: [`Type`](Uint.mdx#type)

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

Gas actually used by this call

##### input

> `readonly` **input**: `Uint8Array`

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

Input data (calldata or init code)

##### output

> `readonly` **output**: `Uint8Array`

Defined in: [src/primitives/CallTrace/CallTraceType.ts:36](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L36)

Return data or deployed code

##### revertReason?

> `readonly` `optional` **revertReason**: `string`

Defined in: [src/primitives/CallTrace/CallTraceType.ts:40](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L40)

Decoded revert reason (from Error(string) or Panic(uint256))

##### to?

> `readonly` `optional` **to**: [`AddressType`](Address.mdx#addresstype)

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

Callee address (undefined for CREATE/CREATE2 before completion)

##### type

> `readonly` **type**: `"CALL"` | `"STATICCALL"` | `"DELEGATECALL"` | `"CALLCODE"` | `"CREATE"` | `"CREATE2"` | `"SELFDESTRUCT"`

Defined in: [src/primitives/CallTrace/CallTraceType.ts:15](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L15)

Call type

##### value?

> `readonly` `optional` **value**: [`Type`](Uint.mdx#type)

Defined in: [src/primitives/CallTrace/CallTraceType.ts:28](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/CallTraceType.ts#L28)

Call value in wei

## Functions

### \_flatten()

> **\_flatten**(`trace`): [`CallTraceType`](#calltracetype)\[]

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

Flattens a call tree into a linear list of all calls
Useful for analyzing all calls in execution order

#### Parameters

##### trace

[`CallTraceType`](#calltracetype)

Root call trace

#### Returns

[`CallTraceType`](#calltracetype)\[]

Flat array of all calls (including root)

#### Example

```javascript theme={null}
import { flatten } from './flatten.js';
const allCalls = flatten(rootTrace);
const failedCalls = allCalls.filter(call => call.error);
```

***

### \_from()

> **\_from**(`data`): [`CallTraceType`](#calltracetype)

Defined in: [src/primitives/CallTrace/from.js:31](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/from.js#L31)

Creates a CallTrace from raw data

#### Parameters

##### data

CallTrace data

###### calls?

readonly [`CallTraceType`](#calltracetype)\[]

Nested calls

###### error?

`string`

Error message

###### from

[`AddressType`](Address.mdx#addresstype)

Caller address

###### gas

[`Type`](Uint.mdx#type)

Gas provided

###### gasUsed

[`Type`](Uint.mdx#type)

Gas used

###### input

`Uint8Array`\<`ArrayBufferLike`>

Input data

###### output

`Uint8Array`\<`ArrayBufferLike`>

Output data

###### revertReason?

`string`

Decoded revert reason

###### to?

[`AddressType`](Address.mdx#addresstype)

Callee address

###### type

`"CALL"` | `"STATICCALL"` | `"DELEGATECALL"` | `"CALLCODE"` | `"CREATE"` | `"CREATE2"` | `"SELFDESTRUCT"`

Call type

###### value?

[`Type`](Uint.mdx#type)

Call value

#### Returns

[`CallTraceType`](#calltracetype)

CallTrace instance

#### Example

```javascript theme={null}
import { from } from './from.js';
const trace = from({
  type: "CALL",
  from: fromAddress,
  to: toAddress,
  gas: 100000n,
  gasUsed: 50000n,
  input: new Uint8Array(),
  output: new Uint8Array()
});
```

***

### \_getCalls()

> **\_getCalls**(`trace`): readonly [`CallTraceType`](#calltracetype)\[]

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

Gets nested calls from a CallTrace

#### Parameters

##### trace

[`CallTraceType`](#calltracetype)

CallTrace to extract calls from

#### Returns

readonly [`CallTraceType`](#calltracetype)\[]

Nested calls (empty array if none)

#### Example

```javascript theme={null}
import { getCalls } from './getCalls.js';
const nestedCalls = getCalls(trace);
console.log(`${nestedCalls.length} nested calls`);
```

***

### \_hasError()

> **\_hasError**(`trace`): `boolean`

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

Checks if a CallTrace has an error

#### Parameters

##### trace

[`CallTraceType`](#calltracetype)

CallTrace to check

#### Returns

`boolean`

True if call failed

#### Example

```javascript theme={null}
import { hasError } from './hasError.js';
if (hasError(trace)) {
  console.error(`Call failed: ${trace.error}`);
}
```

***

### flatten()

> **flatten**(`trace`): [`CallTraceType`](#calltracetype)\[]

Defined in: [src/primitives/CallTrace/index.ts:73](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/index.ts#L73)

Flattens a call tree into a linear list

#### Parameters

##### trace

[`CallTraceType`](#calltracetype)

Root call trace

#### Returns

[`CallTraceType`](#calltracetype)\[]

Flat array of all calls

#### Example

```typescript theme={null}
import { CallTrace } from './primitives/CallTrace/index.js';
const allCalls = CallTrace.flatten(trace);
```

***

### from()

> **from**(`data`): [`CallTraceType`](#calltracetype)

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

Creates a CallTrace from raw data

#### Parameters

##### data

`Omit`\<[`CallTraceType`](#calltracetype), `brand`>

CallTrace data

#### Returns

[`CallTraceType`](#calltracetype)

CallTrace instance

#### See

[https://voltaire.tevm.sh/primitives/call-trace](https://voltaire.tevm.sh/primitives/call-trace) for CallTrace documentation

#### Since

0.0.0

#### Example

```typescript theme={null}
import { CallTrace } from './primitives/CallTrace/index.js';
const trace = CallTrace.from({ type: "CALL", from, to, gas: 100000n, gasUsed: 50000n, input, output });
```

***

### getCalls()

> **getCalls**(`trace`): readonly [`CallTraceType`](#calltracetype)\[]

Defined in: [src/primitives/CallTrace/index.ts:43](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/index.ts#L43)

Gets nested calls from a CallTrace

#### Parameters

##### trace

[`CallTraceType`](#calltracetype)

CallTrace to extract calls from

#### Returns

readonly [`CallTraceType`](#calltracetype)\[]

Nested calls

#### Example

```typescript theme={null}
import { CallTrace } from './primitives/CallTrace/index.js';
const calls = CallTrace.getCalls(trace);
```

***

### hasError()

> **hasError**(`trace`): `boolean`

Defined in: [src/primitives/CallTrace/index.ts:58](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/CallTrace/index.ts#L58)

Checks if a CallTrace has an error

#### Parameters

##### trace

[`CallTraceType`](#calltracetype)

CallTrace to check

#### Returns

`boolean`

True if call failed

#### Example

```typescript theme={null}
import { CallTrace } from './primitives/CallTrace/index.js';
if (CallTrace.hasError(trace)) console.error(trace.error);
```
