Skip to content

ernitingarg/thegraph-subgraphs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Overview

This document explains how to initialize, create, and deploy your subgraph to the sandbox Subgraph Studio which can be published to hosted service once testing is done.

  1. Prerequisite

  2. Install Graph CLI with either npm or yarn

npm install -g @graphprotocol/graph-cli

yarn global add @graphprotocol/graph-cli
  1. Run below command to create new subgraph for existing smart contract. Below example creates the subgraph for uniswap smart contract.
graph init --protocol ethereum --network goerli --from-contract 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 --contract-name UNI --studio --index-events subgraph_slug_name subgraph_directory
  1. Authenticate within CLI by providing Subgraph Studio API key
graph auth --studio <api_key>
  1. Go to subgraph directory
cd subgraph_directory
  1. Build the subgraph
graph codegen && graph build
  1. Deploy subgraph to Subgraph Studio
graph deploy --studio subgraph_slug_name
  1. You can access and use playground for the deployed subgraph at below url
https://thegraph.com/studio/subgraph/subgraph_slug_name/

image

About

Explanation about subgraph creation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published