Creating a Subgraph
💡 If you already have a subgraph and are looking to deploy it on Satsuma, see Subgraph Deploys.
Creating the subgraph
Install the
graph-cli
:Create a new subgraph.
To create a subgraph from scratch:
To create a subgraph that indexes all events of an existing contract:
The ABI will be fetched from Etherscan. If it can't be found, the
--abi
file will need to be specified.
Modifying the subgraph
Add new datasources with the
graph add
command.Write your GraphQL schema in
schema.graphql
.Add new mappings, entities, and event handlers.
Add mappings to datasources in the
subgraph.yml
manifest that tell the indexer which handlers to call when triggers occur.Write the corresponding handlers.
For more details, see these docs.
Last updated