Skip to content

Commit

Permalink
feat: Use explorer api in v3 info (#9963)
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
This PR focuses on optimizing data fetching and updating UI components
in the `V3Info` module.

### Detailed summary
- Updated data fetching methods for tokens and pools
- Removed unnecessary constants and imports
- Refactored UI components for volume and fees display

> The following files were skipped due to too many changes:
`apps/web/src/views/V3Info/data/protocol/transactions.ts`,
`apps/web/src/views/V3Info/data/pool/transactions.ts`,
`apps/web/src/views/V3Info/data/token/priceData.ts`,
`apps/web/src/views/V3Info/data/token/chartData.ts`,
`apps/web/src/views/V3Info/data/protocol/overview.ts`,
`apps/web/src/views/V3Info/data/protocol/chart.ts`,
`apps/web/src/views/V3Info/data/pool/chartData.ts`,
`apps/web/src/views/V3Info/data/token/transactions.ts`,
`apps/web/src/views/V3Info/data/pool/tickData.ts`,
`apps/web/src/state/info/api/schema.d.ts`,
`apps/web/src/views/V3Info/hooks/index.ts`

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

<!-- end pr-codex -->
  • Loading branch information
memoyil authored Jun 11, 2024
1 parent 0d4025b commit 21fffbe
Show file tree
Hide file tree
Showing 16 changed files with 1,004 additions and 1,475 deletions.
137 changes: 131 additions & 6 deletions apps/web/src/state/info/api/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export interface paths {
/** Get positions from v3 pool */
get: operations['getCachedPoolsPositionsV3ByChainNameByPool']
}
'/cached/pools/chart/v3/{chainName}/{address}/fees': {
/** Get pool fees chart */
get: operations['getCachedPoolsChartV3ByChainNameByAddressFees']
}
'/cached/pools/chart/{protocol}/{chainName}/{address}/tvl': {
/** Get pool tvl chart */
get: operations['getCachedPoolsChartByProtocolByChainNameByAddressTvl']
Expand Down Expand Up @@ -186,22 +190,28 @@ export interface components {
decimals: number
totalTxCount: number
txCount24h: number
txCount48h: number
txCount7d: number
priceUSD: string
priceUSD24h: string
priceUSD48h: string
priceUSD7d: string
/** @description Total volume in USD */
totalVolumeUSD: string
volumeUSD24h: null | string
volumeUSD48h: null | string
volumeUSD7d: null | string
tvlUSD: string
tvlUSD24h: string
tvlUSD48h: string
tvlUSD7d: string
tvl: string
tvl24h: string
tvl48h: string
tvl7d: string
totalFeeUSD: string
feeUSD24h: string
feeUSD48h: string
feeUSD7d: string
}
v2TokenData: {
Expand All @@ -212,19 +222,24 @@ export interface components {
decimals: number
totalTxCount: number
txCount24h: number
txCount48h: number
txCount7d: number
priceUSD: string
priceUSD24h: string
priceUSD48h: string
priceUSD7d: string
/** @description Total volume in USD */
totalVolumeUSD: string
volumeUSD24h: null | string
volumeUSD48h: null | string
volumeUSD7d: null | string
tvlUSD: string
tvlUSD24h: string
tvlUSD48h: string
tvlUSD7d: string
tvl: string
tvl24h: string
tvl48h: string
tvl7d: string
}
TokenPrice: {
Expand All @@ -240,12 +255,24 @@ export interface components {
timestamp: Record<string, never> | string
}
ticks: {
id: string
/** @description Tick index */
tickIdx: number
liquidityGross: string
liquidityNet: string
}[]
/** @description Cursor for pagination start */
startCursor?: string
/** @description Cursor for pagination end */
endCursor?: string
/** @description Has next page */
hasNextPage?: boolean
/** @description Has previous page */
hasPrevPage?: boolean
rows: {
id: string
/** @description Tick index */
tickIdx: number
liquidityGross: string
liquidityNet: string
price0: string
price1: string
}[]
}
positions: {
/** @description Cursor for pagination start */
startCursor?: string
Expand Down Expand Up @@ -708,22 +735,28 @@ export interface operations {
decimals: number
totalTxCount: number
txCount24h: number
txCount48h: number
txCount7d: number
priceUSD: string
priceUSD24h: string
priceUSD48h: string
priceUSD7d: string
/** @description Total volume in USD */
totalVolumeUSD: string
volumeUSD24h: null | string
volumeUSD48h: null | string
volumeUSD7d: null | string
tvlUSD: string
tvlUSD24h: string
tvlUSD48h: string
tvlUSD7d: string
tvl: string
tvl24h: string
tvl48h: string
tvl7d: string
totalFeeUSD: string
feeUSD24h: string
feeUSD48h: string
feeUSD7d: string
}[]
}
Expand All @@ -749,19 +782,24 @@ export interface operations {
decimals: number
totalTxCount: number
txCount24h: number
txCount48h: number
txCount7d: number
priceUSD: string
priceUSD24h: string
priceUSD48h: string
priceUSD7d: string
/** @description Total volume in USD */
totalVolumeUSD: string
volumeUSD24h: null | string
volumeUSD48h: null | string
volumeUSD7d: null | string
tvlUSD: string
tvlUSD24h: string
tvlUSD48h: string
tvlUSD7d: string
tvl: string
tvl24h: string
tvl48h: string
tvl7d: string
}[]
}
Expand All @@ -786,19 +824,24 @@ export interface operations {
decimals: number
totalTxCount: number
txCount24h: number
txCount48h: number
txCount7d: number
priceUSD: string
priceUSD24h: string
priceUSD48h: string
priceUSD7d: string
/** @description Total volume in USD */
totalVolumeUSD: string
volumeUSD24h: null | string
volumeUSD48h: null | string
volumeUSD7d: null | string
tvlUSD: string
tvlUSD24h: string
tvlUSD48h: string
tvlUSD7d: string
tvl: string
tvl24h: string
tvl48h: string
tvl7d: string
}[]
}
Expand All @@ -808,6 +851,12 @@ export interface operations {
/** Get all ticks from v3 pool */
getCachedPoolsTicksV3ByChainNameByPool: {
parameters: {
query?: {
/** @description Cursor for pagination before */
before?: string
/** @description Cursor for pagination after */
after?: string
}
path: {
/** @description Chain name */
chainName: 'bsc' | 'ethereum' | 'base' | 'opbnb' | 'zksync' | 'polygon-zkevm' | 'linea' | 'arbitrum'
Expand Down Expand Up @@ -850,6 +899,27 @@ export interface operations {
}
}
}
/** Get pool fees chart */
getCachedPoolsChartV3ByChainNameByAddressFees: {
parameters: {
path: {
/** @description Chain name */
chainName: 'bsc' | 'ethereum' | 'base' | 'opbnb' | 'zksync' | 'polygon-zkevm' | 'linea' | 'arbitrum'
/** @description Ethereum address */
address: string
}
}
responses: {
200: {
content: {
'application/json': {
bucket: Record<string, never> | string
feeUSD: string
}[]
}
}
}
}
/** Get pool tvl chart */
getCachedPoolsChartByProtocolByChainNameByAddressTvl: {
parameters: {
Expand Down Expand Up @@ -971,12 +1041,16 @@ export interface operations {
tvlToken1: string
/** @description Volume in USD in 24h */
volumeUSD24h: string
/** @description Volume in USD in 24h */
volumeUSD48h: string
/** @description Volume in USD in 7d */
volumeUSD7d: string
/** @description Total value locked in USD */
tvlUSD: string
/** @description Total value locked in USD 24h ago */
tvlUSD24h: string
/** @description Total value locked in USD 24h ago */
tvlUSD48h: string
/** @description Total value locked in USD 7d ago */
tvlUSD7d: string
/** @description Pool created at timestamp */
Expand All @@ -987,8 +1061,20 @@ export interface operations {
tick: null | number
/** @description Total fee in USD */
totalFeeUSD: string
/** @description Fee in USD in 24h */
feeUSD24h: string
/** @description Fee in USD in 24h */
feeUSD48h: string
/** @description Fee in USD in 7d */
feeUSD7d: string
/** @description Total protocol fee in USD */
totalProtocolFeeUSD: string
/** @description Protocol fee in USD in 24h */
protocolFeeUSD24h: string
/** @description Protocol fee in USD in 24h */
protocolFeeUSD48h: string
/** @description Protocol fee in USD in 7d */
protocolFeeUSD7d: string
}
}
}
Expand Down Expand Up @@ -1034,12 +1120,16 @@ export interface operations {
tvlToken1: string
/** @description Volume in USD in 24h */
volumeUSD24h: string
/** @description Volume in USD in 24h */
volumeUSD48h: string
/** @description Volume in USD in 7d */
volumeUSD7d: string
/** @description Total value locked in USD */
tvlUSD: string
/** @description Total value locked in USD 24h ago */
tvlUSD24h: string
/** @description Total value locked in USD 24h ago */
tvlUSD48h: string
/** @description Total value locked in USD 7d ago */
tvlUSD7d: string
/** @description Pool created at timestamp */
Expand Down Expand Up @@ -1088,18 +1178,23 @@ export interface operations {
tvlToken1: string
/** @description Volume in USD in 24h */
volumeUSD24h: string
/** @description Volume in USD in 24h */
volumeUSD48h: string
/** @description Volume in USD in 7d */
volumeUSD7d: string
/** @description Total value locked in USD */
tvlUSD: string
/** @description Total value locked in USD 24h ago */
tvlUSD24h: string
/** @description Total value locked in USD 24h ago */
tvlUSD48h: string
/** @description Total value locked in USD 7d ago */
tvlUSD7d: string
/** @description Pool created at timestamp */
createdAtTimestamp: Record<string, never> | string
virtualPrice: string
virtualPrice24h: null | string
virtualPrice48h: null | string
virtualPrice7d: null | string
}
}
Expand Down Expand Up @@ -1198,12 +1293,16 @@ export interface operations {
tvlToken1: string
/** @description Volume in USD in 24h */
volumeUSD24h: string
/** @description Volume in USD in 24h */
volumeUSD48h: string
/** @description Volume in USD in 7d */
volumeUSD7d: string
/** @description Total value locked in USD */
tvlUSD: string
/** @description Total value locked in USD 24h ago */
tvlUSD24h: string
/** @description Total value locked in USD 24h ago */
tvlUSD48h: string
/** @description Total value locked in USD 7d ago */
tvlUSD7d: string
/** @description Pool created at timestamp */
Expand All @@ -1214,8 +1313,20 @@ export interface operations {
tick: null | number
/** @description Total fee in USD */
totalFeeUSD: string
/** @description Fee in USD in 24h */
feeUSD24h: string
/** @description Fee in USD in 24h */
feeUSD48h: string
/** @description Fee in USD in 7d */
feeUSD7d: string
/** @description Total protocol fee in USD */
totalProtocolFeeUSD: string
/** @description Protocol fee in USD in 24h */
protocolFeeUSD24h: string
/** @description Protocol fee in USD in 24h */
protocolFeeUSD48h: string
/** @description Protocol fee in USD in 7d */
protocolFeeUSD7d: string
}[]
}
}
Expand Down Expand Up @@ -1263,12 +1374,16 @@ export interface operations {
tvlToken1: string
/** @description Volume in USD in 24h */
volumeUSD24h: string
/** @description Volume in USD in 24h */
volumeUSD48h: string
/** @description Volume in USD in 7d */
volumeUSD7d: string
/** @description Total value locked in USD */
tvlUSD: string
/** @description Total value locked in USD 24h ago */
tvlUSD24h: string
/** @description Total value locked in USD 24h ago */
tvlUSD48h: string
/** @description Total value locked in USD 7d ago */
tvlUSD7d: string
/** @description Pool created at timestamp */
Expand Down Expand Up @@ -1319,18 +1434,23 @@ export interface operations {
tvlToken1: string
/** @description Volume in USD in 24h */
volumeUSD24h: string
/** @description Volume in USD in 24h */
volumeUSD48h: string
/** @description Volume in USD in 7d */
volumeUSD7d: string
/** @description Total value locked in USD */
tvlUSD: string
/** @description Total value locked in USD 24h ago */
tvlUSD24h: string
/** @description Total value locked in USD 24h ago */
tvlUSD48h: string
/** @description Total value locked in USD 7d ago */
tvlUSD7d: string
/** @description Pool created at timestamp */
createdAtTimestamp: Record<string, never> | string
virtualPrice: string
virtualPrice24h: null | string
virtualPrice48h: null | string
virtualPrice7d: null | string
}[]
}
Expand Down Expand Up @@ -1633,16 +1753,21 @@ export interface operations {
totalVolumeUSD: string
totalProtocolFeeUSD: string
totalProtocolFeeUSD24h: string
totalProtocolFeeUSD48h: string
totalProtocolFeeUSD30d: string
totalTxCount: number
totalFeeUSD: string
totalFeeUSD24h: string
totalFeeUSD48h: string
totalFeeUSD30d: string
tvlUSD24h: string
tvlUSD48h: string
tvlUSD30d: string
volumeUSD24h: string
volumeUSD48h: string
volumeUSD30d: string
txCount24h: number
txCount48h: number
txCount30d: number
}
}
Expand Down
Loading

0 comments on commit 21fffbe

Please sign in to comment.