This is a blockchain indexer that listens for AccountCreated event emmited by Argents Account Contract. It captures owner and guardian owner, stores them in a MongoDB database, and exposes the indexed data through a GraphQL API.
Updated Version 2 Here => https://github.com/fishonamos/strkindex/tree/apiv2
- Blockchain Event Listener
- Data Storage
- GraphQL API
.
├── backend
│ ├── dbconfig.ts # MongoDB configuration and connection logic
│ ├── indexer.ts # Blockchain event listener and indexer logic
│ ├── server.ts # GraphQL server setup and resolvers
├── package.json # Project dependencies and scripts
└── README.md # Project documentation
- Node.js v16.x or later
- Yarn and npm
- MongoDB instance (local or cloud-based)
- Starknet node or access to an RPC provider
Create a .env
file in the root directory of the project and populate it with the following variables:
MONGODB_URI=<Your MongoDB connection string>
APIBARA_TOKEN=<Your Apibara API token>
npm install
You can run the indexer and GraphQL server concurrently using the following command:
yarn start:both
This will start both the indexer and the GraphQL server.
Alternatively, you can run them separately:
-
Start the indexer:
yarn start:indexer
-
Start the GraphQL server:
yarn start:server
The GraphQL server exposes the following queries:
Fetches a paginated list of indexed events.
-
Arguments:
page
(optional): The page number (default is 1).limit
(optional): The number of items per page (default is 10).
-
Returns: A list of
AccountEvent
objects.
Retrieves a specific event by its guardian address.
-
Arguments:
guardian
: The guardian address.
-
Returns: An
AccountEvent
object.
Retrieves a specific event by its owner address.
-
Arguments:
owner
: The owner address.
-
Returns: An
AccountEvent
object.