Skip to content

Conversation

@shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Dec 4, 2025

Summary

image

To Test

isNearIntentsBridgeProviderEnabled feature-flag must be enabled while testing this feature!

  1. When connected with smart-contract wallet, then only Near intents bridge provider should be available
  2. When making a cross-chain swap and current account is a smart-contract account or custom recipient is specified, then the warning should be displayed on the confirmation screen

Summary by CodeRabbit

  • New Features

    • Smart‑contract recipient confirmation banner and confirmation controls; shared trade‑confirm context hook now used by confirmation modals.
    • Hook to detect hook‑based bridge providers.
  • Improvements

    • Bridge providers and order flows respect smart‑contract wallet status and carry bridge order details into notifications.
    • Network selector visibility refined; network logo supports styling className.
    • Button/validation, fee/timeline and warning UI tweaks; trade confirmations consolidated.
  • Removed

    • Bundle wrap banner.
  • Localization

    • Added Spanish and Russian recipient‑warning translations.

✏️ Tip: You can customize this high-level summary in your review settings.

@shoom3301 shoom3301 self-assigned this Dec 4, 2025
@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cowfi Ready Ready Preview Dec 16, 2025 10:59am
explorer-dev Ready Ready Preview Dec 16, 2025 10:59am
swap-dev Ready Ready Preview Dec 16, 2025 10:59am
widget-configurator Ready Ready Preview Dec 16, 2025 10:59am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
cosmos Ignored Ignored Dec 16, 2025 10:59am
sdk-tools Ignored Ignored Preview Dec 16, 2025 10:59am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

Centralizes 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

