Skip to content

Commit bd5f53a

Browse files
authored
Add section on _meta (#201)
* Add section on _meta * more fields to the block
1 parent 5971b1c commit bd5f53a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pages/en/querying/graphql-api.mdx

+30
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,33 @@ GraphQL schemas generally define root types for `queries`, `subscriptions` and `
316316
All GraphQL types with `@entity` directives in your schema will be treated as entities and must have an `ID` field.
317317

318318
> **Note:** Currently, all types in your schema must have an `@entity` directive. In the future, we will treat types without an `@entity` directive as value objects, but this is not yet supported.
319+
320+
### Subgraph Metadata
321+
322+
All subgraphs have an auto-generated `_Meta_` object, which provides access to subgraph metadata. This can be queried as follows:
323+
324+
```graphQL
325+
{
326+
_meta(block: { number: 123987 }) {
327+
block {
328+
number
329+
hash
330+
timestamp
331+
}
332+
deployment
333+
hasIndexingErrors
334+
}
335+
}
336+
```
337+
338+
If a block is provided, the metadata is as of that block, if not the latest indexed block is used. If provided, the block must be after the subgraph's start block, and less than or equal to the most recently indexed block.
339+
340+
`deployment` is a unique ID, corresponding to the IPFS CID of the `subgraph.yaml` file.
341+
342+
`block` provides information about the latest block (taking into account any block constraints passed to _meta):
343+
- hash: the hash of the block
344+
- number: the block number
345+
- timestamp: the timestamp of the block, if available (this is currently only available for subgraphs indexing EVM networks)
346+
347+
`hasIndexingErrors` is a boolean identifying whether the subgraph encountered indexing errors at some past block
348+

0 commit comments

Comments
 (0)