Skip to content

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

Description

@Chucks1093

Summary

The indexer receives raw Soroban event data from the Stellar RPC and must map it to the server's internal trade event schema. This mapping should live in a dedicated helper so it can be unit tested without invoking the RPC and reused across different event parsers.

Scope

  • Add parseStellarTradeEvent(rawEvent): TradeEvent helper
  • Maps raw Soroban event topic and data fields to: event_type, creator_id, actor_address, amount, price, fee, ledger_sequence, timestamp
  • Throws a typed ParseError if any required field is missing or the wrong type
  • Add unit tests for a valid buy event, a valid sell event, and a missing required field

Acceptance Criteria

  • Valid buy event maps to correct schema fields
  • Valid sell event maps to correct schema fields
  • Missing required field throws ParseError
  • No RPC calls made in tests

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions