UNPKG

@graphprotocol/graph-cli

Version:

CLI for building for and deploying to The Graph

1,015 lines • 29.1 kB
{ "commands": { "add": { "aliases": [], "args": { "address": { "description": "The contract address", "name": "address", "required": true }, "subgraph-manifest": { "default": "subgraph.yaml", "name": "subgraph-manifest" } }, "description": "Adds a new datasource to a subgraph.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "abi": { "name": "abi", "summary": "Path to the contract ABI. If not provided, will be fetched from contract API.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "start-block": { "name": "start-block", "summary": "The block number to start indexing events from. If not provided, will be fetched from contract API", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "contract-name": { "name": "contract-name", "summary": "Name of the contract. If not provided, will be fetched from contract API", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "merge-entities": { "name": "merge-entities", "summary": "Whether to merge entities with the same name.", "allowNo": false, "type": "boolean" }, "network-file": { "name": "network-file", "summary": "Networks config file path.", "default": "networks.json", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "add", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "add.js" ] }, "auth": { "aliases": [], "args": { "deploy-key": { "name": "deploy-key" } }, "description": "Sets the deploy key to use when deploying to a Graph node.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "auth", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "auth.js" ] }, "build": { "aliases": [], "args": { "subgraph-manifest": { "default": "subgraph.yaml", "name": "subgraph-manifest" } }, "description": "Builds a subgraph and (optionally) uploads it to IPFS.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "ipfs": { "char": "i", "name": "ipfs", "summary": "Upload build results to an IPFS node.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "output-dir": { "char": "o", "name": "output-dir", "summary": "Output directory for build results.", "default": "build/", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "output-format": { "char": "t", "name": "output-format", "summary": "Output format for mappings.", "default": "wasm", "hasDynamicHelp": false, "multiple": false, "options": [ "wasm", "wast" ], "type": "option" }, "skip-migrations": { "name": "skip-migrations", "summary": "Skip subgraph migrations.", "allowNo": false, "type": "boolean" }, "watch": { "char": "w", "name": "watch", "summary": "Regenerate types when subgraph files change.", "allowNo": false, "type": "boolean" }, "network": { "name": "network", "summary": "Network configuration to use from the networks config file.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "network-file": { "name": "network-file", "summary": "Networks config file path.", "default": "networks.json", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "build", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "build.js" ] }, "clean": { "aliases": [], "args": {}, "description": "Clean the cache and generated files.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "codegen-dir": { "name": "codegen-dir", "summary": "Directory where the \"graph codegen\" code is stored.", "default": "generated/", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "build-dir": { "name": "build-dir", "summary": "Directory where the \"graph build\" code is stored.", "default": "build/", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "clean", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "clean.js" ] }, "codegen": { "aliases": [], "args": { "subgraph-manifest": { "default": "subgraph.yaml", "name": "subgraph-manifest" } }, "description": "Generates AssemblyScript types for a subgraph.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "output-dir": { "char": "o", "name": "output-dir", "summary": "Output directory for generated types.", "default": "generated/", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "skip-migrations": { "name": "skip-migrations", "summary": "Skip subgraph migrations.", "allowNo": false, "type": "boolean" }, "watch": { "char": "w", "name": "watch", "summary": "Regenerate types when subgraph files change.", "allowNo": false, "type": "boolean" }, "uncrashable": { "char": "u", "name": "uncrashable", "summary": "Generate Float Subgraph Uncrashable helper file.", "allowNo": false, "type": "boolean" }, "ipfs": { "char": "i", "hidden": true, "name": "ipfs", "summary": "IPFS node to use for fetching subgraph data.", "default": "https://api.thegraph.com/ipfs/api/v0", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "uncrashable-config": { "aliases": [ "uc" ], "dependsOn": [ "uncrashable" ], "name": "uncrashable-config", "summary": "Directory for uncrashable config.", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "codegen", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "codegen.js" ] }, "create": { "aliases": [], "args": { "subgraph-name": { "name": "subgraph-name", "required": true } }, "deprecationOptions": { "message": "In next major version, this command will be merged as a subcommand for `graph local`." }, "description": "Registers a subgraph name", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "node": { "char": "g", "name": "node", "required": true, "summary": "Graph node to create the subgraph in.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "access-token": { "name": "access-token", "summary": "Graph access token.", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "create", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "state": "deprecated", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "create.js" ] }, "deploy": { "aliases": [], "args": { "subgraph-name": { "name": "subgraph-name" }, "subgraph-manifest": { "default": "subgraph.yaml", "name": "subgraph-manifest" } }, "description": "Deploys a subgraph to a Graph node.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "node": { "char": "g", "name": "node", "summary": "Graph node for which to initialize.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "deploy-key": { "exclusive": [ "access-token" ], "name": "deploy-key", "summary": "User deploy key.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "access-token": { "deprecated": { "to": "deploy-key", "message": "In next version, we are removing this flag in favor of '--deploy-key'" }, "exclusive": [ "deploy-key" ], "name": "access-token", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "version-label": { "char": "l", "name": "version-label", "summary": "Version label used for the deployment.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "ipfs": { "char": "i", "name": "ipfs", "summary": "Upload build results to an IPFS node.", "default": "https://api.thegraph.com/ipfs/api/v0", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "ipfs-hash": { "name": "ipfs-hash", "required": false, "summary": "IPFS hash of the subgraph manifest to deploy.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "headers": { "aliases": [ "hdr" ], "name": "headers", "summary": "Add custom headers that will be used by the IPFS HTTP client.", "default": {}, "hasDynamicHelp": false, "multiple": false, "type": "option" }, "debug-fork": { "name": "debug-fork", "summary": "ID of a remote subgraph whose store will be GraphQL queried.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "output-dir": { "char": "o", "name": "output-dir", "summary": "Output directory for build results.", "default": "build/", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "skip-migrations": { "name": "skip-migrations", "summary": "Skip subgraph migrations.", "allowNo": false, "type": "boolean" }, "watch": { "char": "w", "name": "watch", "summary": "Regenerate types when subgraph files change.", "allowNo": false, "type": "boolean" }, "network": { "name": "network", "summary": "Network configuration to use from the networks config file.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "network-file": { "name": "network-file", "summary": "Networks config file path.", "default": "networks.json", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "deploy", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "deploy.js" ] }, "init": { "aliases": [], "args": { "subgraphName": { "name": "subgraphName" }, "directory": { "name": "directory" } }, "description": "Creates a new subgraph with basic scaffolding.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "protocol": { "name": "protocol", "hasDynamicHelp": false, "multiple": false, "options": [ "arweave", "ethereum", "near", "cosmos", "substreams", "subgraph" ], "type": "option" }, "node": { "char": "g", "name": "node", "summary": "Graph node for which to initialize.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "from-contract": { "description": "Creates a scaffold based on an existing contract.", "exclusive": [ "from-example" ], "name": "from-contract", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "from-example": { "description": "Creates a scaffold based on an example subgraph.", "exclusive": [ "from-contract", "spkg" ], "name": "from-example", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "contract-name": { "dependsOn": [ "from-contract" ], "description": "Name of the contract.", "helpGroup": "Scaffold from contract", "name": "contract-name", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "index-events": { "dependsOn": [ "from-contract" ], "description": "Index contract events as entities.", "helpGroup": "Scaffold from contract", "name": "index-events", "allowNo": false, "type": "boolean" }, "skip-install": { "name": "skip-install", "summary": "Skip installing dependencies.", "allowNo": false, "type": "boolean" }, "skip-git": { "name": "skip-git", "summary": "Skip initializing a Git repository.", "allowNo": false, "type": "boolean" }, "start-block": { "dependsOn": [ "from-contract" ], "description": "Block number to start indexing from.", "helpGroup": "Scaffold from contract", "name": "start-block", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "abi": { "dependsOn": [ "from-contract" ], "name": "abi", "summary": "Path to the contract ABI", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "spkg": { "name": "spkg", "summary": "Path to the SPKG file", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "network": { "description": "Refer to https://github.com/graphprotocol/networks-registry/ for supported networks", "name": "network", "summary": "Network the contract is deployed to.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "ipfs": { "char": "i", "hidden": true, "name": "ipfs", "summary": "IPFS node to use for fetching subgraph data.", "default": "https://api.thegraph.com/ipfs/api/v0", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "init", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "init.js" ] }, "local": { "aliases": [], "args": { "local-command": { "name": "local-command", "required": true } }, "description": "Runs local tests against a Graph Node environment (using Ganache by default).", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "node-logs": { "name": "node-logs", "summary": "Print the Graph Node logs.", "allowNo": false, "type": "boolean" }, "ethereum-logs": { "name": "ethereum-logs", "summary": "Print the Ethereum logs.", "allowNo": false, "type": "boolean" }, "compose-file": { "name": "compose-file", "summary": "Custom Docker Compose file for additional services.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "node-image": { "name": "node-image", "summary": "Custom Graph Node image to test against.", "default": "graphprotocol/graph-node:latest", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "standalone-node": { "name": "standalone-node", "summary": "Use a standalone Graph Node outside Docker Compose.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "standalone-node-args": { "dependsOn": [ "standalone-node" ], "name": "standalone-node-args", "summary": "Custom arguments to be passed to the standalone Graph Node.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "skip-wait-for-ipfs": { "name": "skip-wait-for-ipfs", "summary": "Don't wait for IPFS to be up at localhost:15001", "allowNo": false, "type": "boolean" }, "skip-wait-for-ethereum": { "name": "skip-wait-for-ethereum", "summary": "Don't wait for Ethereum to be up at localhost:18545", "allowNo": false, "type": "boolean" }, "skip-wait-for-etherium": { "deprecated": { "message": "Use --skip-wait-for-ethereum instead" }, "name": "skip-wait-for-etherium", "summary": "Don't wait for Ethereum to be up at localhost:18545", "allowNo": false, "type": "boolean" }, "skip-wait-for-postgres": { "name": "skip-wait-for-postgres", "summary": "Don't wait for Postgres to be up at localhost:15432", "allowNo": false, "type": "boolean" }, "timeout": { "name": "timeout", "summary": "Time to wait for service containers in milliseconds.", "default": 120000, "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "local", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "local.js" ] }, "publish": { "aliases": [], "args": { "subgraph-manifest": { "default": "subgraph.yaml", "name": "subgraph-manifest" } }, "description": "Publish to the Graph Network", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "subgraph-id": { "name": "subgraph-id", "required": false, "summary": "Subgraph ID to publish to.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "protocol-network": { "name": "protocol-network", "required": false, "summary": "The network to use for the subgraph deployment.", "default": "arbitrum-one", "hasDynamicHelp": false, "multiple": false, "options": [ "arbitrum-one", "arbitrum-sepolia" ], "type": "option" }, "ipfs": { "char": "i", "name": "ipfs", "summary": "Upload build results to an IPFS node.", "default": "https://api.thegraph.com/ipfs/api/v0", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "ipfs-hash": { "name": "ipfs-hash", "required": false, "summary": "IPFS hash of the subgraph manifest to deploy.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "webapp-url": { "name": "webapp-url", "required": false, "summary": "URL of the web UI you want to use to deploy.", "default": "https://cli.thegraph.com/publish", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "api-key": { "name": "api-key", "required": false, "summary": "The API key to use for the Subgraph queries.", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "publish", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "publish.js" ] }, "remove": { "aliases": [], "args": { "subgraph-name": { "name": "subgraph-name", "required": true } }, "deprecationOptions": { "message": "In next major version, this command will be merged as a subcommand for `graph local`." }, "description": "Unregisters a subgraph name", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "node": { "char": "g", "name": "node", "required": true, "summary": "Graph node to delete the subgraph from.", "hasDynamicHelp": false, "multiple": false, "type": "option" }, "access-token": { "name": "access-token", "summary": "Graph access token.", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "remove", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "state": "deprecated", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "remove.js" ] }, "test": { "aliases": [], "args": { "datasource": { "name": "datasource" } }, "description": "Runs rust binary for subgraph testing.", "flags": { "help": { "char": "h", "description": "Show CLI help.", "name": "help", "allowNo": false, "type": "boolean" }, "coverage": { "char": "c", "name": "coverage", "summary": "Run the tests in coverage mode.", "allowNo": false, "type": "boolean" }, "docker": { "char": "d", "name": "docker", "summary": "Run the tests in a docker container (Note: Please execute from the root folder of the subgraph).", "allowNo": false, "type": "boolean" }, "force": { "char": "f", "name": "force", "summary": "Binary - overwrites folder + file when downloading. Docker - rebuilds the docker image.", "allowNo": false, "type": "boolean" }, "logs": { "char": "l", "name": "logs", "summary": "Logs to the console information about the OS, CPU model and download url (debugging purposes).", "allowNo": false, "type": "boolean" }, "recompile": { "char": "r", "name": "recompile", "summary": "Force-recompile tests.", "allowNo": false, "type": "boolean" }, "version": { "char": "v", "name": "version", "summary": "Choose the version of the rust binary that you want to be downloaded/used.", "hasDynamicHelp": false, "multiple": false, "type": "option" } }, "hasDynamicHelp": false, "hiddenAliases": [], "id": "test", "pluginAlias": "@graphprotocol/graph-cli", "pluginName": "@graphprotocol/graph-cli", "pluginType": "core", "strict": true, "enableJsonFlag": false, "isESM": true, "relativePath": [ "dist", "commands", "test.js" ] } }, "version": "0.96.0-alpha-20250211183825-802768a7b811892d1c945e88491926e436413436" }