Skip to content

Add JSDoc/TSDoc and a usage guide for the cached contract-read layer (lib/contracts + lib/cache/contract-cache.ts) #477

@Baskarayelu

Description

@Baskarayelu

📋 Description

The frontend reads on-chain data through a cached contract layer: lib/cache/contract-cache.ts, lib/cache/registry.ts, and cached wrappers like lib/contracts/remittance-split-cached.ts and lib/contracts/insurance-cached.ts. The caching semantics (TTL, invalidation via app/api/cache/invalidate/route.ts, lru-cache usage) are non-obvious and undocumented, making it risky for contributors to add a new cached read correctly.

Why this matters: a contributor who caches a write result or sets the wrong TTL can serve stale balances. Clear docs on when and how to cache are essential before more readers are added.

🎯 Requirements & Context

Functional requirements

Context & constraints

🛠️ Suggested Execution

git checkout -b docs/contract-cache-guide
  • Add TSDoc + docs/contract-cache.md + README cross-link.
npm run lint
npm run test:unit
  • Edge cases to document: cache miss, manual invalidation, TTL expiry, what must never be cached (writes, balances post-transfer).

Example commit message

docs(cache): document contract-cache layer and add-a-reader recipe

Adds TSDoc to cache/registry plus docs/contract-cache.md covering TTL,
invalidation, and a step-by-step new cached read recipe.

✅ Acceptance Criteria & Guidelines

Requirement Target
TSDoc on cache/registry public API Required
docs/contract-cache.md complete + accurate Required
Invalidation endpoint documented Required
README cross-link Required
Lint + unit tests still pass Required
Timeframe 96 hours from assignment

💬 Community & Support

Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA

Comment to claim before starting. 🚀

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions