Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove warnings and deprecated info graphql components #11124

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions apps/web/src/config/constants/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BLOCKS_SUBGRAPHS, ChainId, STABLESWAP_SUBGRAPHS, V2_SUBGRAPHS, V3_SUBGRAPHS } from '@pancakeswap/chains'
import { ChainId, V2_SUBGRAPHS, V3_SUBGRAPHS } from '@pancakeswap/chains'

export const THE_GRAPH_PROXY_API = 'https://thegraph.pancakeswap.com'

Expand All @@ -9,27 +9,15 @@ export const SNAPSHOT_BASE_URL = process.env.NEXT_PUBLIC_SNAPSHOT_BASE_URL
export const API_PROFILE = 'https://profile.pancakeswap.com'
export const API_NFT = 'https://nft.pancakeswap.com/api/v1'
export const SNAPSHOT_API = `${SNAPSHOT_BASE_URL}/graphql`
export const SNAPSHOT_HUB_API = `${SNAPSHOT_BASE_URL}/api/message`
export const GRAPH_API_POTTERY = `${THE_GRAPH_PROXY_API}/pottery`
// export const ONRAMP_API_BASE_URL = 'https://monkfish-app-s4mda.ondigitalocean.app'
export const ONRAMP_API_BASE_URL = 'https://onramp2-api.pancakeswap.com'
export const TRANSAK_API_BASE_URL = 'https://api-stg.transak.com/api/v1'
export const MOONPAY_BASE_URL = 'https://api.moonpay.com'
export const NOTIFICATION_HUB_BASE_URL = 'https://notification-hub.pancakeswap.com'
/**
* V1 will be deprecated but is still used to claim old rounds
*/
export const GRAPH_API_PREDICTION_V1 = `${THE_GRAPH_PROXY_API}/prediction-v1-bsc`

export const V3_BSC_INFO_CLIENT = `https://open-platform.nodereal.io/${
process.env.NEXT_PUBLIC_NODE_REAL_API_INFO || process.env.NEXT_PUBLIC_NODE_REAL_API_ETH
}/pancakeswap-v3/graphql`

const BLOCKS_SUBGRAPH_URLS = {
...BLOCKS_SUBGRAPHS,
[ChainId.OPBNB]: `${THE_GRAPH_PROXY_API}/blocks-opbnb`,
}

export const GRAPH_API_NFTMARKET = `${THE_GRAPH_PROXY_API}/nft-marketplace-bsc`
export const GRAPH_HEALTH = 'https://api.thegraph.com/index-node/graphql'

Expand All @@ -53,9 +41,6 @@ export const V2_SUBGRAPH_URLS = {
[ChainId.LINEA]: `${THE_GRAPH_PROXY_API}/exchange-v2-linea`,
[ChainId.OPBNB]: `${THE_GRAPH_PROXY_API}/exchange-v2-opbnb`,
}
export const INFO_CLIENT_ETH = V2_SUBGRAPH_URLS[ChainId.ETHEREUM]

export const BLOCKS_CLIENT_WITH_CHAIN = BLOCKS_SUBGRAPH_URLS

export const ASSET_CDN = process.env.NEXT_PUBLIC_ASSET_CDN || 'https://assets.pancakeswap.finance'

Expand All @@ -71,13 +56,6 @@ export const V3_SUBGRAPH_URLS = {
[ChainId.OPBNB]: `${THE_GRAPH_PROXY_API}/exchange-v3-opbnb`,
}

export const STABLESWAP_SUBGRAPHS_URLS = {
...STABLESWAP_SUBGRAPHS,
[ChainId.BSC]: `${THE_GRAPH_PROXY_API}/exchange-stableswap-bsc`,
[ChainId.ARBITRUM_ONE]: `${THE_GRAPH_PROXY_API}/exchange-stableswap-arb`,
[ChainId.ETHEREUM]: `${THE_GRAPH_PROXY_API}/exchange-stableswap-eth`,
}

export const TRADING_REWARD_API = 'https://trading-reward.pancakeswap.com/api/v1'

export const X_API_ENDPOINT = process.env.NEXT_PUBLIC_QUOTING_API
Expand All @@ -87,13 +65,8 @@ export const QUOTING_API_PREFIX = `${X_API_ENDPOINT}/order-price`
export const QUOTING_API = `${QUOTING_API_PREFIX}/get-price`

export const FARMS_API = 'https://farms-api.pancakeswap.com'
export const FARMS_API_V2 = 'https://v3-farm-api-prod-6ulht.ondigitalocean.app/api'

export const MERCURYO_WIDGET_ID = process.env.NEXT_PUBLIC_MERCURYO_WIDGET_ID || '64d1f9f9-85ee-4558-8168-1dc0e7057ce6'

export const MOONPAY_API_KEY = process.env.NEXT_PUBLIC_MOONPAY_LIVE_KEY || 'pk_test_1Ibe44lMglFVL8COOYO7SEKnIBrzrp54'

export const TRANSAK_API_KEY = process.env.NEXT_PUBLIC_TRANSAK_LIVE_KEY || 'bf960e79-6d98-4fd0-823d-8409d290c346'
export const FARMS_API_V2 = 'https://v3-farm-api-prod-6ulht.ondigitalocean.app/api'

