Allow configuring a custom HTTP User-Agent for RPC requests
Problem
The SDK currently relies on the default HTTP User-Agent provided by the underlying runtime (Node.js, Undici, browser, etc.) and does not expose a way for applications to identify themselves when communicating with RPC nodes.
This makes all applications appear as generic clients, reducing observability for RPC operators and making diagnostics more difficult.
Some infrastructure providers also apply operational policies (monitoring, abuse mitigation, rate limiting, allowlists, analytics...) based on the User-Agent.
Proposal
Allow applications to configure a custom HTTP User-Agent through the client configuration. Example:
const client = new Client({
rpcUrls: ['https://rpc.example.com'],
userAgent: 'Morphit/1.7.5'
});Benefits
- Allow applications to clearly identify themselves to RPC operators.
- Improve troubleshooting and operational support.
- Enable infrastructure providers to apply application-specific policies when appropriate.
- Avoid every application sharing the same generic runtime User-Agent.
- Keep the SDK independent from any specific configuration system (.env, CLI, framework, etc.).