CallResult
CallResult<
ErrorType>:object
Result of a TEVM VM Call method.
Type Parameters
• ErrorType = TevmCallError
Type declaration
accessList?
The access list if enabled on call. Mapping of addresses to storage slots.
Example
const accessList = result.accessListconsole.log(accessList) // { "0x...": Set(["0x..."]) }amountSpent?
optionalamountSpent:bigint
The amount of ether used by this transaction. Does not include L1 fees.
baseFee?
optionalbaseFee:bigint
The base fee of the transaction.
blobGasUsed?
optionalblobGasUsed:bigint
Amount of blob gas consumed by the transaction.
createdAddress?
optionalcreatedAddress:Address
Address of created account during the transaction, if any.
createdAddresses?
optionalcreatedAddresses:Set<Address>
Map of addresses which were created (used in EIP 6780). Note the addresses are not actually created until the transaction is mined.
errors?
optionalerrors:ErrorType[]
Description of the exception, if any occurred.
executionGasUsed
executionGasUsed:
bigint
Amount of gas the code used to run within the EVM. This only includes gas spent on the EVM execution itself and doesn’t account for gas spent on other factors such as data storage.
gas?
optionalgas:bigint
Amount of gas left after execution.
gasRefund?
optionalgasRefund:bigint
The gas refund counter as a uint256.
l1BaseFee?
optionall1BaseFee:bigint
Latest known L1 base fee known by the L2 chain. Only included when an OP-Stack common is provided.
See
l1BlobFee?
optionall1BlobFee:bigint
Current blob base fee known by the L2 chain.
See
l1Fee?
optionall1Fee:bigint
L1 fee that should be paid for the transaction. Only included when an OP-Stack common is provided.
See
l1GasUsed?
optionall1GasUsed:bigint
Amount of L1 gas used to publish the transaction. Only included when an OP-Stack common is provided.
See
logs?
optionallogs:Log[]
Array of logs that the contract emitted.
Example
const logs = result.logslogs?.forEach(log => console.log(log))minerValue?
optionalminerValue:bigint
The value that accrues to the miner by this transaction.
preimages?
Preimages mapping of the touched accounts from the transaction (see reportPreimages option).
priorityFee?
optionalpriorityFee:bigint
Priority fee set by the transaction.
rawData
rawData:
Hex
Encoded return value from the contract as a hex string.
Example
const rawData = result.rawDataconsole.log(`Raw data returned: ${rawData}`)selfdestruct?
optionalselfdestruct:Set<Address>
A set of accounts to selfdestruct.
totalGasSpent?
optionaltotalGasSpent:bigint
The amount of gas used in this transaction, which is paid for.
This contains the gas units that have been used on execution, plus the upfront cost,
which consists of calldata cost, intrinsic cost, and optionally the access list costs.
This is analogous to what eth_estimateGas would return. Does not include L1 fees.
trace?
optionaltrace:DebugTraceCallResult
The call trace if tracing is enabled on call.
Example
const trace = result.tracetrace.structLogs.forEach(console.log)txHash?
optionaltxHash:Hex
The returned transaction hash if the call was included in the chain.
Will not be defined if the call was not included in the chain.
Whether a call is included in the chain depends on the createTransaction option and the result of the call.
Example
const txHash = result.txHashif (txHash) { console.log(`Transaction included in the chain with hash: ${txHash}`)}Example
import { createClient } from 'viem'import { createTevmTransport, tevmCall } from 'tevm'import { optimism } from 'tevm/common'import { CallResult } from 'tevm/actions'
const client = createClient({ transport: createTevmTransport({}), chain: optimism,})
const callParams = { data: '0x...', bytecode: '0x...', gasLimit: 420n,}
const result: CallResult = await tevmCall(client, callParams)console.log(result)