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

Added most up to date guide for getting started with The Graph #92

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
bigger screenshots
alinobrasil committed Jun 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 457a18f89938103cddd100a68e17b3eba3fedaa5
63 changes: 27 additions & 36 deletions pages/dev-ecosystem-providers/indexers/the-graph.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{/*
import {ImageWithCaption} from '../../../components';

import imgApiKeys from "../../../public/assets/ecosystem/resources/the-graph/api_keys.png";
@@ -9,7 +8,7 @@ import imgPlayground from "../../../public/assets/ecosystem/resources/the-graph/
import imgPublishButton from "../../../public/assets/ecosystem/resources/the-graph/publish_button.png";
import imgPublishScreen from "../../../public/assets/ecosystem/resources/the-graph/publish_screen.png";
import imgQueryUrl from "../../../public/assets/ecosystem/resources/the-graph/query_url.png";
*/}


# The Graph

@@ -31,29 +30,27 @@ Here’s a step by step walk through:

### Create a subgraph on Subgraph Studio⁠

Go to the [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet. Once your wallet is connected, you can begin by clicking “Create a Subgraph”. Please choose a good name for the subgraph because this name can’t be edited later. It is recommended to use Title Case: “Subgraph Name Chain Name.”
Go to the [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet. Once your wallet is connected, you can begin by clicking “Create a Subgraph”. When entering the subgraph name, it is recommended to use Title Case: “Subgraph Name Chain Name.”

{/*
<ImageWithCaption
img={imgCreateSubgraph}
alt="Create a Subgraph"
caption="Example of creating a subgraph"
className="max-w-xs mx-auto"
caption="Create a Subgraph"
/>
*/}




You will then land on your subgraph’s page. All the CLI commands you need will be visible on the right side of the page:

{/*

<ImageWithCaption
img={imgCliCommands}
alt="CLI commands"
caption="Example of CLI commands"
className="max-w-xs mx-auto"
caption="CLI commands"

/>
*/}




@@ -70,14 +67,13 @@ You can copy this directly from your subgraph page to include your specific subg
graph init --studio <SUBGRAPH_SLUG>
```
You’ll be prompted to provide some info on your subgraph like this:
{/*

<ImageWithCaption
img={imgCliSample}
alt="CLI sample"
caption="Example of a CLI sample"
className="max-w-xs mx-auto"
caption="CLI"
/>
*/}



Simply have your contract verified on the block explorer and the CLI will automatically obtain the ABI and set up your subgraph. The default settings will generate an entity for each event.
@@ -106,14 +102,13 @@ You will be asked for a version label. You can enter something like v0.0.1, but

You can test your subgraph by making a sample query in the playground section. The Details tab will show you an API endpoint. You can use that endpoint to test from your dapp.

{/*

<ImageWithCaption
img={imgPlayground}
alt="Playground"
caption="Example of the Playground"
className="max-w-xs mx-auto"
caption="Run your graphql query in Studio"
/>
*/}




@@ -122,29 +117,27 @@ You can test your subgraph by making a sample query in the playground section. T
Once your subgraph is ready to be put into production, you can publish it to the decentralized network. On your subgraph’s page in Subgraph Studio, click on the Publish button:


{/*

<ImageWithCaption
img={imgPublishButton}
alt="Publish button"
caption="Example of the publish button"
className="max-w-xs mx-auto"
caption="Click Publish"
/>
*/}



Before you can query your subgraph, Indexers need to begin serving queries on it. In order to streamline this process, you can curate your own subgraph using GRT.

When publishing, you’ll see the option to curate your subgraph. As of May 2024, it is recommended that you curate your own subgraph with at least 3,000 GRT to ensure that it is indexed and available for querying as soon as possible.


{/*

<ImageWithCaption
img={imgPublishScreen}
alt="Publish screen"
caption="Example of the publish screen"
className="max-w-xs mx-auto"
caption="Publish Screen"
/>
*/}



> **Note:** The Graph's smart contracts are all on Arbitrum One, even though your subgraph is indexing data from Ethereum, BSC or any other [supported chain](https://thegraph.com/docs/en/developing/supported-networks/).
@@ -158,14 +151,13 @@ For any subgraph on the decentralized network, you can start querying it by pass
Here’s an example from the [CryptoPunks Ethereum subgraph](https://thegraph.com/explorer/subgraphs/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK) by Messari:


{/*

<ImageWithCaption
img={imgQueryURL}
img={imgQueryUrl}
alt="Query URL"
caption="Example of the Query URL"
className="max-w-xs mx-auto"
caption="Query URL"
/>
*/}


The query URL for this subgraph is:

@@ -175,14 +167,13 @@ Now, you simply need to  fill in your own API Key to start sending GraphQL quer

### Getting your own API Key

{/*

<ImageWithCaption
img={imgApiKeys}
alt="API keys"
caption="Example of the API keys"
className="max-w-xs mx-auto"
caption="API keys"
/>
*/}



In Subgraph Studio, you’ll see the “API Keys” menu at the top of the page. Here you can create API Keys.