diff --git a/src/apollo/client.js b/src/apollo/client.js index e765a2245..c11e1ec89 100644 --- a/src/apollo/client.js +++ b/src/apollo/client.js @@ -4,7 +4,7 @@ import { HttpLink } from 'apollo-link-http' export const client = new ApolloClient({ link: new HttpLink({ - uri: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswapv2', + uri: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v2-dev', }), cache: new InMemoryCache(), shouldBatch: true, diff --git a/src/apollo/queries.js b/src/apollo/queries.js index 186874d21..c2796e1c9 100644 --- a/src/apollo/queries.js +++ b/src/apollo/queries.js @@ -752,10 +752,10 @@ const TokenFields = ` } ` -// used for getting top tokens by total liquidity +// used for getting top tokens by daily volume export const TOKEN_TOP_DAY_DATAS = gql` query tokenDayDatas($date: Int) { - tokenDayDatas(first: 50, orderBy: dailyVolumeUSD, orderDirection: desc, where: { date_gt: $date }) { + tokenDayDatas(first: 50, orderBy: totalLiquidityUSD, orderDirection: desc, where: { date_gt: $date }) { id date } diff --git a/src/components/GlobalChart/index.js b/src/components/GlobalChart/index.js index 6fa0dc229..f1ad87b57 100644 --- a/src/components/GlobalChart/index.js +++ b/src/components/GlobalChart/index.js @@ -45,7 +45,7 @@ const GlobalChart = ({ display }) => { if (item.date > utcStartTime) { return item } else { - return + return true } }) .filter((item) => { diff --git a/src/components/TokenList/index.js b/src/components/TokenList/index.js index d6d941a42..5e557e637 100644 --- a/src/components/TokenList/index.js +++ b/src/components/TokenList/index.js @@ -128,7 +128,7 @@ function TopTokenList({ tokens, itemMax = 10, useTracked = false }) { // sorting const [sortDirection, setSortDirection] = useState(true) - const [sortedColumn, setSortedColumn] = useState(SORT_FIELD.LIQ) + const [sortedColumn, setSortedColumn] = useState(SORT_FIELD.VOL) const below1080 = useMedia('(max-width: 1080px)') const below680 = useMedia('(max-width: 680px)') diff --git a/src/constants/index.js b/src/constants/index.js index fdf05c2b8..4f0d0437d 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -12,10 +12,7 @@ export const timeframeOptions = { } // token list urls to fetch tokens from - use for warnings on tokens and pairs -export const SUPPORTED_LIST_URLS__NO_ENS = [ - 'https://gateway.ipfs.io/ipns/tokens.uniswap.org', - 'https://www.coingecko.com/tokens_list/uniswap/defi_100/v_0_0_0.json', -] +export const SUPPORTED_LIST_URLS__NO_ENS = ['https://tokens.coingecko.com/uniswap/all.json'] // hide from overview list export const TOKEN_BLACKLIST = [ diff --git a/src/contexts/Application.js b/src/contexts/Application.js index 8885f1e9c..05930d151 100644 --- a/src/contexts/Application.js +++ b/src/contexts/Application.js @@ -271,8 +271,12 @@ export function useListedTokens() { async function fetchList() { const allFetched = await SUPPORTED_LIST_URLS__NO_ENS.reduce(async (fetchedTokens, url) => { const tokensSoFar = await fetchedTokens - const newTokens = await getTokenList(url) - return Promise.resolve([...tokensSoFar, ...newTokens.tokens]) + try { + const newTokens = await getTokenList(url) + return Promise.resolve([...tokensSoFar, ...newTokens.tokens]) + } catch (e) { + return Promise.resolve([...tokensSoFar]) + } }, Promise.resolve([])) let formatted = allFetched?.map((t) => t.address.toLowerCase()) updateSupportedTokens(formatted) diff --git a/src/contexts/TokenData.js b/src/contexts/TokenData.js index 3441e0559..e57838940 100644 --- a/src/contexts/TokenData.js +++ b/src/contexts/TokenData.js @@ -229,7 +229,7 @@ const getTopTokens = async (ethPrice, ethPriceOld) => { try { // need to get the top tokens by liquidity by need token day datas - const currentDate = parseInt(Date.now() / 86400 / 1000) * 86400 - 86400 + const currentDate = parseInt(Date.now() / 86400 / 1000) * 86400 - 86400 - 86400 let tokenids = await client.query({ query: TOKEN_TOP_DAY_DATAS, @@ -237,10 +237,11 @@ const getTopTokens = async (ethPrice, ethPriceOld) => { variables: { date: currentDate }, }) + console.log(tokenids) + const ids = tokenids?.data?.tokenDayDatas?.reduce((accum, entry) => { - const newMap = accum - newMap.push(entry.id.slice(0, 42)) - return newMap + accum.push(entry.id.slice(0, 42)) + return accum }, []) let current = await client.query({