Cohort / File(s) Summary
Bridging enablement & provider gating
apps/cowswap-frontend/src/common/updaters/BridgingEnabledUpdater.ts, apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts
Simplified bridging enable check to route === Routes.SWAP; disable specific providers (bungee/across) when smart‑contract wallets detected; updated effect deps.
Common trade‑confirm context & re‑export
apps/cowswap-frontend/src/modules/trade/hooks/useCommonTradeConfirmContext.ts, apps/cowswap-frontend/src/modules/trade/index.ts
New hook exposing CommonTradeConfirmContext (account, ensName, appData, isSmartContractWallet); re‑exported from trade index.
TradeConfirmation API & consumers
apps/cowswap-frontend/src/modules/*/ConfirmModal/*, apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx, apps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsx, apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.cosmos.tsx
Consumers now spread commonTradeConfirmContext into TradeConfirmation; TradeConfirmation props refactored to extend CommonTradeConfirmContext and include isSmartContractWallet/appData; fixtures updated.
Smart‑contract recipient confirmation
apps/cowswap-frontend/src/modules/swap/hooks/useSmartContractRecipientConfirmed.ts, apps/cowswap-frontend/src/modules/swap/pure/SmartContractReceiverWarning/index.tsx
Added Jotai-backed confirmation atom, hooks (read/toggle/shouldCheck), and SmartContractReceiverWarning component with checkbox/toggle API.
Swap UI integration (warnings & buttons)
apps/cowswap-frontend/src/modules/swap/containers/Warnings/index.tsx, apps/cowswap-frontend/src/modules/swap/containers/TradeButtons/index.tsx
Warnings render SmartContractReceiverWarning when gating conditions met and reset confirmation on key changes; TradeButtons disables submit until recipient confirmed when required.
Network selector & chains hiding
apps/cowswap-frontend/src/common/hooks/useShouldHideNetworkSelector.ts, apps/cowswap-frontend/src/legacy/components/Header/NetworkSelector/index.tsx, apps/cowswap-frontend/src/modules/tokensList/hooks/useChainsToSelect.ts
New useShouldHideNetworkSelector hook; NetworkSelector and token-chains logic hide network UI for certain wallet conditions.
Order / presign / fulfillment bridge data
apps/cowswap-frontend/src/modules/orders/updaters/OrdersNotificationsUpdater/handlers.tsx, apps/cowswap-frontend/src/modules/orders/containers/OrderNotification/index.tsx, libs/events/src/types/orders.ts, apps/cowswap-frontend/src/modules/orders/utils/emitPresignedOrderEvent.ts
OnPresignedOrder payload now may include optional bridgeOrder; handlers compute/passthrough orderInfo for bridge orders; emitPresignedOrderEvent annotated void; OrderNotification can prefer provided receiver.
Pending orders updater (bridge integration)
apps/cowswap-frontend/src/common/updaters/orders/PendingOrdersUpdater.ts
Threaded bridgeOrdersMap and account through UpdateOrdersParams, handlePresignedOrders and _updateOrders; added bridgeOrdersMapRef and include bridgeOrder in fulfillment events.
Safe bundle flows: record/emit bridge orders
apps/cowswap-frontend/src/modules/tradeFlow/services/safeBundleFlow/safeBundleApprovalFlow.ts, apps/cowswap-frontend/src/modules/tradeFlow/services/safeBundleFlow/safeBundleEthFlow.ts
Extract bridgeQuoteAmounts from tradeContext and add/emit bridge order records when present in safe bundle flows.
Bundle banner removals & exports
apps/cowswap-frontend/src/modules/trade/containers/TradeWarnings/index.tsx, apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/BundleTxWrapBanner/index.tsx, apps/cowswap-frontend/src/modules/tradeWidgetAddons/index.ts
Removed BundleTxApprovalBanner and deleted BundleTxWrapBanner and its export.
UI / fee / progress tweaks
apps/cowswap-frontend/src/modules/trade/pure/TotalFeeRow/index.tsx, apps/cowswap-frontend/src/modules/trade/pure/TradeFees/index.tsx, apps/cowswap-frontend/src/modules/orderProgressBar/pure/steps/FinishedStep.tsx
Added optional withTimelineDot to TotalFeeRow and propagated from TradeFees; refactored FinishedStep into typed subcomponents and expanded props.
Types, return annotations & misc utilities
apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx, apps/cowswap-frontend/src/modules/trade/hooks/useIsCurrentTradeBridging.ts, apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx, apps/cowswap-frontend/src/common/hooks/useGetExecutedBridgeSummary.ts, libs/common-utils/src/environments.ts, libs/ui/src/pure/NetworkLogo/index.tsx
Added explicit return types, simplified executed summary call, introduced forceProdApi/isProdLike/isBarnBackendEnv flags, and allowed NetworkLogo to accept className.
Locales
apps/cowswap-frontend/src/locales/en-US.po, apps/cowswap-frontend/src/locales/es-ES.po, apps/cowswap-frontend/src/locales/ru-RU.po
Added/moved translation entries (including SmartContractReceiverWarning strings); no runtime logic changes.
Bridge provider helpers & validation usage
apps/cowswap-frontend/src/entities/bridgeProvider/index.ts, apps/cowswap-frontend/src/entities/bridgeProvider/useHasHookBridgeProvidersEnabled.ts, apps/cowswap-frontend/src/modules/tradeFormValidation/hooks/useTradeFormValidationContext.ts
Added useHasHookBridgeProvidersEnabled hook and export; trade-form validation consumes it to conditionally compute proxy loading/validity.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing close attention:
    • apps/cowswap-frontend/src/common/updaters/orders/PendingOrdersUpdater.ts — signature changes, bridgeOrdersMapRef, async propagation.
    • useCommonTradeConfirmContext and TradeConfirmation type/consumer alignment across confirm modals.
    • Smart‑contract recipient hooks/atom reset and gating logic in Warnings and TradeButtons.
    • BridgeProvidersUpdater and BridgingEnabledUpdater — ensure provider gating correctness.
    • Deleted bundle components — search for residual imports/usages.

Possibly related PRs

Suggested reviewers

  • fairlighteth
  • elena-zh

"I nibble code and hop light-footed near,
Routes align and warnings now appear.
Recipients checked, bridge orders trace,
Providers gated, networks hide their face.
A rabbit cheers — this patch hops clear!" 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.28% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description is incomplete. While it includes a summary screenshot and testing instructions, it lacks the 'To Test' checklist items and 'Background' section specified in the template. Add detailed checklist items under 'To Test' (e.g., verify smart-contract wallet detection, check Near provider availability) and optionally include 'Background' section explaining the motivation for the change.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective: enabling the Near bridge provider for smart-contract wallets. It is clear, specific, and directly relates to the primary change across the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/enable-near-bridge-for-smart-accounts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.


const isWalletCompatible = Boolean(account ? accountType !== AccountType.SMART_CONTRACT : true)
const shouldEnableBridging = isWalletCompatible && isSwapRoute
const shouldEnableBridging = tradeTypeInfo?.route === Routes.SWAP
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 UI

Component 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: Redundant useAppData() call.

useCommonTradeConfirmContext() already calls useAppData() internally and includes appData in its return value. The separate useAppData() call on line 55 is redundant and can be removed by using commonTradeConfirmContext.appData instead.

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: Redundant useWalletInfo() call for account.

commonTradeConfirmContext already provides account. The useWalletInfo() call on line 77 is now only used for account which is redundant. However, useWalletDetails() on line 78 is still needed for allowsOffchainSigning.

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 for account and appData.

Both useWalletInfo() and useAppData() are called separately, but useCommonTradeConfirmContext() already provides account and appData. 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.appData and commonTradeConfirmContext.account respectively.

Update imports:

-import { useWalletInfo } from '@cowprotocol/wallet'
-import { useAppData } from 'modules/appData'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16788e6 and 32c14d7.

📒 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.ts
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.cosmos.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx
  • apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx
  • apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts
  • apps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx
  • apps/cowswap-frontend/src/modules/trade/index.ts
  • apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx
  • apps/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.ts
  • apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx
  • apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts
  • apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts
  • apps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx
  • apps/cowswap-frontend/src/modules/trade/index.ts
  • apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx
  • apps/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.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx
  • apps/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.ts
  • apps/cowswap-frontend/src/modules/trade/pure/SmartContractReceiverWarning/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/hooks/useSmartContractRecipientConfirm.ts
  • apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts
  • apps/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.ts
  • apps/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.ts
  • apps/cowswap-frontend/src/modules/twap/containers/TwapConfirmModal/index.tsx
  • apps/cowswap-frontend/src/modules/trade/containers/TradeConfirmModal/index.cosmos.tsx
  • apps/cowswap-frontend/src/modules/trade/index.ts
  • apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx
  • apps/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.ts
  • apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersConfirmModal/index.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx
  • apps/cowswap-frontend/src/modules/trade/index.ts
  • apps/cowswap-frontend/src/modules/yield/containers/YieldConfirmModal/index.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/ConfirmWarnings.tsx
  • apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx
  • apps/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 correct

Using tradeTypeInfo?.route === Routes.SWAP as the single source of truth for shouldEnableBridging is clean and keeps wallet-type concerns out of this updater, which is consistent with delegating provider gating to BridgeProvidersUpdater.

apps/cowswap-frontend/src/modules/trade/pure/PriceUpdatedBanner/index.tsx (1)

1-1: Explicit ReactNode return type is appropriate

Importing ReactNode and annotating PriceUpdatedBanner’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 props

Adding appData={null} and isSmartContractWallet={false} keeps the cosmos fixture aligned with the extended TradeConfirmation props while preserving previous behavior.

apps/cowswap-frontend/src/modules/trade/index.ts (1)

45-45: Re-exporting useCommonTradeConfirmContext from the trade barrel makes sense

Exposing 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 changes

Including isSmartContractWallet: false and appData: null in confirmationState keeps this fixture compatible with the widened TradeConfirmationProps while keeping the scenario simple.

apps/cowswap-frontend/src/entities/bridgeProvider/BridgeProvidersUpdater.ts (1)

6-7: Smart‑contract‑aware provider gating matches intended behavior

Using useIsSmartContractWallet to ensure only nearIntentsBridgeProvider remains 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. Including isSmartContractWallet in 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

useCommonTradeConfirmContext cleanly consolidates wallet info, ENS, smart‑contract flag, and appData into 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: Intentional appData override noted.

The commonTradeConfirmContext spread (line 89) includes appData from useAppData(), but it's intentionally overridden by the explicit appData={tradeContext.postOrderParams.appData || undefined} prop on line 99. This ensures limit orders use their specific postOrderParams.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.account for TradeBasicConfirmDetails.

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 appData from the context will be used appropriately.

apps/cowswap-frontend/src/modules/swap/containers/SwapConfirmModal/index.tsx (1)

117-131: LGTM!

The spread of commonTradeConfirmContext into TradeConfirmation is 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: Verify recipient null handling in SmartContractReceiverWarning.

The recipient prop passed to SmartContractReceiverWarning can be Nullish<string> (null or undefined), but looking at the external snippet (lines 36-66), the component uses recipient ?? account when rendering the address link. This correctly falls back to account when recipient is 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 useMemo correctly memoizes the return value with appropriate dependencies. The state tuple reference from useState is stable, ensuring consistent behavior.

apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx (3)

25-38: LGTM!

The TradeConfirmationProps extension with CommonTradeConfirmContext is clean and correctly removes the need for separate account, ensName, and appData props. 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:

  1. Hook extracts confirmation state and output chain ID
  2. Button is disabled until user confirms for bridging trades with smart-contract wallets
  3. Logic flows correctly through to ConfirmWarnings

110-119: LGTM!

ConfirmWarnings correctly receives all necessary props including the new outputChainId and smartContractRecipientConfirmState. The integration is complete and consistent with the changes in ConfirmWarnings.tsx.

Copy link
Contributor

@fairlighteth fairlighteth left a 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

@fairlighteth
Copy link
Contributor

Just FYI:

Bridge providers (Bungee, Across) are now unavailable for smart contract wallets,

Screenshot 2025-12-05 at 13 35 54

Using Safe wallet https://basescan.org/address/0x8FAb71C0d4272698A3B2d1F3Ed5FC3c1B9b3E531 seems to use Bungee?

Copy link
Contributor

@elena-zh elena-zh left a 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:

  1. The feature does not respect the feature-flag isBridgingEnabled
  2. 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.
hide from safe as not possible to switch
  1. There is a total fee field that looks weird:
total fee (safe fee)
  1. Order recipient shows an intermediate address in the 'presigned' pop-up:
recievre
  1. When Swap part is completed, I get 'TX Completed' modal
tx com
  1. But then, 'bridging' step appears, and there is no indication if a pending order there:
no pending1
  1. When sending an order to a custom recipient, there are 2 warnings now. I think, one of them should be removed?
2 recip warnings

Thanks!

shoom3301 and others added 3 commits December 8, 2025 17:32
… 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
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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?: string override is fine, but please define/guarantee its format (address-only?).
Right now ReceiverInfo will still render an ExplorerLink type="address" even if receiver is not a valid address, which can produce a broken link if any caller passes an ENS/name/invalid string. Consider either enforcing receiver to be an address at the type/prop boundary, or hardening ReceiverInfo to only render the explorer link when isAddress(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) return could be return null for explicit React semantics.

Also applies to: 116-118

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f57cef8 and 421c965.

📒 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

Copy link
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thank you!
1q: should this message block the UI in Safe where Near is the only bridge provider?
image

@shoom3301 shoom3301 force-pushed the feat/enable-near-bridge-for-smart-accounts branch from ecc8c0a to d118359 Compare December 15, 2025 11:10
@shoom3301
Copy link
Collaborator Author

@elena-zh thanks! Fixed.
Now it should not wait for account proxy verification when there is no hook-based bridge providers enabled.
Even if you use EOA and only Near is enabled, then it should not wait.

@elena-zh
Copy link
Contributor

@shoom3301 , not fixed :(
image

To reproduce:

  1. connect to Safe using WC
  2. close the browser tab with the app
  3. reopen the tab in an hour
  4. load the bridge trade -->
image

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
@shoom3301
Copy link
Collaborator Author

@elena-zh fixed it, thanks!

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 copy

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between d118359 and 2e1797f.

📒 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.po
  • apps/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.po
  • apps/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.po
  • apps/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 commonContext to 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 safe

The 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 wired

Reusing existing “Confirm” and “Recipient” strings for SmartContractReceiverWarning plus 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 cleanup

Marking 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

Copy link
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@shoom3301 shoom3301 merged commit 0da32ab into develop Dec 17, 2025
15 checks passed
@shoom3301 shoom3301 deleted the feat/enable-near-bridge-for-smart-accounts branch December 17, 2025 07:28
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants