Skip to main content
import { StructLog } from 'voltaire-effect'
import { Effect } from 'effect'

const log = await Effect.runPromise(StructLog.from({
  pc: 0,
  op: 'PUSH1',
  gas: 100000n,
  gasCost: 3n,
  depth: 1,
  stack: ['0x1', '0x2'],
  storage: { '0x0': '0x64' },
  memory: ['0x00...']
}))

Fields

FieldTypeDescription
pcnumberProgram counter
opstringOpcode name
gasbigintRemaining gas
gasCostbigintCost of this op
depthnumberCall depth
stackstring[]Stack contents
memorystring[]Memory (optional)
storageRecordStorage changes (optional)
refundbigintGas refund (optional)
errorstringError message (optional)

Error Handling

const result = await Effect.runPromiseExit(StructLog.from(invalid))
if (result._tag === 'Failure') {
  console.error(result.cause) // StructLogError
}