@openzeppelin/contracts-ui-builder-adapter-evm
Version:
EVM Adapter for Contracts UI Builder
272 lines (258 loc) • 6.88 kB
text/typescript
import {
arbitrum as viemArbitrum,
avalanche as viemAvalanche,
base as viemBase,
bsc as viemBsc,
linea as viemLinea,
mainnet as viemMainnet,
optimism as viemOptimism,
polygon as viemPolygon,
polygonZkEvm as viemPolygonZkEvm,
scroll as viemScroll,
zksync as viemZkSync,
} from 'viem/chains';
import { TypedEvmNetworkConfig } from '../types';
export const ethereumMainnet: TypedEvmNetworkConfig = {
id: 'ethereum-mainnet',
exportConstName: 'ethereumMainnet',
name: 'Ethereum',
ecosystem: 'evm',
network: 'ethereum',
type: 'mainnet',
isTestnet: false,
chainId: 1,
rpcUrl: viemMainnet.rpcUrls.default.http[0],
explorerUrl: 'https://etherscan.io',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'ethereum',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemMainnet,
};
export const arbitrumMainnet: TypedEvmNetworkConfig = {
id: 'arbitrum-mainnet',
exportConstName: 'arbitrumMainnet',
name: 'Arbitrum One',
ecosystem: 'evm',
network: 'arbitrum',
type: 'mainnet',
isTestnet: false,
chainId: 42161,
rpcUrl: viemArbitrum.rpcUrls.default.http[0],
explorerUrl: 'https://arbiscan.io',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'arbitrum',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemArbitrum,
};
export const polygonMainnet: TypedEvmNetworkConfig = {
id: 'polygon-mainnet',
exportConstName: 'polygonMainnet',
name: 'Polygon',
ecosystem: 'evm',
network: 'polygon',
type: 'mainnet',
isTestnet: false,
chainId: 137,
rpcUrl: viemPolygon.rpcUrls.default.http[0],
explorerUrl: 'https://polygonscan.com',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'polygon',
nativeCurrency: {
name: 'MATIC',
symbol: 'MATIC',
decimals: 18,
},
viemChain: viemPolygon,
};
export const polygonZkEvmMainnet: TypedEvmNetworkConfig = {
id: 'polygon-zkevm-mainnet',
exportConstName: 'polygonZkEvmMainnet',
name: 'Polygon zkEVM',
ecosystem: 'evm',
network: 'polygon-zkevm',
type: 'mainnet',
isTestnet: false,
chainId: 1101,
rpcUrl: viemPolygonZkEvm.rpcUrls.default.http[0],
explorerUrl: 'https://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: viemPolygonZkEvm,
};
export const baseMainnet: TypedEvmNetworkConfig = {
id: 'base-mainnet',
exportConstName: 'baseMainnet',
name: 'Base',
ecosystem: 'evm',
network: 'base',
type: 'mainnet',
isTestnet: false,
chainId: 8453,
rpcUrl: viemBase.rpcUrls.default.http[0],
explorerUrl: 'https://basescan.org',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'base',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemBase,
};
export const bscMainnet: TypedEvmNetworkConfig = {
id: 'bsc-mainnet',
exportConstName: 'bscMainnet',
name: 'BNB Smart Chain',
ecosystem: 'evm',
network: 'bsc',
type: 'mainnet',
isTestnet: false,
chainId: 56,
rpcUrl: viemBsc.rpcUrls.default.http[0],
explorerUrl: 'https://bscscan.com',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'bsc',
nativeCurrency: {
name: 'BNB',
symbol: 'BNB',
decimals: 18,
},
viemChain: viemBsc,
};
export const optimismMainnet: TypedEvmNetworkConfig = {
id: 'optimism-mainnet',
exportConstName: 'optimismMainnet',
name: 'OP Mainnet',
ecosystem: 'evm',
network: 'optimism',
type: 'mainnet',
isTestnet: false,
chainId: 10,
rpcUrl: viemOptimism.rpcUrls.default.http[0],
explorerUrl: 'https://optimistic.etherscan.io',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'optimism',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemOptimism,
};
export const avalancheMainnet: TypedEvmNetworkConfig = {
id: 'avalanche-mainnet',
exportConstName: 'avalancheMainnet',
name: 'Avalanche C-Chain',
ecosystem: 'evm',
network: 'avalanche',
type: 'mainnet',
isTestnet: false,
chainId: 43114,
rpcUrl: viemAvalanche.rpcUrls.default.http[0],
explorerUrl: 'https://snowscan.xyz',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'avalanche',
nativeCurrency: {
name: 'Avalanche',
symbol: 'AVAX',
decimals: 18,
},
viemChain: viemAvalanche,
};
// TODO: test and setup the api and explorer config
export const zkSyncEraMainnet: TypedEvmNetworkConfig = {
id: 'zksync-era-mainnet',
exportConstName: 'zkSyncEraMainnet',
name: 'ZkSync Era',
ecosystem: 'evm',
network: 'zksync-era',
type: 'mainnet',
isTestnet: false,
chainId: 324,
rpcUrl: viemZkSync.rpcUrls.default.http[0],
explorerUrl: 'https://explorer.zksync.io',
apiUrl: 'https://block-explorer-api.mainnet.zksync.io/api',
primaryExplorerApiIdentifier: 'zksync-era-mainnet',
supportsEtherscanV2: false,
icon: 'zksync',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemZkSync,
};
export const scrollMainnet: TypedEvmNetworkConfig = {
id: 'scroll-mainnet',
exportConstName: 'scrollMainnet',
name: 'Scroll',
ecosystem: 'evm',
network: 'scroll',
type: 'mainnet',
isTestnet: false,
chainId: 534352,
rpcUrl: viemScroll.rpcUrls.default.http[0],
explorerUrl: 'https://scrollscan.com',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'scroll',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemScroll,
};
export const lineaMainnet: TypedEvmNetworkConfig = {
id: 'linea-mainnet',
exportConstName: 'lineaMainnet',
name: 'Linea',
ecosystem: 'evm',
network: 'linea',
type: 'mainnet',
isTestnet: false,
chainId: 59144,
rpcUrl: viemLinea.rpcUrls.default.http[0],
explorerUrl: 'https://lineascan.build',
apiUrl: 'https://api.etherscan.io/v2/api',
primaryExplorerApiIdentifier: 'etherscan-v2',
supportsEtherscanV2: true,
icon: 'linea',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
viemChain: viemLinea,
};
// TODO: Add other EVM mainnet networks with their public RPCs and viemChain objects