Skip to content

Function: getChain()

function getChain(chainId: number, rpc?: ChainRpcUrls): Chain;

Defined in: packages/core/lib/utils/getChain.ts:12

Returns a Chain object based on the provided chain ID.

If the chain has built-in support (HappyChain Sepolia (216), Local Devnet (31337), then it is not necessary to provide RPC urls. Otherwise providing the rpc URL(s) is mandatory.

Parameters

chainId

number

rpc?

ChainRpcUrls

Returns

Chain

Throws

Error if an rpc URL is not provided for a custom chain