feat(bridge): enable sell=buy feature#7633
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
WalkthroughBumps ChangesSDK Upgrade and Feature Enablement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Deploying swap-dev with
|
| Latest commit: |
b5fc9c3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://83478759.swap-dev-5u6.pages.dev |
| Branch Preview URL: | https://feat-sell-buy-2.swap-dev-5u6.pages.dev |
Deploying explorer-dev with
|
| Latest commit: |
b5fc9c3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://64b4ee53.explorer-dev-dxz.pages.dev |
| Branch Preview URL: | https://feat-sell-buy-2.explorer-dev-dxz.pages.dev |
In tools/scripts/install.js: - Instead of skipping https-pinned non-SDK @cowprotocol deps, collect their name@version lockfile keys (forceResolveKeys). - Before the preview install, strip those entries from pnpm-lock.yaml (packages: + snapshots: blocks). pnpm then re-resolves just those packages as direct npmjs tarballs. - Restore the original lockfile in finally so the working tree stays clean. Verified: syntax check passes, version parsing returns 0.11.0, the stripper removes exactly the two cms blocks (228 bytes, 263→261 @cowprotocol keys) with no collateral, and the full strip-then-install flow installs cms successfully even with the GitHub scope override active.
… feat/sell-buy-2 # Conflicts: # apps/cowswap-frontend/package.json # apps/cowswap-frontend/src/modules/tradeFormValidation/pure/TradeFormButtons/tradeButtonsMap.tsx # apps/explorer/package.json # apps/sdk-tools/package.json # apps/widget-configurator/package.json # libs/analytics/package.json # libs/balances-and-allowances/package.json # libs/common-const/package.json # libs/common-hooks/package.json # libs/common-utils/package.json # libs/core/package.json # libs/currency/package.json # libs/ens/package.json # libs/events/package.json # libs/multicall/package.json # libs/permit-utils/package.json # libs/tokens/package.json # libs/types/package.json # libs/ui/package.json # libs/wallet/package.json # libs/widget-lib/package.json # pnpm-lock.yaml # tools/scripts/install.js
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@libs/types/package.json`:
- Around line 27-28: Update the SDK versions in the package.json dependencies
section to actual, available versions on npm. Change the `@cowprotocol/cow-sdk`
version from 9.2.0 to an existing version such as 9.0.2, and update
`@cowprotocol/sdk-bridging` version from 4.2.0 to an actual available version on
the npm registry. Verify both updated versions exist before committing to ensure
the dependencies can be properly resolved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 515d28bc-cf4c-4647-a568-19e7d31bc56d
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (24)
apps/cowswap-frontend/package.jsonapps/cowswap-frontend/src/locales/en-US.poapps/cowswap-frontend/src/modules/hooksStore/containers/HooksStoreWidget/index.tsxapps/cowswap-frontend/src/modules/tradeFormValidation/pure/QuoteApiErrorButton.pure.tsxapps/cowswap-frontend/src/modules/tradeQuote/services/fetchAndProcessQuote.tsapps/explorer/package.jsonapps/sdk-tools/package.jsonapps/widget-configurator/package.jsonlibs/analytics/package.jsonlibs/balances-and-allowances/package.jsonlibs/common-const/package.jsonlibs/common-hooks/package.jsonlibs/common-utils/package.jsonlibs/core/package.jsonlibs/currency/package.jsonlibs/ens/package.jsonlibs/events/package.jsonlibs/multicall/package.jsonlibs/permit-utils/package.jsonlibs/tokens/package.jsonlibs/types/package.jsonlibs/ui/package.jsonlibs/wallet/package.jsonlibs/widget-lib/package.json
elena-zh
left a comment
There was a problem hiding this comment.
Hey @shoom3301 , works perfectly fine with Bungee and Near.
Some comments:
- Simple swaps should be working on Hooks only (you forgot to mention about it in the description)
- There is one trivial priority issue #6856 that would be nice to address one day
- and could you please check why sell is not = buy when I bridge to BTC?
Thanks
|
@elena-zh thanks!
|
alfetopito
left a comment
There was a problem hiding this comment.
I see the fee is returned by the backend API, so the question is for them, but anyway, I expected it to not show any fees for this type of order.
But if I look closely at the order, I see the issue is because we always quote native with wrapped token instead:
{"from":"0xD711bD26Bf5B153001a7C0ACcb289782b6f775e9","sellToken":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","buyToken":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","receiver":"0xD711bD26Bf5B153001a7C0ACcb289782b6f775e9","validFor":1800,"appData":"{\"appCode\":\"CoW Swap\",\"environment\":\"pr\",\"metadata\":{\"bridging\":{\"destinationChainId\":\"42161\",\"destinationTokenAddress\":\"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\",\"providerId\":\"cow-sdk://bridging/providers/bungee\"},\"hooks\":{\"post\":[{\"callData\":\"0x00\",\"dappId\":\"cow-sdk://bridging/providers\",\"gasLimit\":\"600000\",\"target\":\"0x0000000000000000000000000000000000000000\"}]},\"orderClass\":{\"orderClass\":\"market\"},\"quote\":{\"slippageBips\":247,\"smartSlippage\":true}},\"version\":\"1.15.0\"}","appDataHash":"0xe49cf30f20c51efd0bcac4ee1dbf7f113148175eb0dc23a8521c009064a50643","priceQuality":"optimal","signingScheme":"eip1271","onchainOrder":true,"verificationGasLimit":0,"kind":"sell","sellAmountBeforeFee":"1000000000000000000"}Anyway, not related to this PR but to backend implementation instead.
Got a case which is probably the issue I mentioned in the SDK PR regarding the symbol matching: USDT (base) -> USDT0 (arb1) routes via USDC:

One last thing, I don't seem to be able to actually click on swap:
Screen.Recording.2026-06-15.at.17.31.06.mov
| import { SELL_ETH_RESET_STATE } from '../consts' | ||
|
|
||
| export function useOnCurrencySelection(): (field: Field, currency: Currency | null) => void { | ||
| export function useOnCurrencySelection(enableSellEqBuy = false): (field: Field, currency: Currency | null) => void { |
There was a problem hiding this comment.
I didn't get why we want to enable sell=buy conditional to whether hook store is enabled

Summary
Coupled with cowprotocol/cow-sdk#897
With this change, cross-chain swaps should support intermediate token ~= destination token.
For example:
https://swap.cow.fi/#/8453/swap/USDC/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48?targetChainId=1
This will never route you USDC (Base) -> USDC (Base) -> USDC (Ethereum) because
USDC (Base) -> USDC (Base)was not supported on the backend.In this PR it should do such a route.
To Test
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Chores