0.4.1 • Published 1 month ago

@sovereign-sdk/indexer v0.4.1

Weekly downloads
-
License
-
Repository
github
Last release
1 month ago

@sovereign-sdk/indexer

An extendable indexer for Sovereign SDK rollups written in TypeScript.

Running

With your database accessible & rollup running the indexer can be started like so:

DATABASE_URL="postgres://YOUR_DB_STRING" npx @sovereign-sdk/indexer --rollup-url http://localhost:12346

Database Setup

The indexer expects the database to have the events table structure as defined in db/create_events_table.sql. This table is used to store rollup events with their associated metadata, timestamps, and payload information.

Currently this package doesn't perform migration management or have any extra opinions about database schema so it can potentially connect to existing databases, this might change in the future though.

Local development

For local development of your rollup+application you might want to have the indexer run against a local postgres database, the following section provides instructions on how to do this.

Prerequisites

  • Docker installed on your system
  • Docker daemon running

Setup Steps

  1. Pull the official Postgres Docker image:
docker pull postgres
  1. Create and start a Postgres container:
docker run --name sov-indexer-db \
  -e POSTGRES_PASSWORD=admin123 \
  -d \
  -p 5432:5432 \
  postgres

Note: If you change the password, make sure to update it in the dev npm script connection string as well.

  1. Verify the container is running:
docker ps
  1. If you need to start an existing container later:
docker start sov-indexer-db
  1. Initialize the database schema:
docker exec -i sov-indexer-db psql -U postgres < ./db/create_events_table.sql

Connection Details

  • Host: localhost
  • Port: 5432
  • Username: postgres
  • Password: admin123
  • Database: postgres

Useful Docker Commands

Stop the container:

docker stop sov-indexer-db

Remove the container (will delete all data):

docker rm sov-indexer-db

View container logs:

docker logs sov-indexer-db
0.4.1

1 month ago

0.4.0

2 months ago

0.3.0

2 months ago

0.2.0

3 months ago

0.1.2

3 months ago

0.1.1

3 months ago