CLI for SubQuery
$ npm install -g @subql/cli
$ subql COMMAND
running command...
$ subql (--version)
@subql/cli/6.6.3-0 linux-x64 node-v24.11.1
$ subql --help [COMMAND]
USAGE
$ subql COMMAND
...subql build [LOCATION]subql build-manifest [LOCATION]subql codegen [LOCATION]subql codegen:import-abi LOCATIONsubql import-abi LOCATIONsubql init NAMEsubql mcpsubql migratesubql multi-chain:add [LOCATION]subql network:add-deployment-boostsubql network:connect-walletsubql network:create-api-key NAMEsubql network:create-deploymentsubql network:create-flex-plansubql network:create-projectsubql network:disconnect-walletsubql network:list-account-boostssubql network:list-api-keyssubql network:list-deployment-boostssubql network:list-deployment-indexerssubql network:list-deploymentssubql network:list-flex-planssubql network:list-projectssubql network:remove-api-key NAMEsubql network:remove-deployment-boostsubql network:stop-flex-plansubql network:swap-deployment-boostsubql onfinality:create-deploymentsubql onfinality:create-multichain-deployment [LOCATION]subql onfinality:create-projectsubql onfinality:delete-deploymentsubql onfinality:delete-projectsubql onfinality:promote-deploymentsubql publish [LOCATION]
Build this SubQuery project code into a bundle
USAGE
$ subql build [LOCATION] [--output <value>]
ARGUMENTS
LOCATION The path to the project, this can be a directory or a project manifest file.
FLAGS
--output=<value> [default: dist] The output location relative to the location
DESCRIPTION
Build this SubQuery project code into a bundle
See code: src/commands/build.ts
Build TypeScript manifest file to YAML (generates project.yaml from project.ts)
USAGE
$ subql build-manifest [LOCATION]
ARGUMENTS
LOCATION The path to the project, this can be a directory or a project manifest file.
DESCRIPTION
Build TypeScript manifest file to YAML (generates project.yaml from project.ts)
See code: src/commands/build-manifest.ts
Generate entity types from the GraphQL schema and contract interfaces
USAGE
$ subql codegen [LOCATION]
ARGUMENTS
LOCATION The project directory or path to project manifest.
DESCRIPTION
Generate entity types from the GraphQL schema and contract interfaces
See code: src/commands/codegen/index.ts
Import and ABI to generate project handlers and mapping functions based on an Ethereum ABI. If address is provided, it will attempt to fetch the ABI and start block from the Etherscan.
USAGE
$ subql codegen:import-abi LOCATION [--address <value>] [--abiName <value>] [--startBlock <value>] [--abiPath <value>]
[--events <value>] [--functions <value>]
ARGUMENTS
LOCATION The path to the project, this can be a directory or a project manifest file.
FLAGS
--abiName=<value> The contracts name, if not provided, the contract address will be used if the ABI is fetched
from Etherscan
--abiPath=<value> The path to the ABI file
--address=<value> The contracts address
--events=<value> ABI events to generate handlers for. Use '*' for all. e.g. --events="approval, transfer"
--functions=<value> ABI functions to generate handlers for. Use '*' for all. e.g. --functions="approval, transfer"
--startBlock=<value> The start block of the handler, generally the block the contract is deployed.
DESCRIPTION
Import and ABI to generate project handlers and mapping functions based on an Ethereum ABI. If address is provided, it
will attempt to fetch the ABI and start block from the Etherscan.
ALIASES
$ subql import-abi
See code: src/commands/codegen/import-abi.ts
Import and ABI to generate project handlers and mapping functions based on an Ethereum ABI. If address is provided, it will attempt to fetch the ABI and start block from the Etherscan.
USAGE
$ subql import-abi LOCATION [--address <value>] [--abiName <value>] [--startBlock <value>] [--abiPath <value>]
[--events <value>] [--functions <value>]
ARGUMENTS
LOCATION The path to the project, this can be a directory or a project manifest file.
FLAGS
--abiName=<value> The contracts name, if not provided, the contract address will be used if the ABI is fetched
from Etherscan
--abiPath=<value> The path to the ABI file
--address=<value> The contracts address
--events=<value> ABI events to generate handlers for. Use '*' for all. e.g. --events="approval, transfer"
--functions=<value> ABI functions to generate handlers for. Use '*' for all. e.g. --functions="approval, transfer"
--startBlock=<value> The start block of the handler, generally the block the contract is deployed.
DESCRIPTION
Import and ABI to generate project handlers and mapping functions based on an Ethereum ABI. If address is provided, it
will attempt to fetch the ABI and start block from the Etherscan.
ALIASES
$ subql import-abi
Initialize a SubQuery project from a template
USAGE
$ subql init NAME [--location <value>] [--network <value>] [--networkFamily <value>] [--endpoint
<value>] [--installDependencies] [--packageManager npm|yarn|pnpm] [--author <value>]
ARGUMENTS
NAME The name of the project to create
FLAGS
--author=<value> The project author that will be set in package.json. Defaults to the current system user
--endpoint=<value> The RPC endpoint that the project will use
--installDependencies Install the dependencies of the project
--location=<value> The path to the project, this can be a directory or a project manifest file.
--network=<value> The name of the network the project will index data for
--networkFamily=<value> The network family the project will index data for, e.g. EVM, Substrate
--packageManager=<option> [default: npm]
<options: npm|yarn|pnpm>
DESCRIPTION
Initialize a SubQuery project from a template
See code: src/commands/init.ts
Runs an MCP (Model Context Protocol) server over stdio
USAGE
$ subql mcp
DESCRIPTION
Runs an MCP (Model Context Protocol) server over stdio
See code: src/commands/mcp.ts
Migrate a Subgraph project to a SubQuery project, including the manifest and schema.
USAGE
$ subql migrate --input <value> --output <value> [--gitSubDirectory <value>]
FLAGS
--gitSubDirectory=<value> A subdirectory in the git repo if the input is a git repo
--input=<value> (required) A directory or git repo to a subgraph project
--output=<value> (required) The location of the SubQuery project
DESCRIPTION
Migrate a Subgraph project to a SubQuery project, including the manifest and schema.
See code: src/commands/migrate.ts
Add new chain manifest to multi-chain project
USAGE
$ subql multi-chain:add [LOCATION] --chainManifestFile <value>
ARGUMENTS
LOCATION The path to the multichain project, this can be a directory or a multichain manifest file.
FLAGS
--chainManifestFile=<value> (required) The path to the new chain manifest
DESCRIPTION
Add new chain manifest to multi-chain project
See code: src/commands/multi-chain/add.ts
Increase the boost for a deployment
USAGE
$ subql network:add-deployment-boost --network mainnet|testnet-mumbai|testnet|local --deploymentId <value> --amount
<value>
FLAGS
--amount=<value> (required) The amount to boost the deployment with, in SQT
--deploymentId=<value> (required) The deployment id for the project
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Increase the boost for a deployment
See code: src/commands/network/add-deployment-boost.ts
Connect a wallet via Wallet Connect for interacting with the network
USAGE
$ subql network:connect-wallet
DESCRIPTION
Connect a wallet via Wallet Connect for interacting with the network
See code: src/commands/network/connect-wallet.ts
Create an API key for making queries via the SubQuery Network
USAGE
$ subql network:create-api-key NAME --network mainnet|testnet-mumbai|testnet|local
ARGUMENTS
NAME The name of the api key, used to identify it
FLAGS
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Create an API key for making queries via the SubQuery Network
See code: src/commands/network/create-api-key.ts
Create a new deployment for a SubQuery project
USAGE
$ subql network:create-deployment --network mainnet|testnet-mumbai|testnet|local --projectId <value> --deploymentId <value>
--deploymentVersion <value> [--deploymentDescription <value>]
FLAGS
--deploymentDescription=<value> A description of the deployment, release notes
--deploymentId=<value> (required) The IPFS CID of the published project
--deploymentVersion=<value> (required) The version of the deployment
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
--projectId=<value> (required) The project id, this should be a 0x prefixed hex number
DESCRIPTION
Create a new deployment for a SubQuery project
See code: src/commands/network/create-deployment.ts
Create a new Flex Plan for querying a SubQuery deployment on the SubQuery Network
USAGE
$ subql network:create-flex-plan --network mainnet|testnet-mumbai|testnet|local --deploymentId <value> --amount
<value>
FLAGS
--amount=<value> (required) The amount to deposit into the plan, in SQT
--deploymentId=<value> (required) The deploymentId to create a flex plan for
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Create a new Flex Plan for querying a SubQuery deployment on the SubQuery Network
See code: src/commands/network/create-flex-plan.ts
Create a new SubQuery project on the SubQuery network
USAGE
$ subql network:create-project --network mainnet|testnet-mumbai|testnet|local --deploymentId <value> --projectType
0|1|2|3|SUBQUERY|RPC|SQ_DICT|SUBGRAPH --name <value> [--description <value>] [--image <value>] [--tags <value>...]
[--website <value>] [--codeRepository <value>] [--deploymentVersion <value>] [--deploymentDescription <value>]
FLAGS
--codeRepository=<value> A URL to the project code repository
--deploymentDescription=<value> A description of the deployment, release notes
--deploymentId=<value> (required) The IPFS CID of the published project
--deploymentVersion=<value> [default: 1.0.0] The version of the deployment
--description=<value> A short description of the project
--image=<value> A URL to an image for the project
--name=<value> (required) The name of the project
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
--projectType=<option> (required)
<options: 0|1|2|3|SUBQUERY|RPC|SQ_DICT|SUBGRAPH>
--tags=<value>... A list of tags for the project
--website=<value> A URL to the project website
DESCRIPTION
Create a new SubQuery project on the SubQuery network
See code: src/commands/network/create-project.ts
Disconnect a wallet connected via WalletConnect
USAGE
$ subql network:disconnect-wallet
DESCRIPTION
Disconnect a wallet connected via WalletConnect
See code: src/commands/network/disconnect-wallet.ts
Get a list of the deployments an account boosts
USAGE
$ subql network:list-account-boosts --network mainnet|testnet-mumbai|testnet|local [--address <value>]
FLAGS
--address=<value> The account address to list boosts for
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Get a list of the deployments an account boosts
See code: src/commands/network/list-account-boosts.ts
List API keys for making queries via the SubQuery Network
USAGE
$ subql network:list-api-keys --network mainnet|testnet-mumbai|testnet|local
FLAGS
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
List API keys for making queries via the SubQuery Network
See code: src/commands/network/list-api-keys.ts
Get a list of boosts made to a project deployment
USAGE
$ subql network:list-deployment-boosts --network mainnet|testnet-mumbai|testnet|local --deploymentId <value>
FLAGS
--deploymentId=<value> (required) The deployment id for the project
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Get a list of boosts made to a project deployment
See code: src/commands/network/list-deployment-boosts.ts
List the indexers for a deployment on the SubQuery Network
USAGE
$ subql network:list-deployment-indexers --network mainnet|testnet-mumbai|testnet|local --deploymentId <value>
FLAGS
--deploymentId=<value> (required) The DeploymentID of the project to list deployments for
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
List the indexers for a deployment on the SubQuery Network
See code: src/commands/network/list-deployment-indexers.ts
List deployments for a SubQuery project
USAGE
$ subql network:list-deployments --network mainnet|testnet-mumbai|testnet|local --projectId <value>
FLAGS
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
--projectId=<value> (required) The ID of the project to list deployments for
DESCRIPTION
List deployments for a SubQuery project
See code: src/commands/network/list-deployments.ts
List your Flex Plans for querying projects on the SubQuery Network
USAGE
$ subql network:list-flex-plans --network mainnet|testnet-mumbai|testnet|local [--address <value>]
FLAGS
--address=<value> The account address to list boosts for
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
List your Flex Plans for querying projects on the SubQuery Network
See code: src/commands/network/list-flex-plans.ts
List projects for a given account on then SubQuery network
USAGE
$ subql network:list-projects --network mainnet|testnet-mumbai|testnet|local [--address <value>] [--networkRpc
<value>]
FLAGS
--address=<value> The address of the account that owns the projects
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
--networkRpc=<value> Override the network rpc url
DESCRIPTION
List projects for a given account on then SubQuery network
See code: src/commands/network/list-projects.ts
Remove an API key used for making queries via the SubQuery Network
USAGE
$ subql network:remove-api-key NAME --network mainnet|testnet-mumbai|testnet|local
ARGUMENTS
NAME The name of the api key, used to identify it
FLAGS
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Remove an API key used for making queries via the SubQuery Network
See code: src/commands/network/remove-api-key.ts
Decrease the boost amount for a project deployment on the SubQuery network
USAGE
$ subql network:remove-deployment-boost --network mainnet|testnet-mumbai|testnet|local --deploymentId <value> --amount
<value>
FLAGS
--amount=<value> (required) The amount of boost to remove from the deployment, in SQT
--deploymentId=<value> (required) The deployment id for the project
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Decrease the boost amount for a project deployment on the SubQuery network
See code: src/commands/network/remove-deployment-boost.ts
Stop a Flex Plan for a deployment on the SubQuery Network
USAGE
$ subql network:stop-flex-plan --network mainnet|testnet-mumbai|testnet|local --deploymentId <value>
FLAGS
--deploymentId=<value> (required) The deploymentId to create a flex plan for
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
DESCRIPTION
Stop a Flex Plan for a deployment on the SubQuery Network
See code: src/commands/network/stop-flex-plan.ts
Swap the boost from one deployment to another deployment on the SubQuery Network
USAGE
$ subql network:swap-deployment-boost --network mainnet|testnet-mumbai|testnet|local --fromDeploymentId <value> --toDeploymentId
<value> --amount <value>
FLAGS
--amount=<value> (required) The amount to boost the deployment with, in SQT
--fromDeploymentId=<value> (required) The deployment id for the project that is already boosted
--network=<option> (required) [default: mainnet] The network to check.
<options: mainnet|testnet-mumbai|testnet|local>
--toDeploymentId=<value> (required) The deployment id for the project to move the boost to
DESCRIPTION
Swap the boost from one deployment to another deployment on the SubQuery Network
See code: src/commands/network/swap-deployment-boost.ts
Create a project deployment on the OnFinality managed services
USAGE
$ subql onfinality:create-deployment --org <value> --projectName <value> --type primary|stage --ipfsCID <value>
[--indexerVersion <value>] [--queryVersion <value>] [--dict <value>] [--endpoint <value>] [--indexerUnsafe]
[--indexerBatchSize <value>] [--indexerSubscription] [--disableHistorical] [--indexerUnfinalized]
[--indexerStoreCacheThreshold <value>] [--disableIndexerStoreCacheAsync] [--indexerWorkers <value>] [--queryUnsafe]
[--querySubscription] [--queryTimeout <value>] [--queryMaxConnection <value>] [--queryAggregate] [--queryLimit
<value>] [--useDefaults]
FLAGS
--dict=<value> A dictionary endpoint for this projects network
--disableHistorical Disable historical data indexing
--disableIndexerStoreCacheAsync Disable async store cache
--endpoint=<value> The RPC endpoint to be used by the project
--indexerBatchSize=<value> [default: 30] The batch size for the indexer
--indexerStoreCacheThreshold=<value> The number of items kept in the cache before flushing
--indexerSubscription Enable subscription for the indexer
--indexerUnfinalized Enable unfinalized blocks indexing
--indexerUnsafe Run the indexer in unsafe mode, this will disable some checks
--indexerVersion=<value> Indexer image version
--indexerWorkers=<value> The number of workers for the indexer
--ipfsCID=<value> (required) The IPFC CID of the published project
--org=<value> (required) The Github organization name
--projectName=<value> (required) Project name
--queryAggregate Enable aggregate queries
--queryLimit=<value> The maximum number of results for the query
--queryMaxConnection=<value> The maximum number of connections for the query
--querySubscription Enable subscription queries
--queryTimeout=<value> The timeout for the query
--queryUnsafe Run the query in unsafe mode, this will disable some checks
--queryVersion=<value> Query image version
--type=<option> (required) [default: primary]
<options: primary|stage>
--useDefaults Use default values for indexerVersion, queryVersion, dictionary, endpoint
DESCRIPTION
Create a project deployment on the OnFinality managed services
See code: src/commands/onfinality/create-deployment.ts
Create a multi-chain project deployment no the OnFinality managed services
USAGE
$ subql onfinality:create-multichain-deployment [LOCATION] --org <value> --projectName <value> --type primary|stage [--indexerVersion
<value>] [--queryVersion <value>] [--dict <value>] [--endpoint <value>] [--indexerUnsafe] [--indexerBatchSize
<value>] [--indexerSubscription] [--disableHistorical] [--indexerUnfinalized] [--indexerStoreCacheThreshold <value>]
[--disableIndexerStoreCacheAsync] [--indexerWorkers <value>] [--queryUnsafe] [--querySubscription] [--queryTimeout
<value>] [--queryMaxConnection <value>] [--queryAggregate] [--queryLimit <value>] [--useDefaults] [--ipfs <value>]
ARGUMENTS
LOCATION The path to the project, this can be a directory or a project manifest file.
FLAGS
--dict=<value> A dictionary endpoint for this projects network
--disableHistorical Disable historical data indexing
--disableIndexerStoreCacheAsync Disable async store cache
--endpoint=<value> The RPC endpoint to be used by the project
--indexerBatchSize=<value> [default: 30] The batch size for the indexer
--indexerStoreCacheThreshold=<value> The number of items kept in the cache before flushing
--indexerSubscription Enable subscription for the indexer
--indexerUnfinalized Enable unfinalized blocks indexing
--indexerUnsafe Run the indexer in unsafe mode, this will disable some checks
--indexerVersion=<value> Indexer image version
--indexerWorkers=<value> The number of workers for the indexer
--ipfs=<value> An additional IPFS endpoint to upload to
--org=<value> (required) The Github organization name
--projectName=<value> (required) Project name
--queryAggregate Enable aggregate queries
--queryLimit=<value> The maximum number of results for the query
--queryMaxConnection=<value> The maximum number of connections for the query
--querySubscription Enable subscription queries
--queryTimeout=<value> The timeout for the query
--queryUnsafe Run the query in unsafe mode, this will disable some checks
--queryVersion=<value> Query image version
--type=<option> (required) [default: primary]
<options: primary|stage>
--useDefaults Use default values for indexerVersion, queryVersion, dictionary, endpoint
DESCRIPTION
Create a multi-chain project deployment no the OnFinality managed services
See code: src/commands/onfinality/create-multichain-deployment.ts
Create a project on the OnFinality managed services
USAGE
$ subql onfinality:create-project --org <value> --projectName <value> [--logoURL <value>] [--subtitle <value>] [--description
<value>] [--dedicatedDB <value>] [--projectType subquery|subgraph]
FLAGS
--dedicatedDB=<value> Dedicated DataBase
--description=<value> Description
--logoURL=<value> Logo URL
--org=<value> (required) Github organization name
--projectName=<value> (required) Project name
--projectType=<option> [default: subquery] Project type [subquery|subgraph]
<options: subquery|subgraph>
--subtitle=<value> Subtitle
DESCRIPTION
Create a project on the OnFinality managed services
See code: src/commands/onfinality/create-project.ts
Delete a deployment from the OnFinality managed services
USAGE
$ subql onfinality:delete-deployment --org <value> --projectName <value> --deploymentID <value>
FLAGS
--deploymentID=<value> (required) Deployment ID
--org=<value> (required) Github organization name
--projectName=<value> (required) Project name
DESCRIPTION
Delete a deployment from the OnFinality managed services
See code: src/commands/onfinality/delete-deployment.ts
Delete a project on the OnFinality managed services
USAGE
$ subql onfinality:delete-project --org <value> --projectName <value>
FLAGS
--org=<value> (required) The Github organization name
--projectName=<value> (required) The project name
DESCRIPTION
Delete a project on the OnFinality managed services
See code: src/commands/onfinality/delete-project.ts
Promote a deployment on the OnFinality managed services from a Stage environment to Production
USAGE
$ subql onfinality:promote-deployment --org <value> --projectName <value> --deploymentID <value>
FLAGS
--deploymentID=<value> (required) Deployment ID
--org=<value> (required) Github organization name
--projectName=<value> (required) Project name
DESCRIPTION
Promote a deployment on the OnFinality managed services from a Stage environment to Production
See code: src/commands/onfinality/promote-deployment.ts
Upload this SubQuery project to IPFS for distribution
USAGE
$ subql publish [LOCATION] [--ipfs <value>] [--silent]
ARGUMENTS
LOCATION The path to the project, this can be a directory or a project manifest file.
FLAGS
--ipfs=<value> An additional IPFS endpoint to upload to
--silent Run the command without logging, only outputs the CIDs
DESCRIPTION
Upload this SubQuery project to IPFS for distribution
See code: src/commands/publish.ts