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: pages/en/deploying/deploying-a-subgraph-to-hosted.mdx
+18-10Lines changed: 18 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -102,25 +102,23 @@ If your previously deployed subgraph is still in status `Syncing`, it will be im
102
102
103
103
In some cases, you will want to deploy the same subgraph to multiple Ethereum networks without duplicating all of its code. The main challenge that comes with this is that the contract addresses on these networks are different.
104
104
105
-
### graph-cli >=0.29.0
105
+
### Using graph-cli
106
106
107
-
From version `0.29.0` the `build` command accepts two new options:
107
+
Both `graph build` (since `v0.29.0`) and `graph deploy` (since `v0.32.0`) accept two new options:
108
108
109
109
```sh
110
-
graph build [options] [<subgraph-manifest>]
111
-
112
110
Options:
113
111
114
112
...
115
-
--network <name> Network to use from networks.json
You can use the `--network` option to specify a network configuration from a `json` standard file (defaults to `networks.json`) to easily update your subgraph during development.
120
118
121
119
**Note:** The `init` command will now auto-generate a `networks.json` based on the provided information. You will then be able to update existing or add additional networks.
122
120
123
-
If you don't have a `networks.json` file, you'll need to manually create one with the follwing structure:
121
+
If you don't have a `networks.json` file, you'll need to manually create one with the following structure:
124
122
125
123
```json
126
124
{
@@ -182,7 +180,7 @@ This is what your networks config file should look like:
182
180
}
183
181
```
184
182
185
-
Now we can run the following command:
183
+
Now we can run one of the following commands:
186
184
187
185
```sh
188
186
# Using default networks.json file
@@ -207,9 +205,19 @@ dataSources:
207
205
kind: ethereum/events
208
206
```
209
207
210
-
Now you are ready to `yarn deploy`
208
+
Now you are ready to `yarn deploy`.
209
+
210
+
**Note:** As mentioned earlier, since `graph-cli 0.32.0` you can directly run `yarn deploy` with the `--network` option:
One solution for older graph-cli versions that allows to parameterize aspects like contract addresses is to generate parts of it using a templating system like [Mustache](https://mustache.github.io/) or [Handlebars](https://handlebarsjs.com/).
0 commit comments