@tevm/decorators / EthActionsApi
EthActionsApi =
object
Defined in: actions/EthActionsApi.ts:16
The actions api is the high level API for interacting with a Tevm client similar to viem actions These actions correspond 1:1 eith the public ethereum JSON-RPC api
https://tevm.sh/learn/actions/
eth:
object
Defined in: actions/EthActionsApi.ts:21
Standard JSON-RPC methods for interacting with the VM
blockNumber:
EthBlockNumberHandler
Returns the current block number
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const blockNumber = await tevm.eth.blockNumber()
console.log(blockNumber) // 0ncall:
EthCallHandler
Executes a call without modifying the state
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const res = await tevm.eth.call({to: '0x123...', data: '0x123...'})
console.log(res) // "0x..."chainId:
EthChainIdHandler
Returns the current chain id
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const chainId = await tevm.eth.chainId()
console.log(chainId) // 10ngasPrice:
EthGasPriceHandler
Returns the current gas price
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const gasPrice = await tevm.eth.gasPrice()
console.log(gasPrice) // 0ngetBalance:
EthGetBalanceHandler
Returns the balance of a given address
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const balance = await tevm.eth.getBalance({address: '0x123...', tag: 'pending'})
console.log(gasPrice) // 0ngetCode:
EthGetCodeHandler
Returns code at a given address
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const code = await tevm.eth.getCode({address: '0x123...'})getStorageAt:
EthGetStorageAtHandler
Returns storage at a given address and slot
Set the tag to a block number or block hash to get the balance at that block
Block tag defaults to 'pending' tag which is the optimistic state of the VM
const storageValue = await tevm.eth.getStorageAt({address: '0x123...', position: 0})