Skip to content

feat(stellar): implement Soroban contract event ingestion parser - #42

Open
samkay1277 wants to merge 18 commits into
ASTROIDX556:mainfrom
samkay1277:main
Open

feat(stellar): implement Soroban contract event ingestion parser #42
samkay1277 wants to merge 18 commits into
ASTROIDX556:mainfrom
samkay1277:main

Conversation

@samkay1277

@samkay1277 samkay1277 commented Aug 27, 2026

Copy link
Copy Markdown

Summary

Implements a Soroban event ingestion parser that decodes raw Stellar RPC event XDR (topics + value), maps known SAC-style patterns into typed payloads, and emits NestJS domain events for downstream modules (budgets, audits, transactions).

Changes

  • Add SorobanEventParserService (src/modules/stellar/services/soroban-event-parser.service.ts)
    • Decode base64 SCVal topics/values via @stellar/stellar-sdk (xdr + scValToNative)
    • Classify SAC patterns: transfer, mint, burn, approve
    • Safe per-event error handling (malformed XDR does not stop the batch)
    • Emit stellar.soroban_event_parsed and transaction.confirmed on successful transfer mapping
  • Register service in StellarModule
  • Vitest coverage in soroban-event-parser.service.spec.ts (realistic mocks + EventEmitter2 spies)

Acceptance criteria

  • Parse typical Soroban events (topics + data) from base64 into TS interfaces
  • Decoding exceptions handled without interrupting worker flow
  • Known SAC-style patterns mapped to typed schemas
  • Typed payloads emitted via NestJS EventEmitter2
  • Tests with mock payloads and mocked emitter

Closes #28

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@samkay1277 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

@privyy-bit privyy-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after automated review verification.

@mergekeeper

mergekeeper Bot commented Aug 27, 2026

Copy link
Copy Markdown

Needs changes

StellarTransactionService was accidentally removed from StellarModule providers and exports during SorobanEventParserService registration.

  • src/modules/stellar/stellar.module.ts:11: StellarTransactionService was removed from imports/providers/exports in StellarModule, which might break existing transaction service consumers.

Reviewed commit: 0ec75aa995e615b92239794778311e8d09438dee.

mergekeeper[bot]
mergekeeper Bot previously requested changes Aug 27, 2026

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

Duplicate nested service file created under src/src/modules/stellar/services/soroban-event-parser.service.ts.

  • src/src/modules/stellar/services/soroban-event-parser.service.ts:1: Remove duplicate or misnested service file under src/src/.

Reviewed commit: fb55db2b8b2da3d4b309893a7e7d6f701a251880.

@privyy-bit privyy-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after automated review verification.

@privyy-bit
privyy-bit dismissed mergekeeper[bot]’s stale review August 27, 2026 17:49

Superseded: requested changes were addressed; re-validated before merge.

@privyy-bit privyy-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after automated review verification.

@privyy-bit

Copy link
Copy Markdown
Contributor

CI Checks Failed — Action Needed

The continuous integration checks on this pull request are failing. The maintainer cannot merge until all required checks pass.

Failing checks:

  • typecheck: failure
  • lint: failure

What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. You can also click the Resolve button to let the automation attempt the fix.

Sent automatically on behalf of the maintainer.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

Duplicate nested file created at src/src/modules/stellar/services/soroban-event-parser.service.ts due to incorrect path nesting.

  • src/src/modules/stellar/services/soroban-event-parser.service.ts:1: Remove this duplicate nested directory path (src/src/...) and keep only the correct file under src/modules/stellar/services/soroban-event-parser.service.ts

Reviewed commit: e0c9a18d9e2b1632b4f75445beae7798ec579069.

@samkay1277

Copy link
Copy Markdown
Author

@privyy-bit I have done the review on the failing check and I have corrected

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

A duplicate nested path file was introduced in error and needs to be removed.

  • src/src/modules/stellar/services/soroban-event-parser.service.ts:1: Remove duplicate nested file created at incorrect path src/src/modules/stellar/services/soroban-event-parser.service.ts.

Reviewed commit: f2b04e58dad95e038ca26a211d7f0ea868486672.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

An empty duplicate service file was accidentally committed under an incorrect nested directory path.

  • src/src/modules/stellar/services/soroban-event-parser.service.ts:1: Remove this duplicate empty file created under the incorrect nested directory path src/src/modules/stellar/services/.

Reviewed commit: 49bf0d8c8691886eb3d75cc2b71954fb9dcd8bc1.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

A duplicate nested file src/src/modules/stellar/services/soroban-event-parser.service.ts was accidentally added and needs to be removed.

  • src/src/modules/stellar/services/soroban-event-parser.service.ts:1: Remove duplicate nested directory structure and redundant empty file.

Reviewed commit: b9dcd1946bcff8ac3e5a04329b4ceef6dabac79a.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

The StellarModule accidentally removes StellarTransactionService while registering SorobanEventParserService.

  • src/modules/stellar/stellar.module.ts:11: StellarTransactionService was removed from providers and exports in StellarModule. This looks like an accidental regression and should be preserved alongside SorobanEventParserService.

Reviewed commit: 018ae282c388bc1b176634b2ed3f34795bcf0e95.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

A typo in log string formatting prevents correct error interpolation and a required service was removed from StellarModule exports.

  • src/modules/stellar/services/soroban-event-parser.service.ts:153: Malformed template string syntax '( {raw.contractId ?? '?'} tx= ){raw.contractId ?? '?'}' instead of template variables ${...}.
  • src/modules/stellar/stellar.module.ts:33: StellarTransactionService was removed from module providers and exports, which may break dependent modules expecting it.

Reviewed commit: af7d898be34cc49c22ac0b8011b9c04795124c9e.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

There is a syntax error in soroban-event-parser.service.ts on line 144 due to a malformed template literal interpolation and an extra closing brace at the end of the file.

  • src/modules/stellar/services/soroban-event-parser.service.ts:144: Syntax error in template literal string interpolation: '( {raw.contractId ?? '?'} tx= ){raw.txHash ?? '?'}' contains unmatched backslashes and braces.
  • src/modules/stellar/services/soroban-event-parser.service.ts:332: Unexpected extra closing brace at the end of the file causing a compilation error.

Reviewed commit: 18cc4a9a83dc4677e5971b0eaa03f0545c723300.

@mergekeeper

mergekeeper Bot commented Aug 29, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #28.
Verdict: clean

The pull request correctly implements the Soroban contract event ingestion pipeline parser, registers it in the StellarModule, and provides comprehensive unit tests using Vitest.

Reviewed commit: ed57e944ce9162413c8d4ad59281b73d8a9c8b77.
CI and merge eligibility are checked separately.

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs changes

StellarTransactionService was accidentally removed from StellarModule providers and exports during SorobanEventParserService registration.

  • src/modules/stellar/stellar.module.ts:11: StellarTransactionService was removed from imports/providers/exports in StellarModule, which might break existing transaction service consumers.

Reviewed commit: 0ec75aa995e615b92239794778311e8d09438dee.

@mergekeeper

mergekeeper Bot commented Aug 30, 2026

Copy link
Copy Markdown

MergeKeeper review unavailable

AI provider review response did not contain valid JSON

No approval or merge action was taken.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement Soroban contract event ingestion pipeline parser

3 participants