import type { RpcConfig } from '../types/common' /** * Production Portal RPC gateway hostname. * Staging equivalent: `web.portalhq.dev`. * Used as the fallback when neither `gatewayHost` nor `host` is supplied. */ export const DEFAULT_RPC_HOST = 'web.portalhq.io' /** * Builds the default Portal-managed RPC gateway config from a given gateway host. * * URL template: https://{rpcHost}/rpc/v1/{namespace}/{reference} * * Covers 13 chains — 11 EVM + 2 Solana. Polygon Amoy (eip155:80002) is used; * the deprecated Mumbai (eip155:80001) is intentionally excluded. * * When rpcConfig is undefined or {} in the Portal constructor, this function is * called automatically. An explicit non-empty rpcConfig always takes precedence * verbatim — no merging with defaults. */ export function buildDefaultRpcConfig( rpcHost: string = DEFAULT_RPC_HOST, ): RpcConfig { const base = `https://${rpcHost}/rpc/v1` return { 'eip155:1': `${base}/eip155/1`, 'eip155:11155111': `${base}/eip155/11155111`, 'eip155:137': `${base}/eip155/137`, 'eip155:80002': `${base}/eip155/80002`, 'eip155:8453': `${base}/eip155/8453`, 'eip155:84532': `${base}/eip155/84532`, 'eip155:143': `${base}/eip155/143`, 'eip155:10143': `${base}/eip155/10143`, 'eip155:10': `${base}/eip155/10`, 'eip155:42161': `${base}/eip155/42161`, 'eip155:43114': `${base}/eip155/43114`, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': `${base}/solana/5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`, 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1': `${base}/solana/EtWTRABZaYq6iMfeYKouRu166VU2xqa1`, } }