Skip to main content

Documentation Index

Fetch the complete documentation index at: https://beta.docs.sqd.dev/llms.txt

Use this file to discover all available pages before exploring further.

See the Handling contract events guide for usage examples and event specification routes.

evmDecoder

Returns a query-transformer combo that instructs the source to fetch and decode smart contract event logs.
evmDecoder<T>(config: EvmDecoderConfig<T>): Transformer
Parameters:
  • range: Block range { from: number | 'latest', to?: number } (required)
  • contracts: Array of contract addresses or a factory (optional — omit to receive events from all contracts)
  • events: Map of event names to ABI event objects or { event, params } filter objects (required)
  • profiler: Profiler config shard for labeling the transformer in profiling data { name: string } (optional)
  • onError: Error handler (optional)
Example:
import { evmDecoder, commonAbis } from "@subsquid/pipes/evm";

const decoder = evmDecoder({
  range: { from: 20000000, to: 20100000 },
  contracts: ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
  events: {
    transfer: commonAbis.erc20.events.Transfer,
  },
});

await evmPortalSource({
  portal: "https://portal.sqd.dev/datasets/ethereum-mainnet",
  outputs: decoder,
}).pipeTo(target);

Decoded event structure

Each entry in the output arrays is a DecodedEvent object:
FieldTypeDescription
eventdecoded event typeDecoded event data fields
contractstringAddress of the contract that emitted the event
block{ number: number, hash: string }Block number and hash
timestampDateBlock timestamp
rawEventLogRaw log with address, topics, data, transactionHash, logIndex, transactionIndex
factory{ contract, blockNumber, event }Present only when using a factory; carries the factory deployment event that discovered this contract

commonAbis

import { commonAbis } from '@subsquid/pipes/evm'
commonAbis is a built-in collection of typed ABI modules. See the Handling contract events guide for usage examples.

commonAbis.erc20

Events:
Signature
commonAbis.erc20.events.TransferTransfer(address indexed from, address indexed to, uint256 value)
commonAbis.erc20.events.ApprovalApproval(address indexed owner, address indexed spender, uint256 value)
Functions:
Signature
commonAbis.erc20.functions.namename() → string
commonAbis.erc20.functions.symbolsymbol() → string
commonAbis.erc20.functions.decimalsdecimals() → uint8
commonAbis.erc20.functions.totalSupplytotalSupply() → uint256
commonAbis.erc20.functions.balanceOfbalanceOf(address _owner) → uint256
commonAbis.erc20.functions.allowanceallowance(address _owner, address _spender) → uint256
commonAbis.erc20.functions.transfertransfer(address _to, uint256 _value) → bool
commonAbis.erc20.functions.approveapprove(address _spender, uint256 _value) → bool
commonAbis.erc20.functions.transferFromtransferFrom(address _from, address _to, uint256 _value) → bool