> **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.

# Filter.toRpc

:::info
`Filter.toRpc` is a re-export of ox's [`Filter.toRpc`](https://oxlib.sh/api/Filter/toRpc). Refer to the ox documentation for the full reference.
:::

Converts a [`Filter.Filter`](/docs/utilities/filter/types#filter) to a [`Filter.Rpc`](/docs/utilities/filter/types#rpc).

## Imports

```ts
import { Filter } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { AbiEvent, Filter } from 'viem/utils'

const transfer = AbiEvent.from(
  'event Transfer(address indexed, address indexed, uint256)'
)
const { topics } = AbiEvent.encode(transfer)

const filter = Filter.toRpc({
  address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
  topics
})
// @log: {
// @log:   address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
// @log:   topics: [
// @log:     '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
// @log:   ],
// @log: }
```

## Definition

```ts
function toRpc(
  filter: toRpc.Input,
): Rpc
```

## Parameters

### filter

* **Type:** `toRpc.Input`

The filter to convert.

## Return Type

An RPC filter.

[`Rpc`](/docs/utilities/filter/types#filterrpc)
