|
| 1 | +--- |
| 2 | +title: Built-in Chain Configs |
| 3 | +sidebar_label: Built-in Chain Configs |
| 4 | + |
| 5 | +description: "Built-in Chain Configurations Provided by Web3Auth" |
| 6 | +image: "images/docs-meta-cards/documentation-card.png" |
| 7 | +--- |
| 8 | + |
| 9 | +Web3Auth provides **Built-in Chain Configurations** for certain popular blockchain networks. This |
| 10 | +simplifies the setup by abstracting away manual configuration steps. This convenience |
| 11 | +complements—but does not replace—the existing approach of manually specifying the entire chain |
| 12 | +configuration when needed. |
| 13 | + |
| 14 | +For supported EVM-based chains, Web3Auth uses a **premium Infura service**, currently bundled |
| 15 | +conveniently with your Web3Auth setup. |
| 16 | + |
| 17 | +## Type Declarations |
| 18 | + |
| 19 | +Here's how these helper functions are declared: |
| 20 | + |
| 21 | +```typescript |
| 22 | +import { ChainNamespaceType, CustomChainConfig } from "./IChainInterface"; |
| 23 | + |
| 24 | +export declare const getEvmChainConfig: ( |
| 25 | + chainId: number, |
| 26 | + web3AuthClientId?: string, |
| 27 | +) => CustomChainConfig | null; |
| 28 | +export declare const getSolanaChainConfig: (chainId: number) => CustomChainConfig | null; |
| 29 | +export declare const getXrplChainConfig: (chainId: number) => CustomChainConfig | null; |
| 30 | +export declare const getChainConfig: ( |
| 31 | + chainNamespace: ChainNamespaceType, |
| 32 | + chainId?: number | string, |
| 33 | + web3AuthClientId?: string, |
| 34 | +) => CustomChainConfig | null; |
| 35 | +``` |
| 36 | + |
| 37 | +## Usage |
| 38 | + |
| 39 | +Web3Auth provides dedicated helper functions to fetch these built-in chain configurations: |
| 40 | + |
| 41 | +### EVM Chains |
| 42 | + |
| 43 | +```typescript |
| 44 | +import { getEvmChainConfig } from "@web3auth/base"; |
| 45 | + |
| 46 | +const clientId = "YOUR_WEB3AUTH_CLIENT_ID"; // get it from https://dashboard.web3auth.io |
| 47 | + |
| 48 | +const chainConfig = getEvmChainConfig(0x1, clientId)!; |
| 49 | +``` |
| 50 | + |
| 51 | +:::info |
| 52 | + |
| 53 | +Though the `web3AuthClientId` parameter appears optional, it is mandatory to access Web3Auth's |
| 54 | +bundled premium Infura RPC APIs. It's marked optional for backward compatibility and isn't required |
| 55 | +for non-EVM chains. |
| 56 | + |
| 57 | +::: |
| 58 | + |
| 59 | +### Solana Chains |
| 60 | + |
| 61 | +```typescript |
| 62 | +import { getSolanaChainConfig } from "@web3auth/base"; |
| 63 | + |
| 64 | +const chainConfig = getSolanaChainConfig(0x1)!; |
| 65 | +``` |
| 66 | + |
| 67 | +### XRPL Chains |
| 68 | + |
| 69 | +```typescript |
| 70 | +import { getXrplChainConfig } from "@web3auth/base"; |
| 71 | + |
| 72 | +const chainConfig = getXrplChainConfig(0x2)!; |
| 73 | +``` |
| 74 | + |
| 75 | +## Supported Chains and Chain IDs |
| 76 | + |
| 77 | +### EVM Chains |
| 78 | + |
| 79 | +| Chain Name | Decimal ID | Hexadecimal ID | |
| 80 | +| --------------------------- | ---------- | -------------- | |
| 81 | +| Ethereum Mainnet | 1 | `0x1` | |
| 82 | +| Optimism | 10 | `0xa` | |
| 83 | +| Base | 8453 | `0x2105` | |
| 84 | +| Arbitrum One | 42161 | `0xa4b1` | |
| 85 | +| Linea | 59144 | `0xe708` | |
| 86 | +| Sepolia Testnet | 11155111 | `0xaa36a7` | |
| 87 | +| Polygon Mainnet | 137 | `0x89` | |
| 88 | +| Polygon Amoy Testnet | 80002 | `0x13882` | |
| 89 | +| Binance Smart Chain Mainnet | 56 | `0x38` | |
| 90 | +| Binance Smart Chain Testnet | 97 | `0x61` | |
| 91 | +| Cronos Mainnet | 25 | `0x19` | |
| 92 | +| Cronos Testnet | 338 | `0x152` | |
| 93 | +| Klaytn Mainnet | 8217 | `0x2019` | |
| 94 | +| Soneium Minato Testnet | 1946 | `0x79a` | |
| 95 | +| Soneium Mainnet | 1868 | `0x74c` | |
| 96 | + |
| 97 | +:::tip |
| 98 | + |
| 99 | +If you're working with an EVM chain that's not listed here, you must provide the complete chain |
| 100 | +configuration yourself. Please refer to the |
| 101 | +[EVM Chain Configuration](/connect-blockchain/evm/evm.mdx) guide for detailed instructions. |
| 102 | + |
| 103 | +::: |
| 104 | + |
| 105 | +### Solana Chains |
| 106 | + |
| 107 | +| Chain Name | Decimal IDs | Hexadecimal IDs | |
| 108 | +| -------------- | ----------- | --------------- | |
| 109 | +| Solana Mainnet | 1, 101 | `0x1`, `0x65` | |
| 110 | +| Solana Testnet | 2, 102 | `0x2`, `0x66` | |
| 111 | +| Solana Devnet | 3, 103 | `0x3`, `0x67` | |
| 112 | + |
| 113 | +### XRPL Chains |
| 114 | + |
| 115 | +| Chain Name | Decimal ID | Hexadecimal ID | |
| 116 | +| ------------ | ---------- | -------------- | |
| 117 | +| XRPL Mainnet | 1 | `0x1` | |
| 118 | +| XRPL Testnet | 2 | `0x2` | |
| 119 | +| XRPL Devnet | 3 | `0x3` | |
0 commit comments