Skip to content

docs: fix declared eth_call examples and document struct field access - #1136

Open
yash251 wants to merge 1 commit into
graphprotocol:mainfrom
yash251:yash/declared-calls-docs
Open

yash251 wants to merge 1 commit into
graphprotocol:mainfrom
yash251:yash/declared-calls-docs

Conversation

@yash251

@yash251 yash251 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

The declared eth_call section in subgraphs/developing/creating/advanced has two examples that don't parse into the shape graph-node expects, and it doesn't cover struct field access from specVersion 1.4.0.

Example fixes (advanced.mdx)

  • The event.address example listed event:, handler: and calls: at the same level as eventHandlers:, so the YAML parses with eventHandlers: null and the handler fields at the top level. It's now a proper list entry under eventHandlers.
  • The event.params example wrote calls as a list (- ERC20DecimalsToken0: ...). graph-node deserializes calls as a map of label to call (HashMap<String, String> in UnresolvedCallDecls, graph/src/data_source/common.rs), so the list form fails. It's now ERC20DecimalsToken0: ..., with one sentence explaining that calls is a map.
  • Added "This feature is available from specVersion: 1.2.0", matching graph-node's SPEC_VERSION_1_2_0 ("Enables eth call declarations") and the existing 1.2.0 row in the specVersion table.

New: accessing struct fields

A short subsection with an example of reading struct fields by position (event.params.asset.0) and by name (event.params.complexAsset.base.addr), available from specVersion: 1.4.0. The examples are taken from graph-node's tests/integration-tests/declared-calls-struct-fields/subgraph.yaml and match docs/subgraph-manifest.md §1.5.3 in graph-node.

specVersion table (subgraph-manifest.mdx)

  • Added a 1.4.0 row ("struct fields in declared eth_calls"), from SPEC_VERSION_1_4_0 in graph/src/data/subgraph/api_version.rs.
  • Removed the hard-coded "The latest version is 1.3.0" from the specVersion bullet and pointed to the table instead. graph-node already defines 1.5.0 (Amp data sources), which the docs intentionally don't cover since Remove Amp, add Anubis network icon + custom page, fix Robinhood icon #1120, so any "latest" number here would be wrong or would need Amp docs. Happy to put a version back if you prefer.

Checks: every YAML snippet in the section parses to the expected shape (the old two did not); prettier --check and eslint --max-warnings 0 pass on both files. English pages only, no URL changes.

The first example listed event and handler outside an eventHandlers list
entry, and the second wrote calls as a list, which graph-node rejects
because calls is a map. Also document struct field access in declared
calls (specVersion 1.4.0) and add 1.4.0 to the specVersion table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant