Skip to content

Add receipt registry with getReceiptByTxHash lookup #613

Description

@Kingsman-99

Description

src/receipt.ts generates payment receipts but provides no way to retrieve a previously generated receipt by its transaction hash. Once a receipt is created, callers must store it themselves with no SDK lookup support. This issue adds a local receipt registry with hash-based lookup.

Acceptance Criteria

  • registerReceipt(receipt: PaymentReceipt): void exported — stores receipt keyed by receipt.txHash
  • getReceiptByTxHash(txHash: string): PaymentReceipt | null exported — returns stored receipt or null
  • getAllReceipts(): PaymentReceipt[] exported — returns all registered receipts ordered by receipt.timestamp ascending
  • clearReceipts(): void exported for test teardown
  • Registry is module-level (singleton) — not tied to any class instance
  • All exported from src/index.ts
  • Unit tests: register and retrieve by hash, unknown hash returns null, getAllReceipts order, clearReceipts empties registry

Context

  • Target files: src/receipt.ts, src/index.ts
  • PaymentReceipt type already defined in src/types/receipts.ts — do not duplicate it

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions