Skip to content

Commit e72811c

Browse files
committed
updating copy
1 parent a9d591b commit e72811c

File tree

2 files changed

+22
-85
lines changed

2 files changed

+22
-85
lines changed

website/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

website/pages/en/cookbook/transfer-to-the-graph.mdx

Lines changed: 21 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,30 @@ Learn how to quickly upgrade your subgraphs from any platform to [The Graph's de
1818

1919
## 1. Set Up Your Studio Environment
2020

21+
### Create a Subgraph in Subgraph Studio
22+
23+
- Go to [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet.
24+
- Click "Create a Subgraph". It is recommended to name the subgraph in Title Case: "Subgraph Name Chain Name".
25+
26+
> Note: After publishing, the subgraph name will be editable but requires on-chain action each time, so name it properly.
27+
2128
### Install the Graph CLI⁠
2229

23-
On your local machine, run the following commands:
30+
You must have [Node.js](https://nodejs.org/) and a package manager of your choice (`npm` or `pnpm`) installed to use the Graph CLI. Check for the [most recent](https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI version.
31+
32+
On your local machine, run the following command:
2433

2534
Using [npm](https://www.npmjs.com/):
2635

2736
```sh
28-
graph init --product subgraph-studio
37+
npm install -g @graphprotocol/graph-cli@latest
2938
```
3039

31-
> Alternatively, you can set up your environment using codespaces on your Github repo.
32-
33-
### Create a Subgraph in Subgraph Studio
34-
35-
- Go to [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet.
36-
- Click "Create a Subgraph". It is recommended to name the subgraph in Title Case: "Subgraph Name Chain Name".
37-
38-
> Note: After publishing, the subgraph name will be editable but requires signing each time, so name it properly.
40+
Use the following command to create a subgraph in Studio using the CLI:
3941

40-
For additional information on subgraph creation and the Graph CLI, check out the subgraph [Quick Start](/quick-start/) and [Creating a Subgraph](/developing/creating-a-subgraph).
42+
```sh
43+
graph init --product subgraph-studio
44+
```
4145

4246
### Authenticate Your Subgraph
4347

@@ -49,13 +53,16 @@ graph auth --studio <your-auth-code>
4953

5054
## 2. Deploy Your Subgraph to Studio
5155

56+
If you have your source code, you can easily deploy it to Studio. However, if you don't here's a quick way to deploy your subgraph.
57+
5258
In The Graph CLI, run the following command:
5359

5460
```sh
5561
graph deploy --studio <slug> --ipfs-hash <your-subgraph-ipfs-hash>
62+
5663
```
5764

58-
> Note: There is no coding required, simply use the **IPFS provided by your current host**. You’ll be prompted to enter a version (e.g., v0.0.1).
65+
> **Note:** Every subgraph has an IPFS hash (Deployment ID), which looks like this: "Qmasdfad...". To deploy simply use this **IPFS hash**. You’ll be prompted to enter a version (e.g., v0.0.1).
5966
6067
## 3. Publish Your Subgraph to The Graph Network
6168

@@ -65,7 +72,7 @@ graph deploy --studio <slug> --ipfs-hash <your-subgraph-ipfs-hash>
6572

6673
> To attract about 3 indexers to query your subgraph, it’s recommended to curate at least 3,000 GRT. To learn more about curating, check out [Curating](/network/curating/) on The Graph.
6774
68-
You can start querying any subgraph by sending a GraphQL query into the subgraph’s query URL endpoint, which is located at the top of its Explorer page in Subgraph Studio.
75+
You can start [querying](/querying/querying-the-graph/) any subgraph by sending a GraphQL query into the subgraph’s query URL endpoint, which is located at the top of its Explorer page in Subgraph Studio.
6976

7077
#### Example
7178

@@ -87,81 +94,11 @@ You can create API Keys in Subgraph Studio under the “API Keys” menu at the
8794

8895
![API keys](https://lh7-us.googleusercontent.com/docsz/AD_4nXdz7H8hSRf2XqrU0jN3p3KbmuptHvQJbhRHOJh67nBfwh8RVnhTsCFDGA_JQUFizyMn7psQO0Vgk6Vy7cKYH47OyTq5PqycB0xxLyF4kSPsT7hYdMv2MEzAo433sJT6VlQbUAzgPnSxKI9a5Tn3ShSzaxI?key=fnI6SyFgXU9SZRNX5C5vPQ)
8996

90-
### Sample Query
91-
92-
This query shows the most expensive CryptoPunks sold.
93-
94-
```graphql
95-
{
96-
trades(orderBy: priceETH, orderDirection: desc) {
97-
priceETH
98-
tokenId
99-
}
100-
}
101-
```
102-
103-
Passing this into the query URL returns this result:
104-
105-
```graphql
106-
{
107-
"data": {
108-
"trades": [
109-
{
110-
"priceETH": "124457.067524886018255505",
111-
"tokenId": "9998"
112-
},
113-
{
114-
"priceETH": "8000",
115-
"tokenId": "5822"
116-
}
117-
// ...
118-
]
119-
}
120-
}
121-
```
122-
123-
<aside />
124-
125-
### Sample code
126-
127-
```jsx
128-
const axios = require('axios')
129-
130-
const graphqlQuery = `{
131-
trades(orderBy: priceETH, orderDirection: desc) {
132-
priceETH
133-
tokenId
134-
}
135-
}`;
136-
const queryUrl =
137-
'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK'
138-
139-
const graphQLRequest = {
140-
method: 'post',
141-
url: queryUrl,
142-
data: {
143-
query: graphqlQuery,
144-
},
145-
};
146-
147-
// Send the GraphQL query
148-
axios(graphQLRequest)
149-
.then((response) => {
150-
// Handle the response here
151-
const data = response.data.data;
152-
console.log(data);
153-
})
154-
.catch(error) => {
155-
// Handle any errors
156-
console.error(error);
157-
});
158-
```
159-
16097
### Monitor Subgraph Status
16198

16299
Once you upgrade, you can access and manage your subgraphs in [Subgraph Studio](https://thegraph.com/studio/) and explore all subgraphs in [The Graph Explorer](https://thegraph.com/networks/).
163100

164101
### Additional Resources
165102

103+
- To quickly create and publish a new subgraph, check out the [Quick Start](/quick-start/).
166104
- To explore all the ways you can optimize & customize your subgraph for a better performance, read more about [creating a subgraph here](/developing/creating-a-subgraph/).
167-
- For more information about querying data from your subgraph, read more [here](/querying/querying-the-graph/).

0 commit comments

Comments
 (0)