Parses a chain ID string into a type-safe ChainId.
Attempts to match against predefined chain IDs first, then falls back to Custom.
The corresponding ChainId, or null if invalid
The chain ID string