Compare commits
No commits in common. "48eb3f0005c3ea784e551c77a24195fb44e48eb2" and "1c131ee4963c54e1582b6786ed9e0b12a099fd8d" have entirely different histories.
48eb3f0005
...
1c131ee496
@ -1,6 +1,8 @@
|
|||||||
export const UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org'
|
export const UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org'
|
||||||
export const UNI_EXTENDED_LIST = 'https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org'
|
export const UNI_EXTENDED_LIST = 'https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org'
|
||||||
|
const UNI_UNSUPPORTED_LIST = 'https://cloudflare-ipfs.com/ipns/unsupportedtokens.uniswap.org'
|
||||||
const AAVE_LIST = 'tokenlist.aave.eth'
|
const AAVE_LIST = 'tokenlist.aave.eth'
|
||||||
|
const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json'
|
||||||
// TODO(WEB-2282): Re-enable CMC list once we have a better solution for handling large lists.
|
// TODO(WEB-2282): Re-enable CMC list once we have a better solution for handling large lists.
|
||||||
// const CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json'
|
// const CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json'
|
||||||
const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json'
|
const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json'
|
||||||
@ -25,6 +27,8 @@ export const AVALANCHE_LIST =
|
|||||||
export const BASE_LIST =
|
export const BASE_LIST =
|
||||||
'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json'
|
'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json'
|
||||||
|
|
||||||
|
export const UNSUPPORTED_LIST_URLS: string[] = [BA_LIST, UNI_UNSUPPORTED_LIST]
|
||||||
|
|
||||||
// default lists to be 'active' aka searched across
|
// default lists to be 'active' aka searched across
|
||||||
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST]
|
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST]
|
||||||
export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
|
export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
|
||||||
@ -48,7 +52,8 @@ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
|
|||||||
CELO_LIST,
|
CELO_LIST,
|
||||||
PLASMA_BNB_LIST,
|
PLASMA_BNB_LIST,
|
||||||
AVALANCHE_LIST,
|
AVALANCHE_LIST,
|
||||||
BASE_LIST
|
BASE_LIST,
|
||||||
|
...UNSUPPORTED_LIST_URLS,
|
||||||
]
|
]
|
||||||
|
|
||||||
export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS]
|
export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS]
|
||||||
|
@ -127,7 +127,7 @@ export const FALLBACK_URLS = {
|
|||||||
*/
|
*/
|
||||||
export const RPC_URLS = {
|
export const RPC_URLS = {
|
||||||
[ChainId.MAINNET]: [
|
[ChainId.MAINNET]: [
|
||||||
`https://rpc.mevblocker.io/fast`,
|
`https://mainnet.infura.io/v3/${INFURA_KEY}`,
|
||||||
QUICKNODE_MAINNET_RPC_URL,
|
QUICKNODE_MAINNET_RPC_URL,
|
||||||
...FALLBACK_URLS[ChainId.MAINNET],
|
...FALLBACK_URLS[ChainId.MAINNET],
|
||||||
],
|
],
|
||||||
|
@ -2,7 +2,7 @@ import { TokenInfo } from '@uniswap/token-lists'
|
|||||||
import { ListsState } from 'state/lists/reducer'
|
import { ListsState } from 'state/lists/reducer'
|
||||||
|
|
||||||
import store from '../state'
|
import store from '../state'
|
||||||
import { UNI_EXTENDED_LIST, UNI_LIST} from './lists'
|
import { UNI_EXTENDED_LIST, UNI_LIST, UNSUPPORTED_LIST_URLS } from './lists'
|
||||||
import { COMMON_BASES } from './routing'
|
import { COMMON_BASES } from './routing'
|
||||||
import brokenTokenList from './tokenLists/broken.tokenlist.json'
|
import brokenTokenList from './tokenLists/broken.tokenlist.json'
|
||||||
import { NATIVE_CHAIN_ID } from './tokens'
|
import { NATIVE_CHAIN_ID } from './tokens'
|
||||||
@ -37,6 +37,14 @@ class TokenSafetyLookupTable {
|
|||||||
brokenTokenList.tokens.forEach((token) => {
|
brokenTokenList.tokens.forEach((token) => {
|
||||||
this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BROKEN
|
this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BROKEN
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Initialize blocked tokens from all urls included
|
||||||
|
UNSUPPORTED_LIST_URLS.map((url) => lists.byUrl[url]?.current?.tokens)
|
||||||
|
.filter((x): x is TokenInfo[] => !!x)
|
||||||
|
.flat(1)
|
||||||
|
.forEach((token) => {
|
||||||
|
this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BLOCKED
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
checkToken(address: string, chainId?: number | null) {
|
checkToken(address: string, chainId?: number | null) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists'
|
import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { DEFAULT_LIST_OF_LISTS } from 'constants/lists'
|
import { DEFAULT_LIST_OF_LISTS, UNSUPPORTED_LIST_URLS } from 'constants/lists'
|
||||||
import TokenSafetyLookupTable from 'constants/tokenSafetyLookup'
|
import TokenSafetyLookupTable from 'constants/tokenSafetyLookup'
|
||||||
import { useStateRehydrated } from 'hooks/useStateRehydrated'
|
import { useStateRehydrated } from 'hooks/useStateRehydrated'
|
||||||
import useInterval from 'lib/hooks/useInterval'
|
import useInterval from 'lib/hooks/useInterval'
|
||||||
@ -32,7 +32,7 @@ export default function Updater(): null {
|
|||||||
if (!isWindowVisible) return
|
if (!isWindowVisible) return
|
||||||
DEFAULT_LIST_OF_LISTS.forEach((url) => {
|
DEFAULT_LIST_OF_LISTS.forEach((url) => {
|
||||||
// Skip validation on unsupported lists
|
// Skip validation on unsupported lists
|
||||||
const isUnsupportedList = false;
|
const isUnsupportedList = UNSUPPORTED_LIST_URLS.includes(url)
|
||||||
fetchList(url, isUnsupportedList).catch((error) => console.debug('interval list fetching error', error))
|
fetchList(url, isUnsupportedList).catch((error) => console.debug('interval list fetching error', error))
|
||||||
})
|
})
|
||||||
}, [fetchList, isWindowVisible])
|
}, [fetchList, isWindowVisible])
|
||||||
@ -50,6 +50,14 @@ export default function Updater(): null {
|
|||||||
fetchList(listUrl).catch((error) => console.debug('list added fetching error', error))
|
fetchList(listUrl).catch((error) => console.debug('list added fetching error', error))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
UNSUPPORTED_LIST_URLS.forEach((listUrl) => {
|
||||||
|
const list = lists[listUrl]
|
||||||
|
if (!list || (!list.current && !list.loadingRequestId && !list.error)) {
|
||||||
|
fetchList(listUrl, /* isUnsupportedList= */ true).catch((error) =>
|
||||||
|
console.debug('list added fetching error', error)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
}, [dispatch, fetchList, lists, rehydrated])
|
}, [dispatch, fetchList, lists, rehydrated])
|
||||||
|
|
||||||
// automatically update lists for every version update
|
// automatically update lists for every version update
|
||||||
|
Loading…
x
Reference in New Issue
Block a user