Graph CLI

Learn how to work with the open-source graph-cli package.

The graph-cli package contains commands that help you create, develop, and publish your subgraph.

Installation

# NPM
npm install -g @graphprotocol/[email protected]

# Yarn
yarn global add @graphprotocol/[email protected]

Version

Please note that CLI versions after 0.73.0 may introduce a "hosted service is deprecated" error — this is an automatic message and does not apply to Alchemy Subgraphs. If you see this error please downgrade to 0.73.0 or earlier. Contact support with any questions!

Commands

CommandDescription
graph initCreates a new subgraph project
graph codegenGenerates AssemblyScript types for smart contract ABIs and the subgraph schema
graph deployDeploys a subgraph (See Deploying a Subgraph)
graph addAdds a new datasource to the yaml file and updates schema.graphql, abis, and mappings
graph testRuns unit tests with Matchstick

See full specification for additional commands and details.

ReadMe