From 147089c5242167edb75f16cce96bfc4b677f235b Mon Sep 17 00:00:00 2001 From: Aahna Ashina <95955389+aahna-ashina@users.noreply.github.com> Date: Tue, 26 Dec 2023 19:05:10 +0700 Subject: [PATCH 1/5] refactor: remove tokens censoring (#3) #3 --- src/state/lists/hooks.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/state/lists/hooks.ts b/src/state/lists/hooks.ts index 11e9411af0c..67f36c95d89 100644 --- a/src/state/lists/hooks.ts +++ b/src/state/lists/hooks.ts @@ -5,7 +5,7 @@ import { AppState } from 'state/reducer' import sortByListPriority from 'utils/listSort' import BROKEN_LIST from '../../constants/tokenLists/broken.tokenlist.json' -import { DEFAULT_ACTIVE_LIST_URLS, UNSUPPORTED_LIST_URLS } from './../../constants/lists' +import { DEFAULT_ACTIVE_LIST_URLS } from './../../constants/lists' type Mutable = { -readonly [P in keyof T]: Mutable @@ -75,9 +75,6 @@ export function useUnsupportedTokenList(): TokenAddressMap { // get hard-coded broken tokens const brokenListMap = useMemo(() => tokensToChainTokenMap(BROKEN_LIST), []) - // get dynamic list of unsupported tokens - const loadedUnsupportedListMap = useCombinedTokenMapFromUrls(UNSUPPORTED_LIST_URLS) - // format into one token address map - return useMemo(() => combineMaps(brokenListMap, loadedUnsupportedListMap), [brokenListMap, loadedUnsupportedListMap]) + return brokenListMap; } From 6cc6b28df9f6f8c76f31568cfc9eeff5ffdde3cb Mon Sep 17 00:00:00 2001 From: Aahna Ashina <95955389+aahna-ashina@users.noreply.github.com> Date: Tue, 26 Dec 2023 19:59:11 +0700 Subject: [PATCH 2/5] refactor: fix installation graphql script (#3) #3 --- scripts/fetch-schema.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/fetch-schema.js b/scripts/fetch-schema.js index 2cd48f6c530..075798fe987 100644 --- a/scripts/fetch-schema.js +++ b/scripts/fetch-schema.js @@ -9,19 +9,13 @@ const thegraphConfig = require('../graphql.thegraph.config') const exec = promisify(child_process.exec) -function fetchSchema(url, outputFile) { - exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`) - .then(({ stderr, stdout }) => { - if (stderr) { - throw new Error(stderr) - } else { - fs.writeFile(outputFile, stdout) - } - }) - .catch((err) => { - console.error(err) - console.error(`Failed to fetch schema from ${url}`) - }) +async function fetchSchema(url, outputFile) { + try { + const { stdout } = await exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`); + await fs.writeFile(outputFile, stdout); + } catch(err){ + console.error(`Failed to fetch schema from ${url}`) + } } fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema) From c376cd692e9501ae815e2ee80b5d92779a6dd112 Mon Sep 17 00:00:00 2001 From: Aahna Ashina <95955389+aahna-ashina@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:00:37 +0700 Subject: [PATCH 3/5] refactor: change mainnet rpc because infura blocks connections not from uni (#3) #3 --- src/constants/networks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/networks.ts b/src/constants/networks.ts index d7cbb103fbc..bb1dcce3c97 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -127,7 +127,7 @@ export const FALLBACK_URLS = { */ export const RPC_URLS = { [ChainId.MAINNET]: [ - `https://mainnet.infura.io/v3/${INFURA_KEY}`, + `https://rpc.mevblocker.io/fast`, QUICKNODE_MAINNET_RPC_URL, ...FALLBACK_URLS[ChainId.MAINNET], ], From 23d59ce32c58e5e42c04fb3ea35226353a49b4bb Mon Sep 17 00:00:00 2001 From: Aahna Ashina <95955389+aahna-ashina@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:32:15 +0700 Subject: [PATCH 4/5] refactor: remove prohibited & blocked lists checking (#3) #3 --- src/constants/lists.ts | 5 ----- src/constants/tokenSafetyLookup.ts | 10 +--------- src/state/lists/updater.ts | 12 ++---------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 889e1234f72..25f812355f1 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -1,8 +1,6 @@ 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' -const UNI_UNSUPPORTED_LIST = 'https://cloudflare-ipfs.com/ipns/unsupportedtokens.uniswap.org' 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. // 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' @@ -27,8 +25,6 @@ export const AVALANCHE_LIST = export const BASE_LIST = '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 export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST] export const DEFAULT_INACTIVE_LIST_URLS: string[] = [ @@ -53,7 +49,6 @@ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [ PLASMA_BNB_LIST, AVALANCHE_LIST, BASE_LIST, - ...UNSUPPORTED_LIST_URLS, ] export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS] diff --git a/src/constants/tokenSafetyLookup.ts b/src/constants/tokenSafetyLookup.ts index 18fc115dde0..e3b8d9d2b3f 100644 --- a/src/constants/tokenSafetyLookup.ts +++ b/src/constants/tokenSafetyLookup.ts @@ -2,7 +2,7 @@ import { TokenInfo } from '@uniswap/token-lists' import { ListsState } from 'state/lists/reducer' import store from '../state' -import { UNI_EXTENDED_LIST, UNI_LIST, UNSUPPORTED_LIST_URLS } from './lists' +import { UNI_EXTENDED_LIST, UNI_LIST } from './lists' import { COMMON_BASES } from './routing' import brokenTokenList from './tokenLists/broken.tokenlist.json' import { NATIVE_CHAIN_ID } from './tokens' @@ -37,14 +37,6 @@ class TokenSafetyLookupTable { brokenTokenList.tokens.forEach((token) => { 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) { diff --git a/src/state/lists/updater.ts b/src/state/lists/updater.ts index fc18347fb3a..a3af2e495b8 100644 --- a/src/state/lists/updater.ts +++ b/src/state/lists/updater.ts @@ -1,6 +1,6 @@ import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists' import { useWeb3React } from '@web3-react/core' -import { DEFAULT_LIST_OF_LISTS, UNSUPPORTED_LIST_URLS } from 'constants/lists' +import { DEFAULT_LIST_OF_LISTS } from 'constants/lists' import TokenSafetyLookupTable from 'constants/tokenSafetyLookup' import { useStateRehydrated } from 'hooks/useStateRehydrated' import useInterval from 'lib/hooks/useInterval' @@ -32,7 +32,7 @@ export default function Updater(): null { if (!isWindowVisible) return DEFAULT_LIST_OF_LISTS.forEach((url) => { // Skip validation on unsupported lists - const isUnsupportedList = UNSUPPORTED_LIST_URLS.includes(url) + const isUnsupportedList = false fetchList(url, isUnsupportedList).catch((error) => console.debug('interval list fetching error', error)) }) }, [fetchList, isWindowVisible]) @@ -50,14 +50,6 @@ export default function Updater(): null { 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]) // automatically update lists for every version update From 1e5a3d1b3cbacf97e193c4fa3ac9f1bc6ce3747d Mon Sep 17 00:00:00 2001 From: Aahna Ashina <95955389+aahna-ashina@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:37:49 +0700 Subject: [PATCH 5/5] refactor: remove warnings (#3) #3 --- src/constants/tokenSafety.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/constants/tokenSafety.tsx b/src/constants/tokenSafety.tsx index 80e0fa98dc4..1919081f295 100644 --- a/src/constants/tokenSafety.tsx +++ b/src/constants/tokenSafety.tsx @@ -93,10 +93,6 @@ export function checkWarning(tokenAddress: string, chainId?: number | null) { return null case TOKEN_LIST_TYPES.UNI_EXTENDED: return MediumWarning - case TOKEN_LIST_TYPES.UNKNOWN: - return StrongWarning - case TOKEN_LIST_TYPES.BLOCKED: - return BlockedWarning case TOKEN_LIST_TYPES.BROKEN: return BlockedWarning }