You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/pages/en/quick-start.mdx
+19-20
Original file line number
Diff line number
Diff line change
@@ -8,26 +8,25 @@ Ensure that your subgraph will be indexing data from a [supported network](/deve
8
8
9
9
This guide is written assuming that you have:
10
10
11
-
- A smart contract address on the network of your choice
12
-
- GRT to curate your subgraph
13
11
- A crypto wallet
12
+
- A smart contract address on the network of your choice
14
13
15
14
## 1. Create a subgraph on Subgraph Studio
16
15
17
16
Go to the [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet.
18
17
19
-
Once connected, you can begin by clicking “Create a Subgraph”.
18
+
Once your wallet is connected, you can begin by clicking “Create a Subgraph." It is recommended to name the subgraph in Title Case: "Subgraph Name Chain Name."
20
19
21
20
## 2. Install the Graph CLI
22
21
23
-
The Graph CLI is written in JavaScript and you will need to have either `npm` or `yarn` installed to use it.
22
+
The Graph CLI is written in TypeScript and you will need to have `node` and either `npm` or `yarn` installed to use it. Check that you have the most recent CLI version installed.
24
23
25
24
On your local machine, run one of the following commands:
26
25
27
26
Using [npm](https://www.npmjs.com/):
28
27
29
28
```sh
30
-
npm install -g @graphprotocol/graph-cli
29
+
npm install -g @graphprotocol/graph-cli@latest
31
30
```
32
31
33
32
Using [yarn](https://yarnpkg.com/):
@@ -36,7 +35,13 @@ Using [yarn](https://yarnpkg.com/):
36
35
yarn global add @graphprotocol/graph-cli
37
36
```
38
37
39
-
## 3. Initialize your Subgraph
38
+
## 3. Initialize your subgraph from existing contract
39
+
40
+
Initialize your subgraph from an existing contract by running the initialize command:
41
+
42
+
```sh
43
+
graph init --studio <SUBGRAPH_SLUG>
44
+
```
40
45
41
46
> You can find commands for your specific subgraph on the subgraph page in [Subgraph Studio](https://thegraph.com/studio/).
42
47
@@ -53,17 +58,11 @@ When you initialize your subgraph, the CLI tool will ask you for the following i
53
58
- Index contract events as entities: it is suggested that you set this to true as it will automatically add mappings to your subgraph for every emitted event
54
59
- Add another contract(optional): you can add another contract
55
60
56
-
Initialize your subgraph from an existing contract by running the following command:
57
-
58
-
```sh
59
-
graph init --studio <SUBGRAPH_SLUG>
60
-
```
61
-
62
61
See the following screenshot for an example for what to expect when initializing your subgraph:
The previous commands create a scaffold subgraph that you can use as a starting point for building your subgraph. When making changes to the subgraph, you will mainly work with three files:
69
68
@@ -93,7 +92,7 @@ You will be asked for a version label. It's strongly recommended to use [semver]
93
92
94
93
## 6. Test your subgraph
95
94
96
-
You can test your subgraph by making a sample query in the playground section.
95
+
In Subgraph Studio's playground environment, you can test your subgraph by making a sample query.
97
96
98
97
The logs will tell you if there are any errors with your subgraph. The logs of an operational subgraph will look like this:
99
98
@@ -143,26 +142,26 @@ If your subgraph is failing, you can query the subgraph health by using the Grap
143
142
}
144
143
```
145
144
146
-
## 7. Publish Your Subgraph to The Graph’s Decentralized Network
145
+
## 7. Publish your subgraph to The Graph’s Decentralized Network
147
146
148
-
Once your subgraph has been deployed to Subgraph Studio, you have tested it out, and are ready to put it into production, you can then publish it to the decentralized network.
147
+
Once your subgraph has been deployed to Subgraph Studio, you have tested it out, and you are ready to put it into production, you can then publish it to the decentralized network.
149
148
150
-
In Subgraph Studio, click on your subgraph. On the subgraph’s page, you will be able to click the publish button on the top right.
149
+
In Subgraph Studio, you will be able to click the publish button on the top right of your subgraph's page.
151
150
152
151
Select the network you would like to publish your subgraph to. It is recommended to publish subgraphs to Arbitrum One to take advantage of the [faster transaction speeds and lower gas costs](/arbitrum/arbitrum-faq).
153
152
154
-
The (upgrade Indexer)[/sunrise/#about-the-upgrade-indexer] will begin serving queries on your subgraph regardless of subgraph curation, and will provide you with 100,000 free queries per month.
153
+
The (upgrade Indexer)[/sunrise/#about-the-upgrade-indexer] will begin serving queries on your subgraph regardless of subgraph curation, and it will provide you with 100,000 free queries per month.
155
154
156
155
For a higher quality of service and stronger redundancy, you can curate your subgraph to attract more Indexers. At the time of writing, it is recommended that you curate your own subgraph with at least 3,000 GRT to ensure 3-5 additional Indexers begin serving queries on your subgraph.
157
156
158
157
To save on gas costs, you can curate your subgraph in the same transaction that you published it by selecting this button when you publish your subgraph to The Graph’s decentralized network:
Now, you can query your subgraph by sending GraphQL queries to your subgraph’s Query URL, which you can find by clicking on the query button.
165
164
166
-
You can query from your dapp if you don't have your API keyvia the free, rate-limited temporary query URL that can be used for development and staging.
165
+
If you don't have your API key, you can query via the free, rate-limited development query URL, which can be used for development and staging.
167
166
168
167
For more information about querying data from your subgraph, read more [here](/querying/querying-the-graph/).
0 commit comments