'use client' import { useState } from 'react' const CHAIN_138 = { chainId: '0x8a', chainName: 'DeFi Oracle Meta Mainnet', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: ['https://rpc-http-pub.d-bis.org', 'https://rpc.d-bis.org', 'https://rpc2.d-bis.org'], blockExplorerUrls: ['https://explorer.d-bis.org'], } const CHAIN_MAINNET = { chainId: '0x1', chainName: 'Ethereum Mainnet', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: ['https://eth.llamarpc.com', 'https://rpc.ankr.com/eth', 'https://ethereum.publicnode.com'], blockExplorerUrls: ['https://etherscan.io'], } const CHAIN_ALL_MAINNET = { chainId: '0x9f2c4', chainName: 'ALL Mainnet', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: ['https://mainnet-rpc.alltra.global'], blockExplorerUrls: ['https://alltra.global'], } export function AddToMetaMask() { const [status, setStatus] = useState(null) const [error, setError] = useState(null) const ethereum = typeof window !== 'undefined' ? (window as unknown as { ethereum?: { request: (args: { method: string; params: unknown[] }) => Promise } }).ethereum : undefined const addChain = async (chain: typeof CHAIN_138) => { setError(null) setStatus(null) if (!ethereum) { setError('MetaMask or another Web3 wallet is not installed.') return } try { await ethereum.request({ method: 'wallet_addEthereumChain', params: [chain], }) setStatus(`Added ${chain.chainName}. You can switch to it in your wallet.`) } catch (e) { const err = e as { code?: number; message?: string } if (err.code === 4902) { setStatus(`Added ${chain.chainName}. You can switch to it in your wallet.`) } else { setError(err.message || 'Failed to add network') } } } // Production (explorer.d-bis.org): same origin; dev: NEXT_PUBLIC_API_URL or localhost const apiBase = typeof window !== 'undefined' ? process.env.NEXT_PUBLIC_API_URL || window.location.origin : process.env.NEXT_PUBLIC_API_URL || 'https://explorer.d-bis.org' const tokenListUrl = apiBase.replace(/\/$/, '') + '/api/config/token-list' return (

Add to MetaMask

Add Chain 138 (DeFi Oracle Meta Mainnet), Ethereum Mainnet, or ALL Mainnet to your wallet. Then add the token list URL in MetaMask Settings so tokens appear automatically.

Token list URL (add in MetaMask Settings → Token lists):

{tokenListUrl}
{status &&

{status}

} {error &&

{error}

}
) }