explorer
explorer copied to clipboard
Explorer: Move static RPC calls behind the Vercel caching layer
Problem
Blocks are by definition immutable. Client should not hit, for instance, getBlock()
over and over and over. Here's the change that needs to be made.
Proposed Solution
- Change the frontend to query explorer.solana.com/api/block/{BLOCKNUM}
- Move the getBlock call into /pages/api/block/[blocknum].ts
- Cache the result of the local API call at the edge, using Vercel caching. Docs here.
Note: you can do lambdas on Vercel without Next.js: https://vercel.com/docs/concepts/functions/serverless-functions Cache control docs: https://vercel.com/docs/concepts/functions/serverless-functions/edge-caching