# `Cartouche.Filter`
[🔗](https://github.com/zenhive/cartouche/blob/main/lib/cartouche/filter.ex#L1)

A system to create an Ethereum log filter and have
parsed events passed back to registered processes.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `listen`

```elixir
@spec listen(GenServer.server()) :: :ok
```

Registers the calling process as a listener on `filter`. The filter will
send `{:event, {name, params}, log}` for matched, decoded events and
`{:log, log}` for every raw log it receives.

# `start_link`

```elixir
@spec start_link(Keyword.t()) :: GenServer.on_start()
```

Starts a Cartouche.Filter GenServer that polls Ethereum logs matching the
given filter and forwards parsed events to registered listeners.

## Options

  * `:name` — registered name for the GenServer (defaults to `__MODULE__`)
  * `:address` — contract address to filter on (omit to match any)
  * `:topics` — list of topic filters
  * `:events` — list of `ABI.FunctionSelector.t()` or signature strings;
    events are decoded and dispatched as `{:event, {name, params}, log}`
  * `:rpc_opts` — keyword list forwarded to `Cartouche.RPC` calls
  * `:extra_data` — opaque value attached to every log/event message
  * `:check_delay` — milliseconds between filter polls (default 3000)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
