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

primitives/StructLog

Type Aliases

StructLogType

StructLogType = object
Defined in: src/primitives/StructLog/StructLogType.ts:11 Geth-style structured execution log entry Each entry represents one opcode execution with human-readable formatting

See

https://voltaire.tevm.sh/primitives/struct-log for StructLog documentation

Since

0.0.0

Properties

[brand]
readonly [brand]: "StructLog"
Defined in: src/primitives/StructLog/StructLogType.ts:12
depth
readonly depth: number
Defined in: src/primitives/StructLog/StructLogType.ts:22 Call depth (0 for top-level call)
error?
readonly optional error: string
Defined in: src/primitives/StructLog/StructLogType.ts:32 Error message if operation failed
gas
readonly gas: Type
Defined in: src/primitives/StructLog/StructLogType.ts:18 Remaining gas before this operation
gasCost
readonly gasCost: Type
Defined in: src/primitives/StructLog/StructLogType.ts:20 Gas cost for this operation
memory?
readonly optional memory: readonly string[]
Defined in: src/primitives/StructLog/StructLogType.ts:26 Memory contents as 32-byte hex chunks
op
readonly op: string
Defined in: src/primitives/StructLog/StructLogType.ts:16 Opcode name (e.g., “PUSH1”, “ADD”, “SSTORE”)
pc
readonly pc: number
Defined in: src/primitives/StructLog/StructLogType.ts:14 Program counter
refund?
readonly optional refund: Type
Defined in: src/primitives/StructLog/StructLogType.ts:30 Gas refund counter
stack
readonly stack: readonly string[]
Defined in: src/primitives/StructLog/StructLogType.ts:24 Stack contents as hex strings (top to bottom)
storage?
readonly optional storage: Record<string, string>
Defined in: src/primitives/StructLog/StructLogType.ts:28 Storage changes (hex key -> hex value)

Functions

_from()

_from(data): StructLogType
Defined in: src/primitives/StructLog/from.js:29 Creates a StructLog from raw data

Parameters

data
StructLog data
depth
number Call depth
error?
string Error message
gas
Type Remaining gas
gasCost
Type Gas cost
memory?
readonly string[] Memory as hex chunks
op
string Opcode name
pc
number Program counter
refund?
Type Gas refund
stack
readonly string[] Stack as hex strings
storage?
Record<string, string> Storage changes

Returns

StructLogType StructLog instance

Example

import { from } from './from.js';
const log = from({
  pc: 0,
  op: "PUSH1",
  gas: 1000000n,
  gasCost: 3n,
  depth: 0,
  stack: ["0x60"]
});

_toOpStep()

_toOpStep(log): OpStepType
Defined in: src/primitives/StructLog/toOpStep.js:13 Converts a StructLog to an OpStep Parses hex strings back to typed values

Parameters

log
StructLogType StructLog to convert

Returns

OpStepType OpStep instance

Example

import { toOpStep } from './toOpStep.js';
const step = toOpStep(structLog);

from()

from(data): StructLogType
Defined in: src/primitives/StructLog/index.ts:23 Creates a StructLog from raw data

Parameters

data
Omit<StructLogType, brand> StructLog data

Returns

StructLogType StructLog instance

See

https://voltaire.tevm.sh/primitives/struct-log for StructLog documentation

Since

0.0.0

Example

import { StructLog } from './primitives/StructLog/index.js';
const log = StructLog.from({ pc: 0, op: "PUSH1", gas: 1000000n, gasCost: 3n, depth: 0, stack: [] });

toOpStep()

toOpStep(log): OpStepType
Defined in: src/primitives/StructLog/index.ts:40 Converts a StructLog to an OpStep

Parameters

log
StructLogType StructLog to convert

Returns

OpStepType OpStep instance

Example

import { StructLog } from './primitives/StructLog/index.js';
const step = StructLog.toOpStep(log);