Allow network `localhost` during `graph init`
When I try to initialize a subgraph, I'm forced to select a public chain from the registry. It's a pretty common use-case to start developing a subgraph against a local hardhat/anvil node.
$ graph init
› Warning: In next major version, this flag will be removed. By default we will
› stop initializing a Git repository.
? Network … localhost
Other · other network not on the list
< 112 more - type to filter >
Selecting other exits the wizard:
graph init
› Warning: In next major version, this flag will be removed. By default we will
› stop initializing a Git repository.
✔ Network · N/A
The chain list is populated from the Networks Registry:
https://github.com/graphprotocol/networks-registry
To add a chain to the registry you can create an issue or submit a PR
It should continue the flow but forcing to specify a path to an ABI file instead of trying to download the ABI from a blockexplorer in my opinion.
Good point.
I like having "Other" option that gives you a way out if you can't find the chain you are looking for. From UX perspective.
Perhaps we can add "Local Node" as an option here.
Just checked earlier versions of graph cli and not seeing "localhost" option. How was it handled before?
It wasn't. It's a new feature request.
Based on further discussions with @p-diogo the flow should go like this:
- User selects "Other" or "Custom" network
- Enters custom network ID with default being "localhost"
- Gets a warning with a suggestion to add this network to the registry
- Manually specifies ABI path, start block and contract name
I think it would also be useful to specify a protocol (like ethereum) with a custom RPC. This could be useful if you're running a permissioned (therefore not a well known) network.
Yup. I need that to be to handle locally run test network like https://0xspaceshard.github.io/starknet-devnet/
Is there any alternative at the moment?
Without it, it just means I cannot use the same indexer for my CI, test and for my production release. Which to me is a deal breaker. I don't want to have to support two indexers for the same chain.