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)!;
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 Name | Decimal ID | Hexadecimal ID |
---|---|---|
Ethereum Mainnet | 1 | 0x1 |
Optimism | 10 | 0xa |
Base | 8453 | 0x2105 |
Arbitrum One | 42161 | 0xa4b1 |
Linea | 59144 | 0xe708 |
Sepolia Testnet | 11155111 | 0xaa36a7 |
Polygon Mainnet | 137 | 0x89 |
Polygon Amoy Testnet | 80002 | 0x13882 |
Binance Smart Chain Mainnet | 56 | 0x38 |
Binance Smart Chain Testnet | 97 | 0x61 |
Cronos Mainnet | 25 | 0x19 |
Cronos Testnet | 338 | 0x152 |
Klaytn Mainnet | 8217 | 0x2019 |
Soneium Minato Testnet | 1946 | 0x79a |
Soneium Mainnet | 1868 | 0x74c |
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 Name | Decimal IDs | Hexadecimal IDs |
---|---|---|
Solana Mainnet | 1, 101 | 0x1 , 0x65 |
Solana Testnet | 2, 102 | 0x2 , 0x66 |
Solana Devnet | 3, 103 | 0x3 , 0x67 |
XRPL Chains
Chain Name | Decimal ID | Hexadecimal ID |
---|---|---|
XRPL Mainnet | 1 | 0x1 |
XRPL Testnet | 2 | 0x2 |
XRPL Devnet | 3 | 0x3 |