Skip to content

Wire stream event handlers to persistence #52

Description

@pragmaticAweds

Context

The streams package now has Stream, WithdrawalAction, and CancelAction entities plus handlers for created, funded, withdrawal, and cancel events. Several handlers still only validate/log events and return success, so indexed stream events do not fully update persistent state yet.

Scope

  • Add a streams repository/service for Stream, WithdrawalAction, and CancelAction writes
  • Persist stream creation from StreamCreated events
  • Apply funded events to stream totals or funding state as defined by the schema
  • Persist withdrawal actions and update withdrawn totals idempotently
  • Persist cancel actions and mark streams canceled idempotently
  • Add tests that prove duplicate event processing does not double-count amounts

Out of Scope

  • Defining new Soroban event shapes
  • Distribution domain persistence
  • GraphQL API resolvers
  • Broad poller refactors outside handler persistence wiring

Acceptance Criteria

  • Stream handlers write durable database state through a repository/service
  • Handler tests cover create, fund, withdraw, cancel, duplicate replay, and missing stream cases
  • Numeric token amounts are handled without floating-point precision loss
  • Existing TODOs for stream handler persistence are removed or replaced with narrower follow-up notes
  • bun run indexer:type-check passes
  • bun run indexer:test passes
  • bun run indexer:lint passes

Dependencies

Suggested Files or Packages

  • indexer/streams/src/db/
  • indexer/streams/src/handlers/
  • indexer/common/src/db/repository.ts

Metadata

Metadata

Assignees

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