-
Notifications
You must be signed in to change notification settings - Fork 18
Add token metadata caching #37
Copy link
Copy link
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programarea:indexerEvent ingestionEvent ingestiondifficulty:intermediate~half a day~half a dayhelp wantedExtra attention is neededExtra attention is needed
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programarea:indexerEvent ingestionEvent ingestiondifficulty:intermediate~half a day~half a dayhelp wantedExtra attention is neededExtra attention is needed
Background
Every time Wraith processes a transfer event, it may need to resolve the token's symbol and decimals from the SAC contract via Soroban RPC. On high-volume ledgers, this adds significant latency and RPC load. Caching token metadata after the first lookup would reduce RPC calls dramatically.
What to build
Add an in-memory (or Postgres-backed) cache for token metadata: symbol, decimals, and name. Populate on first encounter; serve from cache on subsequent events.
Key files
src/indexer.ts— where token metadata is currently looked upsrc/tokenCache.ts— create this moduleprisma/schema.prisma— optionally add aTokenMetadatamodel for persistenceSuggested execution
src/tokenCache.tswith aMap<contractId, { symbol, decimals, name }>TokenMetadatarows in PostgresGET /tokensendpoint listing all cached tokensExample commit message:
feat(indexer): add token metadata caching to reduce Soroban RPC callsAcceptance criteria
GET /tokensreturns all cached token metadata