LimeChain / giant-squid-main

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Setup

Prerequisites

  • Node >=20
  • Nvm
  • Install SubSquid CLI:
 npm i -g @subsquid/cli@latest
  • Install Docker Desktop

  • Install PgAdmin 4

  • Register on Dwellir to get a CHAIN_RPC_ENDPOINT URL (It supports most chains)

  • Make a new .env file (Copy .env.example)

Run the project

  • Build:
sqd build
  • Build the DB:
sqd up
  • Run:
sqd process

TIPS

If you're using VSCode - Enable format on save with Prettier

On code change, to apply changes:

sqd build && sqd process

PgAdmin 4 Configuration

To connect locally to the DB when you register a new DB, you need to configure the following:

Name: DB_NAME
Host name/address: localhost
Port: DB_PORT
Password: DB_PASS

Development (Example - Subject to change)

Adding a new chain

  1. Go to chain/ and create a new folder with the chain name
  2. Create a metadata.json file with the pallets that will be used (Refer to template folder)
  3. Run sqd typegen - to generate class types for the chain
  4. Go to chain/{chainName}/ and create a decoders folder inside with events and calls subfolders (Refer to the templates folder)
  5. Implement the pallet calls and events decoding in the corresponding folders (Refer to the templates folder)

Adding a new pallet (Example with current structure - subject to change)

  1. Figure out pallet flow
  2. Create/Update DB schema
  3. Apply migration
  4. Import in registry.ts the Handlers
  5. Implement each pallet action in the indexer/actions folder (Could split the code in the actions folder)

About

License:GNU General Public License v3.0


Languages

Language:TypeScript 99.7%Language:JavaScript 0.2%Language:Shell 0.1%