# Indexer Wildcard

> Use when indexing all instances of a contract across all addresses (e.g., all ERC-20 transfers on a chain). Config setup (no address), wildcard handler option, and event.srcAddress.

- Skill: `enviodev/indexer-wildcard` (Agent Skill)
- Install (CLI): `npx skillmds@latest add enviodev/indexer-wildcard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/enviodev/indexer-wildcard/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: enviodev (https://skillmd.com/u/enviodev)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/enviodev/indexer-wildcard

---


# Wildcard Indexing

Index all events matching an event signature across all contract addresses on a chain.

## Config (no address = wildcard)

```yaml
contracts:
  - name: ERC20
    events:
      - event: Transfer(indexed address from, indexed address to, uint256 value)

chains:
  - id: 1
    contracts:
      - name: ERC20
        # No address = wildcard (indexes ALL matching events on the chain)
```

## Handler with `wildcard: true`

Pass `wildcard: true` in the options object to `indexer.onEvent`. Use `event.srcAddress` to identify which contract emitted the event:

```ts
indexer.onEvent(
  {
    contract: "ERC20",
    event: "Transfer",
    wildcard: true,
    fields: { transaction: ["hash"] },
  },
  async ({ event, context }) => {
    const tokenAddress = event.srcAddress; // The actual contract address
    const id = `${event.transaction.hash}-${event.logIndex}`;

    context.Transfer.set({
      id,
      token_id: tokenAddress,
      from: event.params.from,
      to: event.params.to,
      value: event.params.value,
    });
  },
);
```

## Combining with Event Filters (`where`)

Wildcard indexing produces high event volume. Use `where` to reduce it — see the `indexer-filters` skill for object, array, function, and `addresses` forms.

```ts
indexer.onEvent(
  {
    contract: "ERC20",
    event: "Transfer",
    wildcard: true,
    where: { params: { from: ZERO_ADDRESS } },
  },
  async ({ event, context }) => {
    /* ... */
  },
);
```

> If something is unclear, use the `envio-docs` skill to search and read the latest documentation.

