This document describes how to setup your local working environment in order to develop Messari subgraphs.
- Node & npm
- Some development experience
- Technical knowledge of blockchains (especially evm)
- Knowledge of The Graph (our beginner RESOURCES.md file will be a good starting place)
After installing Nodejs and npm you are close to done with installing all of the development dependencies. There are a few other npm packages to install globally:
- graph-cli
- graph-ts
- messari-subgraph-cli (more on this in TOOLING.md)
- mustache
This is really all that you need, but you can read more about the graph packages here.
After cloning the repo and moving into the head of the repository you should install the project-level npm packages:
git clone https://github.com/messari/subgraphs.git
cd subgraphs
npm install
npm install
will install husky
in order to run some pre-commit hooks behind the scenes (mainly to format with prettier
). If you want to disable this for some reason you can run:
npm uninstall husky && git config --unset core.hooksPath
In general we follow Google's styling guide as best we can. A few pointers to get you started:
- Always opt for
const
overlet
unless you have to change the value of the variable. - Use constants when you are hardcoding a value and use
CONSTANT_CASE
. - Otherwise most variables should be in
camelCase
- File names should be in
camelCase
and we try to keep folder names to one word if possible. - To make your code more readable use early returns when things go wrong.
- When making a contract call you should always your
try...reverted
pattern outlined here.
From here you should be set to build, run, and deploy Messari subgraphs as outlined in WALKTHROUGH.md. Next you should familiarize yourself with the project structure and tooling. 🚀