evmquery icon

evmquery

Read on-chain data from any supported EVM chain using CEL expressions

Execute Query

AI-generated

Summary

Executes a CEL expression against EVM smart-contract state on a selected chain, returning the query result (optionally unwrapped with execution metadata) for downstream workflow steps.

Inputs

  • preset — Recipe selector. custom (default) shows the Expression, Contracts, and Context Variables fields; erc20-balance, native-balance, and nft-owner hide those fields and instead reveal the preset's address/token inputs, building the expression automatically. Not expression-capable.
  • chainId (required) — EVM chain to query. Required. Dynamically populated from the evmquery /chains endpoint, with a static fallback to Ethereum (evm_ethereum), Base (evm_base), and BNB Smart Chain (evm_bnb_mainnet). May be overridden with an expression yielding an evm_* chain id. Defaults to evm_ethereum.
  • expression (required) — CEL expression to evaluate. Required when Preset is Custom Expression. References named contracts directly (e.g. Token.balanceOf(holder)) and context variables via vars.<name>. Hidden when a named preset is active. Multi-line input; see the evmquery docs for the full CEL surface.
  • contracts — Optional fixed collection of named contract references used by the expression. Hidden when a named preset is active. Each entry has a Name (must be a valid CEL identifier: letters, digits, underscores only, not starting with a digit) and Address (0x-prefixed, 20 bytes). Sent to the API as schema.contracts = { <name>: { address } }. A JSON object supplied via an AI caller ($fromAI) is normalized to the same shape.
  • context — Optional fixed collection of typed context variables. Hidden when a named preset is active. Each entry has a Name (referenced as vars.<name> in the expression), a Type (sol_int, sol_address, bool, string, bytes, or the list<...> variants), and a Value. Types are sent as schema.context; non-empty runtime values are sent as the top-level context. Scalars accept a literal; list types accept a JSON array literal or an expression evaluating to an array (e.g. {{ $json.holders }}). Boolean strings and JSON-array strings are coerced.
  • preset_erc20_balance_tokenAddress (required) — ERC-20 token contract address. Required when Preset = ERC-20 balance. Becomes the Token contract in the generated expression Token.balanceOf(holder).
  • preset_erc20_balance_holder (required) — Holder address whose ERC-20 balance to read. Required when Preset = ERC-20 balance. Bound as the holder context variable (sol_address).
  • preset_native_balance_account (required) — Account address whose native (gas) balance to read. Required when Preset = Native balance. Used in the generated expression account.balance().
  • preset_nft_owner_collection (required) — ERC-721 collection contract address. Required when Preset = NFT owner. Becomes the Collection contract in the generated expression Collection.ownerOf(tokenId).
  • preset_nft_owner_tokenId (required) — ERC-721 token id whose owner to resolve. Required when Preset = NFT owner. Bound as the tokenId context variable (sol_int). Defaults to 0.
  • options — Optional advanced options collection. Output Format: simple (default) unwraps result.value — object results are spread at the top level, scalars/arrays are wrapped under value — and attaches a $meta object; raw returns the full API response envelope verbatim. Timeout (Ms): server-side evaluation timeout in milliseconds; 0/empty uses the evmquery default. Only outputFormat applies to Execute; timeoutMs also applies to Validate.

Output shape

simple | raw

One output item is produced per input item, linked via pairedItem. With Output Format = Simple (default), the returned JSON is either { ...objectResult, $meta } (object results spread at the top level) or { value: <scalar-or-array>, $meta }. $meta contains type (result type), blockNumber, credits (credits consumed), rounds (total evaluation rounds), onChainCalls (on-chain call count), and latencyMs; side-car fields may be absent when the query performs no on-chain reads. With Output Format = Raw, the complete POST /query API envelope is returned verbatim. If continueOnFail is enabled and the request fails, the node emits { error: <message> } for that item instead of throwing.

Links

Discussion