Skip to content

fix(backend): extract shared indexer state id#726

Merged
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
Bug-Hunter-X:fix/641-indexer-state-constant
Jun 1, 2026
Merged

fix(backend): extract shared indexer state id#726
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
Bug-Hunter-X:fix/641-indexer-state-constant

Conversation

@Bug-Hunter-X
Copy link
Copy Markdown
Contributor

@Bug-Hunter-X Bug-Hunter-X commented Jun 1, 2026

Overview

This PR extracts the hardcoded singleton IndexerState ID into one shared constant so all live call sites import the same value instead of duplicating the string in multiple files. It keeps the existing runtime behavior unchanged while making future updates safer.

Related Issue

Closes #641

Changes

🔧 Shared Indexer State Constant

  • [ADD] backend/src/lib/indexer-state.ts
  • Added a single exported INDEXER_STATE_ID constant for the IndexerState primary key.

🔄 Updated Call Sites

  • [MODIFY] backend/src/workers/soroban-event-worker.ts
  • [MODIFY] backend/src/services/indexerService.ts
  • [MODIFY] backend/src/routes/health.routes.ts
  • [MODIFY] backend/src/routes/v1/admin.routes.ts
  • Replaced the hardcoded 'singleton' value with INDEXER_STATE_ID in the live backend call sites.
  • Kept behavior unchanged.

Verification Results

Acceptance Criteria Status
Constant moved to a shared module
All live call sites import it
No behavior change
Backend build passes

How to Test

# 1. Confirm you're on the branch
git branch --show-current

# 2. Verify the backend builds successfully
npm run build

# 3. Optional: inspect the refactor
git diff -- backend/src/lib/indexer-state.ts backend/src/workers/soroban-event-worker.ts backend/src/services/indexerService.ts backend/src/routes/health.routes.ts backend/src/routes/v1/admin.routes.ts

Screenshots

✅ Backend build passes

Run:

npm run build
image

Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean — closes #641 (INDEXER_STATE_ID extracted to one shared constant across 5 files). all CI green. merging!

join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

@ogazboiz ogazboiz merged commit 0192b10 into LabsCrypt:main Jun 1, 2026
9 checks passed
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.

[Backend] Hardcoded 'singleton' INDEXER_STATE_ID duplicated across files — extract to one constant

2 participants