Skip to content

v3.4.0

Choose a tag to compare

@DZakh DZakh released this 23 Jul 15:56
6c163cc

Unlimited onEvent Handlers

Previously, we allowed only a single onEvent handler per event definition, making it impossible to have different handlers with different filters for the same event definition. Since 3.4.0 there's no such restriction.

import { indexer } from "envio";

// Track all ERC20 Transfers
indexer.onEvent(
  { contract: "ERC20", event: "Transfer", wildcard: true },
  async ({ event, context }) => {},
);

// And a separate handler for USDC-only is also possible
indexer.onEvent(
  { contract: "ERC20", event: "Transfer", wildcard: true, where: {
      params: [
        { from: USDC_ADDRESS },
        { to: USDC_ADDRESS },
      ],
    },
  },
  async ({ event, context }) => {},
);

// And contractRegister can have a different `where` filter for the same event
indexer.contractRegister(
  { contract: "ERC20", event: "Transfer", wildcard: false /* non-wildcard for contract register */ },
  async ({ event, context }) => {},
);

Note: It might result in a single log being processed by different handlers and calculated as multiple events in the metric. The same log execution is guaranteed to follow handler registration order inside a file.

By @DZakh in #1462, #1469

Per-entity ClickHouse Tuning

Perfect for making your analytic queries faster. Reach out to us for ClickHouse support on Envio Cloud 👍

type Transfer @storage(clickhouse: {
  partitionBy: "toYYYYMM(timestamp)",
  orderBy: ["timestamp"],
  ttl: "timestamp + INTERVAL 2 YEAR"
}) {
  id: ID!
  timestamp: Timestamp!
}

By @moose-code in #1433

Test Indexer Got 12x Faster

We got many reports that our testing framework got slower after the v3 upgrade. We fixed it, and now it's as fast as before with all the new features v3 brought.

Check out the Testing Guide if your agents still don't use our testing framework for indexer development.

Note: The change made test indexer instances run in-process, which might result in shared state pollution in some edge cases.

By @DZakh in #1467

Internal Changes

  • Removed Handlebars dependency by @DZakh in #1468
  • Internal test suite is better and better by @DZakh in #1470

Full Changelog: v3.3.2...v3.4.0