graph-tooling icon indicating copy to clipboard operation
graph-tooling copied to clipboard

On the init command, scaffold the subgraph with the contracts names of the ABIs

Open eboadom opened this issue 5 years ago • 5 comments

Currently the execution of graph init generates ABI's with the name Contract because of this https://github.com/graphprotocol/graph-cli/blob/3a9a5a972795029b63843761171fd7687e12fd8f/src/commands/init.js#L190 Could be good to apply take as name the filename of the ABI instead of Contract, or even introduce another cli option on graph init to control that.

eboadom avatar Aug 09 '19 13:08 eboadom

I'm not aware of any ABI files that contain the contract name, although there may be some. I agree a --contract-name or --abi-name CLI flag could work.

This could be a neat little thing to hack on for anyone looking to get their feet wet in the CLI codebase.

Jannis avatar Aug 12 '19 09:08 Jannis

I have no problem to submit a PR if you want @Jannis

eboadom avatar Aug 12 '19 15:08 eboadom

@ernesto-usal That would be awesome! 😄

Jannis avatar Aug 12 '19 16:08 Jannis

We could add support for Hardhat (and others?) artifacts where the contract name and abi are in one file. Example of such a file is:

{
  "_format": "hh-sol-artifact-1",
  "contractName": "MyNFT",
  "sourceName": "contracts/MyNFT.sol",
  "abi": [
    {
      "inputs": [],
      "stateMutability": "nonpayable",
      "type": "constructor"
    },
// ...

schmidsi avatar Feb 28 '23 17:02 schmidsi

Is anyone working on the issue?

Lucifer0x17 avatar Sep 21 '23 17:09 Lucifer0x17