Skip to content

Commit 3bb1491

Browse files
authored
Merge pull request #6184 from cowprotocol/release/2025-08-27
chore(release): 2025 08 27
2 parents bbf836d + 3a0c358 commit 3bb1491

File tree

150 files changed

+1622
-692
lines changed

Some content is hidden

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

150 files changed

+1622
-692
lines changed

apps/cowswap-frontend/.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
# Appzi NPS feedback
4242
#REACT_APP_FEEDBACK_ENABLED_DEV=false
4343
#REACT_APP_APPZI_FEEDBACK_KEY=
44-
#REACT_APP_APPZI_NPS_KEY=
4544

4645
# Launch darkly
4746
#REACT_APP_LAUNCH_DARKLY_KEY=your-launch-darkly-key

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export class QuoteApiError extends Error {
121121
return 'Error fetching quote'
122122
}
123123
}
124+
124125
constructor(quoteError: QuoteApiErrorObject) {
125126
super(quoteError.description)
126127

@@ -131,8 +132,6 @@ export class QuoteApiError extends Error {
131132
}
132133
}
133134

134-
// TODO: Replace any with proper type definitions
135-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
136-
export function isValidQuoteError(error: any): error is QuoteApiError {
135+
export function isValidQuoteError(error: unknown): error is QuoteApiError {
137136
return error instanceof QuoteApiError
138137
}

apps/cowswap-frontend/src/appzi.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ export const isAppziEnabled =
2424

2525
const PROD_FEEDBACK_KEY = 'f7591eca-72f7-4888-b15f-e7ff5fcd60cd'
2626
const TEST_FEEDBACK_KEY = '6da8bf10-4904-4952-9a34-12db70e9194e'
27-
const PROD_NPS_KEY = '55872789-593b-4c6c-9e49-9b5c7693e90a'
28-
const TEST_NPS_KEY = '5b794318-f81c-4dac-83ba-15a6e4c9353d'
2927

30-
const FEEDBACK_KEY = process.env.REACT_APP_APPZI_FEEDBACK_KEY || isProdLike ? PROD_FEEDBACK_KEY : TEST_FEEDBACK_KEY
31-
const NPS_KEY = process.env.REACT_APP_APPZI_NPS_KEY || isProdLike ? PROD_NPS_KEY : TEST_NPS_KEY
28+
const FEEDBACK_KEY = process.env.REACT_APP_APPZI_FEEDBACK_KEY || (isProdLike ? PROD_FEEDBACK_KEY : TEST_FEEDBACK_KEY)
3229

3330
const APPZI_TOKEN = process.env.REACT_APP_APPZI_TOKEN || '5ju0G'
3431

35-
const PENDING_TOO_LONG_TIME = ms`5 min`
32+
const PENDING_TOO_LONG_TIME_SWAP = ms`5 min`
33+
const PENDING_TOO_LONG_TIME_BRIDGE = ms`7 min`
3634

3735
declare global {
3836
interface Window {
@@ -55,7 +53,7 @@ type AppziCustomSettings = {
5553
waitedTooLong?: true
5654
expired?: true
5755
traded?: true
58-
bridged?: true
56+
isBridging?: true
5957
created?: true
6058
cancelled?: true
6159
openedLimitPage?: true
@@ -105,18 +103,11 @@ export function openFeedbackAppzi(params: { account?: string; walletName?: strin
105103
}
106104
}
107105

108-
// TODO: Add proper return type annotation
109-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
110-
export function openNpsAppzi() {
111-
if (typeof window !== 'undefined') {
112-
window.appzi?.openWidget(NPS_KEY)
113-
}
114-
}
115-
116-
export function isOrderInPendingTooLong(openSince: number | undefined): boolean {
106+
export function isOrderInPendingTooLong(openSince: number | undefined, isBridging?: boolean): boolean {
117107
const now = Date.now()
108+
const pendingTime = isBridging ? PENDING_TOO_LONG_TIME_BRIDGE : PENDING_TOO_LONG_TIME_SWAP
118109

119-
return !!openSince && now - openSince > PENDING_TOO_LONG_TIME
110+
return !!openSince && now - openSince > pendingTime
120111
}
121112

122113
// Different triggers for each NPS survey.

apps/cowswap-frontend/src/common/containers/TradeApprove/TradeApproveButton.tsx

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

apps/cowswap-frontend/src/common/containers/TradeApprove/TradeApproveModal.tsx

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

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

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

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

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

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ export function useBridgeOrderOutputToken(
2828
? order.outputToken.chainId
2929
: crossChainOrder?.bridgingParams.destinationChainId
3030

31-
const tokens = useBridgeSupportedTokens(
31+
const { data } = useBridgeSupportedTokens(
3232
isLocalOrderCached || !destinationChainId ? undefined : { buyChainId: destinationChainId },
33-
).data
33+
)
3434

3535
return useMemo(() => {
3636
if (isLocalOrderCached) return localOrderOutputToken as TokenWithLogo
3737

38-
if (!tokens?.length || !outputTokenAddress) {
38+
if (data?.isRouteAvailable === false || !data?.tokens?.length || !outputTokenAddress) {
3939
// Fallback to localOrderOutputToken when crossChainOrder data is still loading
4040
// This prevents swapAndBridgeOverview from being undefined in fresh sessions
4141
return localOrderOutputToken as TokenWithLogo
4242
}
4343

4444
const tokenAddressLower = outputTokenAddress.toLowerCase()
45-
const token = tokens.find((token) => token.address.toLowerCase() === tokenAddressLower)
45+
const token = data.tokens.find((token) => token.address.toLowerCase() === tokenAddressLower)
4646

4747
// This is actually a hack
4848
// For some reason Bungee replaces ETH with WETH, so we cannot find WETH in tokens
4949
// Here we fallback to localOrderOutputToken to show at least something
5050
return token ?? (localOrderOutputToken as TokenWithLogo)
51-
}, [isLocalOrderCached, localOrderOutputToken, tokens, outputTokenAddress])
51+
}, [isLocalOrderCached, localOrderOutputToken, data, outputTokenAddress])
5252
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import { useTradeSpenderAddress } from '@cowprotocol/balances-and-allowances'
12
import { getWrappedToken, isEnoughAmount } from '@cowprotocol/common-utils'
23
import { Currency, CurrencyAmount } from '@uniswap/sdk-core'
34

45
import { Nullish } from 'types'
56

6-
import { useTradeSpenderAddress } from 'common/hooks/useTradeSpenderAddress'
7-
87
import { useTokenAllowance } from './useTokenAllowance'
98

9+
1010
/**
1111
* Hook to check if a token needs approval
1212
*
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { useBalancesAndAllowances } from '@cowprotocol/balances-and-allowances'
2+
import { getIsNativeToken } from '@cowprotocol/common-utils'
3+
import { OrderClass } from '@cowprotocol/cow-sdk'
4+
import { useWalletInfo } from '@cowprotocol/wallet'
5+
6+
import { useOnlyPendingOrders } from 'legacy/state/orders/hooks'
7+
8+
import { doesOrderHavePermit } from '../utils/doesOrderHavePermit'
9+
10+
export interface OrderFillability {
11+
hasEnoughAllowance: boolean | undefined
12+
hasEnoughBalance: boolean | undefined
13+
hasPermit?: boolean
14+
}
15+
16+
export function usePendingOrdersFillability(orderClass?: OrderClass): Record<string, OrderFillability | undefined> {
17+
const { chainId, account } = useWalletInfo()
18+
19+
const pendingOrders = useOnlyPendingOrders(chainId, account)
20+
const tokens = pendingOrders.map((order) => order.sellToken.toLowerCase())
21+
22+
const { balances, allowances } = useBalancesAndAllowances(tokens)
23+
24+
return pendingOrders.reduce<Record<string, OrderFillability>>((acc, order) => {
25+
if (orderClass && order.class !== orderClass) return acc
26+
27+
if (getIsNativeToken(chainId, order.inputToken.address)) {
28+
acc[order.id] = {
29+
hasEnoughBalance: true,
30+
hasEnoughAllowance: true,
31+
hasPermit: false,
32+
}
33+
return acc
34+
}
35+
36+
const balance = balances[order.sellToken.toLowerCase()]
37+
const allowance = allowances?.[order.sellToken.toLowerCase()]
38+
39+
acc[order.id] = {
40+
hasEnoughBalance: balance ? balance.gte(order.sellAmount) : undefined,
41+
hasEnoughAllowance: allowance ? allowance.gte(order.sellAmount) : undefined,
42+
hasPermit: doesOrderHavePermit(order),
43+
}
44+
45+
return acc
46+
}, {})
47+
}

0 commit comments

Comments
 (0)