@openzeppelin/contracts-ui-builder-adapter-evm
Version:
EVM Adapter for Contracts UI Builder
273 lines (259 loc) • 7.43 kB
text/typescript
import {
arbitrumSepolia as viemArbitrumSepolia,
avalancheFuji as viemAvalancheFuji,
baseSepolia as viemBaseSepolia,
bscTestnet as viemBscTestnet,
lineaSepolia as viemLineaSepolia,
optimismSepolia as viemOptimismSepolia,
polygonAmoy as viemPolygonAmoy,
polygonZkEvmCardona as viemPolygonZkEvmCardona,
scrollSepolia as viemScrollSepolia,
sepolia as viemSepolia,
zksyncSepoliaTestnet as viemZkSyncSepoliaTestnet,
} from 'viem/chains';
import { TypedEvmNetworkConfig } from '../types';
export const ethereumSepolia: TypedEvmNetworkConfig = {
id: 'ethereum-sepolia',
exportConstName: 'ethereumSepolia',
name: 'Sepolia',
ecosystem: 'evm',
network: 'ethereum',
type: 'testnet',
isTestnet: true,
chainId: 11155111,
rpcUrl: viemSepolia.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia.etherscan.io',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'ethereum',
nativeCurrency: {
name: 'Sepolia Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemSepolia,
};
export const arbitrumSepolia: TypedEvmNetworkConfig = {
id: 'arbitrum-sepolia',
exportConstName: 'arbitrumSepolia',
name: 'Arbitrum Sepolia',
ecosystem: 'evm',
network: 'arbitrum',
type: 'testnet',
isTestnet: true,
chainId: 421614,
rpcUrl: viemArbitrumSepolia.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia.arbiscan.io',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'arbitrum',
nativeCurrency: {
name: 'Arbitrum Sepolia Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemArbitrumSepolia,
};
export const polygonAmoy: TypedEvmNetworkConfig = {
id: 'polygon-amoy',
exportConstName: 'polygonAmoy',
name: 'Polygon Amoy',
ecosystem: 'evm',
network: 'polygon',
type: 'testnet',
isTestnet: true,
chainId: 80002,
rpcUrl: viemPolygonAmoy.rpcUrls.default.http[0],
explorerUrl: 'https://amoy.polygonscan.com',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'polygon',
nativeCurrency: {
name: 'MATIC',
symbol: 'MATIC',
decimals: 18,
},
viemChain: viemPolygonAmoy,
};
export const polygonZkEvmCardona: TypedEvmNetworkConfig = {
id: 'polygon-zkevm-cardona',
exportConstName: 'polygonZkEvmCardona',
name: 'Polygon zkEVM Cardona',
ecosystem: 'evm',
network: 'polygon-zkevm',
type: 'testnet',
isTestnet: true,
chainId: 2442,
rpcUrl: viemPolygonZkEvmCardona.rpcUrls.default.http[0],
explorerUrl: 'https://cardona-zkevm.polygonscan.com',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'polygon',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemPolygonZkEvmCardona,
};
export const baseSepolia: TypedEvmNetworkConfig = {
id: 'base-sepolia',
exportConstName: 'baseSepolia',
name: 'Base Sepolia',
ecosystem: 'evm',
network: 'base',
type: 'testnet',
isTestnet: true,
chainId: 84532,
rpcUrl: viemBaseSepolia.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia.basescan.org',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'base',
nativeCurrency: {
name: 'Sepolia Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemBaseSepolia,
};
export const bscTestnet: TypedEvmNetworkConfig = {
id: 'bsc-testnet',
exportConstName: 'bscTestnet',
name: 'BSC Testnet',
ecosystem: 'evm',
network: 'bsc',
type: 'testnet',
isTestnet: true,
chainId: 97,
rpcUrl: viemBscTestnet.rpcUrls.default.http[0],
explorerUrl: 'https://testnet.bscscan.com',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'bsc',
nativeCurrency: {
name: 'BNB',
symbol: 'BNB',
decimals: 18,
},
viemChain: viemBscTestnet,
};
export const optimismSepolia: TypedEvmNetworkConfig = {
id: 'optimism-sepolia',
exportConstName: 'optimismSepolia',
name: 'OP Sepolia',
ecosystem: 'evm',
network: 'optimism',
type: 'testnet',
isTestnet: true,
chainId: 11155420,
rpcUrl: viemOptimismSepolia.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia-optimism.etherscan.io',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'optimism',
nativeCurrency: {
name: 'Sepolia Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemOptimismSepolia,
};
export const avalancheFuji: TypedEvmNetworkConfig = {
id: 'avalanche-fuji',
exportConstName: 'avalancheFuji',
name: 'Avalanche Fuji C-Chain',
ecosystem: 'evm',
network: 'avalanche',
type: 'testnet',
isTestnet: true,
chainId: 43113,
rpcUrl: viemAvalancheFuji.rpcUrls.default.http[0],
explorerUrl: 'https://testnet.snowscan.xyz',
apiUrl: 'https://api.etherscan.io/v2/api', // Using Etherscan V2 unified API
primaryExplorerApiIdentifier: 'etherscan-v2', // Unified identifier for V2 API
supportsEtherscanV2: true,
requiresExplorerApiKey: true,
icon: 'avalanche',
nativeCurrency: {
name: 'Avalanche',
symbol: 'AVAX',
decimals: 18,
},
viemChain: viemAvalancheFuji,
};
// TODO: test and setup the api and explorer config
export const zksyncSepoliaTestnet: TypedEvmNetworkConfig = {
id: 'zksync-era-sepolia',
exportConstName: 'zksyncSepoliaTestnet',
name: 'ZkSync Era Sepolia',
ecosystem: 'evm',
network: 'zksync-era',
type: 'testnet',
isTestnet: true,
chainId: 300,
rpcUrl: viemZkSyncSepoliaTestnet.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia.explorer.zksync.io',
apiUrl: 'https://block-explorer-api.sepolia.zksync.dev/api',
primaryExplorerApiIdentifier: 'zksync-era-sepolia',
supportsEtherscanV2: false,
icon: 'zksync',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemZkSyncSepoliaTestnet,
};
export const scrollSepolia: TypedEvmNetworkConfig = {
id: 'scroll-sepolia',
exportConstName: 'scrollSepolia',
name: 'Scroll Sepolia',
ecosystem: 'evm',
network: 'scroll',
type: 'testnet',
isTestnet: true,
chainId: 534351,
rpcUrl: viemScrollSepolia.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia.scrollscan.dev',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'scroll',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemScrollSepolia,
};
export const lineaSepolia: TypedEvmNetworkConfig = {
id: 'linea-sepolia',
exportConstName: 'lineaSepolia',
name: 'Linea Sepolia',
ecosystem: 'evm',
network: 'linea',
type: 'testnet',
isTestnet: true,
chainId: 59141,
rpcUrl: viemLineaSepolia.rpcUrls.default.http[0],
explorerUrl: 'https://sepolia.lineascan.build',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'linea',
nativeCurrency: {
name: 'Linea Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemLineaSepolia,
};
// TODO: Add other EVM testnet networks as needed (e.g., Arbitrum Sepolia)