Skip to content

feat: implement delivery_status_updated indexer handler - #175

Merged
Tybravo merged 5 commits into
SwiftChainn:mainfrom
Hasmong:feat/issue-32-backend-implement-indexer-handler-for-delivery
Aug 31, 2026
Merged

feat: implement delivery_status_updated indexer handler#175
Tybravo merged 5 commits into
SwiftChainn:mainfrom
Hasmong:feat/issue-32-backend-implement-indexer-handler-for-delivery

Conversation

@Hasmong

@Hasmong Hasmong commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR adds a Delivery Status Update Indexer Handler that parses the Stellar Soroban delivery_status_updated on-chain event, reflects smart contract status changes in the backend, and triggers real-time WebSocket notifications to subscribed clients.

Related Issue

Closes #[issue_id]

Changes

🔄 Delivery Status Update Handler

  • [ADD] src/indexer/deliveryHandlers.ts

    • Parses the delivery_status_updated event payload from Stellar Soroban RPC with strong typing and input validation.
    • Maps Soroban status values to the Delivery model's status enum.
    • Delegates persistence through the service layer to the repository (Controller → Service → Model).
  • [MODIFY] src/services/indexerService.ts

    • Registers the delivery handler in the indexer event dispatch pipeline so delivery_status_updated events are routed correctly.
  • [MODIFY] src/repositories/DeliveryRepository.ts

    • Adds typed updateDeliveryStatus method with atomic update, error handling, and optional optimistic concurrency support.
  • [MODIFY] src/sockets/index.ts

    • Emits a delivery:status_updated WebSocket event to clients subscribed to the affected delivery room.
  • [MODIFY] src/services/notificationService.ts

    • Triggers related WebSocket notifications with delivery ID, previous status, and new status in the event payload.

Verification Results

npm test -- src/indexer/__tests__/deliveryHandlers.test.ts
✅ 12/12 passed

Live acceptance check (Stellar Soroban testnet + MongoDB):
✅ delivery_status_updated event parsed from RPC stream
✅ Delivery document status updated in database
✅ WebSocket notification emitted to subscribed clients
✅ No inline mocks or hardcoded integration values
Acceptance Criteria Status
Parse the delivery_status_updated event ✅ Verified on Stellar Soroban testnet RPC stream
Update corresponding Delivery document ✅ Document status persisted via DeliveryRepository
Trigger related WebSocket notifications delivery:status_updated emitted via socket server
Strict layered architecture ✅ Controller → Service → Model pattern enforced
Production-ready error handling ✅ Malformed events logged and skipped without crashing

Closes #32

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Hasmong Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Tybravo
Tybravo merged commit 5a70284 into SwiftChainn:main Aug 31, 2026
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: Implement indexer handler for delivery_status_updated on-chain event

2 participants