Function: resolveEvmChain()
function resolveEvmChain(config): Chain;
Defined in: evm-client/src/provider.ts:172
The viem Chain for a config: the explicit
EvmConfig.chain if supplied, otherwise a minimal definition
synthesized from chainId + rpcUrl.
Synthesizing is the default on purpose. Looking a chain up by id would mean
importing the whole viem/chains barrel — several hundred definitions — into
every consumer's bundle to read one number back, and none of the metadata that
buys (multicall3, explorers, currency symbol) is used by anything in this
package. A caller who wants it passes the definition itself.
Parameters
| Parameter | Type |
|---|---|
config | EvmConfig<string> |
Returns
Chain
Throws
when an explicit chain disagrees with chainId. The two are
independently used — the wallet client asserts its chain.id against the
node's before every send, while the deployment addresses are keyed by chainId
— so a mismatch means the config describes two different networks, and it is
cheaper to say so here than to debug the address it resolved from the wrong
one. Note evmConfig derives chainId from chain, so this only
fires when both were set explicitly.