> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Execute Call \[call]

Executes a new message call without submitting a transaction to the network (`eth_call`).

## Usage

This example executes a new message call without submitting a transaction to the network (`eth_call`).

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const { data } = await client.call({
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
// @log: data: '0x...'
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())
```
:::

### Standalone Action

Call `Actions.call` directly by passing the Client as the first argument.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const { data } = await Actions.call(client, {
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
// @log: data: '0x...'
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
})
```
:::

## Recipes

### Call Deployless Bytecode

Pass `code` to execute bytecode without deploying a contract.

```ts twoslash
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())

const bytecode = '0x...'
const calldata = '0x...'
const { data } = await client.call({
  code: bytecode, // [!code focus]
  data: calldata,
})
```

### Call with State Overrides

Pass `stateOverride` to evaluate a call against temporary account state.

```ts twoslash
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())

const { data } = await client.call({
  data: '0x06fdde03',
  stateOverride: { // [!code focus]
    '0xd2135CfB216b74109775236E36d4b433F1DF507B': { // [!code focus]
      balance: 1000000000000000000n, // [!code focus]
    }, // [!code focus]
  }, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### Send a Call Without Batching

Set `batch: false` when the call must use its own RPC request.

```ts twoslash
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({
  batch: { multicall: true },
  chain: mainnet,
  transport: http(),
}).extend(publicActions())

const { data } = await client.call({
  batch: false, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

## Return Value

`{ data: Hex | undefined }`

The return data of the call, or `undefined` when the call returns `0x`.

## Parameters

### accessList

* **Type:** `AccessList`

The EIP-2930 access list to attach to the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  accessList: [ // [!code focus]
    { // [!code focus]
      address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus]
      storageKeys: [ // [!code focus]
        '0x0000000000000000000000000000000000000000000000000000000000000001', // [!code focus]
      ], // [!code focus]
    }, // [!code focus]
  ], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### account

* **Type:** `Account | Address`
* **Default:** `client.account`

The Account object or address to use as the call's `msg.sender`. This option takes precedence over [`from`](#from).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### authorizationList

* **Type:** `AuthorizationList`

The EIP-7702 (signed) authorization list to attach to the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  authorizationList: [ // [!code focus]
    { // [!code focus]
      address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus]
      chainId: 1, // [!code focus]
      nonce: 0n, // [!code focus]
      r: '0x...', // [!code focus]
      s: '0x...', // [!code focus]
      yParity: 0, // [!code focus]
    }, // [!code focus]
  ], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### batch

* **Type:** `boolean`
* **Default:** `client.batch.multicall`

Whether to batch this call into a single `multicall` aggregate request when the Client has multicall batching enabled.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  batch: false, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blobs

* **Type:** `readonly Hex[]`

The blobs to attach to the call (EIP-4844).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
const blobData = '0x1234' as const
// ---cut---
const { data } = await Actions.call(client, {
  blobs: [blobData], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blobVersionedHashes

* **Type:** `readonly Hex[]`

The versioned hashes of the EIP-4844 blobs attached to the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  blobVersionedHashes: ['0x...'], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blockHash

* **Type:** `Hex`

Executes the call against the state at a block identified by its hash.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  blockHash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blockNumber

* **Type:** `bigint`

Executes the call against the state at a given block number.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  blockNumber: 42069n, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blockOverrides

* **Type:** `BlockOverrides`

Overrides block fields (for example, `number`, `time`, `baseFeePerGas`) for the duration of the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  blockOverrides: { // [!code focus]
    baseFeePerGas: 1000000000n, // [!code focus]
  }, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blockTag

* **Type:** `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'`
* **Default:** `client.blockTag ?? 'latest'`

Executes the call against the state at a given block tag.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  blockTag: 'pending', // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### chainId

* **Type:** `number | Hex`

The chain ID to include in the call request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  chainId: 1, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### code

* **Type:** `Hex`

Bytecode to execute without deploying it. This option cannot be combined with `factory`, `factoryData`, or `to`.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
const bytecode = '0x...'
const calldata = '0x...'
// ---cut---
const { data } = await Actions.call(client, {
  code: bytecode, // [!code focus]
  data: calldata,
})
```

### data

* **Type:** `Hex`

The calldata to send with the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  data: '0x06fdde03', // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### factory

* **Type:** `Address`

The factory that deploys the contract before the call. Pass this option with [`factoryData`](#factorydata). It cannot be combined with [`code`](#code).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
const calldata = '0x...'
// ---cut---
const { data } = await Actions.call(client, {
  data: calldata,
  factory: '0xE8Df82fA4E10e6A12a9Dab552bceA2acd26De9bb', // [!code focus]
  factoryData: '0x...',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### factoryData

* **Type:** `Hex`

The calldata that deploys the contract through [`factory`](#factory). Pass both options together.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
const calldata = '0x...'
// ---cut---
const { data } = await Actions.call(client, {
  data: calldata,
  factory: '0xE8Df82fA4E10e6A12a9Dab552bceA2acd26De9bb',
  factoryData: '0x...', // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### from

* **Type:** `Address`

The raw sender address. Viem uses this field only when neither [`account`](#account) nor a Client Account is available.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  data: '0x06fdde03',
  from: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### gas

* **Type:** `number | bigint | Hex`

The gas limit provided for the call's execution.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  gas: 1_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### gasPrice

* **Type:** `number | bigint | Hex`

The legacy gas price (in wei) to use for the call. Mutually exclusive with `maxFeePerGas`/`maxPriorityFeePerGas`.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  gasPrice: 20_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### maxFeePerBlobGas

* **Type:** `number | bigint | Hex`

The max fee per blob gas (in wei) the sender is willing to pay (EIP-4844).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  maxFeePerBlobGas: 1_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### maxFeePerGas

* **Type:** `number | bigint | Hex`

The total fee per gas (in wei) the sender is willing to pay (EIP-1559).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  maxFeePerGas: 20_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### maxPriorityFeePerGas

* **Type:** `number | bigint | Hex`

The max priority fee per gas (in wei) to pay to the block producer (EIP-1559).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  maxPriorityFeePerGas: 1_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### nonce

* **Type:** `number | bigint | Hex`

The nonce to use for the call's sender.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  nonce: 69n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### requestOptions

* **Type:** `{ dedupe?: boolean; signal?: AbortSignal; ... }`

Per-request transport options, such as an `AbortSignal` that cancels the request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const controller = new AbortController()
const { data } = await Actions.call(client, {
  data: '0x06fdde03',
  requestOptions: { signal: controller.signal }, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### requireCanonical

* **Type:** `boolean`
* **Default:** `false`

Requires [`blockHash`](#blockhash) to identify a block in the canonical chain.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  blockHash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
  data: '0x06fdde03',
  requireCanonical: true, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### stateOverride

* **Type:** `StateOverrides`

Overrides account state (balance, nonce, code, storage) for the duration of the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  stateOverride: { // [!code focus]
    '0xd2135CfB216b74109775236E36d4b433F1DF507B': { // [!code focus]
      balance: 1000000000000000000n, // [!code focus]
    }, // [!code focus]
  }, // [!code focus]
})
```

### to

* **Type:** `Address | null`

The address to call. Pass `null` to omit the call target.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus]
})
```

### type

* **Type:** `string`

Forces the transaction request to a specific type (for example, `'eip1559'`, `'eip2930'`, `'legacy'`).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  type: 'eip1559', // [!code focus]
})
```

### value

* **Type:** `number | bigint | Hex`

The value (in wei) sent with the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const { data } = await Actions.call(client, {
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  value: 1000000000000000000n, // [!code focus]
})
```

## Errors

| Error | Description |
| --- | --- |
| `BlockParameter.RequireCanonicalError` | `requireCanonical` was provided without a `blockHash`. |
| `CcipRead.LookupError` | An ERC-3668 offchain lookup failed. |
| `CcipRead.LookupLimitExceededError` | An ERC-3668 response exceeded the maximum lookup depth. |
| `Actions.Errors.CounterfactualDeploymentFailedError` | The counterfactual deployment (`factory`/`factoryData` or `code`) failed. |
| `RpcError.ExecutionError` | The call could not be executed. |
