/**
 * Token icon URLs for display in the DApp (symbol or key → URL).
 * Aligned with token-lists logoURI (IPFS-hosted via Pinata).
 * Includes Chain 138, Cronos (25) ISO-4217 W tokens, and compliant stables.
 */
const IPFS = 'https://ipfs.io/ipfs';
const ETH_LOGO = `${IPFS}/Qma3FKtLce9MjgJgWbtyCxBiPjJ6xi8jGWUSKNS5Jc2ong`;
const WETH10_LOGO = `${IPFS}/QmanDFPHxnbKd6SSNzzXHf9GbpL9dLXSphxDZSPPYE6ds4`;
const LINK_LOGO = `${IPFS}/QmenWcmfNGfssz4HXvrRV912eZDiKqLTt6z2brRYuTGz9A`;
const CUSDT_LOGO = `${IPFS}/QmRfhPs9DcyFPpGjKwF6CCoVDWUHSxkQR34n9NK7JSbPCP`;
const CUSDC_LOGO = `${IPFS}/QmNPq4D5JXzurmi9jAhogVMzhAQRk1PZ1r9H3qQUV9gjDm`;
const ETHUSD_LOGO = `${IPFS}/QmPZuycjyJEe2otREuQ5HirvPJ8X6Yc6MBtwz1VhdD79pY`;
const EURW_LOGO = `${IPFS}/QmPh16PY241zNtePyeK7ep1uf1RcARV2ynGAuRU8U7sSqS`;
const GBPW_LOGO = `${IPFS}/QmT2nJ6WyhYBCsYJ6NfS1BPAqiGKkCEuMxiC8ye93Co1hF`;
const W_LOGO = `${IPFS}/Qmb9JmuD9ehaQtTLBBZmAoiAbvE53e3FMjkEty8rvbPf9K`;

export const TOKEN_ICON_URLS: Record<string, string> = {
  ETH: ETH_LOGO,
  WETH: ETH_LOGO,
  WETH9: ETH_LOGO,
  WETH10: WETH10_LOGO,
  LINK: LINK_LOGO,
  cUSDT: CUSDT_LOGO,
  cUSDC: CUSDC_LOGO,
  'ETH-USD': ETHUSD_LOGO,
  USDW: CUSDC_LOGO,
  EURW: EURW_LOGO,
  GBPW: GBPW_LOGO,
  AUDW: W_LOGO,
  JPYW: W_LOGO,
  CHFW: W_LOGO,
  CADW: W_LOGO,
};

export const TOKEN_ICON_BY_ADDRESS: Record<string, string> = {
  // Chain 138
  '0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6': ETHUSD_LOGO,
  '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': ETH_LOGO,
  '0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9F': WETH10_LOGO,
  '0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03': LINK_LOGO,
  '0x93E66202A11B1772E55407B32B44e5Cd8eda7f22': CUSDT_LOGO,
  '0xf22258f57794CC8E06237084b353Ab30fFfa640b': CUSDC_LOGO,
  // Cronos (25) WETH9, LINK, ISO-4217 W tokens
  '0x99B3511A2d315A497C8112C1fdd8D508d4B1E506': ETH_LOGO,
  '0x8c80A01F461f297Df7F9DA3A4f740D7297C8Ac85': LINK_LOGO,
  '0x948690147D2e50ffe50C5d38C14125aD6a9FA036': CUSDC_LOGO,
  '0x58a8D8F78F1B65c06dAd7542eC46b299629A60dd': EURW_LOGO,
  '0xFb4B6Cc81211F7d886950158294A44C312abCA29': GBPW_LOGO,
  '0xf9f5D0ACD71C76F9476F10B3F3d3E201F0883C68': W_LOGO,
  '0xeE17bB0322383fecCA2784fbE2d4CD7d02b1905B': W_LOGO,
  '0xc9750828124D4c10e7a6f4B655cA8487bD3842EB': W_LOGO,
  '0x328Cd365Bb35524297E68ED28c6fF2C9557d1363': W_LOGO,
};

export function getTokenIconUrl(symbol: string): string | undefined {
  const key = symbol?.toUpperCase() || '';
  return TOKEN_ICON_URLS[key] ?? TOKEN_ICON_URLS[symbol ?? ''];
}
