Skip to content

Commit ba4edb0

Browse files
authored
feat(new-chains): add q4 chains (#6404)
* chore: set cow-sdk version temporarily to pr-606 * feat: add linea/plasma chainInfo * feat: add linea/plasma common settings * feat: add linea/plasma network config * chore: add todo regarding tenderly support for linea/plasma * chore: remove unused constant * refactor: rename fn to getCowTokenForChain * feat: add linea/plasma initial tokens * feat: add linea/plasma feature flags * feat: add linea/plasma explorer config * refactor: remove unused fn * feat: add linea/plasma safe config * refactor: make ens settings same for most networks * feat: add linea/plasma favorite tokens config * feat: add linea/plasma to token search * feat: add linea/plasma uni token lists (that don't exist yet) * feat: add linea/plasma trust assets config * feat: add linea/plasma rpc config for switching chains * feat: disable plasma from bff balances fetching * feat: add linea/plasma explorer configs * feat: add linea/plasma initial yield page configs * feat: add linea/plasma fee config * feat: add linea/plasma defillama config * refactor: use isZkSyncChain instead of hardcoding it for lens * feat: add linea/plasma/bnb bridge banner * feat: add linea/plasma cowswap benefits to progress bar * feat: add linea/plasma surplus card start dates * feat: add linea/plasma as new chains, replacing bnb and lens * feat: add bnb to list of supported chains FAQ * chore: add doc entry to not mistakenly update chain names map * feat: add linea/plasma token lists * chore: bump all sdk packages to the PR version * chore: add hack to show linea/plasma chain logos * fix: replace hook with pure component for unsupported networks text * fix: use correct address for USDT on Plasma * fix: remove temporary workaround for linea/plasma logos * fix: replace sdk gh pkgs with published version * fix: typo * fix: remove duplicated entry for BNB * fix: disable tenderly for Plasma * fix: typo * fix: automate list of deployed chains * fix: move available chains text to a helper fn * fix: show all chains CoW Swap is available on * fix: increase number of networks to show from 9 to 10
1 parent 1385188 commit ba4edb0

File tree

37 files changed

+332
-197
lines changed

37 files changed

+332
-197
lines changed

apps/cow-fi/data/cow-protocol/const.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import IMG_LOGO_SHAPESHIFT from '@cowprotocol/assets/images/logo-shapeshift.svg'
3232
import IMG_LOGO_STAKE_DAO from '@cowprotocol/assets/images/logo-stakedao.svg'
3333
import IMG_LOGO_SYNTHETIX from '@cowprotocol/assets/images/logo-synthetix.svg'
3434
import IMG_LOGO_TELLER_FINANCE from '@cowprotocol/assets/images/logo-teller.svg'
35+
import { getAvailableChainsText } from '@cowprotocol/common-const'
3536
import { Color } from '@cowprotocol/ui'
3637

3738
import { CowFiCategory, toCowFiGtmEvent } from 'src/common/analytics/types'
@@ -390,8 +391,7 @@ export function useFaqData(): FaqItem[] {
390391
},
391392
{
392393
question: 'What chains does CoW Protocol currently support?',
393-
answer:
394-
'CoW Protocol is currently deployed on Ethereum, BNB, Base, Arbitrum, Polygon, Avalanche, Gnosis, and Lens.',
394+
answer: 'CoW Protocol is currently deployed on: ' + getAvailableChainsText(),
395395
},
396396
{
397397
question: 'How do I get support?',

apps/cowswap-frontend/src/common/containers/WalletUnsupportedNetworkBanner/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { UI, Media } from '@cowprotocol/ui'
1+
import { ReactElement } from 'react'
2+
3+
import { Media, UI } from '@cowprotocol/ui'
24

35
import { AlertCircle } from 'react-feather'
46
import styled from 'styled-components/macro'
57

68
import { useIsProviderNetworkUnsupported } from 'common/hooks/useIsProviderNetworkUnsupported'
7-
8-
import { useUnsupportedNetworksText } from '../../hooks/useUnsupportedNetworksText'
9+
import { UnsupportedNetworksText } from 'common/pure/UnsupportedNetworksText'
910

1011
const Wrapper = styled.div`
1112
position: fixed;
@@ -37,11 +38,8 @@ const StyledAlertCircle = styled(AlertCircle)`
3738
color: var(${UI.COLOR_DANGER});
3839
`
3940

40-
// TODO: Add proper return type annotation
41-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
42-
export function WalletUnsupportedNetworkBanner() {
41+
export function WalletUnsupportedNetworkBanner(): ReactElement {
4342
const isChainIdUnsupported = useIsProviderNetworkUnsupported()
44-
const unsupportedNetworksText = useUnsupportedNetworksText()
4543

4644
return (
4745
<>
@@ -50,7 +48,9 @@ export function WalletUnsupportedNetworkBanner() {
5048
<div>
5149
<StyledAlertCircle size={24} />
5250
</div>
53-
<div>{unsupportedNetworksText}</div>
51+
<div>
52+
<UnsupportedNetworksText />
53+
</div>
5454
</Wrapper>
5555
)}
5656
</>

apps/cowswap-frontend/src/common/hooks/useUnsupportedNetworksText.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

apps/cowswap-frontend/src/common/pure/NetworksList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Trans } from '@lingui/macro'
99

1010
import * as styledEl from './styled'
1111

12-
const NEW_NETWORK_IDS = [SupportedChainId.BNB, SupportedChainId.LENS] // BNB, Lens
12+
const NEW_NETWORK_IDS = [SupportedChainId.LINEA, SupportedChainId.PLASMA]
1313

1414
export interface NetworksListProps {
1515
currentChainId: SupportedChainId | null
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ReactElement } from 'react'
2+
3+
import { Trans } from '@lingui/macro'
4+
5+
export function UnsupportedNetworksText(): ReactElement {
6+
return <Trans>Please connect your wallet to one of our supported networks.</Trans>
7+
}

apps/cowswap-frontend/src/modules/account/containers/AccountDetails/SurplusCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ const BASE_START_DATE = 'December 2024'
2525
const POLYGON_START_DATE = 'June 2025'
2626
const AVALANCHE_START_DATE = 'June 2025'
2727
const LENS_START_DATE = 'September 2025'
28-
const BNB_START_DATE = 'September 2025' // TODO: Update when BNB is supported
28+
const BNB_START_DATE = 'September 2025'
29+
const LINEA_START_DATE = 'November 2025'
30+
const PLASMA_START_DATE = 'December 2025'
2931

3032
const START_DATE: Record<SupportedChainId, string> = {
3133
[SupportedChainId.MAINNET]: DEFAULT_START_DATE,
@@ -37,6 +39,8 @@ const START_DATE: Record<SupportedChainId, string> = {
3739
[SupportedChainId.AVALANCHE]: AVALANCHE_START_DATE,
3840
[SupportedChainId.LENS]: LENS_START_DATE,
3941
[SupportedChainId.BNB]: BNB_START_DATE,
42+
[SupportedChainId.LINEA]: LINEA_START_DATE,
43+
[SupportedChainId.PLASMA]: PLASMA_START_DATE,
4044
}
4145

4246
// TODO: Break down this large function into smaller functions

apps/cowswap-frontend/src/modules/account/containers/AccountDetails/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import { Fragment, ReactNode } from 'react'
22

33
import { CHAIN_INFO } from '@cowprotocol/common-const'
44
import { styled } from '@cowprotocol/common-hooks'
5-
import { getEtherscanLink, getExplorerLabel, shortenAddress, getExplorerAddressLink } from '@cowprotocol/common-utils'
5+
import { getEtherscanLink, getExplorerAddressLink, getExplorerLabel, shortenAddress } from '@cowprotocol/common-utils'
66
import { Command } from '@cowprotocol/types'
77
import { ExternalLink } from '@cowprotocol/ui'
88
import {
9-
useWalletInfo,
10-
useWalletDetails,
11-
useIsWalletConnect,
9+
ConnectionType,
1210
getIsHardWareWallet,
13-
useDisconnectWallet,
14-
useConnectionType,
1511
getIsInjectedMobileBrowser,
16-
ConnectionType,
12+
useConnectionType,
13+
useDisconnectWallet,
14+
useIsWalletConnect,
15+
useWalletDetails,
16+
useWalletInfo,
1717
} from '@cowprotocol/wallet'
1818

1919
import { Trans } from '@lingui/macro'
@@ -26,7 +26,7 @@ import { updateSelectedWallet } from 'legacy/state/user/reducer'
2626
import { useInjectedWidgetParams } from 'modules/injectedWidget'
2727

2828
import { useIsProviderNetworkUnsupported } from 'common/hooks/useIsProviderNetworkUnsupported'
29-
import { useUnsupportedNetworksText } from 'common/hooks/useUnsupportedNetworksText'
29+
import { UnsupportedNetworksText } from 'common/pure/UnsupportedNetworksText'
3030

3131
import { AccountIcon } from './AccountIcon'
3232
import { ActivitiesList } from './ActivitiesList'
@@ -43,8 +43,8 @@ import {
4343
WalletActions,
4444
WalletName,
4545
WalletNameAddress,
46-
WalletSelector,
4746
WalletSecondaryActions,
47+
WalletSelector,
4848
WalletWrapper,
4949
Wrapper,
5050
} from './styled'
@@ -102,8 +102,6 @@ export function AccountDetails({
102102
const isWalletConnect = useIsWalletConnect()
103103
const isInjectedMobileBrowser = getIsInjectedMobileBrowser()
104104

105-
const unsupportedNetworksText = useUnsupportedNetworksText()
106-
107105
// In case the wallet is connected via WalletConnect and has wallet name set, add the suffix to be clear
108106
// This to avoid confusion for instance when using Metamask mobile
109107
// When name is not set, it defaults to WalletConnect already
@@ -177,7 +175,9 @@ export function AccountDetails({
177175
</InfoCard>
178176

179177
{isChainIdUnsupported ? (
180-
<UnsupportedWalletBox>{unsupportedNetworksText}</UnsupportedWalletBox>
178+
<UnsupportedWalletBox>
179+
<UnsupportedNetworksText />
180+
</UnsupportedWalletBox>
181181
) : (
182182
<>
183183
<SurplusCard />

apps/cowswap-frontend/src/modules/orderProgressBar/constants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import PROGRESSBAR_COW_SURPLUS_1 from '@cowprotocol/assets/cow-swap/progressbar-
22
import PROGRESSBAR_COW_SURPLUS_2 from '@cowprotocol/assets/cow-swap/progressbar-finished-image-2.svg'
33
import PROGRESSBAR_COW_SURPLUS_3 from '@cowprotocol/assets/cow-swap/progressbar-finished-image-3.svg'
44
import PROGRESSBAR_COW_SURPLUS_4 from '@cowprotocol/assets/cow-swap/progressbar-finished-image-4.svg'
5+
import { getAvailableChainsText } from '@cowprotocol/common-const'
56
import { SupportedChainId } from '@cowprotocol/cow-sdk'
67

78
/**
@@ -88,8 +89,7 @@ export const COW_SWAP_BENEFITS = [
8889
"Unlike most other exchanges, CoW Swap doesn't charge you any fees if your trade fails.",
8990
]
9091

91-
export const TRADE_ON_NEW_CHAINS_BENEFIT =
92-
'CoW Swap is now live on Arbitrum, Base, Polygon, and Avalanche. Switch the network toggle in the nav bar for quick, cheap transactions.'
92+
export const TRADE_ON_NEW_CHAINS_BENEFIT = `CoW Swap is live on ${getAvailableChainsText()}. Switch the network toggle in the nav bar for quick, cheap transactions.`
9393

9494
export const CHAIN_SPECIFIC_BENEFITS: Record<SupportedChainId, string[]> = {
9595
[SupportedChainId.MAINNET]: [TRADE_ON_NEW_CHAINS_BENEFIT, ...COW_SWAP_BENEFITS],
@@ -101,6 +101,8 @@ export const CHAIN_SPECIFIC_BENEFITS: Record<SupportedChainId, string[]> = {
101101
[SupportedChainId.AVALANCHE]: COW_SWAP_BENEFITS,
102102
[SupportedChainId.LENS]: COW_SWAP_BENEFITS,
103103
[SupportedChainId.BNB]: COW_SWAP_BENEFITS,
104+
[SupportedChainId.LINEA]: COW_SWAP_BENEFITS,
105+
[SupportedChainId.PLASMA]: COW_SWAP_BENEFITS,
104106
}
105107

106108
export const SURPLUS_IMAGES = [

apps/cowswap-frontend/src/modules/swap/containers/NetworkBridgeBanner/NetworkBridgeBanner.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ const RootWrapper = styled.div`
5151
}
5252
`
5353

54+
// TODO: remove once network is supported for cross-chain swaps
5455
const SHOULD_SHOW_ALERT = {
5556
[SupportedChainId.GNOSIS_CHAIN]: true,
5657
[SupportedChainId.LENS]: true,
58+
[SupportedChainId.BNB]: true,
59+
[SupportedChainId.LINEA]: true,
60+
[SupportedChainId.PLASMA]: true,
5761
}
5862

5963
type NetworkAlertChains = keyof typeof SHOULD_SHOW_ALERT

apps/cowswap-frontend/src/modules/tokensList/pure/ChainsSelector/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Check, ChevronDown, ChevronUp } from 'react-feather'
1010
import * as styledEl from './styled'
1111

1212
// Number of skeleton shimmers to show during loading state
13-
const LOADING_ITEMS_COUNT = 9
13+
const LOADING_ITEMS_COUNT = 10
1414

1515
const LoadingShimmerElements = (
1616
<styledEl.Wrapper>

0 commit comments

Comments
 (0)