diff --git a/README.md b/README.md index 4a3c5c67..ca8fbee3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Uniswap Info V3 -An open sourced interface for Uniswap V3 analytics. +An open sourced interface for Uniswap V3 analytics. Info URL: https://info.uniswap.org/#/ diff --git a/schema.json b/schema.json index 9fb5d549..4ef3dc23 100644 --- a/schema.json +++ b/schema.json @@ -34748,18 +34748,14 @@ "name": "entity", "description": null, "isRepeatable": false, - "locations": [ - "OBJECT" - ], + "locations": ["OBJECT"], "args": [] }, { "name": "derivedFrom", "description": null, "isRepeatable": false, - "locations": [ - "FIELD_DEFINITION" - ], + "locations": ["FIELD_DEFINITION"], "args": [ { "name": "field", @@ -34779,9 +34775,7 @@ "name": "subgraphId", "description": null, "isRepeatable": false, - "locations": [ - "OBJECT" - ], + "locations": ["OBJECT"], "args": [ { "name": "id", @@ -34801,11 +34795,7 @@ "name": "include", "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", "isRepeatable": false, - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], "args": [ { "name": "if", @@ -34829,11 +34819,7 @@ "name": "skip", "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", "isRepeatable": false, - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], "args": [ { "name": "if", @@ -34857,12 +34843,7 @@ "name": "deprecated", "description": "Marks an element of a GraphQL schema as no longer supported.", "isRepeatable": false, - "locations": [ - "FIELD_DEFINITION", - "ARGUMENT_DEFINITION", - "INPUT_FIELD_DEFINITION", - "ENUM_VALUE" - ], + "locations": ["FIELD_DEFINITION", "ARGUMENT_DEFINITION", "INPUT_FIELD_DEFINITION", "ENUM_VALUE"], "args": [ { "name": "reason", @@ -34882,9 +34863,7 @@ "name": "specifiedBy", "description": "Exposes a URL that specifies the behaviour of this scalar.", "isRepeatable": false, - "locations": [ - "SCALAR" - ], + "locations": ["SCALAR"], "args": [ { "name": "url", @@ -34908,11 +34887,7 @@ "name": "client", "description": "Direct the client to resolve this field locally, either from the cache or local resolvers.", "isRepeatable": false, - "locations": [ - "FIELD", - "FRAGMENT_DEFINITION", - "INLINE_FRAGMENT" - ], + "locations": ["FIELD", "FRAGMENT_DEFINITION", "INLINE_FRAGMENT"], "args": [ { "name": "always", @@ -34932,9 +34907,7 @@ "name": "export", "description": "Export this locally resolved field as a variable to be used in the remainder of this query. See\nhttps://www.apollographql.com/docs/react/essentials/local-state/#using-client-fields-as-variables", "isRepeatable": false, - "locations": [ - "FIELD" - ], + "locations": ["FIELD"], "args": [ { "name": "as", @@ -34958,9 +34931,7 @@ "name": "connection", "description": "Specify a custom store key for this result. See\nhttps://www.apollographql.com/docs/react/advanced/caching/#the-connection-directive", "isRepeatable": false, - "locations": [ - "FIELD" - ], + "locations": ["FIELD"], "args": [ { "name": "key", @@ -35002,4 +34973,4 @@ } ] } -} \ No newline at end of file +} diff --git a/src/components/Popups/ListUpdatePopup.tsx b/src/components/Popups/ListUpdatePopup.tsx index a25dd339..2e2fb8be 100644 --- a/src/components/Popups/ListUpdatePopup.tsx +++ b/src/components/Popups/ListUpdatePopup.tsx @@ -46,7 +46,11 @@ export default function ListUpdatePopup({ removeThisPopup() }, [auto, dispatch, listUrl, removeThisPopup]) - const { added: tokensAdded, changed: tokensChanged, removed: tokensRemoved } = useMemo(() => { + const { + added: tokensAdded, + changed: tokensChanged, + removed: tokensRemoved, + } = useMemo(() => { return diffTokenLists(oldList.tokens, newList.tokens) }, [newList.tokens, oldList.tokens]) const numTokensChanged = useMemo( diff --git a/src/data/combined/pools.ts b/src/data/combined/pools.ts index b747412d..680ed0f4 100644 --- a/src/data/combined/pools.ts +++ b/src/data/combined/pools.ts @@ -87,9 +87,7 @@ interface PoolDataResponse { /** * Fetch top addresses by volume */ -export function usePoolDatas( - poolAddresses: string[] -): { +export function usePoolDatas(poolAddresses: string[]): { loading: boolean error: boolean data: @@ -111,18 +109,21 @@ export function usePoolDatas( client: dataClient, }) - const { loading: loading24, error: error24, data: data24 } = useQuery( - POOLS_BULK(block24?.number, poolAddresses), - { client: dataClient } - ) - const { loading: loading48, error: error48, data: data48 } = useQuery( - POOLS_BULK(block48?.number, poolAddresses), - { client: dataClient } - ) - const { loading: loadingWeek, error: errorWeek, data: dataWeek } = useQuery( - POOLS_BULK(blockWeek?.number, poolAddresses), - { client: dataClient } - ) + const { + loading: loading24, + error: error24, + data: data24, + } = useQuery(POOLS_BULK(block24?.number, poolAddresses), { client: dataClient }) + const { + loading: loading48, + error: error48, + data: data48, + } = useQuery(POOLS_BULK(block48?.number, poolAddresses), { client: dataClient }) + const { + loading: loadingWeek, + error: errorWeek, + data: dataWeek, + } = useQuery(POOLS_BULK(blockWeek?.number, poolAddresses), { client: dataClient }) const anyError = Boolean(error || error24 || error48 || blockError || errorWeek) const anyLoading = Boolean(loading || loading24 || loading48 || loadingWeek) diff --git a/src/data/pools/chartData.ts b/src/data/pools/chartData.ts index 80292c21..0765b0e5 100644 --- a/src/data/pools/chartData.ts +++ b/src/data/pools/chartData.ts @@ -53,7 +53,11 @@ export async function fetchPoolChartData(address: string, client: ApolloClient({ + const { + data: chartResData, + error, + loading, + } = await client.query({ query: POOL_CHART, variables: { address: address, diff --git a/src/data/pools/poolData.ts b/src/data/pools/poolData.ts index b747412d..680ed0f4 100644 --- a/src/data/pools/poolData.ts +++ b/src/data/pools/poolData.ts @@ -87,9 +87,7 @@ interface PoolDataResponse { /** * Fetch top addresses by volume */ -export function usePoolDatas( - poolAddresses: string[] -): { +export function usePoolDatas(poolAddresses: string[]): { loading: boolean error: boolean data: @@ -111,18 +109,21 @@ export function usePoolDatas( client: dataClient, }) - const { loading: loading24, error: error24, data: data24 } = useQuery( - POOLS_BULK(block24?.number, poolAddresses), - { client: dataClient } - ) - const { loading: loading48, error: error48, data: data48 } = useQuery( - POOLS_BULK(block48?.number, poolAddresses), - { client: dataClient } - ) - const { loading: loadingWeek, error: errorWeek, data: dataWeek } = useQuery( - POOLS_BULK(blockWeek?.number, poolAddresses), - { client: dataClient } - ) + const { + loading: loading24, + error: error24, + data: data24, + } = useQuery(POOLS_BULK(block24?.number, poolAddresses), { client: dataClient }) + const { + loading: loading48, + error: error48, + data: data48, + } = useQuery(POOLS_BULK(block48?.number, poolAddresses), { client: dataClient }) + const { + loading: loadingWeek, + error: errorWeek, + data: dataWeek, + } = useQuery(POOLS_BULK(blockWeek?.number, poolAddresses), { client: dataClient }) const anyError = Boolean(error || error24 || error48 || blockError || errorWeek) const anyLoading = Boolean(loading || loading24 || loading48 || loadingWeek) diff --git a/src/data/pools/tickData.ts b/src/data/pools/tickData.ts index e8beab2a..87761f53 100644 --- a/src/data/pools/tickData.ts +++ b/src/data/pools/tickData.ts @@ -164,7 +164,11 @@ export const fetchTicksSurroundingPrice = async ( error?: boolean data?: PoolTickData }> => { - const { data: poolResult, error, loading } = await client.query({ + const { + data: poolResult, + error, + loading, + } = await client.query({ query: poolQuery, variables: { poolAddress, diff --git a/src/data/protocol/chart.ts b/src/data/protocol/chart.ts index 974d7ff7..8eae6db3 100644 --- a/src/data/protocol/chart.ts +++ b/src/data/protocol/chart.ts @@ -55,7 +55,11 @@ async function fetchChartData(client: ApolloClient) { try { while (!allFound) { - const { data: chartResData, error, loading } = await client.query({ + const { + data: chartResData, + error, + loading, + } = await client.query({ query: GLOBAL_CHART, variables: { startTime: startTimestamp, diff --git a/src/data/protocol/overview.ts b/src/data/protocol/overview.ts index 39dd1dcc..d4c40412 100644 --- a/src/data/protocol/overview.ts +++ b/src/data/protocol/overview.ts @@ -51,15 +51,17 @@ export function useFetchProtocolData( // fetch all data const { loading, error, data } = useQuery(GLOBAL_DATA(), { client: activeDataClient }) - const { loading: loading24, error: error24, data: data24 } = useQuery( - GLOBAL_DATA(block24?.number ?? 0), - { client: activeDataClient } - ) - - const { loading: loading48, error: error48, data: data48 } = useQuery( - GLOBAL_DATA(block48?.number ?? 0), - { client: activeDataClient } - ) + const { + loading: loading24, + error: error24, + data: data24, + } = useQuery(GLOBAL_DATA(block24?.number ?? 0), { client: activeDataClient }) + + const { + loading: loading48, + error: error48, + data: data48, + } = useQuery(GLOBAL_DATA(block48?.number ?? 0), { client: activeDataClient }) const anyError = Boolean(error || error24 || error48 || blockError) const anyLoading = Boolean(loading || loading24 || loading48) diff --git a/src/data/search/index.ts b/src/data/search/index.ts index 2a028b27..0d4f348a 100644 --- a/src/data/search/index.ts +++ b/src/data/search/index.ts @@ -130,9 +130,7 @@ interface PoolRes { asAddress: PoolResFields[] } -export function useFetchSearchResults( - value: string -): { +export function useFetchSearchResults(value: string): { tokens: TokenData[] pools: PoolData[] loading: boolean diff --git a/src/data/tokens/chartData.ts b/src/data/tokens/chartData.ts index 1ef378a9..281465c9 100644 --- a/src/data/tokens/chartData.ts +++ b/src/data/tokens/chartData.ts @@ -50,7 +50,11 @@ export async function fetchTokenChartData(address: string, client: ApolloClient< try { while (!allFound) { - const { data: chartResData, error, loading } = await client.query({ + const { + data: chartResData, + error, + loading, + } = await client.query({ query: TOKEN_CHART, variables: { address: address, diff --git a/src/data/tokens/priceData.ts b/src/data/tokens/priceData.ts index 8634947f..ee118db0 100644 --- a/src/data/tokens/priceData.ts +++ b/src/data/tokens/priceData.ts @@ -119,7 +119,11 @@ export async function fetchTokenPriceData( let skip = 0 let allFound = false while (!allFound) { - const { data: priceData, errors, loading } = await dataClient.query({ + const { + data: priceData, + errors, + loading, + } = await dataClient.query({ query: PRICE_CHART, variables: { address: address, diff --git a/src/data/tokens/tokenData.ts b/src/data/tokens/tokenData.ts index f7ca6426..bb48ddfa 100644 --- a/src/data/tokens/tokenData.ts +++ b/src/data/tokens/tokenData.ts @@ -60,9 +60,7 @@ interface TokenDataResponse { /** * Fetch top addresses by volume */ -export function useFetchedTokenDatas( - tokenAddresses: string[] -): { +export function useFetchedTokenDatas(tokenAddresses: string[]): { loading: boolean error: boolean data: @@ -85,26 +83,29 @@ export function useFetchedTokenDatas( client: dataClient, }) - const { loading: loading24, error: error24, data: data24 } = useQuery( - TOKENS_BULK(parseInt(block24?.number), tokenAddresses), - { - client: dataClient, - } - ) + const { + loading: loading24, + error: error24, + data: data24, + } = useQuery(TOKENS_BULK(parseInt(block24?.number), tokenAddresses), { + client: dataClient, + }) - const { loading: loading48, error: error48, data: data48 } = useQuery( - TOKENS_BULK(parseInt(block48?.number), tokenAddresses), - { - client: dataClient, - } - ) + const { + loading: loading48, + error: error48, + data: data48, + } = useQuery(TOKENS_BULK(parseInt(block48?.number), tokenAddresses), { + client: dataClient, + }) - const { loading: loadingWeek, error: errorWeek, data: dataWeek } = useQuery( - TOKENS_BULK(parseInt(blockWeek?.number), tokenAddresses), - { - client: dataClient, - } - ) + const { + loading: loadingWeek, + error: errorWeek, + data: dataWeek, + } = useQuery(TOKENS_BULK(parseInt(blockWeek?.number), tokenAddresses), { + client: dataClient, + }) const anyError = Boolean(error || error24 || error48 || blockError || errorWeek) const anyLoading = Boolean(loading || loading24 || loading48 || loadingWeek || !blocks) diff --git a/src/hooks/useENS.ts b/src/hooks/useENS.ts index 857ce6da..c36bd5bd 100644 --- a/src/hooks/useENS.ts +++ b/src/hooks/useENS.ts @@ -6,9 +6,11 @@ import useENSName from './useENSName' * Given a name or address, does a lookup to resolve to an address and name * @param nameOrAddress ENS name or address */ -export default function useENS( - nameOrAddress?: string | null -): { loading: boolean; address: string | null; name: string | null } { +export default function useENS(nameOrAddress?: string | null): { + loading: boolean + address: string | null + name: string | null +} { const validated = isAddress(nameOrAddress) const reverseLookup = useENSName(validated ? validated : undefined) const lookup = useENSAddress(nameOrAddress) diff --git a/src/state/multicall/updater.test.ts b/src/state/multicall/updater.test.ts index 0110b9b2..feaad4f3 100644 --- a/src/state/multicall/updater.test.ts +++ b/src/state/multicall/updater.test.ts @@ -128,9 +128,9 @@ describe('multicall updater', () => { expect(outdatedListeningKeys({}, { abc: 2, def: 3 }, 1, 1)).toEqual(['abc', 'def']) }) it('returns only outdated keys', () => { - expect( - outdatedListeningKeys({ [1]: { abc: { data: '0x', blockNumber: 2 } } }, { abc: 1, def: 1 }, 1, 2) - ).toEqual(['def']) + expect(outdatedListeningKeys({ [1]: { abc: { data: '0x', blockNumber: 2 } } }, { abc: 1, def: 1 }, 1, 2)).toEqual( + ['def'] + ) }) it('returns only keys not being fetched', () => { expect( diff --git a/src/state/multicall/updater.tsx b/src/state/multicall/updater.tsx index d15ec59e..536d547c 100644 --- a/src/state/multicall/updater.tsx +++ b/src/state/multicall/updater.tsx @@ -130,9 +130,10 @@ export default function Updater(): null { return outdatedListeningKeys(state.callResults, listeningKeys, chainId, latestBlockNumber) }, [chainId, state.callResults, listeningKeys, latestBlockNumber]) - const serializedOutdatedCallKeys = useMemo(() => JSON.stringify(unserializedOutdatedCallKeys.sort()), [ - unserializedOutdatedCallKeys, - ]) + const serializedOutdatedCallKeys = useMemo( + () => JSON.stringify(unserializedOutdatedCallKeys.sort()), + [unserializedOutdatedCallKeys] + ) useEffect(() => { if (!latestBlockNumber || !chainId || !multicallContract) return diff --git a/src/state/pools/hooks.ts b/src/state/pools/hooks.ts index 790540ff..93b0eaad 100644 --- a/src/state/pools/hooks.ts +++ b/src/state/pools/hooks.ts @@ -21,19 +21,19 @@ export function useAllPoolData(): { export function useUpdatePoolData(): (pools: PoolData[]) => void { const dispatch = useDispatch() const [network] = useActiveNetworkVersion() - return useCallback((pools: PoolData[]) => dispatch(updatePoolData({ pools, networkId: network.id })), [ - dispatch, - network.id, - ]) + return useCallback( + (pools: PoolData[]) => dispatch(updatePoolData({ pools, networkId: network.id })), + [dispatch, network.id] + ) } export function useAddPoolKeys(): (addresses: string[]) => void { const dispatch = useDispatch() const [network] = useActiveNetworkVersion() - return useCallback((poolAddresses: string[]) => dispatch(addPoolKeys({ poolAddresses, networkId: network.id })), [ - dispatch, - network.id, - ]) + return useCallback( + (poolAddresses: string[]) => dispatch(addPoolKeys({ poolAddresses, networkId: network.id })), + [dispatch, network.id] + ) } export function usePoolDatas(poolAddresses: string[]): PoolData[] { diff --git a/src/state/tokens/updater.ts b/src/state/tokens/updater.ts index 9202cc92..5f6e35ff 100644 --- a/src/state/tokens/updater.ts +++ b/src/state/tokens/updater.ts @@ -31,9 +31,11 @@ export default function Updater(): null { }, [allTokenData]) // update unloaded pool entries with fetched data - const { error: tokenDataError, loading: tokenDataLoading, data: tokenDatas } = useFetchedTokenDatas( - unfetchedTokenAddresses - ) + const { + error: tokenDataError, + loading: tokenDataLoading, + data: tokenDatas, + } = useFetchedTokenDatas(unfetchedTokenAddresses) useEffect(() => { if (tokenDatas && !tokenDataError && !tokenDataLoading) {