From 0afeb5acaf9fce50eed66a6bc64468d8f7c14ffe Mon Sep 17 00:00:00 2001 From: Jordan Frankfurt Date: Tue, 31 Aug 2021 11:05:12 -0400 Subject: [PATCH] add arbitrum token list (#2268) --- src/constants/lists.ts | 2 ++ src/state/lists/updater.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 9b28a26042..1c4909f11f 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -7,6 +7,7 @@ const CMC_STABLECOIN = 'stablecoin.cmc.eth' const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json' const COMPOUND_LIST = 'https://raw.githubusercontent.com/compound-finance/token-list/master/compound.tokenlist.json' const GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json' +export const ARBITRUM_LIST = 'https://bridge.arbitrum.io/token-list-42161.json' const KLEROS_LIST = 't2crtokens.eth' export const OPTIMISM_LIST = 'https://static.optimism.io/optimism.tokenlist.json' const ROLL_LIST = 'https://app.tryroll.com/tokens.json' @@ -27,6 +28,7 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [ ROLL_LIST, COINGECKO_LIST, KLEROS_LIST, + ARBITRUM_LIST, OPTIMISM_LIST, GEMINI_LIST, ...UNSUPPORTED_LIST_URLS, // need to load unsupported tokens as well diff --git a/src/state/lists/updater.ts b/src/state/lists/updater.ts index 88e9de8324..6981555173 100644 --- a/src/state/lists/updater.ts +++ b/src/state/lists/updater.ts @@ -1,6 +1,6 @@ import { getVersionUpgrade, minVersionBump, VersionUpgrade } from '@uniswap/token-lists' import { SupportedChainId } from 'constants/chains' -import { OPTIMISM_LIST, UNSUPPORTED_LIST_URLS } from 'constants/lists' +import { ARBITRUM_LIST, OPTIMISM_LIST, UNSUPPORTED_LIST_URLS } from 'constants/lists' import { useCallback, useEffect } from 'react' import { useAppDispatch } from 'state/hooks' import { useAllLists } from 'state/lists/hooks' @@ -32,6 +32,9 @@ export default function Updater(): null { if (chainId && [SupportedChainId.OPTIMISM, SupportedChainId.OPTIMISTIC_KOVAN].includes(chainId)) { dispatch(enableList(OPTIMISM_LIST)) } + if (chainId && [SupportedChainId.ARBITRUM_ONE, SupportedChainId.ARBITRUM_RINKEBY].includes(chainId)) { + dispatch(enableList(ARBITRUM_LIST)) + } }, [chainId, dispatch]) // fetch all lists every 10 minutes, but only after we initialize library useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null)