Skip to content

feat: add local receipt registry with hash-based lookup - #725

Merged
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
wendyamoni-creator:feat/receipt-registry
Aug 29, 2026
Merged

feat: add local receipt registry with hash-based lookup#725
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
wendyamoni-creator:feat/receipt-registry

Conversation

@wendyamoni-creator

@wendyamoni-creator wendyamoni-creator commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a module-level receipt registry to src/receipt.ts so callers can look up previously generated receipts by transaction hash without managing storage themselves.

Changes

  • src/receipt.ts — four new exported functions backed by a singleton Map<string, ChainPaymentReceipt>:
    • registerReceipt(receipt) — stores keyed by receipt.txHash
    • getReceiptByTxHash(txHash) — returns stored receipt or null
    • getAllReceipts() — returns all receipts sorted by timestamp ascending
    • clearReceipts() — empties the registry (test teardown)
  • src/index.ts — all four functions added to the existing receipt export block
  • test/receipt.registry.test.ts — 10 unit tests covering all acceptance criteria

Tests

✓ test/receipt.registry.test.ts  (10 tests) 7ms

Covers: register + retrieve by hash, unknown hash returns null, overwrite on duplicate txHash, multi-receipt isolation, empty registry, timestamp-ascending sort, sort consistency, idempotent clear.closes #613

- registerReceipt(receipt): stores receipt keyed by txHash
- getReceiptByTxHash(txHash): returns stored receipt or null
- getAllReceipts(): returns all receipts sorted by timestamp asc
- clearReceipts(): empties registry for test teardown
- All four functions exported from src/index.ts
- Unit tests (10) in test/receipt.registry.test.ts
@Kingsman-99
Kingsman-99 merged commit ef6f74e into Stellar-split:main Aug 29, 2026
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 receipt registry with getReceiptByTxHash lookup

2 participants