Skip to content

Commit

Permalink
indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
fishonamos committed Dec 1, 2024
1 parent 0ebeebb commit 6bbd126
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions land-registry-indexer/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Configuration settings for the Land Registry Indexer
*
* This module loads environment variables from a .env file and provides
* configuration constants used throughout the application.
*/

import dotenv from 'dotenv';
dotenv.config();

Expand Down
19 changes: 19 additions & 0 deletions land-registry-indexer/src/eventHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/**
* Event handler functions for the Land Registry smart contract
*
* These functions process events emitted by the contract and store them in PostgreSQL.
* Each handler receives:
* - client: PostgreSQL client for database operations
* - data: Event data from the contract
* - cursor: Block/transaction metadata
*
* The handlers maintain the state of:
* - Land parcels (registration, transfers, verification)
* - Inspectors (adding/removing)
* - Marketplace listings (creation, updates, sales)
*
* All monetary values are stored as strings to preserve precision.
* Addresses are stored as strings in their full StarkNet format.
* Timestamps are converted from Unix seconds to JavaScript Date objects.
*/

import { PoolClient } from 'pg';
import { StarkNetCursor } from '@apibara/protocol';

Expand Down
8 changes: 8 additions & 0 deletions land-registry-indexer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Main entry point for the Land Registry Indexer
*
* This script initializes the indexer, connects to the PostgreSQL database,
* and starts processing events from the StarkNet node using Apibara.
*/

import { Indexer, IndexerRunner } from '@apibara/indexer';
import { StarkNetCursor, Filter } from '@apibara/protocol';
import { Pool } from 'pg';
Expand Down

0 comments on commit 6bbd126

Please sign in to comment.