[gas-fee-controller] Cache chains supported by Gas API
- Dominant language
- TypeScript
- Stars
- 413
- Forks
- 308
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 253
Description
We request gas prices from the API for every single request, making no attempt to cache which chains are supported or not. This makes gas estimates for unsupported chains slower, and unnecessarily increases network traffic.
We should instead cache the chains that we know to be unsupported by the API. We don't add support for new chains so often that we need to check every minute. Checking every day or week should suffice.
Acceptance criteria:
* If we find that a chain is not supported by our gas API, we cache that information locally so that no reattempts are made
* The cache expires periodically, so that clients can discover automatically when support has been added for new chains
* Minimum expiry of 1 day, though it might make sense to make it longer, e.g. 1 week.
* We use a console warning when we discover that a chain is not supported, rather than throwing an error.
* Today we [throw an error](https://github.com/MetaMask/core/blob/cd158e08d054f7d773e6f7c360b74b9a1cefa468/packages/gas-fee-controller/src/determineGasFeeCalculations.ts#L102), but this is incorrect semantically because this scenario is expected and not indicative of any problem, and it's useless because the error is silently caught and ignored.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/gas-fee-controller/src/determineGasFeeCalculations.ts around the current unsupported-chain error at line 102. Trace how unsupported chains are detected and handled, then verify that local results expire after at least a day, repeated requests are avoided, and discovery produces a console warning instead of an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design, blockchain
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100