Skip to main content

Overview

The Chains API provides a list of all blockchain networks supported by OneBalance. This includes both mainnet and testnet chains, along with their metadata for proper identification and display.

API Methods

getChains

Retrieve the complete list of supported blockchain chains.

Parameters

This method takes no parameters.

Returns

array
Array of all supported blockchain chains

Example

Example Response

Chain Configuration

OneBalance provides additional chain metadata through the CHAIN_CONFIG constant:

Utility Functions

The chains module provides several utility functions for working with chain data:

getChainName

Get the human-readable name for a chain ID.

getChainLogoUrl

Get the logo URL for a chain.

getChainConfig

Get complete configuration for a chain.

extractChainIdFromCAIP

Extract chain ID from CAIP chain identifier.

extractChainIdFromAssetType

Extract chain ID from CAIP-19 asset type.

Real-World Implementation

Supported Chains

OneBalance currently supports the following chains:

Ethereum

Chain ID: 1The original smart contract platform

Optimism

Chain ID: 10Ethereum Layer 2 for lower fees

Polygon

Chain ID: 137Fast and low-cost EVM sidechain

Base

Chain ID: 8453Coinbase’s Ethereum L2

Arbitrum

Chain ID: 42161Popular Ethereum Layer 2

Linea

Chain ID: 59144ConsenSys zkEVM L2

Avalanche

Chain ID: 43114High-throughput blockchain

Unichain

Chain ID: 130Uniswap’s dedicated chain

Solana

Chain ID: 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpHigh-performance blockchain

Filtering Chains

Building Chain Selectors

Understanding CAIP-2

Chain identifiers use the CAIP-2 standard:
  • namespace: Blockchain type (e.g., eip155 for EVM, solana for Solana)
  • reference: Chain-specific identifier (chain ID for EVM chains)

Caching Strategy

Chain lists are relatively static. Cache them to improve performance.

Error Handling

Best Practices

Cache Results

Chains change very rarely - cache indefinitely or until app restart

Use Utility Functions

Use provided utilities like getChainName() for consistent display

Show Chain Logos

Display chain logos for better visual identification

Filter Appropriately

Hide testnets in production, show them in development