Skip to content

Commit

Permalink
chore: Remove info leftovers (pancakeswap#10081)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->


<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor and optimize the timestamp handling
in the `useBlocksFromTimestamps` hook.

### Detailed summary
- Removed `useBlockFromTimeStampQuery` and consolidated timestamp
handling in `useBlocksFromTimestamps`
- Updated references to `useBlockFromTimeStampQuery` to
`useBlocksFromTimestamps`
- Removed unused types and interfaces related to timestamp handling

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
memoyil authored Jun 25, 2024
1 parent 246a8a9 commit 466c71b
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 386 deletions.
5 changes: 1 addition & 4 deletions apps/web/src/state/info/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ export function createExplorerQuery<
}

export const chartPeriodRange = ['1H', '1D', '1W', '1M', '1Y'] as const
export type ChartPeriod = (typeof chartPeriodRange)[number]

export const chartGroupBy = ['1D', '1W', '1M'] as const

export type ChartGroupBy = (typeof chartGroupBy)[number]
export type ChartPeriod = (typeof chartPeriodRange)[number]

export const chainIdToExplorerInfoChainName = {
[ChainId.BSC]: 'bsc',
Expand Down
11 changes: 0 additions & 11 deletions apps/web/src/state/info/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ export const multiChainQueryMainToken: Record<MultiChainName, string> = {
OPBNB: 'ETH',
}

export const multiChainStartTime = {
BSC: PCS_V2_START,
ETH: PCS_ETH_START,
POLYGON_ZKEVM: 1686236845,
ZKSYNC: 1690462800, // Thu Jul 27 2023 13:00:00 UTC+0000
ARB: 1686732526,
LINEA: 1692878400,
BASE: 1693483200,
OPBNB: 1695945600,
}

export const multiChainId: Record<MultiChainName, ChainId> = {
BSC: ChainId.BSC,
ETH: ChainId.ETHEREUM,
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/state/info/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getAprsForStableFarm } from 'utils/getAprsForStableFarm'
import { getDeltaTimestamps } from 'utils/getDeltaTimestamps'
import { getLpFeesAndApr } from 'utils/getLpFeesAndApr'
import { getPercentChange } from 'utils/infoDataHelpers'
import { useBlockFromTimeStampQuery } from 'views/Info/hooks/useBlocksFromTimestamps'
import { useBlocksFromTimestamps } from 'views/Info/hooks/useBlocksFromTimestamps'
import { explorerApiClient } from './api/client'
import { useExplorerChainNameByQuery } from './api/hooks'
import { MultiChainName, MultiChainNameExtend, checkIsStableSwap, multiChainId } from './constant'
Expand Down Expand Up @@ -555,7 +555,7 @@ export const useAllTokenHighLight = ({
const chainNameByQuery = useChainNameByQuery()
const chainName = targetChainName ?? chainNameByQuery
const [t24h, t48h, t7d, t14d] = getDeltaTimestamps()
const { blocks } = useBlockFromTimeStampQuery([t24h, t48h, t7d, t14d], undefined, undefined, chainName)
const { blocks } = useBlocksFromTimestamps([t24h, t48h, t7d, t14d], undefined, chainName)
const type = checkIsStableSwap() ? 'stableSwap' : 'swap'
const { data, isPending } = useQuery({
queryKey: [`info/token/data/${type}`, chainName],
Expand Down Expand Up @@ -667,7 +667,7 @@ export const useTokenDatasQuery = (addresses?: string[], withSettings = true): T
const name = addresses?.join('')
const chainName = useChainNameByQuery()
const [t24h, t48h, t7d, t14d] = getDeltaTimestamps()
const { blocks } = useBlockFromTimeStampQuery([t24h, t48h, t7d, t14d])
const { blocks } = useBlocksFromTimestamps([t24h, t48h, t7d, t14d])
const type = checkIsStableSwap() ? 'stableSwap' : 'swap'
const { data, isPending } = useQuery({
queryKey: [`info/token/data/${name}/${type}`, chainName],
Expand Down
203 changes: 0 additions & 203 deletions apps/web/src/state/info/queries/helpers.ts

This file was deleted.

68 changes: 0 additions & 68 deletions apps/web/src/state/info/queries/types.ts

This file was deleted.

Loading

0 comments on commit 466c71b

Please sign in to comment.