export const WALLET_API = 'https://wallet-api.pancakeswap.com'

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/v2/pair/[[...currency]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useRouter } from 'next/router'
import { useAccount } from 'wagmi'
import { useAccountPositionDetailByPool } from 'state/farmsV4/state/accountPositions/hooks'
import { usePoolInfo } from 'state/farmsV4/state/extendPools/hooks'
import React, { useMemo } from 'react'
import { useMemo } from 'react'
import { formatFiatNumber } from '@pancakeswap/utils/formatFiatNumber'
import { useTotalPriceUSD } from 'hooks/useTotalPriceUSD'
import { useLPApr } from 'state/swap/useLPApr'
Expand Down
21 changes: 1 addition & 20 deletions apps/web/src/state/info/constant.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { GraphQLClient } from 'graphql-request'
import { infoStableSwapClients, v2Clients } from 'utils/graphql'

import { ChainId, isTestnetChainId } from '@pancakeswap/chains'
import { STABLE_SUPPORTED_CHAIN_IDS } from '@pancakeswap/stable-swap-sdk'
import { ChainId } from '@pancakeswap/chains'
import { BSC_TOKEN_WHITELIST, ETH_TOKEN_BLACKLIST, ETH_TOKEN_WHITELIST, TOKEN_BLACKLIST } from 'config/constants/info'
import mapValues from 'lodash/mapValues'
import { arbitrum, base, bsc, linea, mainnet, opBNB, polygonZkEvm, zkSync } from 'wagmi/chains'
Expand Down Expand Up @@ -60,11 +56,6 @@ export const multiChainPaths = {
[ChainId.OPBNB]: '/opbnb',
}

export const multiChainQueryStableClient = STABLE_SUPPORTED_CHAIN_IDS.reduce((acc, chainId) => {
if (isTestnetChainId(chainId)) return acc
return { ...acc, [multiChainName[chainId]]: infoStableSwapClients[chainId] }
}, {} as Record<MultiChainName, GraphQLClient>)

export const infoChainNameToExplorerChainName = {
BSC: 'bsc',
ETH: 'ethereum',
Expand All @@ -76,10 +67,6 @@ export const infoChainNameToExplorerChainName = {
OPBNB: 'opbnb',
} as const

export const STABLESWAP_SUBGRAPHS_START_BLOCK = {
ARB: 169319653,
}

export const multiChainScan: Record<MultiChainName, string> = {
BSC: bsc.blockExplorers.default.name,
ETH: mainnet.blockExplorers.default.name,
Expand Down Expand Up @@ -127,12 +114,6 @@ export const multiChainTokenWhiteList: Record<MultiChainName, string[]> = mapVal
(val) => val.map((address) => address.toLowerCase()),
)

export const getMultiChainQueryEndPointWithStableSwap = (chainName: MultiChainNameExtend): GraphQLClient => {
const isStableSwap = checkIsStableSwap()
if (isStableSwap) return multiChainQueryStableClient[chainName]
return v2Clients[multiChainId[chainName]]
}

export const subgraphTokenName = {
[ChainId.BSC]: {
'0x738d96Caf7096659DB4C1aFbf1E1BDFD281f388C': 'Ankr Staked MATIC',
Expand Down
16 changes: 2 additions & 14 deletions apps/web/src/state/info/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
import { STABLE_SUPPORTED_CHAIN_IDS } from '@pancakeswap/stable-swap-sdk'
import { keepPreviousData, useQuery } from '@tanstack/react-query'
import BigNumber from 'bignumber.js'
import { fetchAllTokenDataByAddresses } from 'state/info/queries/tokens/tokenData'
import { Block, Transaction, TransactionType, TvlChartEntry, VolumeChartEntry } from 'state/info/types'
import { Transaction, TransactionType, TvlChartEntry, VolumeChartEntry } from 'state/info/types'
import { getAprsForStableFarm } from 'utils/getAprsForStableFarm'
import { getLpFeesAndApr } from 'utils/getLpFeesAndApr'
import { getPercentChange } from 'utils/infoDataHelpers'
import { explorerApiClient } from './api/client'
import { useExplorerChainNameByQuery } from './api/hooks'
import { operations } from './api/schema'
import { checkIsStableSwap, multiChainId, MultiChainName, MultiChainNameExtend } from './constant'
import { checkIsStableSwap, multiChainId, MultiChainName } from './constant'
import { PoolData, PriceChartEntry, ProtocolData, TokenData } from './types'

dayjs.extend(duration)
Expand Down Expand Up @@ -631,17 +630,6 @@ export const useAllTokenDataQuery = (): {
return data ?? {}
}

const graphPerPage = 50

const fetcher = (addresses: string[], chainName: MultiChainName, blocks: Block[]) => {
const times = Math.ceil(addresses.length / graphPerPage)
const addressGroup: Array<string[]> = []
for (let i = 0; i < times; i++) {
addressGroup.push(addresses.slice(i * graphPerPage, (i + 1) * graphPerPage))
}
return Promise.all(addressGroup.map((d) => fetchAllTokenDataByAddresses(chainName, blocks, d)))
}

export const useTokenDataQuery = (address: string | undefined): TokenData | undefined => {
const chainName = useExplorerChainNameByQuery()
const chainId = useChainIdByQuery()
Expand Down
215 changes: 0 additions & 215 deletions apps/web/src/state/info/queries/tokens/tokenData.ts

This file was deleted.

Loading
Loading