Skip to content

Latest commit

 

History

History
163 lines (99 loc) · 3.88 KB

File metadata and controls

163 lines (99 loc) · 3.88 KB

@tevm/decorators


@tevm/decorators / EthActionsApi

Type Alias: 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

See

https://tevm.sh/learn/actions/

Properties

eth

eth: object

Defined in: actions/EthActionsApi.ts:21

Standard JSON-RPC methods for interacting with the VM

blockNumber

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

See

JSON-RPC

Example
const blockNumber = await tevm.eth.blockNumber()
console.log(blockNumber) // 0n

call

call: 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

See

JSON-RPC

Example
const res = await tevm.eth.call({to: '0x123...', data: '0x123...'})
console.log(res) // "0x..."

chainId

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

See

JSON-RPC

Example
const chainId = await tevm.eth.chainId()
console.log(chainId) // 10n

gasPrice

gasPrice: 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

See

JSON-RPC

Example
const gasPrice = await tevm.eth.gasPrice()
console.log(gasPrice) // 0n

getBalance

getBalance: 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

See

JSON-RPC

Example
const balance = await tevm.eth.getBalance({address: '0x123...', tag: 'pending'})
console.log(gasPrice) // 0n

getCode

getCode: 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

See

JSON-RPC

Example
const code = await tevm.eth.getCode({address: '0x123...'})

getStorageAt

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

See

JSON-RPC

Example
const storageValue = await tevm.eth.getStorageAt({address: '0x123...', position: 0})

See

JSON-RPC