Skip to main content
The method documentation is also available inline and can be accessed via suggestions in most IDEs.
The following setters configure the global settings of EvmBatchProcessor. They return the modified instance and can be chained. Certain configuration methods are required: Here’s how to choose the data sources depending on your use case:
SQD Network v2 gateways require an API key. Set SQD_API_KEY in the process environment or pass apiKey in GatewaySettings. For new projects, prefer the Portal stream stack when it fits your application.

setGateway(url: string | GatewaySettings)

Adds a SQD Network data source. The argument is either a string URL of a SQD Network gateway or
See EVM gateways.

setRpcEndpoint(rpc: ChainRpc)

Adds a RPC data source. If added, it will be used for A node RPC endpoint can be specified as a string URL or as an object:
Setting maxBatchCallSize to 1 disables batching completely.
We recommend using private endpoints for better performance and stability of your squids. For SQD Cloud deployments you can use the RPC addon. If you use an external private RPC, keep the endpoint URL in a Cloud secret.

setDataSource(ds: {archive?: string | GatewaySettings, chain?: ChainRpc}) (deprecated)

Replaced by setGateway() and setRpcEndpoint().

setRpcDataIngestionSettings(settings: RpcDataIngestionSettings)

Specify the RPC ingestion settings.
Here,
  • disabled: Explicitly disables data ingestion from an RPC endpoint.
  • preferTraceApi: By default, debug_traceBlockByHash is used to obtain call traces. This flag selects trace_ methods for finalized blocks and trace_block for hot blocks.
  • useDebugApiForStateDiffs: By default, trace_replayBlockTransactions is used to obtain state diffs for finalized blocks. This flag instructs the processor to utilize debug_traceBlockByHash instead. This setting is only effective for finalized blocks. WARNING: this will significantly increase the amount of data retrieved from the RPC endpoint. Expect download rates in the megabytes per second range.
  • debugTraceTimeout: If set, the processor will pass the timeout parameter to debug trace config.
  • headPollInterval: Poll interval for new blocks in milliseconds. Poll mechanism is used to get new blocks via HTTP connections. Default: 5000.
  • newHeadTimeout: When ingesting from a websocket, this setting specifies the timeout in milliseconds after which the connection will be reset and subscription re-initiated if no new blocks were received. Default: no timeout.
  • validationFlags: Disables specific RPC consistency checks. Keep the checks enabled unless the endpoint is known to return non-standard roots or bloom values.

setFinalityConfirmation(nBlocks: number)

Sets the number of blocks after which the processor will consider the consensus data final. Use a value appropriate for your network. For example, for Ethereum mainnet a widely cited value is 15 minutes/75 blocks.

setBlockRange({from: number, to?: number})

Limits the range of blocks to be processed. When the upper bound is specified, processor will terminate with exit code 0 once it reaches it. Note that block ranges can also be specified separately for each data request. This method sets global bounds for all block ranges in the configuration.

includeAllBlocks(range?: {from: number, to?: number})

By default, processor will fetch only blocks which contain requested items. This method modifies such behavior to fetch all chain blocks. Optionally a range of blocks can be specified for which the setting should be effective.

setPrometheusServer(server: PrometheusServer)

Sets a custom Prometheus server from @subsquid/util-internal-processor-tools.

setPrometheusPort(port: string | number) (deprecated)

Sets the port for the built-in Prometheus metrics server at http://localhost:${port}/metrics. Use setPrometheusServer() for new code. If no server or port is configured, PROCESSOR_PROMETHEUS_PORT takes precedence over PROMETHEUS_PORT; if neither is set, the processor selects an ephemeral port.