Function Signature
Parameters
The CCTP domain identifier to search for. Each chain has a unique domain ID (e.g., Ethereum = 0, Avalanche = 1, OP Mainnet = 2)
Set to
true to search testnet chains, or false to search mainnet chainsReturns
Pointer to a Chain struct containing the blockchain configuration, or
nil if not found. The Chain includes:Name(string) - Chain nameChainID(*big.Int) - EVM chain IDDomain(uint32) - CCTP domain identifierRPC(string) - Default RPC endpoint URLTokenMessengerV2(string) - TokenMessenger V2 contract addressMessageTransmitterV2(string) - MessageTransmitter V2 contract addressUSDC(string) - USDC token contract addressExplorer(string) - Block explorer URLIsTestnet(bool) - Whether this is a testnet chainInstantFinality(bool) - Whether the chain has instant finality
Error if the chain with the specified domain is not found. Returns
nil if successful.Usage Example
Common Domain IDs
Mainnet
- 0 - Ethereum
- 1 - Avalanche
- 2 - OP Mainnet
- 3 - Arbitrum
- 6 - Base
- 7 - Polygon PoS
- 10 - Unichain
- 11 - Linea
- 12 - Codex
- 13 - Sonic
- 14 - World Chain
- 16 - Sei
- 18 - XDC
- 19 - HyperEVM
- 21 - Ink
- 22 - Plume
Testnet
- 0 - Ethereum Sepolia
- 1 - Avalanche Fuji
- 2 - OP Sepolia
- 3 - Arbitrum Sepolia
- 6 - Base Sepolia
- 7 - Polygon PoS Amoy
- 10 - Unichain Sepolia
- 11 - Linea Sepolia
- 12 - Codex Testnet
- 13 - Sonic Testnet
- 14 - World Chain Sepolia
- 16 - Sei Testnet
- 18 - XDC Apothem
- 19 - HyperEVM Testnet
- 21 - Ink Testnet
- 22 - Plume Testnet
- 26 - Arc Testnet
This function searches through all chains returned by
GetChains() and returns the first match. Domain IDs are unique within mainnet and testnet environments.Error Handling
The function returns an error with the message"chain with domain %d not found" if no chain matches the specified domain ID.
Related Functions
- GetChains - Get all configured chains
- GetChainByName - Find a specific chain by its name
- ApplyRPCOverrides - Override default RPC endpoints