diff --git a/packages/indexer-cli/src/commands/indexer/actions/approve.ts b/packages/indexer-cli/src/commands/indexer/actions/approve.ts index 00e71e197..e17a5b54c 100644 --- a/packages/indexer-cli/src/commands/indexer/actions/approve.ts +++ b/packages/indexer-cli/src/commands/indexer/actions/approve.ts @@ -7,17 +7,19 @@ import { fixParameters, printObjectOrArray, parseOutputFormat, + extractProtocolNetworkOption, } from '../../../command-helpers' import { approveActions, fetchActions } from '../../../actions' import { ActionStatus, resolveChainAlias } from '@graphprotocol/indexer-common' const HELP = ` ${chalk.bold('graph indexer actions approve')} [options] [ ...] -${chalk.bold('graph indexer actions approve')} [options] queued +${chalk.bold('graph indexer actions approve')} [options] queued --network ${chalk.dim('Options:')} -h, --help Show usage information + -n, --network Filter action selection by their protocol network (mainnet, arbitrum-one, goerli, arbitrum-goerli) -o, --output table|json|yaml Choose the output format: table (default), JSON, or YAML ` @@ -45,6 +47,7 @@ module.exports = { return } + const protocolNetwork = extractProtocolNetworkOption(parameters.options) let numericActionIDs: number[] const config = loadValidatedConfig() @@ -56,12 +59,19 @@ module.exports = { // If actionIDs is 'queued', then populate actionIDs with actions that are queued if (actionIDs.join() == 'queued') { + if (!protocolNetwork) { + throw new Error( + `Missing required option for approving queued actions: --network`, + ) + } const queuedActions = await fetchActions(client, { status: ActionStatus.QUEUED, + protocolNetwork, }) + numericActionIDs = queuedActions.map(action => action.id) if (numericActionIDs.length === 0) { - throw Error(`No 'queued' actions found`) + throw Error(`No 'queued' actions found for network '${protocolNetwork}'`) } } else { numericActionIDs = actionIDs.map(action => +action)