Commit 5a9034fe authored by Ian Lapham's avatar Ian Lapham Committed by GitHub

fix for error token map parsings (#1384)

parent 6d5625a1
...@@ -61,7 +61,10 @@ export function listToTokenMap(list: TokenList): TokenAddressMap { ...@@ -61,7 +61,10 @@ export function listToTokenMap(list: TokenList): TokenAddressMap {
}) })
?.filter((x): x is TagInfo => Boolean(x)) ?? [] ?.filter((x): x is TagInfo => Boolean(x)) ?? []
const token = new WrappedTokenInfo(tokenInfo, tags) const token = new WrappedTokenInfo(tokenInfo, tags)
if (tokenMap[token.chainId][token.address] !== undefined) throw Error('Duplicate tokens.') if (tokenMap[token.chainId][token.address] !== undefined) {
console.error(new Error(`Duplicate token! ${token.address}`))
return tokenMap
}
return { return {
...tokenMap, ...tokenMap,
[token.chainId]: { [token.chainId]: {
......
...@@ -7,7 +7,7 @@ import { useFetchListCallback } from '../../hooks/useFetchListCallback' ...@@ -7,7 +7,7 @@ import { useFetchListCallback } from '../../hooks/useFetchListCallback'
import useInterval from '../../hooks/useInterval' import useInterval from '../../hooks/useInterval'
import useIsWindowVisible from '../../hooks/useIsWindowVisible' import useIsWindowVisible from '../../hooks/useIsWindowVisible'
import { AppDispatch } from '../index' import { AppDispatch } from '../index'
import { acceptListUpdate, removeList } from './actions' import { acceptListUpdate } from './actions'
import { useActiveListUrls } from './hooks' import { useActiveListUrls } from './hooks'
import { useAllInactiveTokens } from 'hooks/Tokens' import { useAllInactiveTokens } from 'hooks/Tokens'
import { UNSUPPORTED_LIST_URLS } from 'constants/lists' import { UNSUPPORTED_LIST_URLS } from 'constants/lists'
...@@ -35,13 +35,6 @@ export default function Updater(): null { ...@@ -35,13 +35,6 @@ export default function Updater(): null {
// fetch all lists every 10 minutes, but only after we initialize library // fetch all lists every 10 minutes, but only after we initialize library
useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null) useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null)
// hot fix for fetching error
useEffect(() => {
if (lists['https://tokens.coingecko.com/uniswap/all.json']) {
dispatch(removeList('https://tokens.coingecko.com/uniswap/all.json'))
}
}, [dispatch, lists])
// whenever a list is not loaded and not loading, try again to load it // whenever a list is not loaded and not loading, try again to load it
useEffect(() => { useEffect(() => {
Object.keys(lists).forEach(listUrl => { Object.keys(lists).forEach(listUrl => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment