-
Notifications
You must be signed in to change notification settings - Fork 159
feat(bridge): enable Near bridge provider for smart-contract wallets #6618
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
feat(bridge): enable Near bridge provider for smart-contract wallets #6618
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughCentralizes trade-confirmation context, adds smart‑contract‑recipient confirmation and UI, threads bridge quote/order data through order flows and notifications, gates bridge providers for smart‑contract wallets, hides network selector for certain wallets, and removes bundle-related banners. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as Trade UI
participant SCW as SmartContractWalletDetector
participant Confirm as RecipientConfirmation
participant Trade as TradeFlow
participant Orders as OrdersUpdater/Notifier
User->>UI: Start a trade (may be bridging)
UI->>SCW: query isSmartContractWallet & shouldCheckBridgingRecipient
alt SCW true and bridging requires confirmation
SCW-->>UI: true
UI->>Confirm: show SmartContractReceiverWarning (recipient, chain)
User->>Confirm: confirm recipient
Confirm-->>UI: smartContractRecipientConfirmed = true
else no confirmation required
SCW-->>UI: false
end
User->>UI: submit trade
UI->>Trade: include bridgeQuoteAmounts in tradeContext
Trade->>Orders: emit presigned order (payload may include bridgeOrder)
Orders->>Orders: PendingOrdersUpdater links bridgeOrder into order state
Orders-->>UI: OrderNotification renders with optional bridge info
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
b7355c1 to
32c14d7
Compare
|
|
||
| const isWalletCompatible = Boolean(account ? accountType !== AccountType.SMART_CONTRACT : true) | ||
| const shouldEnableBridging = isWalletCompatible && isSwapRoute | ||
| const shouldEnableBridging = tradeTypeInfo?.route === Routes.SWAP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now bridging is always enabled in Swap widget for any type of acccount (EOA, SMART_CONTRACT)
|
|
||
| // Only Near intents provider should be available for smart-contract wallets | ||
| if (isSmartContractWallet) { | ||
| toggleProvider(newProviders, bungeeBridgeProvider, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, it might be shorter like toggleProvider(newProviders, bungeeBridgeProvider, isSmartContractWallet ? false : isBungeeBridgeProviderEnabled), but I preffer better readability in such an important code
apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx (1)
37-66: Localize the main warning text for consistency with rest of trade UIComponent behavior and state handling look good, but the two main sentences are hard-coded English:
The recipient address is ... on {ChainElement}.Please make sure it is a correct one and already exists on {ChainElement}.Given nearby components (e.g.
PriceUpdatedBanner) wrap user text in<Trans>, it would be better to make these strings translatable as well, e.g.:<Trans> The recipient address is <AddressLink address={recipient ?? account} chainId={chainId} /> on {ChainElement}. </Trans>and similarly for the second sentence.
apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx (1)
54-56: RedundantuseAppData()call.
useCommonTradeConfirmContext()already callsuseAppData()internally and includesappDatain its return value. The separateuseAppData()call on line 55 is redundant and can be removed by usingcommonTradeConfirmContext.appDatainstead.Apply this diff:
const commonTradeConfirmContext = useCommonTradeConfirmContext() - const appData = useAppData() const receiveAmountInfo = useGetReceiveAmountInfo()Then update line 76:
- appData={appData} + appData={commonTradeConfirmContext.appData}And update the imports to remove
useAppData:-import { useAppData } from 'modules/appData'apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx (1)
77-79: RedundantuseWalletInfo()call foraccount.
commonTradeConfirmContextalready providesaccount. TheuseWalletInfo()call on line 77 is now only used foraccountwhich is redundant. However,useWalletDetails()on line 78 is still needed forallowsOffchainSigning.Apply this diff to remove the redundancy:
- const { account } = useWalletInfo() const { allowsOffchainSigning } = useWalletDetails() const commonTradeConfirmContext = useCommonTradeConfirmContext()Then update line 147:
- account={account} + account={commonTradeConfirmContext.account}And update imports:
-import { useWalletDetails, useWalletInfo } from '@cowprotocol/wallet' +import { useWalletDetails } from '@cowprotocol/wallet'apps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx (1)
59-65: Redundant hook calls foraccountandappData.Both
useWalletInfo()anduseAppData()are called separately, butuseCommonTradeConfirmContext()already providesaccountandappData. These can be consolidated.Apply this diff:
- const { account } = useWalletInfo() - const appData = useAppData() const receiveAmountInfo = useGetReceiveAmountInfo() const tradeConfirmActions = useTradeConfirmActions() const { slippage } = useSwapDerivedState() const [deadline] = useSwapDeadlineState() const commonTradeConfirmContext = useCommonTradeConfirmContext()Then update line 130 and 156 to use
commonTradeConfirmContext.appDataandcommonTradeConfirmContext.accountrespectively.Update imports:
-import { useWalletInfo } from '@cowprotocol/wallet'-import { useAppData } from 'modules/appData'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.ts(1 hunks)apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts(4 hunks)apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx(5 hunks)apps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx(5 hunks)apps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsx(1 hunks)apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts(1 hunks)apps/cowswap-frontend/src/modules/trade/index.ts(1 hunks)apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx(2 hunks)apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx(1 hunks)apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx(4 hunks)apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts(1 hunks)apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.cosmos.tsx(1 hunks)apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx(3 hunks)apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx(3 hunks)apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx(5 hunks)
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:62-67
Timestamp: 2025-09-25T08:49:32.256Z
Learning: In the cowswap-frontend codebase, when testing hooks that use multiple bridge providers, both providers are always properly mocked as complete jest.Mocked<BridgeProvider<BridgeQuoteResult>> objects with all required methods stubbed, ensuring no undefined returns that could break the hook logic.
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...
Learnt from: limitofzero
Repo: cowprotocol/cowswap PR: 6351
File: apps/cowswap-frontend/src/modules/erc20Approve/containers/TradeApproveModal/useTradeApproveCallback.ts:87-121
Timestamp: 2025-10-13T19:41:31.440Z
Learning: In apps/cowswap-frontend/src/modules/erc20Approve, useApproveCallback returns Promise<TransactionResponse | undefined> and is distinct from useApproveCurrency, which can return Promise<TransactionReceipt | SafeMultisigTransactionResponse>. When reviewing approval flows, verify which hook is actually being used before flagging Safe wallet concerns.
📚 Learning: 2025-10-10T20:28:16.565Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...
Applied to files:
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.tsapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.cosmos.tsxapps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsxapps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsxapps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsxapps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.tsapps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsxapps/cowswap-frontend/src/modules/trade/index.tsapps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsxapps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx
📚 Learning: 2025-10-13T19:41:31.440Z
Learnt from: limitofzero
Repo: cowprotocol/cowswap PR: 6351
File: apps/cowswap-frontend/src/modules/erc20Approve/containers/TradeApproveModal/useTradeApproveCallback.ts:87-121
Timestamp: 2025-10-13T19:41:31.440Z
Learning: In apps/cowswap-frontend/src/modules/erc20Approve, useApproveCallback returns Promise<TransactionResponse | undefined> and is distinct from useApproveCurrency, which can return Promise<TransactionReceipt | SafeMultisigTransactionResponse>. When reviewing approval flows, verify which hook is actually being used before flagging Safe wallet concerns.
Applied to files:
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.tsapps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsxapps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.tsapps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.tsapps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsxapps/cowswap-frontend/src/modules/trade/index.tsapps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsxapps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx
📚 Learning: 2025-07-24T16:42:53.154Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6009
File: apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/HighFeeWarningTooltipContent.tsx:23-33
Timestamp: 2025-07-24T16:42:53.154Z
Learning: In apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/HighFeeWarningTooltipContent.tsx, the use of toFixed(2) for percentage formatting in tooltip content is intentional and differs from the banner message formatting that uses toSignificant(2, undefined, Rounding.ROUND_DOWN). This formatting difference serves different UX purposes and should not be flagged as inconsistent.
Applied to files:
apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsxapps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx
📚 Learning: 2025-11-19T10:18:23.717Z
Learnt from: limitofzero
Repo: cowprotocol/cowswap PR: 6537
File: apps/cowswap-frontend/src/modules/trade/pure/PartnerFeeRow/index.tsx:33-35
Timestamp: 2025-11-19T10:18:23.717Z
Learning: In apps/cowswap-frontend/src/modules/trade/pure/PartnerFeeRow/index.tsx, when there is no partner fee (amount is null/undefined, bps is missing, or amount equals 0), FreeFeeRow is rendered with withTimelineDot={false} hardcoded. This is intentional design—free fee rows should not show the timeline dot regardless of what the parent component passes, as they have a distinct visual treatment from actual fee rows.
Applied to files:
apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx
📚 Learning: 2025-06-16T15:58:00.268Z
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 5830
File: apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/index.tsx:1-2
Timestamp: 2025-06-16T15:58:00.268Z
Learning: JSX can be imported as a named export from React in modern React versions (React 17+). The import `import { JSX } from 'react'` is valid and does not cause compilation errors.
Applied to files:
apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx
📚 Learning: 2025-08-05T14:27:05.023Z
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 5992
File: libs/wallet/src/web3-react/utils/switchChain.ts:36-38
Timestamp: 2025-08-05T14:27:05.023Z
Learning: In libs/wallet/src/web3-react/utils/switchChain.ts, the team prefers using Record<SupportedChainId, string | null> over Partial<Record<SupportedChainId, string>> for WALLET_RPC_SUGGESTION to enforce that all supported chain IDs have explicit values set, even if some might be null. This ensures compile-time completeness checking.
Applied to files:
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.tsapps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.tsapps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.tsapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx
📚 Learning: 2025-09-25T08:49:32.256Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:62-67
Timestamp: 2025-09-25T08:49:32.256Z
Learning: In the cowswap-frontend codebase, when testing hooks that use multiple bridge providers, both providers are always properly mocked as complete jest.Mocked<BridgeProvider<BridgeQuoteResult>> objects with all required methods stubbed, ensuring no undefined returns that could break the hook logic.
Applied to files:
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.tsapps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts
📚 Learning: 2025-02-20T15:59:33.749Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5443
File: apps/cowswap-frontend/src/modules/swap/containers/ConfirmSwapModalSetup/index.tsx:71-71
Timestamp: 2025-02-20T15:59:33.749Z
Learning: The swap module in apps/cowswap-frontend/src/modules/swap/ is marked for deletion in PR #5444 as part of the swap widget unification effort.
Applied to files:
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.tsapps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsxapps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsxapps/cowswap-frontend/src/modules/trade/index.tsapps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsxapps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx
📚 Learning: 2025-07-24T10:00:45.353Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6009
File: apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/hooks/useHighFeeWarning.ts:36-36
Timestamp: 2025-07-24T10:00:45.353Z
Learning: In the CowSwap frontend, when there's a bridgeFee present in the transaction, the isSell flag is always true for business reasons. This means bridge transactions are always structured as sell operations, which ensures consistent currency handling in fee percentage calculations.
Applied to files:
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.ts
📚 Learning: 2025-06-23T07:03:50.760Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5859
File: apps/cowswap-frontend/src/modules/tradeQuote/hooks/useTradeQuotePolling.ts:76-82
Timestamp: 2025-06-23T07:03:50.760Z
Learning: In the useTradeQuotePolling hook, there are two useLayoutEffect hooks that work together: one resets the counter to 0 when the confirmation modal closes, and another automatically triggers pollQuote(false, true) whenever the counter reaches 0. This creates an intentional chain reaction for immediate quote updates.
Applied to files:
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.tsapps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsxapps/cowswap-frontend/src/modules/trade/index.tsapps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsxapps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx
📚 Learning: 2025-06-25T07:28:32.570Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5881
File: apps/cowswap-frontend/src/modules/cowShed/containers/ProxyRecipient/index.tsx:68-72
Timestamp: 2025-06-25T07:28:32.570Z
Learning: In the ProxyRecipient component (apps/cowswap-frontend/src/modules/cowShed/containers/ProxyRecipient/index.tsx), throwing an error when recipient address doesn't match proxy address is intentional design choice to prevent proceeding with incorrect data and ensure data integrity.
Applied to files:
apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx
📚 Learning: 2025-09-19T11:38:59.206Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6232
File: apps/cowswap-frontend/src/modules/tokensList/pure/ChainsSelector/index.tsx:199-200
Timestamp: 2025-09-19T11:38:59.206Z
Learning: The makeBuildClickEvent function in apps/cowswap-frontend/src/modules/tokensList/pure/ChainsSelector/index.tsx takes five parameters: defaultChainId, contextLabel, mode, isSwapMode, and chainsCount. The chainsCount parameter is used to determine the CrossChain flag in analytics events.
Applied to files:
apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsxapps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsxapps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx
📚 Learning: 2025-08-08T13:56:18.009Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6125
File: libs/tokens/src/updaters/TokensListsUpdater/index.tsx:29-31
Timestamp: 2025-08-08T13:56:18.009Z
Learning: In libs/tokens/src/updaters/TokensListsUpdater/index.tsx, the project’s current Jotai version requires using `unstable_getOnInit` (not `getOnInit`) in atomWithStorage options; keep `{ unstable_getOnInit: true }` until Jotai is upgraded.
Applied to files:
apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx
📚 Learning: 2025-08-08T13:55:17.528Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6125
File: libs/tokens/src/state/tokens/allTokensAtom.ts:78-78
Timestamp: 2025-08-08T13:55:17.528Z
Learning: In libs/tokens/src/state/tokens/allTokensAtom.ts (TypeScript/Jotai), the team prefers to wait for token lists to initialize (listsStatesListAtom non-empty) before returning tokens. No fallback to favorites/user-added/native tokens should be used when listsStatesList is empty.
Applied to files:
apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx
📚 Learning: 2025-08-12T05:57:08.021Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6138
File: libs/hook-dapp-lib/src/hookDappsRegistry.ts:1-1
Timestamp: 2025-08-12T05:57:08.021Z
Learning: The matchHooksToDapps function in libs/hook-dapp-lib/src/utils.ts provides backward compatibility for permit hooks through function selector detection (EIP_2612_PERMIT_SELECTOR and DAI_PERMIT_SELECTOR) rather than dappId matching, making it robust against dappId changes.
Applied to files:
apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts
🧬 Code graph analysis (10)
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (3)
libs/wallet/src/api/hooks.ts (2)
useWalletInfo(24-26)useWalletDetails(28-30)libs/wallet/src/web3-react/hooks/useIsSmartContractWallet.ts (1)
useIsSmartContractWallet(11-16)apps/cowswap-frontend/src/modules/twap/services/cancelTwapOrderTxs.ts (1)
appData(111-113)
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.ts (1)
apps/cowswap-frontend/src/common/constants/routes.ts (1)
Routes(10-45)
apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx (5)
libs/common-hooks/src/useTheme.ts (1)
styled(26-26)libs/widget-lib/src/types.ts (1)
SupportedChainId(4-4)libs/common-const/src/chainInfo.ts (1)
CHAIN_INFO(74-141)libs/ui/src/pure/NetworkLogo/index.tsx (1)
NetworkLogo(33-50)libs/ui/src/pure/InlineBanner/InlineBanner/index.tsx (1)
InlineBanner(9-77)
apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx (1)
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (1)
useCommonTradeConfirmContext(14-23)
apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx (2)
libs/widget-lib/src/types.ts (1)
SupportedChainId(4-4)apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx (1)
SmartContractReceiverWarning(37-67)
apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx (2)
libs/wallet/src/api/hooks.ts (1)
useWalletDetails(28-30)apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (1)
useCommonTradeConfirmContext(14-23)
apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts (2)
libs/wallet/src/web3-react/hooks/useIsSmartContractWallet.ts (1)
useIsSmartContractWallet(11-16)apps/cowswap-frontend/src/tradingSdk/bridgingSdk.ts (2)
bungeeBridgeProvider(16-23)acrossBridgeProvider(25-25)
apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx (2)
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (1)
CommonTradeConfirmContext(7-12)apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts (1)
useSmartContractRecipientConfirm(10-27)
apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx (2)
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (1)
useCommonTradeConfirmContext(14-23)apps/cowswap-frontend/src/modules/twap/services/cancelTwapOrderTxs.ts (1)
appData(111-113)
apps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx (1)
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (1)
useCommonTradeConfirmContext(14-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test
- GitHub Check: Lint
🔇 Additional comments (17)
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.ts (1)
13-17: Route-based bridging enablement looks correctUsing
tradeTypeInfo?.route === Routes.SWAPas the single source of truth forshouldEnableBridgingis clean and keeps wallet-type concerns out of this updater, which is consistent with delegating provider gating toBridgeProvidersUpdater.apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx (1)
1-1: ExplicitReactNodereturn type is appropriateImporting
ReactNodeand annotatingPriceUpdatedBanner’s return type matches the JSX usage and improves type clarity without changing behavior.Also applies to: 45-45
apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.cosmos.tsx (1)
7-12: Fixture correctly updated for new TradeConfirmation propsAdding
appData={null}andisSmartContractWallet={false}keeps the cosmos fixture aligned with the extendedTradeConfirmationprops while preserving previous behavior.apps/cowswap-frontend/src/modules/trade/index.ts (1)
45-45: Re-exportinguseCommonTradeConfirmContextfrom the trade barrel makes senseExposing the new common confirm-context hook alongside other trade hooks keeps the public API cohesive and avoids deep import paths.
apps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsx (1)
25-42: Cosmos fixture props updated in line with TradeConfirmation changesIncluding
isSmartContractWallet: falseandappData: nullinconfirmationStatekeeps this fixture compatible with the widenedTradeConfirmationPropswhile keeping the scenario simple.apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts (1)
6-7: Smart‑contract‑aware provider gating matches intended behaviorUsing
useIsSmartContractWalletto ensure onlynearIntentsBridgeProviderremains enabled for smart-contract wallets, while Bungee and Across follow their feature flags for EOAs, is a clear and robust way to enforce the new policy. IncludingisSmartContractWalletin the effect deps ensures provider availability updates as wallet type detection resolves or changes.Also applies to: 29-53, 60-63
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts (1)
7-22: Common trade confirm context hook is well-factored
useCommonTradeConfirmContextcleanly consolidates wallet info, ENS, smart‑contract flag, andappDatainto a memoized object, which should simplify wiring in confirm modals and reduce prop plumbing.apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx (1)
86-100: IntentionalappDataoverride noted.The
commonTradeConfirmContextspread (line 89) includesappDatafromuseAppData(), but it's intentionally overridden by the explicitappData={tradeContext.postOrderParams.appData || undefined}prop on line 99. This ensures limit orders use their specificpostOrderParams.appData.This pattern is correct for this use case. Consider adding a brief inline comment to clarify the override is intentional, preventing future confusion.
apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx (1)
86-88: LGTM!Correct usage of
commonTradeConfirmContext.accountforTradeBasicConfirmDetails.apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx (1)
125-137: LGTM!TradeConfirmation correctly receives the common trade confirm context via spread. The
appDatafrom the context will be used appropriately.apps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx (1)
117-131: LGTM!The spread of
commonTradeConfirmContextintoTradeConfirmationis correctly implemented. The pattern is consistent with other confirmation modals in this PR.apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx (2)
41-48: Verifyrecipientnull handling inSmartContractReceiverWarning.The
recipientprop passed toSmartContractReceiverWarningcan beNullish<string>(null or undefined), but looking at the external snippet (lines 36-66), the component usesrecipient ?? accountwhen rendering the address link. This correctly falls back toaccountwhenrecipientis nullish.The logic is sound.
38-49: LGTM!The warning component ordering is logical: custom recipient warning first, then smart-contract recipient confirmation, then price update banner. Both recipient-related warnings can display simultaneously which is correct since they address different concerns.
apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts (1)
23-26: LGTM!The
useMemocorrectly memoizes the return value with appropriate dependencies. Thestatetuple reference fromuseStateis stable, ensuring consistent behavior.apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx (3)
25-38: LGTM!The
TradeConfirmationPropsextension withCommonTradeConfirmContextis clean and correctly removes the need for separateaccount,ensName, andappDataprops. The interface now inherits these from the common context. Based on learnings, this pure view component correctly receives state from its container wrapper.
67-72: LGTM!The smart contract recipient confirmation flow is correctly integrated:
- Hook extracts confirmation state and output chain ID
- Button is disabled until user confirms for bridging trades with smart-contract wallets
- Logic flows correctly through to
ConfirmWarnings
110-119: LGTM!
ConfirmWarningscorrectly receives all necessary props including the newoutputChainIdandsmartContractRecipientConfirmState. The integration is complete and consistent with the changes inConfirmWarnings.tsx.
...-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts
Outdated
Show resolved
Hide resolved
fairlighteth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review proposed enhancements in #6622
Also take a look at the Coderabbit flagged findings
|
Just FYI:
Using Safe wallet https://basescan.org/address/0x8FAb71C0d4272698A3B2d1F3Ed5FC3c1B9b3E531 seems to use Bungee? |
elena-zh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @shoom3301 , great job!
I have not fully tested it, but run a fwe tests and noticed some issues:
- The feature does not respect the feature-flag isBridgingEnabled
- Sell token selector: there is no need to show chains there when the app is opened inside Safe or connected to Safe(WC) as it is impossible to change a chain from there :(
The only one exception is for Safe with Rabby.
- There is a total fee field that looks weird:
- Order recipient shows an intermediate address in the 'presigned' pop-up:
- When Swap part is completed, I get 'TX Completed' modal
- But then, 'bridging' step appears, and there is no indication if a pending order there:
- When sending an order to a custom recipient, there are 2 warnings now. I think, one of them should be removed?
Thanks!
… feat/enable-near-bridge-for-smart-accounts
* feat: enhance SmartContractReceiverWarning component with improved styling and confirmation checkbox * feat: update Spanish and Russian translations for SmartContractReceiverWarning component
…github.com/cowprotocol/cowswap into feat/enable-near-bridge-for-smart-accounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/cowswap-frontend/src/modules/orders/containers/OrderNotification/index.tsx (2)
27-43:receiver?: stringoverride is fine, but please define/guarantee its format (address-only?).
Right nowReceiverInfowill still render anExplorerLink type="address"even ifreceiveris not a valid address, which can produce a broken link if any caller passes an ENS/name/invalid string. Consider either enforcingreceiverto be an address at the type/prop boundary, or hardeningReceiverInfoto only render the explorer link whenisAddress(receiver)(and otherwise render plain text / nothing).
45-61: Receiver precedence (receiver ?? order.receiver) looks correct; consider keeping return value explicit.
The fallback logic is clear and matches the intent to prefer the supplied prop. Minor nit:if (!order) returncould bereturn nullfor explicit React semantics.Also applies to: 116-118
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/cowswap-frontend/src/locales/en-US.po(60 hunks)apps/cowswap-frontend/src/modules/orders/containers/OrderNotification/index.tsx(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/cowswap-frontend/src/locales/en-US.po
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:62-67
Timestamp: 2025-09-25T08:49:32.256Z
Learning: In the cowswap-frontend codebase, when testing hooks that use multiple bridge providers, both providers are always properly mocked as complete jest.Mocked<BridgeProvider<BridgeQuoteResult>> objects with all required methods stubbed, ensuring no undefined returns that could break the hook logic.
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...
📚 Learning: 2025-10-10T20:28:16.565Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...
Applied to files:
apps/cowswap-frontend/src/modules/orders/containers/OrderNotification/index.tsx
🧬 Code graph analysis (1)
apps/cowswap-frontend/src/modules/orders/containers/OrderNotification/index.tsx (1)
apps/cowswap-frontend/src/modules/orders/pure/ReceiverInfo/index.tsx (1)
ReceiverInfo(15-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Setup
- GitHub Check: Cypress
elena-zh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ecc8c0a to
d118359
Compare
|
@elena-zh thanks! Fixed. |
|
@shoom3301 , not fixed :( To reproduce:
Happens only after the 1st opening, then it does not happen after the page refresh. |
… feat/enable-near-bridge-for-smart-accounts # Conflicts: # apps/cowswap-frontend/src/modules/trade/index.ts
|
@elena-zh fixed it, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/cowswap-frontend/src/locales/en-US.po (1)
5349-5352: Minor wording alignment between approval tooltip and existing approval copyThe new tooltip text (“If you approve an unlimited amount, you will only have to do this once per token.”) is clear and technically accurate. Elsewhere, the longer approval copy still talks about approving the “default amount” to only do this once per token; over time you may want to standardize on “unlimited amount” vs “default amount” to avoid subtle user confusion, but it’s not blocking.
Also applies to: 137-140
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/cowswap-frontend/src/locales/en-US.po(59 hunks)apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx(2 hunks)apps/cowswap-frontend/src/modules/trade/index.ts(1 hunks)apps/cowswap-frontend/src/modules/tradeFlow/services/safeBundleFlow/safeBundleEthFlow.ts(2 hunks)apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/cowswap-frontend/src/modules/tradeFlow/services/safeBundleFlow/safeBundleEthFlow.ts
- apps/cowswap-frontend/src/modules/trade/index.ts
- apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:62-67
Timestamp: 2025-09-25T08:49:32.256Z
Learning: In the cowswap-frontend codebase, when testing hooks that use multiple bridge providers, both providers are always properly mocked as complete jest.Mocked<BridgeProvider<BridgeQuoteResult>> objects with all required methods stubbed, ensuring no undefined returns that could break the hook logic.
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...
📚 Learning: 2025-02-20T15:59:33.749Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5443
File: apps/cowswap-frontend/src/modules/swap/containers/ConfirmSwapModalSetup/index.tsx:71-71
Timestamp: 2025-02-20T15:59:33.749Z
Learning: The swap module in apps/cowswap-frontend/src/modules/swap/ is marked for deletion in PR #5444 as part of the swap widget unification effort.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-08-08T13:55:17.528Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6125
File: libs/tokens/src/state/tokens/allTokensAtom.ts:78-78
Timestamp: 2025-08-08T13:55:17.528Z
Learning: In libs/tokens/src/state/tokens/allTokensAtom.ts (TypeScript/Jotai), the team prefers to wait for token lists to initialize (listsStatesListAtom non-empty) before returning tokens. No fallback to favorites/user-added/native tokens should be used when listsStatesList is empty.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-07-24T16:42:53.154Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6009
File: apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/HighFeeWarningTooltipContent.tsx:23-33
Timestamp: 2025-07-24T16:42:53.154Z
Learning: In apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/HighFeeWarningTooltipContent.tsx, the use of toFixed(2) for percentage formatting in tooltip content is intentional and differs from the banner message formatting that uses toSignificant(2, undefined, Rounding.ROUND_DOWN). This formatting difference serves different UX purposes and should not be flagged as inconsistent.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-10-10T20:28:16.565Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...
Applied to files:
apps/cowswap-frontend/src/locales/en-US.poapps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
📚 Learning: 2025-08-12T05:57:08.021Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6138
File: libs/hook-dapp-lib/src/hookDappsRegistry.ts:1-1
Timestamp: 2025-08-12T05:57:08.021Z
Learning: The matchHooksToDapps function in libs/hook-dapp-lib/src/utils.ts provides backward compatibility for permit hooks through function selector detection (EIP_2612_PERMIT_SELECTOR and DAI_PERMIT_SELECTOR) rather than dappId matching, making it robust against dappId changes.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.poapps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
📚 Learning: 2025-07-18T08:07:55.497Z
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 5992
File: libs/tokens/src/const/tokensList.json:135-167
Timestamp: 2025-07-18T08:07:55.497Z
Learning: Token lists for CoW Swap are maintained in a separate repository at https://github.com/cowprotocol/token-lists, not in the main cowswap repository. Issues related to missing token lists should be tracked in the token-lists repository.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-10-13T19:41:31.440Z
Learnt from: limitofzero
Repo: cowprotocol/cowswap PR: 6351
File: apps/cowswap-frontend/src/modules/erc20Approve/containers/TradeApproveModal/useTradeApproveCallback.ts:87-121
Timestamp: 2025-10-13T19:41:31.440Z
Learning: In apps/cowswap-frontend/src/modules/erc20Approve, useApproveCallback returns Promise<TransactionResponse | undefined> and is distinct from useApproveCurrency, which can return Promise<TransactionReceipt | SafeMultisigTransactionResponse>. When reviewing approval flows, verify which hook is actually being used before flagging Safe wallet concerns.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.poapps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
📚 Learning: 2025-11-19T10:18:23.717Z
Learnt from: limitofzero
Repo: cowprotocol/cowswap PR: 6537
File: apps/cowswap-frontend/src/modules/trade/pure/PartnerFeeRow/index.tsx:33-35
Timestamp: 2025-11-19T10:18:23.717Z
Learning: In apps/cowswap-frontend/src/modules/trade/pure/PartnerFeeRow/index.tsx, when there is no partner fee (amount is null/undefined, bps is missing, or amount equals 0), FreeFeeRow is rendered with withTimelineDot={false} hardcoded. This is intentional design—free fee rows should not show the timeline dot regardless of what the parent component passes, as they have a distinct visual treatment from actual fee rows.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-07-24T10:00:45.353Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6009
File: apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/hooks/useHighFeeWarning.ts:36-36
Timestamp: 2025-07-24T10:00:45.353Z
Learning: In the CowSwap frontend, when there's a bridgeFee present in the transaction, the isSell flag is always true for business reasons. This means bridge transactions are always structured as sell operations, which ensures consistent currency handling in fee percentage calculations.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-05-27T12:20:54.659Z
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 5762
File: apps/cowswap-frontend/src/legacy/state/orders/utils.ts:499-503
Timestamp: 2025-05-27T12:20:54.659Z
Learning: In the CowSwap frontend, when displaying volume fees in the UI (like in ReceiptModal), zero fees (0 bps) should be treated as "free" and hidden from display. Only non-zero fees should show the "Total fee" line. This provides a cleaner UX by not cluttering the interface with "0.00%" fee displays.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-06-25T07:28:32.570Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5881
File: apps/cowswap-frontend/src/modules/cowShed/containers/ProxyRecipient/index.tsx:68-72
Timestamp: 2025-06-25T07:28:32.570Z
Learning: In the ProxyRecipient component (apps/cowswap-frontend/src/modules/cowShed/containers/ProxyRecipient/index.tsx), throwing an error when recipient address doesn't match proxy address is intentional design choice to prevent proceeding with incorrect data and ensure data integrity.
Applied to files:
apps/cowswap-frontend/src/locales/en-US.po
📚 Learning: 2025-09-25T08:49:32.256Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:62-67
Timestamp: 2025-09-25T08:49:32.256Z
Learning: In the cowswap-frontend codebase, when testing hooks that use multiple bridge providers, both providers are always properly mocked as complete jest.Mocked<BridgeProvider<BridgeQuoteResult>> objects with all required methods stubbed, ensuring no undefined returns that could break the hook logic.
Applied to files:
apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
📚 Learning: 2025-04-02T09:58:29.374Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5549
File: apps/cowswap-frontend/src/modules/tradeFlow/services/safeBundleFlow/safeBundleEthFlow.ts:152-152
Timestamp: 2025-04-02T09:58:29.374Z
Learning: In the `safeBundleEthFlow` function, `account` is guaranteed to be truthy based on the type system (`PostOrderParams` defines it as a required string) and the context in which the function is called, so additional runtime checks are unnecessary.
Applied to files:
apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
📚 Learning: 2025-09-25T08:46:43.815Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/modules/tradeQuote/services/fetchAndProcessQuote.test.ts:376-385
Timestamp: 2025-09-25T08:46:43.815Z
Learning: In fetchAndProcessQuote.ts, when bridgingSdk.getBestQuote() returns null, no loading state reset is needed because loading state management is handled through onQuoteResult() callback for results and processQuoteError() for errors. The null case is intentionally designed not to trigger any manager methods.
Applied to files:
apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
🧬 Code graph analysis (1)
apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts (2)
apps/cowswap-frontend/src/entities/bridgeProvider/useHasHookBridgeProvidersEnabled.ts (1)
useHasHookBridgeProvidersEnabled(7-11)apps/cowswap-frontend/src/modules/accountProxy/hooks/useCurrentAccountProxy.ts (1)
useCurrentAccountProxy(84-112)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Setup
- GitHub Check: Cypress
🔇 Additional comments (5)
apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts (2)
42-45: LGTM! Clean optimization for proxy verification.The conditional logic correctly skips proxy verification when no hook-based bridge providers are enabled, improving UX by not blocking trades unnecessarily. The defaults (not loading, valid) allow trades to proceed when proxy checks are irrelevant.
59-102: LGTM! Explicit dependencies and correct memoization.The dependency array is complete and correctly includes all values used in the return object. The refactoring from
commonContextto explicit field enumeration improves clarity and maintainability.apps/cowswap-frontend/src/locales/en-US.po (3)
315-317: Token search & guide banner translations look consistent and safeThe new/relocated token search texts and the consolidated guide banner string read well, keep placeholders/components intact (
<0>…</0>), and align with the intended UX (inactive lists, external sources, and “read our guide” CTA). No issues from an i18n or copy standpoint.Also applies to: 839-842, 859-862, 1167-1169, 2967-2969, 3922-3924, 4240-4243
978-982: Smart-contract receiver warning copy is clear and correctly wiredReusing existing “Confirm” and “Recipient” strings for
SmartContractReceiverWarningplus the new sentence “Confirm this is the correct address and that it exists on this chain.” gives a concise, accurate warning without breaking placeholders or semantics. Looks good.Also applies to: 2017-2021, 3521-3524
47-48: Obsoleting hook dapp descriptions is consistent cleanupMarking the various hook‑dapp‑lib marketing/description strings (Bungee, Across, Aave adapters, LlamaPay, Morpho, generic hook builders, etc.) as obsolete with
#~removes unused copy without impacting runtime behavior. This matches the move away from those hook-based flows and looks fine from an i18n perspective.Also applies to: 98-99, 494-497, 630-631, 778-779, 1081-1082, 1332-1333, 1368-1369, 1637-1638, 1970-1971, 2577-2578, 2819-2820, 2995-2996, 3230-3231, 3380-3381, 3623-3624, 3755-3756, 3799-3800, 4003-4004, 4161-4162, 4375-4376, 4478-4479, 4811-4812, 4955-4956, 5115-5116, 5929-5930, 6011-6012, 6053-6054, 6236-6237
elena-zh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!




Summary
To Test
isNearIntentsBridgeProviderEnabledfeature-flag must be enabled while testing this feature!Summary by CodeRabbit
New Features
Improvements
Removed
Localization
✏️ Tip: You can customize this high-level summary in your review settings.