Skip to content

Commit 4e00fd9

Browse files
authored
Merge pull request #5029 from cowprotocol/release/2024-10-24
chore(release):2024 10 24
2 parents cb589b6 + 37d04c1 commit 4e00fd9

File tree

251 files changed

+4970
-3178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+4970
-3178
lines changed

apps/cow-fi/components/ArticlesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface ArticlesListProps {
77
articles: Article[]
88
}
99

10-
const ARTICLES_PATH = '/learn/articles/'
10+
const ARTICLES_PATH = '/learn/'
1111

1212
export const ArticlesList: React.FC<ArticlesListProps> = ({ articles }) => (
1313
<LinkColumn>

apps/cowswap-frontend/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ REACT_APP_MOCK=true
135135
# REACT_APP_DOMAIN_REGEX_ENS="(:?^cowswap\.eth|ipfs)"
136136

137137
# Path regex (to detect environment)
138-
# REACT_APP_PATH_REGEX_ENS="/ipfs"
138+
# REACT_APP_PATH_REGEX_ENS="/ipfs"

apps/cowswap-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
"dependencies": {},
3131
"devDependencies": {},
3232
"nx": {}
33-
}
33+
}
74.9 KB
Binary file not shown.

apps/cowswap-frontend/src/api/cowProtocol/api.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from '@cowprotocol/common-utils'
1111
import {
1212
Address,
13-
SupportedChainId as ChainId,
1413
CompetitionOrderStatus,
1514
CowEnv,
1615
EnrichedOrder,
@@ -21,6 +20,7 @@ import {
2120
OrderQuoteSideKindSell,
2221
PartialApiContext,
2322
SigningScheme,
23+
SupportedChainId as ChainId,
2424
TotalSurplus,
2525
Trade,
2626
} from '@cowprotocol/cow-sdk'
@@ -31,10 +31,13 @@ import { LegacyFeeQuoteParams as FeeQuoteParams } from 'legacy/state/price/types
3131

3232
import { getAppData } from 'modules/appData'
3333

34+
import { getQuoteValidFor } from 'utils/orderUtils/getQuoteValidFor'
35+
3436
import { ApiErrorCodes } from './errors/OperatorError'
3537
import QuoteApiError, { mapOperatorErrorToQuoteError, QuoteApiErrorDetails } from './errors/QuoteError'
3638
import { getIsOrderBookTypedError } from './getIsOrderBookTypedError'
3739

40+
3841
function getProfileUrl(): Partial<Record<ChainId, string>> {
3942
if (isLocal || isDev || isPr || isBarn) {
4043
return {
@@ -70,7 +73,7 @@ function _fetchProfile(
7073
chainId: ChainId,
7174
url: string,
7275
method: 'GET' | 'POST' | 'DELETE',
73-
data?: any
76+
data?: any,
7477
): Promise<Response> {
7578
const baseUrl = _getProfileApiBaseUrl(chainId)
7679

@@ -96,19 +99,8 @@ const ETH_FLOW_AUX_QUOTE_PARAMS = {
9699
}
97100

98101
function _mapNewToLegacyParams(params: FeeQuoteParams): OrderQuoteRequest {
99-
const {
100-
amount,
101-
kind,
102-
userAddress,
103-
receiver,
104-
validTo,
105-
validFor,
106-
sellToken,
107-
buyToken,
108-
chainId,
109-
priceQuality,
110-
isEthFlow,
111-
} = params
102+
const { amount, kind, userAddress, receiver, validFor, sellToken, buyToken, chainId, priceQuality, isEthFlow } =
103+
params
112104
const fallbackAddress = userAddress || ZERO_ADDRESS
113105
const { appData, appDataHash } = _getAppDataQuoteParams(params)
114106

@@ -122,7 +114,7 @@ function _mapNewToLegacyParams(params: FeeQuoteParams): OrderQuoteRequest {
122114
appDataHash,
123115
partiallyFillable: false,
124116
priceQuality,
125-
...(validFor ? { validFor } : { validTo }),
117+
...getQuoteValidFor(validFor),
126118
}
127119

128120
if (isEthFlow) {
@@ -172,7 +164,7 @@ export async function getQuote(params: FeeQuoteParams): Promise<OrderQuoteRespon
172164
mapOperatorErrorToQuoteError({
173165
errorType: ApiErrorCodes.SameBuyAndSellToken,
174166
description: QuoteApiErrorDetails.SameBuyAndSellToken,
175-
})
167+
}),
176168
)
177169
}
178170

@@ -208,7 +200,7 @@ export async function getOrders(
208200
offset?: number
209201
limit?: number
210202
},
211-
context: PartialApiContext
203+
context: PartialApiContext,
212204
): Promise<EnrichedOrder[]> {
213205
return orderBookApi.getOrders(params, context)
214206
}
@@ -227,7 +219,7 @@ export async function getSurplusData(chainId: ChainId, address: string): Promise
227219

228220
export async function getOrderCompetitionStatus(
229221
chainId: ChainId,
230-
orderId: string
222+
orderId: string,
231223
): Promise<CompetitionOrderStatus | undefined> {
232224
try {
233225
return await orderBookApi.getOrderCompetitionStatus(orderId, { chainId })

apps/cowswap-frontend/src/common/constants/routes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const Routes = {
77
SWAP: `/:chainId?${TRADE_WIDGET_PREFIX}/swap/:inputCurrencyId?/:outputCurrencyId?`,
88
HOOKS: `/:chainId?${TRADE_WIDGET_PREFIX}/swap/hooks/:inputCurrencyId?/:outputCurrencyId?`,
99
LIMIT_ORDER: `/:chainId?${TRADE_WIDGET_PREFIX}/limit/:inputCurrencyId?/:outputCurrencyId?`,
10+
YIELD: `/:chainId?${TRADE_WIDGET_PREFIX}/yield/:inputCurrencyId?/:outputCurrencyId?`,
1011
ADVANCED_ORDERS: `/:chainId?${TRADE_WIDGET_PREFIX}/advanced/:inputCurrencyId?/:outputCurrencyId?`,
1112
LONG_LIMIT_ORDER: `/:chainId?${TRADE_WIDGET_PREFIX}/limit-orders/:inputCurrencyId?/:outputCurrencyId?`,
1213
LONG_ADVANCED_ORDERS: `/:chainId?${TRADE_WIDGET_PREFIX}/advanced-orders/:inputCurrencyId?/:outputCurrencyId?`,
@@ -55,3 +56,10 @@ export const HOOKS_STORE_MENU_ITEM = {
5556
description: 'Powerful tool to generate pre/post interaction for CoW Protocol',
5657
badge: 'New',
5758
}
59+
60+
export const YIELD_MENU_ITEM = {
61+
route: Routes.YIELD,
62+
label: 'Yield',
63+
fullLabel: 'Yield',
64+
description: 'Provide liquidity',
65+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ export function InvalidLocalTimeWarning() {
1616

1717
return (
1818
<GlobalWarning>
19-
Local device time does is not accurate, CoW Swap most likely will not work correctly. Please adjust your device's
20-
time.
19+
Local device time is not accurate, CoW Swap most likely will not work correctly. Please adjust your device's time.
2120
</GlobalWarning>
2221
)
2322
}

apps/cowswap-frontend/src/common/hooks/useGetMarketDimension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const widgetTypeMap: Record<TradeType, string> = {
99
[TradeType.LIMIT_ORDER]: 'LIMIT',
1010
// TODO: set different type for other advanced orders
1111
[TradeType.ADVANCED_ORDERS]: 'TWAP',
12+
[TradeType.YIELD]: 'YIELD',
1213
}
1314

1415
/**\

apps/cowswap-frontend/src/common/hooks/useMenuItems.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@ import { useMemo } from 'react'
33
import { useFeatureFlags } from '@cowprotocol/common-hooks'
44
import { isLocal } from '@cowprotocol/common-utils'
55

6-
import { HOOKS_STORE_MENU_ITEM, MENU_ITEMS } from '../constants/routes'
6+
import { HOOKS_STORE_MENU_ITEM, MENU_ITEMS, YIELD_MENU_ITEM } from '../constants/routes'
77

88
export function useMenuItems() {
99
const { isHooksStoreEnabled } = useFeatureFlags()
10+
const { isYieldEnabled } = useFeatureFlags()
1011

1112
return useMemo(() => {
12-
return isHooksStoreEnabled || isLocal ? MENU_ITEMS.concat(HOOKS_STORE_MENU_ITEM) : MENU_ITEMS
13-
}, [isHooksStoreEnabled])
13+
const items = [...MENU_ITEMS]
14+
15+
if (isHooksStoreEnabled || isLocal) {
16+
items.push(HOOKS_STORE_MENU_ITEM)
17+
}
18+
19+
if (isYieldEnabled || isLocal) {
20+
items.push(YIELD_MENU_ITEM)
21+
}
22+
23+
return items
24+
}, [isHooksStoreEnabled, isYieldEnabled])
1425
}

0 commit comments

Comments
 (0)