From 8e11040fd78e58f0ad834aa0fa6cc492e6c8e077 Mon Sep 17 00:00:00 2001 From: jimmyshi <417711026@qq.com> Date: Mon, 23 Mar 2026 09:43:02 +0800 Subject: [PATCH] Add XLayer mainnet and testnet support using viem built-in chains --- src/core/chains.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/chains.ts b/src/core/chains.ts index 75115d3..67b6efa 100644 --- a/src/core/chains.ts +++ b/src/core/chains.ts @@ -32,7 +32,8 @@ import { aurora, canto, flowMainnet, - + xLayer, + // Testnets sepolia, optimismSepolia, @@ -57,7 +58,8 @@ import { goerli, holesky, flowTestnet, - filecoinCalibration + filecoinCalibration, + xLayerTestnet, } from 'viem/chains'; // Default configuration values @@ -98,7 +100,8 @@ export const chainMap: Record = { 1313161554: aurora, 7700: canto, 747: flowMainnet, - + 196: xLayer, + // Testnets 11155111: sepolia, 11155420: optimismSepolia, @@ -124,6 +127,7 @@ export const chainMap: Record = { 17000: holesky, 545: flowTestnet, 314159: filecoinCalibration, + 1952: xLayerTestnet, }; // Map network names to chain IDs for easier reference @@ -172,7 +176,8 @@ export const networkNameMap: Record = { 'aurora': 1313161554, 'canto': 7700, 'flow': 747, - + 'xlayer': 196, + // Testnets 'sepolia': 11155111, 'optimism-sepolia': 11155420, @@ -218,6 +223,7 @@ export const networkNameMap: Record = { 'holesky': 17000, 'flow-testnet': 545, 'filecoin-calibration': 314159, + 'xlayer-testnet': 1952, }; // Map chain IDs to RPC URLs @@ -254,7 +260,8 @@ export const rpcUrlMap: Record = { 1313161554: 'https://mainnet.aurora.dev', 7700: 'https://canto.gravitychain.io', 747: 'https://mainnet.evm.nodes.onflow.org', - + 196: 'https://xlayerrpc.okx.com', + // Testnets 11155111: 'https://sepolia.drpc.org', 11155420: 'https://sepolia.optimism.io', @@ -280,6 +287,7 @@ export const rpcUrlMap: Record = { 17000: 'https://ethereum-holesky.publicnode.com', 545: 'https://testnet.evm.nodes.onflow.org', 314159: 'https://api.calibration.node.glif.io/rpc/v1', + 1952: 'https://xlayertestrpc.okx.com', }; /**