Skip to content

Commit 0729952

Browse files
committed
init: Make available networks a constant
1 parent 4145017 commit 0729952

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/commands/init.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const { validateContract } = require('../validation')
2020
const Protocol = require('../protocols')
2121

2222
const protocolChoices = Array.from(Protocol.availableProtocols().keys())
23+
const availableNetworks = Protocol.availableNetworks()
2324

2425
const HELP = `
2526
${chalk.bold('graph init')} [options] [subgraph-name] [directory]
@@ -47,12 +48,12 @@ ${chalk.dim('Options for --from-contract:')}
4748
${chalk.dim.underline('Ethereum:')}
4849
4950
--abi <path> Path to the contract ABI (default: download from Etherscan)
50-
--network <${Protocol.availableNetworks().get('ethereum').join('|')}>
51+
--network <${availableNetworks.get('ethereum').join('|')}>
5152
Selects the network the contract is deployed to
5253
5354
${chalk.dim.underline('NEAR:')}
5455
55-
--network <${Protocol.availableNetworks().get('near').join('|')}>
56+
--network <${availableNetworks.get('near').join('|')}>
5657
Selects the network the contract is deployed to
5758
`
5859

@@ -156,7 +157,7 @@ const processInitForm = async (
156157
name: 'network',
157158
message: () => `${protocolInstance.displayName()} network`,
158159
choices: () =>
159-
Protocol.availableNetworks() // TODO: this should be a constant in the top of the file.
160+
availableNetworks
160161
.get(protocol) // Get networks related to the chosen protocol.
161162
.toArray(), // Needed because of gluegun. It can't even receive a JS iterable.
162163
skip: fromExample !== undefined,

0 commit comments

Comments
 (0)