-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* pools pages * fixes and changes * revert demo config
- Loading branch information
Showing
63 changed files
with
1,183 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { Feature } from './types'; | ||
|
||
import { getEnvValue } from '../utils'; | ||
|
||
const contractInfoApiHost = getEnvValue('NEXT_PUBLIC_CONTRACT_INFO_API_HOST'); | ||
const dexPoolsEnabled = getEnvValue('NEXT_PUBLIC_DEX_POOLS_ENABLED') === 'true'; | ||
|
||
const title = 'DEX Pools'; | ||
|
||
const config: Feature<{ api: { endpoint: string; basePath: string } }> = (() => { | ||
if (contractInfoApiHost && dexPoolsEnabled) { | ||
return Object.freeze({ | ||
title, | ||
isEnabled: true, | ||
api: { | ||
endpoint: contractInfoApiHost, | ||
basePath: '', | ||
}, | ||
}); | ||
} | ||
|
||
return Object.freeze({ | ||
title, | ||
isEnabled: false, | ||
}); | ||
})(); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const DEFAULT_PAGE_SIZE = 50; | ||
|
||
export default function getItemIndex(index: number, page: number, pageSize: number = DEFAULT_PAGE_SIZE) { | ||
return (page - 1) * pageSize + index + 1; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Pool } from 'types/api/pools'; | ||
|
||
type PoolLink = { | ||
url: string; | ||
image: string; | ||
title: string; | ||
}; | ||
|
||
export default function getPoolLinks(pool?: Pool): Array<PoolLink> { | ||
if (!pool) { | ||
return []; | ||
} | ||
|
||
return [ | ||
{ | ||
url: pool.coin_gecko_terminal_url, | ||
image: '/static/gecko_terminal.png', | ||
title: 'GeckoTerminal', | ||
}, | ||
].filter(link => Boolean(link.url)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { Pool } from 'types/api/pools'; | ||
|
||
export const getPoolTitle = (pool: Pool) => { | ||
return `${ pool.base_token_symbol } / ${ pool.quote_token_symbol } ${ pool.fee ? `(${ pool.fee }%)` : '' }`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Pool } from 'types/api/pools'; | ||
|
||
export const base: Pool = { | ||
contract_address: '0x06da0fd433c1a5d7a4faa01111c044910a184553', | ||
chain_id: '1', | ||
base_token_address: '0xdac17f958d2ee523a2206206994597c13d831ec7', | ||
base_token_symbol: 'USDT', | ||
base_token_icon_url: 'https://localhost:3000/utia.jpg', | ||
quote_token_address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', | ||
quote_token_symbol: 'WETH', | ||
quote_token_icon_url: 'https://localhost:3000/secondary_utia.jpg', | ||
fully_diluted_valuation_usd: '75486579078', | ||
market_cap_usd: '139312819076.195', | ||
liquidity: '2099941.2238', | ||
dex: { id: 'sushiswap', name: 'SushiSwap' }, | ||
fee: '0.03', | ||
coin_gecko_terminal_url: 'https://www.geckoterminal.com/eth/pools/0x06da0fd433c1a5d7a4faa01111c044910a184553', | ||
}; | ||
|
||
export const noIcons: Pool = { | ||
...base, | ||
base_token_icon_url: null, | ||
quote_token_icon_url: null, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { NextPage } from 'next'; | ||
import dynamic from 'next/dynamic'; | ||
import React from 'react'; | ||
|
||
import type { Props } from 'nextjs/getServerSideProps'; | ||
import PageNextJs from 'nextjs/PageNextJs'; | ||
|
||
const Pool = dynamic(() => import('ui/pages/Pool'), { ssr: false }); | ||
|
||
const Page: NextPage<Props> = (props: Props) => { | ||
return ( | ||
<PageNextJs pathname="/pools/[hash]" query={ props.query }> | ||
<Pool/> | ||
</PageNextJs> | ||
); | ||
}; | ||
|
||
export default Page; | ||
|
||
export { pools as getServerSideProps } from 'nextjs/getServerSideProps'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { NextPage } from 'next'; | ||
import dynamic from 'next/dynamic'; | ||
import React from 'react'; | ||
|
||
import PageNextJs from 'nextjs/PageNextJs'; | ||
|
||
const Pools = dynamic(() => import('ui/pages/Pools'), { ssr: false }); | ||
|
||
const Page: NextPage = () => { | ||
return ( | ||
<PageNextJs pathname="/pools"> | ||
<Pools/> | ||
</PageNextJs> | ||
); | ||
}; | ||
|
||
export default Page; | ||
|
||
export { pools as getServerSideProps } from 'nextjs/getServerSideProps'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ | |
| "copy" | ||
| "cross" | ||
| "delete" | ||
| "dex-tracker" | ||
| "docs" | ||
| "donate" | ||
| "dots" | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const POOL = { | ||
contract_address: '0x6a1041865b76d1dc33da0257582591227c57832c', | ||
chain_id: '1', | ||
base_token_address: '0xf63e309818e4ea13782678ce6c31c1234fa61809', | ||
base_token_symbol: 'JANET', | ||
base_token_icon_url: null, | ||
quote_token_address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', | ||
quote_token_symbol: 'WETH', | ||
quote_token_icon_url: 'https://coin-images.coingecko.com/coins/images/2518/small/weth.png?1696503332', | ||
fully_diluted_valuation_usd: '15211385', | ||
market_cap_usd: '15211385', | ||
liquidity: '394101.2428', | ||
dex: { id: 'uniswap_v2', name: 'Uniswap V2' }, | ||
coin_gecko_terminal_url: 'https://www.geckoterminal.com/eth/pools/0x6a1041865b76d1dc33da0257582591227c57832c', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export type PoolsResponse = { | ||
items: Array<Pool>; | ||
next_page_params: { | ||
page_token: string; | ||
page_size: number; | ||
} | null; | ||
}; | ||
|
||
export type Pool = { | ||
contract_address: string; | ||
chain_id: string; | ||
base_token_address: string; | ||
base_token_symbol: string; | ||
base_token_icon_url: string | null; | ||
quote_token_address: string; | ||
quote_token_symbol: string; | ||
quote_token_icon_url: string | null; | ||
fully_diluted_valuation_usd: string; | ||
market_cap_usd: string; | ||
liquidity: string; | ||
dex: { | ||
id: string; | ||
name: string; | ||
}; | ||
fee?: string; | ||
coin_gecko_terminal_url: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.