Skip to main content

Overview

The useChains hook fetches the list of supported blockchain networks (chains) and provides utilities for working with chain metadata. It automatically loads chains when the component mounts.

Import

Signature

Return Values

Chain[]
Array of supported blockchain networks.
boolean
Indicates if chains are currently being fetched. true on initial load, false after data is loaded or error occurs.
string | null
Error message if chain fetching fails. null when no errors.
(reference: string) => string
Utility function to get a human-readable chain name from a chain reference ID.Parameters:
  • reference (string): Chain reference ID (e.g., "1", "137", "8453")
Returns:
  • Human-readable chain name (e.g., "Ethereum Mainnet", "Polygon", "Base")
  • Falls back to "Chain {reference}" if name is not found

Usage Examples

Basic Usage

Chain Selector Component

Filter Mainnets Only

Chain Select with Icons

Get Chain Info by Reference

Types

Chain

ChainMetadata

Chain Name Mapping

The hook includes a CHAIN_NAMES mapping for common chains:

Notes

  • Chains are fetched automatically when the component mounts
  • The hook only fetches chains once per mount (no automatic refetching)
  • Chain reference IDs are strings (e.g., "1", "137", "8453")
  • For EVM chains, the namespace is typically "eip155"
  • Solana uses a different namespace and reference format
  • Chain logos are available at: https://storage.googleapis.com/tenderly-public-assets/networks/{reference}.svg

See Also