Skip to main content
EvmQueryBuilder assembles a typed portal query from a field selection and one or more data-request clauses. Pass .build() to outputs (or to .pipe()) on an EVM source. The resulting object is consumed by evmPortalStream() and by the evmDecoder which composes on top of it.

evmQuery()

Returns a fresh EvmQueryBuilder.

EvmQueryBuilder<F>

The generic parameter F narrows the block type produced by the stream — only fields explicitly selected with .addFields() appear on the decoded records, at both compile and runtime.

RequestOptions<R>

PortalRange.from defaults to 0; a Date or numeric timestamp is resolved to a block number via the portal at query start. 'latest' is resolved to the current head.

.addFields(fields)

Add to the field selection. Repeated calls are merged recursively. Block hash and number are returned regardless of selection.

block

transaction

log

trace

Trace records are a tagged union over type. Each type has its own action and (optionally) result sub-objects; the field selection is flat with create…/call…/suicide…/reward… prefixes. Shared: Type-specific (appears only on that trace type):

stateDiff

State diffs are a tagged union over kind ('+' = add, '-' = delete, '*' = change, '=' = no-change).

.addLog(options)

Filter logs. All list filters AND across fields but OR within a field. Request options: An empty request: {} matches every log in the range.

.addTransaction(options)

Filter transactions.

.addTrace(options)

Filter execution traces.

.addStateDiff(options)

Filter storage diffs.

.addRange(range)

Push a range-only request with no filters. Mostly useful to bound the stream or in combination with includeAllBlocks set elsewhere.

.merge(other)

Merge another builder’s requests and fields in-place. Overlapping ranges are reconciled at build time.

.build(opts?)

Return a QueryAwareTransformer suitable for use as a source output.
opts.setupQuery is an advanced hook called when the query is finalized: it receives { query, logger } and can mutate query (e.g. merge additional requests from runtime data). Default behaviour is to merge this into the stream’s root query.

See also