/**
 * 统一管理新链的加入
 * 后续新增链，直接在该文件里改
 */

/**
 * 选择链
 * value: 对应的接口id
 * name: 对应的路由名称
 * chain_id: 对应的链id
 * Currency: 对应的币种
 * url.website :官网
 * url.Transaction :对应的交易平台
 * url.???.need_token :是否需要拼接token跳转
 * honeypot :有没有蜜罐
 * gopluslabs :有没有gopluslabs
 */

/**
 * 2/8日
 * 缺少的链
 * doge
 * nov
 * tom
 *
 */
export const chain_options = [
  // ETH
  {
    label: 'ETH',
    value: '/eth',
    img: '/images/svg/selectChain/ETT.svg',
    name: 'ETH',
    fullName: 'ETHEREUM',
    chain_id: 1,
    Currency: ['WETH', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/eth2.svg',
        link: 'https://etherscan.io/address/',
        hashLink: 'https://etherscan.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/ethTransaction.svg',
        link: 'https://app.uniswap.org/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: true,
      url: 'https://aywt3wreda.execute-api.eu-west-1.amazonaws.com/default/IsHoneypot?chain=eth&token=',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/1?contract_addresses=',
    },
  },
  // BSC
  {
    label: 'BSC',
    value: '/coinnav',
    img: '/images/svg/selectChain/bsc.svg',
    name: 'BSC',
    fullName: 'BSC',
    chain_id: 56,
    Currency: ['WBNB', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/bsc.svg',
        link: 'https://bscscan.com/address/',
        hashLink: 'https://bscscan.com/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/bscTransaction.svg',
        link: 'https://pancakeswap.finance/swap?outputCurrency=',
        need_token: true,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: true,
      url: 'https://aywt3wreda.execute-api.eu-west-1.amazonaws.com/default/IsHoneypot?chain=bsc2&token=',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/56?contract_addresses=',
    },
  },
  // POL
  {
    label: 'POL',
    value: '/pol',
    img: '/images/svg/selectChain/pol.svg',
    name: 'POL',
    fullName: 'POLYGON',
    chain_id: 137,
    Currency: ['WMATIC', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/pol.svg',
        link: 'https://polygonscan.com/address/',
        hashLink: 'https://polygonscan.com/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/polTransaction.svg',
        link: 'https://quickswap.exchange/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/137?contract_addresses=',
    },
  },
  // ava
  {
    label: 'AVA',
    value: '/ava',
    img: '/images/svg/selectChain/ava.svg',
    name: 'AVA',
    fullName: 'AVALANCHE',
    chain_id: 43114,
    Currency: ['WAVAX', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/ava.svg',
        link: 'https://snowtrace.io/address/',
        hashLink: 'https://snowtrace.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/avaTransaction.svg',
        link: 'https://traderjoexyz.com/trade#/',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/43114?contract_addresses=',
    },
  },
  // fan
  {
    label: 'FAN',
    value: '/fan',
    img: '/images/svg/selectChain/fan.svg',
    name: 'FAN',
    fullName: 'FANTOM',
    chain_id: 250,
    Currency: ['WFTM', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/fan.svg',
        link: 'https://ftmscan.com/address/',
        hashLink: 'https://ftmscan.com/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/fanTransaction.svg',
        link: 'https://spooky.fi/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/250?contract_addresses=',
    },
  },
  // cro
  {
    label: 'CRO',
    value: '/cro',
    img: '/images/svg/selectChain/cro.svg',
    name: 'CRO',
    fullName: 'CRONOS',
    chain_id: 25,
    Currency: ['WCRO', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/cro.svg',
        link: 'https://cronoscan.com/address/',
        hashLink: 'https://cronoscan.com/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/croTransaction.svg',
        link: 'https://mm.finance/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/25?contract_addresses=',
    },
  },
  // aur
  {
    label: 'AUR',
    value: '/aur',
    img: '/images/svg/selectChain/aur.svg',
    name: 'AUR',
    fullName: 'AURORA',
    chain_id: 1313161554,
    Currency: ['WETH', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/aur.svg',
        link: 'https://aurorascan.dev/address/',
        hashLink: 'https://aurorascan.dev/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/aurTransaction.svg',
        link: 'https://www.trisolaris.io/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: false,
      url: '',
    },
  },
  // mri
  {
    label: 'MRI',
    value: '/mri',
    img: '/images/svg/selectChain/mri.svg',
    name: 'MRI',
    fullName: 'MOONRIVER',
    chain_id: 1285,
    Currency: ['WMOVR', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/mri.svg',
        link: 'https://moonriver.moonscan.io/address/',
        hashLink: 'https://moonriver.moonscan.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/mriTransaction.svg',
        link: 'https://app.solarbeam.io/zh-CN/exchange/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: false,
      url: '',
    },
  },
  // mbe
  {
    label: 'MBE',
    value: '/mbe',
    img: '/images/svg/selectChain/mbe.svg',
    name: 'MBE',
    fullName: 'MOONBEAM',
    chain_id: 1284,
    Currency: ['WGLMR', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/mbe.svg',
        link: 'https://moonbeam.moonscan.io/address/',
        hashLink: 'https://moonbeam.moonscan.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/mbeTransaction.svg',
        link: 'https://spooky.fi/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: false,
      url: '',
    },
  },
  // arb
  {
    label: 'ARB',
    value: '/arb',
    img: '/images/svg/selectChain/arb.svg',
    name: 'ARB',
    fullName: 'ARBITRUM',
    chain_id: 42161,
    Currency: ['WETH', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/arb.svg',
        link: 'https://arbiscan.io/address/',
        hashLink: 'https://arbiscan.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/arbTransaction.svg',
        link: 'https://app.uniswap.org/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/42161?contract_addresses=',
    },
  },
  // opt
  {
    label: 'OPT',
    value: '/opt',
    img: '/images/svg/selectChain/opt.svg',
    name: 'OPT',
    fullName: 'OPTIMISM',
    chain_id: 10,
    Currency: ['WETH', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/opt.svg',
        link: 'https://optimistic.etherscan.io/address/',
        hashLink: 'https://optimistic.etherscan.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/optTransaction.svg',
        link: 'https://app.uniswap.org/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/10?contract_addresses=',
    },
  },
  // gno
  {
    label: 'GNO',
    value: '/gno',
    img: '/images/svg/selectChain/gno.svg',
    name: 'GNO',
    fullName: 'GNOSIS CHAIN',
    chain_id: 100,
    Currency: ['WXDAI', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/gno.svg',
        link: 'https://gnosisscan.io/address/',
        hashLink: 'https://gnosisscan.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/gnoTransaction.svg',
        link: 'https://honeyswap.1hive.eth.limo/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/100?contract_addresses=',
    },
  },
  // cel
  {
    label: 'CEL',
    value: '/cel',
    img: '/images/svg/selectChain/cel.svg',
    name: 'CEL',
    fullName: 'CELO',
    chain_id: 42220,
    Currency: ['CELO', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/cel.svg',
        link: 'https://explorer.celo.org/mainnet/address/',
        hashLink: 'https://explorer.celo.org/mainnet/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/celTransaction.svg',
        link: 'https://app.ubeswap.org/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: false,
      url: '',
    },
  },
  // met
  {
    label: 'MET',
    value: '/met',
    img: '/images/svg/selectChain/met.svg',
    name: 'MET',
    fullName: 'METIS',
    chain_id: 1088,
    Currency: ['Metis', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/met.svg',
        link: 'https://andromeda-explorer.metis.io/address/',
        hashLink: 'https://andromeda-explorer.metis.io/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/metTransaction.svg',
        link: 'https://netswap.io/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: false,
      url: '',
    },
  },
  // hec
  {
    label: 'HEC',
    value: '/hec',
    img: '/images/svg/selectChain/hec.svg',
    name: 'HEC',
    fullName: 'HECO',
    chain_id: 128,
    Currency: ['WHT', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/hec.svg',
        link: 'https://www.hecoinfo.com/en-us/address/',
        hashLink: 'https://www.hecoinfo.com/en-us/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/hecTransaction.svg',
        link: 'https://ht.mdex.com/#/swap?outputCurrency=',
        need_token: true,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: true,
      url: 'https://api.gopluslabs.io/api/v1/token_security/128?contract_addresses=',
    },
  },
  // ast
  {
    label: 'AST',
    value: '/ast',
    img: '/images/svg/selectChain/ast.svg',
    name: 'AST',
    fullName: 'ASTAR',
    chain_id: 592,
    Currency: ['WASTR', 'USDT'],
    url: {
      website: {
        img: '/images/svg/socialInfoWrapper/ast.svg',
        link: 'https://blockscout.com/astar/address/',
        hashLink: 'https://blockscout.com/astar/tx/',
        need_token: true,
        title: 'website',
      },
      Transaction: {
        img: '/images/svg/socialInfoWrapper/astTransaction.svg',
        link: 'https://app.arthswap.org/#/swap',
        need_token: false,
        title: 'Transaction',
      },
    },
    honeypot: {
      request: false,
      url: '',
    },
    gopluslabs: {
      request: false,
      url: '',
    },
  },
];

