[**tevm**](../../README.md)
***
[tevm](../../modules.md) / [http-client](../README.md) / HttpClient
# ~~Interface: HttpClient~~
## Deprecated
a new http client will be created in a future version. For now it's recommended to use viem
## Extends
- [`TevmClient`](../../index/type-aliases/TevmClient.md)
## Properties
| Property | Type | Description | Inherited from |
| ------ | ------ | ------ | ------ |
| ~~`call`~~ | [`CallHandler`](../../actions/type-aliases/CallHandler.md) | Executes a call against the VM. It is similar to `eth_call` but has more options for controlling the execution environment By default it does not modify the state after the call is complete but this can be configured. **Example** `const res = tevm.call({ to: '0x123...', data: '0x123...', from: '0x123...', gas: 1000000, gasPrice: 1n, skipBalance: true, }` | `TevmClient.call` |
| ~~`contract`~~ | [`ContractHandler`](../../actions/type-aliases/ContractHandler.md) | Executes a contract call against the VM. It is similar to `eth_call` but has more options for controlling the execution environment along with a typesafe API for creating the call via the contract abi. The contract must already be deployed. Otherwise see `script` which executes calls against undeployed contracts **Example** `const res = await tevm.contract({ to: '0x123...', abi: [...], function: 'run', args: ['world'] from: '0x123...', gas: 1000000, gasPrice: 1n, skipBalance: true, } console.log(res.data) // "hello"` | `TevmClient.contract` |
| ~~`dumpState`~~ | [`DumpStateHandler`](../../actions/type-aliases/DumpStateHandler.md) | Dumps the current state of the VM into a JSON-seralizable object State can be dumped as follows **Examples** `const {state} = await tevm.dumpState() fs.writeFileSync('state.json', JSON.stringify(state))` And then loaded as follows `const state = JSON.parse(fs.readFileSync('state.json')) await tevm.loadState({state})` | `TevmClient.dumpState` |
| ~~`eth`~~ | `object` | Standard JSON-RPC methods for interacting with the VM **See** [JSON-RPC](https://ethereum.github.io/execution-apis/api-documentation/) | `TevmClient.eth` |
| `eth.blockNumber` | [`EthBlockNumberHandler`](../../actions/type-aliases/EthBlockNumberHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const blockNumber = await tevm.eth.blockNumber() console.log(blockNumber) // 0n` | - |
| `eth.call` | [`EthCallHandler`](../../actions/type-aliases/EthCallHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const res = await tevm.eth.call({to: '0x123...', data: '0x123...'}) console.log(res) // "0x..."` | - |
| `eth.chainId` | [`EthChainIdHandler`](../../actions/type-aliases/EthChainIdHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const chainId = await tevm.eth.chainId() console.log(chainId) // 10n` | - |
| `eth.gasPrice` | [`EthGasPriceHandler`](../../actions/type-aliases/EthGasPriceHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const gasPrice = await tevm.eth.gasPrice() console.log(gasPrice) // 0n` | - |
| `eth.getBalance` | [`EthGetBalanceHandler`](../../actions/type-aliases/EthGetBalanceHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const balance = await tevm.eth.getBalance({address: '0x123...', tag: 'pending'}) console.log(gasPrice) // 0n` | - |
| `eth.getCode` | [`EthGetCodeHandler`](../../actions/type-aliases/EthGetCodeHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const code = await tevm.eth.getCode({address: '0x123...'})` | - |
| `eth.getStorageAt` | [`EthGetStorageAtHandler`](../../actions/type-aliases/EthGetStorageAtHandler.md) | 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](https://ethereum.github.io/execution-apis/api-documentation/) **Example** `const storageValue = await tevm.eth.getStorageAt({address: '0x123...', position: 0})` | - |
| ~~`getAccount`~~ | [`GetAccountHandler`](../../actions/type-aliases/GetAccountHandler.md) | Gets the state of a specific ethereum address **Example** `const res = tevm.getAccount({address: '0x123...'}) console.log(res.deployedBytecode) console.log(res.nonce) console.log(res.balance)` | `TevmClient.getAccount` |
| ~~`loadState`~~ | [`LoadStateHandler`](../../actions/type-aliases/LoadStateHandler.md) | Loads a previously dumped state into the VM State can be dumped as follows **Examples** `const {state} = await tevm.dumpState() fs.writeFileSync('state.json', JSON.stringify(state))` And then loaded as follows `const state = JSON.parse(fs.readFileSync('state.json')) await tevm.loadState({state})` | `TevmClient.loadState` |
| ~~`name`~~ | `string` | - | - |
| ~~`request`~~ | [`TevmJsonRpcRequestHandler`](../../actions/type-aliases/TevmJsonRpcRequestHandler.md) | Request handler for JSON-RPC requests. Most users will want to use the [`actions` api](https://tevm.sh/learn/actions/) instead of this method directly **Example** `const blockNumberResponse = await tevm.request({ method: 'eth_blockNumber', params: [] id: 1 jsonrpc: '2.0' }) const accountResponse = await tevm.request({ method: 'tevm_getAccount', params: [{address: '0x123...'}], id: 1, jsonrpc: '2.0', })` | `TevmClient.request` |
| ~~`requestBulk`~~ | [`TevmJsonRpcBulkRequestHandler`](../../actions/type-aliases/TevmJsonRpcBulkRequestHandler.md) | **`Experimental`** Bulk request handler for JSON-RPC requests. Takes an array of requests and returns an array of results. Bulk requests are currently handled in parallel which can cause issues if the requests are expected to run sequentially or interphere with each other. An option for configuring requests sequentially or in parallel will be added in the future. Currently is not very generic with regard to input and output types. **Example** `const [blockNumberResponse, gasPriceResponse] = await tevm.requestBulk([{ method: 'eth_blockNumber', params: [] id: 1 jsonrpc: '2.0' }, { method: 'eth_gasPrice', params: [] id: 1 jsonrpc: '2.0' }])` ### tevm_* methods #### tevm_call request - CallJsonRpcRequest response - CallJsonRpcResponse #### tevm_getAccount request - GetAccountJsonRpcRequest response - GetAccountJsonRpcResponse #### tevm_setAccount request - SetAccountJsonRpcRequest response - SetAccountJsonRpcResponse #### tevm_fork request - ForkJsonRpcRequest response - ForkJsonRpcResponse ### debug_* methods #### debug_traceCall request - DebugTraceCallJsonRpcRequest response - DebugTraceCallJsonRpcResponse ### eth_* methods #### eth_blockNumber request - EthBlockNumberJsonRpcRequest response - EthBlockNumberJsonRpcResponse #### eth_chainId request - EthChainIdJsonRpcRequest response - EthChainIdJsonRpcResponse #### eth_getCode request - EthGetCodeJsonRpcRequest response - EthGetCodeJsonRpcResponse #### eth_getStorageAt request - EthGetStorageAtJsonRpcRequest response - EthGetStorageAtJsonRpcResponse #### eth_gasPrice request - EthGasPriceJsonRpcRequest response - EthGasPriceJsonRpcResponse #### eth_getBalance request - EthGetBalanceJsonRpcRequest response - EthGetBalanceJsonRpcResponse | `TevmClient.requestBulk` |
| ~~`setAccount`~~ | [`SetAccountHandler`](../../actions/type-aliases/SetAccountHandler.md) | Sets the state of a specific ethereum address **Example** `import {parseEther} from 'tevm' await tevm.setAccount({ address: '0x123...', deployedBytecode: '0x6080604...', balance: parseEther('1.0') })` | `TevmClient.setAccount` |
| ~~`url`~~ | `string` | - | - |