Skip to content

Map contract events to DB rows in the indexer #7

Description

@iexwr

Context

src/indexer.ts only console.logs events. The DB is never updated, so API responses are stale.

Acceptance criteria

  • On request_created: upsert a PaymentRequest row (status='Open').
  • On request_paid: set that row's status='Paid' and store payer.
  • On request_cancelled: set status='Cancelled'.
  • Idempotent: re-processing the same ledger window does not duplicate rows.

Technical notes

  • Parse event topics/payload per the contract's emitted shape (see contracts issue on structured events).
  • Key rows on (contract, requestId).
  • Update Cursor after each successful window.

Testing

  • Unit-test the mapping function with a fixture event object asserting the resulting DB write.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveStellar Wave for StackPayenhancementNew feature or request

    Type

    No type

    Fields

    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