Skip to main content

Built-in Chain Configs

Web3Auth provides Built-in Chain Configurations for certain popular blockchain networks. This simplifies the setup by abstracting away manual configuration steps. This convenience complements—but does not replace—the existing approach of manually specifying the entire chain configuration when needed.

For supported EVM-based chains, Web3Auth uses a premium Infura service, currently bundled conveniently with your Web3Auth setup.

Type Declarations

Here's how these helper functions are declared:

import { ChainNamespaceType, CustomChainConfig } from "./IChainInterface";

export declare const getEvmChainConfig: (
chainId: number,
web3AuthClientId?: string,
) => CustomChainConfig | null;
export declare const getSolanaChainConfig: (chainId: number) => CustomChainConfig | null;
export declare const getXrplChainConfig: (chainId: number) => CustomChainConfig | null;
export declare const getChainConfig: (
chainNamespace: ChainNamespaceType,
chainId?: number | string,
web3AuthClientId?: string,
) => CustomChainConfig | null;

Usage

Web3Auth provides dedicated helper functions to fetch these built-in chain configurations:

EVM Chains

import { getEvmChainConfig } from "@web3auth/base";

const clientId = "YOUR_WEB3AUTH_CLIENT_ID"; // get it from https://dashboard.web3auth.io

const chainConfig = getEvmChainConfig(0x1, clientId)!;
info

Though the web3AuthClientId parameter appears optional, it is mandatory to access Web3Auth's bundled premium Infura RPC APIs. It's marked optional for backward compatibility and isn't required for non-EVM chains.

Solana Chains

import { getSolanaChainConfig } from "@web3auth/base";

const chainConfig = getSolanaChainConfig(0x1)!;

XRPL Chains

import { getXrplChainConfig } from "@web3auth/base";

const chainConfig = getXrplChainConfig(0x2)!;

Supported Chains and Chain IDs

EVM Chains

Chain NameDecimal IDHexadecimal ID
Ethereum Mainnet10x1
Optimism100xa
Base84530x2105
Arbitrum One421610xa4b1
Linea591440xe708
Sepolia Testnet111551110xaa36a7
Polygon Mainnet1370x89
Polygon Amoy Testnet800020x13882
Binance Smart Chain Mainnet560x38
Binance Smart Chain Testnet970x61
Cronos Mainnet250x19
Cronos Testnet3380x152
Klaytn Mainnet82170x2019
Soneium Minato Testnet19460x79a
Soneium Mainnet18680x74c
tip

If you're working with an EVM chain that's not listed here, you must provide the complete chain configuration yourself. Please refer to the EVM Chain Configuration guide for detailed instructions.

Solana Chains

Chain NameDecimal IDsHexadecimal IDs
Solana Mainnet1, 1010x1, 0x65
Solana Testnet2, 1020x2, 0x66
Solana Devnet3, 1030x3, 0x67

XRPL Chains

Chain NameDecimal IDHexadecimal ID
XRPL Mainnet10x1
XRPL Testnet20x2
XRPL Devnet30x3