A detailed list of all active and relevant commands for The Graph CLI, including their purposes, use cases, and examples.
graph init
Purpose:
Creates a new Subgraph project using an example template or an existing smart contract.
Use Case:
subgraph.yaml
, and example code.Example:
graph codegen
Purpose:
Generates AssemblyScript types for smart contract ABIs and the Subgraph schema.
Use Case:
schema.graphql
file or when adding/updating smart contract ABIs.graph build
Purpose:
Compiles the Subgraph to WebAssembly (WASM), preparing it for deployment.
Use Case:
graph deploy
Purpose:
Deploys the compiled Subgraph to the 0xGraph hosting service.
Use Case:
Example:
graph local
Purpose:
Runs a local test environment (e.g., using Ganache or Hardhat) to test the Subgraph with simulated blockchain data.
Use Case:
graph test
Purpose:
Downloads and runs the Matchstick Rust binary to execute unit tests for a Subgraph.
Use Case:
graph add
Purpose:
Adds a new data source to your Subgraph’s manifest file (subgraph.yaml) and updates relevant files such as schema.graphql, ABIs, and mappings.
Use Case:
Example:
Ensure you have the latest version of The Graph CLI installed to avoid potential issues with deprecated or updated commands.
A detailed list of all active and relevant commands for The Graph CLI, including their purposes, use cases, and examples.
graph init
Purpose:
Creates a new Subgraph project using an example template or an existing smart contract.
Use Case:
subgraph.yaml
, and example code.Example:
graph codegen
Purpose:
Generates AssemblyScript types for smart contract ABIs and the Subgraph schema.
Use Case:
schema.graphql
file or when adding/updating smart contract ABIs.graph build
Purpose:
Compiles the Subgraph to WebAssembly (WASM), preparing it for deployment.
Use Case:
graph deploy
Purpose:
Deploys the compiled Subgraph to the 0xGraph hosting service.
Use Case:
Example:
graph local
Purpose:
Runs a local test environment (e.g., using Ganache or Hardhat) to test the Subgraph with simulated blockchain data.
Use Case:
graph test
Purpose:
Downloads and runs the Matchstick Rust binary to execute unit tests for a Subgraph.
Use Case:
graph add
Purpose:
Adds a new data source to your Subgraph’s manifest file (subgraph.yaml) and updates relevant files such as schema.graphql, ABIs, and mappings.
Use Case:
Example:
Ensure you have the latest version of The Graph CLI installed to avoid potential issues with deprecated or updated commands.