Skip to content

Commit

Permalink
Add section on _meta (#201)
Browse files Browse the repository at this point in the history
* Add section on _meta

* more fields to the block
  • Loading branch information
azf20 authored Sep 16, 2022
1 parent 5971b1c commit bd5f53a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pages/en/querying/graphql-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,33 @@ GraphQL schemas generally define root types for `queries`, `subscriptions` and `
All GraphQL types with `@entity` directives in your schema will be treated as entities and must have an `ID` field.

> **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.
### Subgraph Metadata

All subgraphs have an auto-generated `_Meta_` object, which provides access to subgraph metadata. This can be queried as follows:

```graphQL
{
_meta(block: { number: 123987 }) {
block {
number
hash
timestamp
}
deployment
hasIndexingErrors
}
}
```

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.

`deployment` is a unique ID, corresponding to the IPFS CID of the `subgraph.yaml` file.

`block` provides information about the latest block (taking into account any block constraints passed to _meta):
- hash: the hash of the block
- number: the block number
- timestamp: the timestamp of the block, if available (this is currently only available for subgraphs indexing EVM networks)

`hasIndexingErrors` is a boolean identifying whether the subgraph encountered indexing errors at some past block

0 comments on commit bd5f53a

Please sign in to comment.