Skip to content

Commit

Permalink
Fix top tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
zeekay committed Nov 7, 2024
1 parent 0731571 commit 4e4ecdd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/graphql/data/TopTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ gql`
}
`

// Convert Chain.Lux to 'luxnet', others to lowercase
function graphChainName(chain: Chain): string {
return chain === Chain.Lux ? 'luxnet' : chain.toLowerCase();
}

function useSortedTokens(tokens: TopTokens100Query['topTokens']) {
const sortMethod = useAtomValue(sortMethodAtom)
const sortAscending = useAtomValue(sortAscendingAtom)
Expand Down Expand Up @@ -150,7 +155,7 @@ export function useTopTokens(chain: Chain): UseTopTokensReturnValue {

const { data: sparklineQuery } = usePollQueryWhileMounted(
useTopTokensSparklineQuery({
variables: { duration, chain },
variables: { duration, graphChainName(chain) },
}),
PollingInterval.Slow
)
Expand All @@ -166,7 +171,7 @@ export function useTopTokens(chain: Chain): UseTopTokensReturnValue {

const { data, loading: loadingTokens } = usePollQueryWhileMounted(
useTopTokens100Query({
variables: { duration, chain },
variables: { duration, graphChainName(chain) },
}),
PollingInterval.Fast
)
Expand Down

0 comments on commit 4e4ecdd

Please sign in to comment.