📡Subgraph CLI Cheat sheet
Streamlined Guide: Deploying Mantle Subgraphs with The Graph CLI
Summary: This cheat sheet condenses essential commands, tips, and best practices into an indispensable reference for anyone deploying a subgraph. Developers will find this streamlined guide invaluable for swiftly progressing through the deployment workflow and resolving frequent pain points. With key information consolidated in one place, engineers can deploy subgraphs more efficiently and focus their efforts on building applications powered by real-time, customizable blockchain data indexes.
Deployment Network definitions
For developers who are already familiar with Graph Protocol tooling, below are the network definitions to deploy subgraphs on Mantle. These settings can be configured in the subgraph.yaml
file:
For Mantle Andromeda Mainnet:
For Mantle Goerli Testnet:
For Mantle Sepolia Testnet:
1. Get started by install the Graph cli
Download the Graph Cli to cli
2. Authentication with API key
Create an API key at https://subgraph.mantle.xyz/dashboard/api
Authenticate using the Graph Cli and API key.
Note: You need to specify the Mantle deployment endpoint. Your API key should only be used for the Mantle deployment endpoint.
Copy your API key when promoted by the command line
3. Generate types and mappings for your subgraph
Go to your subgraph root directory where
subgraph.yaml
file is located.
Run the following command to generate types and mapping for your subgraph project
4. Compile your subgraph
Run the following command to compile your subgraph into WASM (WebAssembly).
5. Create your subgraph on Mantle Subgraph
Run the following command to create a subgraph entry on the Mantle Subgraph Service. Note that this step only registers a subgraph and does not deploy the actual subgraph in the Mantle Subgraph service. Note: you need to use
--node
flag to specify the Mantle deployment endpoint.
6. Deploy your subgraph to Mantle Subgraph
Run the following command to deploy your subgraph to the Mantle Subgraph Service. Note: you need to use
--node
flag to specify the Mantle deployment endpoint in order to remove your subgraph from the Mantle Subgraph Service.
7. Remove your subgraph from Mantle Subgraph
Run the following command to remove/unregister your subgraph from the Mantle Subgraph Service.
Quick Start in the App
The Mantle Subgraph Web App also offers a concise guide to assist users in deploying their subgraphs effectively.
Last updated