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: temporarily hardcode subgraph urls #5074

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react'
import React from 'react'

import { CHAIN_INFO } from '@cowprotocol/common-const'
import { BlockExplorerLinkType, getBlockExplorerUrl } from '@cowprotocol/common-utils'
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { ExternalLink } from '@cowprotocol/ui'
import { ExternalLink, TokenSymbol } from '@cowprotocol/ui'

import LogoWrapper, { LOGO_MAP } from 'components/common/LogoWrapper'
import { abbreviateString } from 'utils'
Expand All @@ -24,7 +24,7 @@ export interface Props {
/**
* label to replace textContent generated from identifier
*/
label?: string | ReactElement | void
label?: string | void

/**
* Use the URL as a label
Expand Down Expand Up @@ -58,7 +58,7 @@ export const BlockExplorerLink: React.FC<Props> = (props: Props) => {

return (
<ExternalLink href={url} target="_blank" rel="noopener noreferrer" className={className}>
<span>{label}</span>
<TokenSymbol token={{ symbol: label }} length={24} />
{showLogo && <LogoWrapper title={`Open it on ${CHAIN_INFO[networkId].explorerTitle}`} src={LOGO_MAP.etherscan} />}
</ExternalLink>
)
Expand Down
6 changes: 5 additions & 1 deletion apps/explorer/src/components/common/TokenDisplay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TokenSymbol } from '@cowprotocol/ui'

import { TokenErc20 } from '@gnosis.pm/dex-js'
import { BlockExplorerLink } from 'components/common/BlockExplorerLink'
import TokenImg from 'components/common/TokenImg'
Expand Down Expand Up @@ -51,7 +53,9 @@ export function TokenDisplay(props: Readonly<Props>): React.ReactNode {
<StyledImg address={imageAddress} network={network} />
{isNativeToken(erc20.address) ? (
// There's nowhere to link when it's a native token, so, only display the symbol
<NativeWrapper>{erc20.symbol}</NativeWrapper>
<NativeWrapper>
<TokenSymbol length={24} token={erc20} />
</NativeWrapper>
) : (
<BlockExplorerLink identifier={erc20.address} type="token" label={tokenLabel} networkId={network} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const FooterStyled = styled.footer`
justify-content: space-around;
margin: auto auto 0;
height: auto;
padding: 1rem;
padding: 3rem 1rem 4rem 1rem;
max-height: 4rem;

${Media.upToMedium()} {
Expand Down
4 changes: 2 additions & 2 deletions apps/explorer/src/components/token/TokenTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ const TokenTable: React.FC<Props> = (props) => {
} else {
tableContent = (
<>
<tr>
{/* <tr>
<td>Sorted by Volume(24h): from highest to lowest</td>
</tr>
</tr> */}
{items.map((item, i) => (
<RowToken key={`${item.id}-${i}`} index={i + tableState.pageOffset} token={item} />
))}
Expand Down
12 changes: 8 additions & 4 deletions apps/explorer/src/consts/subgraphUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ function getSubgraphUrl(chainId: SupportedChainId, suffix: string): string | nul
* When value is null, then Subgraph is not supported for the network
*/
export const SUBGRAPH_URLS: Record<SupportedChainId, string | null> = {
[SupportedChainId.MAINNET]: getSubgraphUrl(SupportedChainId.MAINNET, 'MAINNET'),
[SupportedChainId.GNOSIS_CHAIN]: getSubgraphUrl(SupportedChainId.GNOSIS_CHAIN, 'GNOSIS_CHAIN'),
[SupportedChainId.ARBITRUM_ONE]: getSubgraphUrl(SupportedChainId.ARBITRUM_ONE, 'ARBITRUM_ONE'),
[SupportedChainId.MAINNET]:
'https://subgraph.satsuma-prod.com/a29a417e85ec/cow-nomev-labs-pt516811924/cow-subgraph-mainnet/api',
[SupportedChainId.GNOSIS_CHAIN]:
'https://subgraph.satsuma-prod.com/a29a417e85ec/cow-nomev-labs-pt516811924/cow-subgraphs-gnosis/api',
[SupportedChainId.ARBITRUM_ONE]:
'https://subgraph.satsuma-prod.com/a29a417e85ec/cow-nomev-labs-pt516811924/cow-subgraph-arb/api',
[SupportedChainId.BASE]: getSubgraphUrl(SupportedChainId.BASE, 'BASE'),
[SupportedChainId.SEPOLIA]: getSubgraphUrl(SupportedChainId.SEPOLIA, 'SEPOLIA'),
[SupportedChainId.SEPOLIA]:
'https://subgraph.satsuma-prod.com/a29a417e85ec/cow-nomev-labs-pt516811924/cow-subgraph-sepolia/api',
Comment on lines +11 to +19
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these to SDK/env vars

}
20 changes: 13 additions & 7 deletions apps/explorer/src/explorer/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@ import { Wrapper as WrapperMod } from '../styled'

const Wrapper = styled(WrapperMod)`
max-width: 100%;
height: calc(100vh - 10rem);
flex-flow: column wrap;
justify-content: center;
display: flex;
min-height: calc(100vh - 10rem);
padding: 0;

${Media.upToMedium()} {
height: 50vh;
min-height: 50vh;
}

${Media.upToSmall()} {
padding: 0 1.6rem;
}
`

const SearchWrapper = styled.div`
flex-flow: column wrap;
justify-content: center;
display: flex;

> h1 {
justify-content: center;
text-align: center;
padding: 2.4rem 0 0.75rem;
margin: 0 0 2.4rem;
font-size: 2.4rem;
Expand Down Expand Up @@ -82,8 +86,10 @@ export const Home: React.FC = () => {
<Helmet>
<title>{APP_TITLE}</title>
</Helmet>
<h1>Search on CoW Protocol Explorer</h1>
<Search className="home" />
<SearchWrapper>
<h1>Search on CoW Protocol Explorer</h1>
<Search className="home" />
</SearchWrapper>
<SummaryWrapper>
{showCharts && (
<>
Expand Down
9 changes: 3 additions & 6 deletions apps/explorer/src/explorer/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ export const GlobalStyle = createGlobalStyle`
html,
body,
#root {
display: block;
max-width: 100vw;
overflow-x: hidden;
margin: 0;
padding: 0;
position: relative;
display: flex;
flex-direction: column;
flex-grow: 1;
${ScrollBarStyle}
}
Expand Down
1 change: 0 additions & 1 deletion apps/explorer/src/theme/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const StaticGlobalStyle = createGlobalStyle`
box-sizing: border-box;
overscroll-behavior-y: none;
scroll-behavior: smooth;
overflow-x: hidden;
}
*, *:before, *:after {
Expand Down
Loading