/**
 * 打开页面默认展示的链
 * 后续需要修改默认链改这里
 * 以chain_options数组的value作为标识
 */
export const DefaultChain = '/eth';

/**
 * 滚动代币
 */
export const publicTokenImg = [
  {
    img: '/images/svg/publicToken/dai.svg',
    title: 'DAI',
  },
  {
    img: '/images/svg/publicToken/eth.svg',
    title: 'ETH',
  },
  {
    img: '/images/svg/publicToken/usdt.svg',
    title: 'USDT',
  },
  {
    img: '/images/svg/publicToken/btc.svg',
    title: 'BTCB',
  },
  {
    img: '/images/svg/publicToken/btc.svg',
    title: 'BTC',
  },
  {
    img: '/images/svg/publicToken/usdc.svg',
    title: 'USDC',
  },
  {
    img: '/images/svg/publicToken/fist.svg',
    title: 'FIST',
  },
  {
    img: '/images/svg/publicToken/doge.svg',
    title: 'DOGE',
  },
  {
    img: '/images/svg/publicToken/bnb.svg',
    title: 'WBNB',
  },
  {
    img: '/images/svg/publicToken/bnb.svg',
    title: 'BNB',
  },
  {
    img: '/images/svg/publicToken/busd.svg',
    title: 'BUSD',
  },
  // wbtc
  {
    img: '/images/svg/publicToken/wbtc.svg',
    title: 'WBTC',
  },
  // m.DAI
  {
    img: '/images/svg/publicToken/mDAI.svg',
    title: 'm.DAI',
  },
  // mCELO
  {
    img: '/images/svg/publicToken/mCELO.svg',
    title: 'mCELO',
  },
  // weth
  {
    img: '/images/svg/publicToken/weth.svg',
    title: 'WETH',
  },
  // WMATIC
  {
    img: '/images/svg/publicToken/WMATIC.svg',
    title: 'WMATIC',
  },
  // WETH.e
  {
    img: '/images/svg/publicToken/weth.svg',
    title: 'WETH.e',
  },
  // WBTC.e
  {
    img: '/images/svg/publicToken/wbtc.svg',
    title: 'WBTC.e',
  },
  // USDC.e
  {
    img: '/images/svg/publicToken/usdc.svg',
    title: 'USDC.e',
  },
  // USDT.e
  {
    img: '/images/svg/publicToken/usdt.svg',
    title: 'USDT.e',
  },
  // WAVAX
  {
    img: '/images/svg/publicToken/ava.svg',
    title: 'WAVAX',
  },
  // WFTM
  {
    img: '/images/svg/publicToken/wftm.svg',
    title: 'WFTM',
  },
  // fUSDT
  {
    img: '/images/svg/publicToken/fusdt.svg',
    title: 'fUSDT',
  },
  // FETH
  {
    img: '/images/svg/publicToken/feth.svg',
    title: 'FETH',
  },
  // FBTC
  {
    img: '/images/svg/publicToken/fbtc.svg',
    title: 'FBTC',
  },
  // LINSPIRIT
  {
    img: '/images/svg/publicToken/LINSPIRIT.svg',
    title: 'LINSPIRIT',
  },
  // MATIC
  {
    img: '/images/svg/publicToken/MATIC.svg',
    title: 'MATIC',
  },
  // FRAX
  {
    img: '/images/svg/publicToken/FRAX.svg',
    title: 'FRAX',
  },
  // AVAX
  {
    img: '/images/svg/publicToken/AVAX.svg',
    title: 'AVAX',
  },
  // FTM
  {
    img: '/images/svg/publicToken/FTM.svg',
    title: 'FTM',
  },
  // WGLMR
  {
    img: '/images/svg/publicToken/WGLMR.svg',
    title: 'WGLMR',
  },
  // WMOVR
  {
    img: '/images/svg/publicToken/WMOVR.svg',
    title: 'WMOVR',
  },
  // xcKSM
  {
    img: '/images/svg/publicToken/xcKSM.svg',
    title: 'xcKSM',
  },
  // WCRO
  {
    img: '/images/svg/publicToken/WCRO.svg',
    title: 'WCRO',
  },
  // AURORA
  {
    img: '/images/svg/publicToken/AURORA.svg',
    title: 'AURORA',
  },
  // NEAR
  {
    img: '/images/svg/publicToken/NEAR.svg',
    title: 'NEAR',
  },
  // TRI
  {
    img: '/images/svg/publicToken/TRI.svg',
    title: 'TRI',
  },

  // new-0-------------------------
  // GNO
  {
    img: '/images/svg/publicToken/gno.svg',
    title: 'GNO',
  },
  // wxdai
  {
    img: '/images/svg/publicToken/wxdai.svg',
    title: 'WXDAI',
  },
  // HNY
  {
    img: '/images/svg/publicToken/HNY.svg',
    title: 'HNY',
  },
  // OP
  {
    img: '/images/svg/publicToken/opt.svg',
    title: 'OP',
  },
  // sUSD
  {
    img: '/images/svg/publicToken/sUSD.svg',
    title: 'sUSD',
  },
  // VELO
  {
    img: '/images/svg/publicToken/VELO.svg',
    title: 'VELO',
  },
  // CELO
  {
    img: '/images/svg/publicToken/CELO.svg',
    title: 'CELO',
  },
  // cUSD
  {
    img: '/images/svg/publicToken/cUSD.svg',
    title: 'cUSD',
  },
  // mCEUR
  {
    img: '/images/svg/publicToken/mCEUR.svg',
    title: 'mCEUR',
  },
  // Metis
  {
    img: '/images/svg/publicToken/Metis.svg',
    title: 'Metis',
  },
  // m.USDT
  {
    img: '/images/svg/publicToken/mUSDT.svg',
    title: 'm.USDT',
  },
  // HBTC
  {
    img: '/images/svg/publicToken/HBTC.svg',
    title: 'HBTC',
  },
  // HUSD
  {
    img: '/images/svg/publicToken/HUSD.svg',
    title: 'HUSD',
  },
  // MDX
  {
    img: '/images/svg/publicToken/MDX.svg',
    title: 'MDX',
  },
  // WHT
  {
    img: '/images/svg/publicToken/WHT.svg',
    title: 'WHT',
  },
  // ARSW
  {
    img: '/images/svg/publicToken/ARSW.svg',
    title: 'ARSW',
  },
  // WASTR
  {
    img: '/images/svg/publicToken/WASTR.svg',
    title: 'WASTR',
  },
];

