Skip to content

Instantly share code, notes, and snippets.

@hungdoansy
Last active June 16, 2022 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hungdoansy/f25eedf9c165aab9a4d05a1105866390 to your computer and use it in GitHub Desktop.
Save hungdoansy/f25eedf9c165aab9a4d05a1105866390 to your computer and use it in GitHub Desktop.
Deploy a subgraph guide

Deploy Subgraph guide (on hosted service)

  1. Go to https://thegraph.com/hosted-service/, register a new account using your Github account
  2. Go to https://thegraph.com/hosted-service/dashboard, -> Add Subgraph, then fill the information. Use: Test Uniswap Graph for name
  3. Grab your subgraph id. If it is https://thegraph.com/hosted-service/subgraph/hungdoansy/uniswap-v2-experiment, grab hungdoansy/uniswap-v2-experiment
  4. Clone an example repo or create a new one from CLI git clone git@github.com:hungdoansy/test-the-graph.git test-uniswap-graph
  5. cd test-uniswap-graph
  6. yarn to install all dependencies
  7. yarn codegen to generate files that are needed when writing mappings
  8. Replace your subgraph id in the package.json
  9. Replace your repo url in SubGraph.yaml
  10. yarn build - self-explanatory
  11. Grab your access token from https://thegraph.com/hosted-service/dashboard
  12. graph auth --product hosted-service <YOUR_ACCESS_TOKEN>
  13. yarn deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment