streamingfast / substreams

Powerful Blockchain streaming data engine, based on StreamingFast Firehose technology.
Apache License 2.0
166 stars 46 forks source link

`substreams init` unable to provide local ABI file #554

Open maoueh opened 1 month ago

maoueh commented 1 month ago

I tried to generate the ABI for a contract on Ethereum Mainnet for which the ABI isn't verified. This proposed me to either provider either the ABI in JSON or the path to the JSON file:

  Cannot fetch the ABI for contract "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" (parsing Abi "Contract source code not verified": read abi: invalid character 'C' looking for beginning of value)

┃ Please paste the contract ABI or the full JSON ABI file path starting with file://fullpath/to/Abi.json: 

I provided /Users/maoueh/Downloads/uniswap-pool.abi.json but this fails with:

┃ Please paste the contract ABI or the full JSON ABI file path starting with file://fullpath/to/Abi.json: /Users/maoueh/Downloads/uniswap-pool.abi.json

  ABI "/Users/maoueh/Downloads/uniswap-pool.abi.json" isn't valid: "json: error calling MarshalJSON for type json.RawMessage: invalid character '/' looking for beginning of value"

I provided file:///Users/maoueh/Downloads/uniswap-pool.abi.json but this fails this time with a different message:

┃ Please paste the contract ABI or the full JSON ABI file path starting with file://fullpath/to/Abi.json: file:///Users/maoueh/Downloads/uniswap-pool.abi.json

  Cannot read the ABI file "/Users/maoueh/Downloads/uniswap-pool.abi.json": open /Users/maoueh/Downloads/uniswap-pool.abi.json: no such file or directory

On my disk the file is there and correct:

$ cat /Users/maoueh/Downloads/uniswap-pool.abi.json | jq '. | length'
36

Pasting the full JSON directly worked correctly.