/**
 * 搜索模块的按钮组
 * 用来搜索不同链
 * 因为有all,所以不使用chain_options作为按钮组
 */
export const SearchChainOptions = [
  {
    label: 'ALL',
    value: 'all',
  },
  {
    label: 'BSC',
    value: 'bsc',
  },
  {
    label: 'ETH',
    value: 'eth',
  },
  {
    label: 'POL',
    value: 'pol',
  },
  {
    label: 'AVA',
    value: 'ava',
  },
  {
    label: 'ARB',
    value: 'arb',
  },
  {
    label: 'FAN',
    value: 'fan',
  },
  {
    label: 'MBE',
    value: 'mbe',
  },
  {
    label: 'MRI',
    value: 'mri',
  },
  {
    label: 'CRO',
    value: 'cro',
  },
  {
    label: 'AUR',
    value: 'aur',
  },
  {
    label: 'GNO',
    value: 'gno',
  },
  {
    label: 'OPT',
    value: 'opt',
  },
  {
    label: 'CEL',
    value: 'cel',
  },
  {
    label: 'MET',
    value: 'met',
  },
  {
    label: 'HEC',
    value: 'hec',
  },
  {
    label: 'AST',
    value: 'ast',
  },
];

/**
 * goplus所需字段
 */
export const goplusList = [
  {
    value: '-',
    key: 'can_take_back_ownership',
    type: 'isit',
  },
  {
    value: '-',
    key: 'cannot_sell_all',
    type: 'isit',
  },
  {
    value: '-',
    key: 'is_open_source',
    type: 'isit',
  },
  {
    value: '-',
    key: 'slippage_modifiable',
    type: 'isit',
  },
  {
    value: '-',
    key: 'trading_cooldown',
    type: 'isit',
  },
  {
    value: '-',
    key: 'transfer_pausable',
    type: 'isit',
  },
  {
    value: '-',
    key: 'buy_tax',
    type: 'number',
  },
  {
    value: '-',
    key: 'sell_tax',
    type: 'number',
  },
  {
    value: '-',
    key: 'is_anti_whale',
    type: 'isit',
  },
  {
    value: '-',
    key: 'is_blacklisted',
    type: 'isit',
  },
  {
    value: '-',
    key: 'is_proxy',
    type: 'isit',
  },
  {
    value: '-',
    key: 'is_whitelisted',
    type: 'isit',
  },
  {
    value: '-',
    key: 'lp_holder_count',
    type: 'number',
  },
];

/**
 * 从链数组中过滤出符合条件的对象
 * @params key--比较的键
 * @params Compare--比较的值
 * @params NeedIndex --是否需要当前对象的下标--默认false-不需要
 */
export const filterChainObj = (
  key: string,
  Compare: number | string,
  NeedIndex: boolean = false
) => {
  // 找到整个对象
  let value: any = chain_options.find((item: any) => item[key] === Compare);
  if (NeedIndex) {
    //   加上下标
    let index = chain_options.findIndex((item: any) => item[key] === Compare);
    if (typeof index === 'number') {
      value.index = index;
    }
  }
  return value;
};

/**
 * 查询开关展示的币种
 * @params
 */
export const SwitchCurrency = (value: string = DefaultChain) => {
  let index = chain_options.findIndex((item: any) => item.value === value);
  return chain_options[index].Currency;
};
