/**
 * Network configuration for ChainID 138 (DeFi Oracle Meta Mainnet)
 */

export const CHAIN_ID = 138;
export const CHAIN_ID_HEX = '0x8a';
export const CHAIN_NAME = 'DeFi Oracle Meta Mainnet';
export const CHAIN_SHORT_NAME = 'defi-oracle';

/**
 * RPC endpoints
 * Domain: d-bis.org (Cloudflare DNS/SSL)
 */
export const RPC_URLS = {
  primary: 'https://rpc-http-pub.d-bis.org',
  secondary: 'https://rpc.d-bis.org',
  tertiary: 'https://rpc2.d-bis.org',
  websocket: 'wss://rpc-ws-pub.d-bis.org',
};

/** Uniswap-style token list for Chain 138 (MetaMask Settings → Token Lists). */
export const TOKEN_LIST_URL = 'https://blockscout.defi-oracle.io/api/config/token-list';
export const TOKEN_LIST_URL_ALT = 'https://tokens.d-bis.org/config/token-list.json';

/**
 * Block explorer (Defi Oracle chain 138 — standard Blockscout UI)
 */
export const BLOCK_EXPLORER_URL = 'https://blockscout.defi-oracle.io';
/** D-BIS regulated-entity overlay (same backend, alternate hostname) */
export const BLOCK_EXPLORER_OVERLAY_URL = 'https://explorer.d-bis.org';

/**
 * Network metadata for wallet_addEthereumChain
 */
export const NETWORK_METADATA = {
  chainId: CHAIN_ID_HEX,
  chainName: CHAIN_NAME,
  nativeCurrency: {
    name: 'Ether',
    symbol: 'ETH',
    decimals: 18,
  },
  rpcUrls: [RPC_URLS.primary, RPC_URLS.secondary, RPC_URLS.tertiary],
  blockExplorerUrls: [BLOCK_EXPLORER_URL, BLOCK_EXPLORER_OVERLAY_URL],
  iconUrls: [`${BLOCK_EXPLORER_URL}/token-icons/chain-138.png`],
} as const;

/**
 * CAIP-2 identifier for ChainID 138
 */
export const CAIP2_IDENTIFIER = `eip155:${CHAIN_ID}`;

