Skip to content

Commit 5b8d8fb

Browse files
chore: extract files.cow.fi into an env variable
1 parent bc1ecd3 commit 5b8d8fb

File tree

13 files changed

+30
-17
lines changed

13 files changed

+30
-17
lines changed

apps/cow-fi/services/tokens/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import path from 'path'
88
import { DATA_CACHE_TIME_SECONDS } from '@/const/meta'
99
import { Network } from '@/const/networkMap'
1010
import { PlatformData, Platforms, TokenDetails, TokenInfo } from 'types'
11+
import { COW_CDN } from '@cowprotocol/common-const'
1112

1213
const NETWORKS: Network[] = ['ethereum', 'base', 'arbitrum-one', 'avalanche', 'polygon-pos', 'xdai']
1314
const COW_TOKEN_ID = 'cow-protocol'
1415

15-
const TOKEN_LISTS_URL = 'https://files.cow.fi/tokens/cowFi-tokens.json'
16+
const TOKEN_LISTS_URL = `${COW_CDN}/tokens/cowFi-tokens.json`
1617
const DESCRIPTIONS_DIR_PATH = path.join(process.cwd(), 'data', 'descriptions')
1718

1819
/**

apps/cowswap-frontend/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,5 @@ INTEGRATION_TESTS_INFURA_KEY=
143143
# Crowdin translations
144144
#######################################
145145
# CROWDIN_PERSONAL_TOKEN
146+
147+
REACT_APP_COW_CDN=https://files.cow.fi

apps/cowswap-frontend/src/modules/orderProgressBar/pure/OrderProgressBar/index.cosmos.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useState, ReactNode, useRef } from 'react'
22

33
import {
4+
COW_CDN,
45
USDC_BASE,
56
USDC_GNOSIS_CHAIN,
67
USDC_MAINNET,
@@ -38,7 +39,7 @@ const account = '0xfb3c7eb936cAA12B5A884d612393969A557d4307'
3839
const swapAndBridgeContextMock: SwapAndBridgeContext = {
3940
bridgeProvider: {
4041
logoUrl:
41-
'https://files.cow.fi/cow-sdk/bridging/providers/across/across-logo.png',
42+
`${COW_CDN}/cow-sdk/bridging/providers/across/across-logo.png`,
4243
name: 'Across',
4344
dappId: 'cow-sdk://bridging/providers/across',
4445
website: 'https://across.to',
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { COW_CDN } from '@cowprotocol/common-const'
2+
13
import ms from 'ms.macro'
24

35
export const PENDING_ORDER_PERMIT_CHECK_INTERVAL = ms`60s`
46

5-
export const PRE_GENERATED_PERMIT_URL =
6-
'https://files.cow.fi/token-lists/PermitInfo'
7+
export const PRE_GENERATED_PERMIT_URL = `${COW_CDN}/token-lists/PermitInfo`

apps/cowswap-frontend/src/modules/tokensList/mocks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TokenWithLogo } from '@cowprotocol/common-const'
1+
import { COW_CDN, TokenWithLogo } from '@cowprotocol/common-const'
22
import { SupportedChainId } from '@cowprotocol/cow-sdk'
33
import { ListState } from '@cowprotocol/tokens'
44

@@ -101,7 +101,7 @@ export const customTokensMock: TokenWithLogo[] = [
101101
export const listsMock: ListState[] = [
102102
{
103103
source:
104-
'https://tokenlists.org/token-list?url=https://files.cow.fi/token-lists/CowSwapSepolia.json',
104+
`https://tokenlists.org/token-list?url=${COW_CDN}/token-lists/CowSwapSepolia.json`,
105105
list: {
106106
name: 'CowSwap Sepolia',
107107
logoURI: 'https://gnosis.mypinata.cloud/ipfs/Qme9B6jRpGtZsRFcPjHvA5T4ugFuL4c3SzWfxyMPa59AMo',
@@ -128,10 +128,10 @@ export const listsMock: ListState[] = [
128128
]
129129

130130
export const importListsMock: ListState = {
131-
source: 'https://files.cow.fi/tokens/CowSwap.json',
131+
source: `${COW_CDN}/tokens/CowSwap.json`,
132132
list: {
133133
name: 'CoW Swap',
134-
logoURI: 'https://files.cow.fi/token-lists/images/list-logo.png',
134+
logoURI: `${COW_CDN}/token-lists/images/list-logo.png`,
135135
// TODO: Replace any with proper type definitions
136136
// eslint-disable-next-line @typescript-eslint/no-explicit-any
137137
tokens: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] as any[],

apps/cowswap-frontend/src/tradingSdk/TestReceiverAccountBridgeProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { COW_CDN } from '@cowprotocol/common-const'
12
import { ChainInfo, EnrichedOrder, EvmCall, TokenInfo } from '@cowprotocol/cow-sdk'
23
import {
34
BridgeProvider,
@@ -21,7 +22,7 @@ export class TestReceiverAccountBridgeProvider implements ReceiverAccountBridgeP
2122
info: BridgeProviderInfo = {
2223
name: 'Receiver Bridge',
2324
logoUrl:
24-
'https://files.cow.fi/cow-sdk/bridging/providers/mock/mock-logo.webp',
25+
`${COW_CDN}/cow-sdk/bridging/providers/mock/mock-logo.webp`,
2526
dappId: 'test-receiver-bridge',
2627
website: 'https://github.com/cowprotocol/cowswap',
2728
type: 'ReceiverAccountBridgeProvider',

apps/explorer/src/components/orders/OrderDetails/crossChainOrder.mock.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { COW_CDN } from '@cowprotocol/common-const'
12
import type { CrossChainOrder } from '@cowprotocol/sdk-bridging'
23

34
export const crossChainOrderMock = {
@@ -8,7 +9,7 @@ export const crossChainOrderMock = {
89
info: {
910
name: 'Bungee',
1011
logoUrl:
11-
'https://files.cow.fi/cow-sdk/bridging/providers/bungee/bungee-logo.png',
12+
`${COW_CDN}/cow-sdk/bridging/providers/bungee/bungee-logo.png`,
1213
dappId: 'cow-sdk://bridging/providers/bungee',
1314
website: 'https://www.bungee.exchange',
1415
},

apps/explorer/src/hooks/useTokenList.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useMemo } from 'react'
22

3-
import { SWR_NO_REFRESH_OPTIONS } from '@cowprotocol/common-const'
3+
import { COW_CDN, SWR_NO_REFRESH_OPTIONS } from '@cowprotocol/common-const'
44
import { ALL_SUPPORTED_CHAIN_IDS, mapSupportedNetworks, SupportedChainId } from '@cowprotocol/cow-sdk'
55
import type { TokenInfo, TokenList } from '@uniswap/token-lists'
66

@@ -32,8 +32,8 @@ const EMPTY_TOKENS: TokenListByAddress = {}
3232
export function useTokenList(chainId: SupportedChainId | undefined): { data: TokenListByAddress; isLoading: boolean } {
3333
const { data: cowSwapList, isLoading: isCowListLoading } = useTokenListByUrl(
3434
chainId !== SupportedChainId.SEPOLIA
35-
? 'https://files.cow.fi/tokens/CowSwap.json'
36-
: 'https://files.cow.fi/token-lists/CowSwapSepolia.json',
35+
? `${COW_CDN}/tokens/CowSwap.json`
36+
: `${COW_CDN}/token-lists/CowSwapSepolia.json`,
3737
)
3838
const { data: coingeckoUniswapList, isLoading: isCoingeckoUniswapLoading } = useTokenListByUrl(
3939
chainId === SupportedChainId.MAINNET ? 'https://tokens.coingecko.com/uniswap/all.json' : '',

apps/widget-configurator/src/app/configurator/consts.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { COW_CDN } from '@cowprotocol/common-const'
12
import { CowWidgetEventListeners, CowWidgetEvents, ToastMessageType } from '@cowprotocol/events'
23
import { CowSwapWidgetPaletteParams, TokenInfo, TradeType } from '@cowprotocol/widget-lib'
34

@@ -9,8 +10,8 @@ export const TRADE_MODES = [TradeType.SWAP, TradeType.LIMIT, TradeType.ADVANCED,
910

1011
// Sourced from https://tokenlists.org/
1112
export const DEFAULT_TOKEN_LISTS: TokenListItem[] = [
12-
{ url: 'https://files.cow.fi/tokens/CowSwap.json', enabled: true },
13-
{ url: 'https://files.cow.fi/token-lists/CoinGecko.1.json', enabled: true },
13+
{ url: `${COW_CDN}/tokens/CowSwap.json`, enabled: true },
14+
{ url: `${COW_CDN}/token-lists/CoinGecko.1.json`, enabled: true },
1415
{ url: 'https://www.gemini.com/uniswap/manifest.json', enabled: false },
1516
{ url: 'https://messari.io/tokenlist/messari-verified', enabled: false },
1617
{ url: 'https://static.optimism.io/optimism.tokenlist.json', enabled: false },

libs/common-const/src/cdn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const COW_CDN = process.env.REACT_APP_COW_CDN || 'https://files.cow.fi'

0 commit comments

Comments
 (0)