An experimental template is used to generate a squid indexing EVM logs and transactions of choice from a contract address. Supports automatic ABI lookups for public contracts using the Etherescan API
-
Install the Squid CLI
-
Init the template and install the dependcies
sqd init my-abi-squid --template https://github.com/subsquid/squid-abi-template
cd my-abi-squid
npm i
- Run
npx squid-gen-abi
with the appropriate flags.
Usage: ts-node generate/run.ts [options]
Options:
--address <contract> contract address
--archive <url> archive endpoint
--abi <path> (Optional) path or URL to the abi file. If omitted, the Etherscan API is used.
-e, --event <name...> one or multiple events to be indexed. '*' will index all events
-f, --function <name...>. one or multiple contract functions to be indexed. '*' will index all functions
--from <block> start indexing from the given block.
--etherscan-api <url> (Optional) an Etherscan-compatible API to fetch contract ABI by a known address. Default: https://api.etherscan.io/
- Build and run the squid
npm run build
make up
make migration
make process
The indexing will start.
In a separate window, start the GraphQL API server at localhost:4350/graphql
:
make serve
- Inspect
schema.graphql
,src/processor.ts
and start hacking!
For more details how to build and deploy a squid, see the docs.
npx squid-gen-abi \
--address 0x2E645469f354BB4F5c8a05B3b30A929361cf77eC \
--archive https://eth.archive.subsquid.io \
--event NewGravatar \
--event UpdatedGravatar \
--function createGravatar \
--from 6000000