Skip to content

Feat/stellar trade event parser#526

Open
Godfrey-Delight wants to merge 3 commits into
accesslayerorg:mainfrom
Godfrey-Delight:feat/stellar-trade-event-parser
Open

Feat/stellar trade event parser#526
Godfrey-Delight wants to merge 3 commits into
accesslayerorg:mainfrom
Godfrey-Delight:feat/stellar-trade-event-parser

Conversation

@Godfrey-Delight

Copy link
Copy Markdown
Contributor

Summary

Added parseStellarTradeEvent(rawEvent: RawSorobanEvent): TradeEvent in src/utils/stellar-trade-event-parser.utils.ts that maps decoded Soroban event fields to the server's trade schema, validates all required fields, maps KEY_BOUGHT/KEY_SOLD to buy/sell, and throws a typed ParseError on missing or invalid input. 10 unit tests cover valid buy/sell events, missing fields, unknown event types, invalid JSON, non-numeric ledger, and empty timestamps
Closed #513

Testing

  • pnpm lint
  • pnpm build
  • pnpm exec prisma generate when schema or generated types changed

Checklist

  • Linked issue or backlog item
  • No secrets or live credentials added
  • Docs updated if setup or env changed
  • Change is scoped to one problem

Implemented a try/catch inside evaluatePriceAlertsForMovement (src/modules/alerts/alert.service.ts:132) that emits a structured logger.error with creator_id, ledger_sequence, new_price, error_message, and failed_at when the alert threshold check fails (e.g., database error reading alerts). Added optional ledger_sequence to the PriceMovement type so the log carries enough context for an operator to replay the check. The error is re-thrown after logging so existing error propagation is preserved. New tests verify the log is emitted with all fields on DB failure and is not emitted on success.
Closed accesslayerorg#510
…e event schema

Added `parseStellarTradeEvent(rawEvent: RawSorobanEvent): TradeEvent` in `src/utils/stellar-trade-event-parser.utils.ts` that maps decoded Soroban event fields to the server's trade schema, validates all required fields, maps `KEY_BOUGHT`/`KEY_SOLD` to `buy`/`sell`, and throws a typed `ParseError` on missing or invalid input. 10 unit tests cover valid buy/sell events, missing fields, unknown event types, invalid JSON, non-numeric ledger, and empty timestamps.
Closed accesslayerorg#513
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Godfrey-Delight 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

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.

Add helper for converting raw Stellar event fields to the server trade event schema

1 participant