Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section on _meta #201

Merged
merged 2 commits into from
Sep 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pages/en/querying/graphql-api.mdx
Original file line number Diff line number Diff line change
@@ -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