Skip to content

feat(stellar): add Stellar event indexing service (lib/stellar/indexer.ts)#34

Merged
Obiajulu-gif merged 2 commits into
Chainmove:mainfrom
devfoma:feat/stellar-event-indexer
Jun 19, 2026
Merged

feat(stellar): add Stellar event indexing service (lib/stellar/indexer.ts)#34
Obiajulu-gif merged 2 commits into
Chainmove:mainfrom
devfoma:feat/stellar-event-indexer

Conversation

@devfoma

@devfoma devfoma commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

This pr closes #13

Summary

Implements the Stellar event indexing service to synchronize Stellar ledger events into MongoDB idempotently for monitoring/dashboards.

Changes

  • lib/stellar/indexer.ts — Core indexer factory. Supports mock and live Horizon modes, maps events to ChainMove records, handles checkpoints, and stores records in MongoDB safely.
  • models/StellarIndexedEvent.ts — Mongoose model for storing indexed events where _id acts as the idempotency key (Stellar operation ID).
  • models/StellarIndexerCursor.ts — Mongoose model tracking the paging token / cursor checkpoint for the stream.
  • lib/stellar/indexer.test.ts — Complete Vitest suite containing 21 tests covering unit mappings, mock mode sync, repeated syncs, cursor resumption, live mode queries, and error handling.

Acceptance Criteria Met

  • Indexer has mock mode (mock: true or configuration-driven)
  • Indexer stores last processed cursor/checkpoint (StellarIndexerCursor model)
  • Indexer handles duplicate events safely (MongoDB 11000 duplicate keys are caught and logged, returning success counts)
  • Indexer maps event types to application-level records (mapEventToChainMoveRecord)
  • Tests use mocked Stellar responses (Vitest mocks and vi.stubGlobal for fetch)

Screenshot

image

@Obiajulu-gif

Copy link
Copy Markdown
Collaborator

Great work on implementing the Stellar event indexing service and providing a comprehensive test suite. I especially appreciate the attention to idempotency, cursor checkpointing, and the coverage around mock and live modes.

Thanks for the solid contribution! 🚀

@Obiajulu-gif

Copy link
Copy Markdown
Collaborator

Resolve your CI Errors

@devfoma devfoma force-pushed the feat/stellar-event-indexer branch from 4dfa12d to b004ba3 Compare June 19, 2026 12:55
@Obiajulu-gif Obiajulu-gif merged commit e7bd388 into Chainmove:main Jun 19, 2026
1 check failed
@Obiajulu-gif

Copy link
Copy Markdown
Collaborator

@devfoma that a great work you did there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2] Add Stellar event indexing service

2 participants