NetworkController: Standardize chainId Handling in Infura and Fetch Middleware
- Dominant language
- TypeScript
- Stars
- 413
- Forks
- 308
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 253
Description
Description:
In the create-network-client.ts file, the createInfuraMiddleware and createFetchMiddleware functions currently handle chainId differently. This inconsistency could lead to potential issues or confusion when integrating with different blockchain networks.
Suggested Changes:
Align the handling of chainId in both middleware functions to use a uniform pattern for scaffolding out eth_chainId.
Ensure that both middleware functions process chainId in a similar manner, enhancing consistency and predictability in network interactions.
References:
[createInfuraNetworkMiddleware Function](https://github.com/MetaMask/core/blob/main/packages/network-controller/src/create-network-client.ts#L120C30-L120C30) - Current implementation of chainId handling.
[createCustomNetworkMiddleware Function](https://github.com/MetaMask/core/blob/main/packages/network-controller/src/create-network-client.ts#Ly) - Different approach to chainId handling.
Expected Outcome:
By standardizing the chainId handling across both middleware functions, we can achieve a more consistent and reliable network management within the MetaMask infrastructure.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/network-controller/src/create-network-client.ts and compare chainId handling in createInfuraMiddleware with createFetchMiddleware, using the referenced implementations as the entry point. Determine the uniform pattern intended for scaffolding eth_chainId, then verify both middleware functions handle chainId consistently and predictably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100