Skip to content

Conversation

@alfetopito
Copy link
Contributor

@alfetopito alfetopito commented Oct 20, 2025

Summary

Adding preliminary support for the new chains we'll launch this quarter: Linea and Plasma.

Testing

  • Unit tests
  • Will load it on CoW Swap

Summary by CodeRabbit

  • New Features

    • Added initial support for Linea (59144) and Plasma (9745): chain metadata, RPC endpoints, wrapped native currencies, and token entries; expanded order-book and bridging network mappings.
  • Documentation

    • Updated supported networks list to include Linea and Plasma (marked under development).
  • Tests

    • Extended test coverage and test data to include Linea and Plasma.
  • Chores

    • Added placeholder/subgraph and provider mappings for the new networks.

@alfetopito alfetopito self-assigned this Oct 20, 2025
@alfetopito
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

Walkthrough

Adds Linea (59144) and Plasma (9745) network data across config, token, bridge contract maps, tests, and docs — new ChainInfo files, enum entries, RPC/wrapped-token mappings, order-book/subgraph entries, and placeholder contract addresses; marked under development.

Changes

Cohort / File(s) Summary
Chain Types
packages/config/src/chains/types.ts
Added SupportedChainId.LINEA = 59144 and SupportedChainId.PLASMA = 9745.
Chain Details
packages/config/src/chains/details/linea.ts, packages/config/src/chains/details/plasma.ts
New exported linea and plasma ChainInfo objects with metadata, logos, multicall3, RPC URLs, and isUnderDevelopment: true.
Chain Registry & Exports
packages/config/src/chains/const/chainIds.ts, packages/config/src/chains/index.ts
Registered LINEA and PLASMA in ALL_SUPPORTED_CHAINS_MAP; re-exported new chain detail modules.
Tokens & Example Tokens
packages/config/src/constants/tokens.ts, examples/react/wagmi/src/tokens.ts
Added WRAPPED_NATIVE_CURRENCIES entries for LINEA and PLASMA; added USDC/USDT token entries for Linea and Plasma in example tokens file.
Bridge Provider Contracts
packages/bridging/src/providers/across/const/contracts.ts, packages/bridging/src/providers/bungee/const/contracts.ts
Added LINEA and PLASMA keys to Across and Bungee contract address maps; some entries left undefined/placeholders/TODOs.
Tests / Test Helpers
packages/bridging/src/test/getWallet.ts, packages/bridging/src/test/getWallet.test.ts
Extended DEFAULT_RPC_URL and test arrays to include LINEA and PLASMA RPC endpoints and chain IDs; small import reorder.
API / Service Config
packages/order-book/src/api.ts, packages/subgraph/src/api.ts, packages/subgraph/src/api.spec.ts
Added LINEA and PLASMA entries to order-book and subgraph config maps (subgraph entries set to null), plus minor import reorderings.
Docs
packages/sdk/README.md
Added Linea and Plasma to Supported Networks list (marked under development).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus areas for review:
    • Placeholder/undefined contract addresses in packages/bridging/src/providers/*/const/contracts.ts.
    • Token addresses and wrapped native addresses in packages/config/src/constants/tokens.ts and examples/react/wagmi/src/tokens.ts for correctness.
    • RPC URL mapping and test coverage in packages/bridging/src/test/* to ensure tests remain isolated.
    • New ChainInfo fields and logo/path references in packages/config/src/chains/details/*.ts.

Possibly related PRs

Suggested reviewers

  • shoom3301
  • cowdan
  • limitofzero

Poem

🐰 I hopped into code at dawn's first light,
Two networks planted, shiny and bright,
RPCs and tokens tucked in neat,
Contracts waiting for addresses to meet,
A little hop — devs, test, and delight.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(new-chains): add q4 chains' clearly describes the main change: adding support for new chains (Linea and Plasma) planned for Q4, which aligns with the PR's primary objective.
✨ 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/q4-chains

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9662503 and 66c24df.

⛔ Files ignored due to path filters (3)
  • packages/config/src/chains/images/linea-logo-dark.svg is excluded by !**/*.svg
  • packages/config/src/chains/images/linea-logo-light.svg is excluded by !**/*.svg
  • packages/config/src/chains/images/plasma-logo.svg is excluded by !**/*.svg
📒 Files selected for processing (15)
  • examples/react/wagmi/src/tokens.ts (1 hunks)
  • packages/bridging/src/providers/across/const/contracts.ts (2 hunks)
  • packages/bridging/src/providers/bungee/const/contracts.ts (3 hunks)
  • packages/bridging/src/test/getWallet.test.ts (2 hunks)
  • packages/bridging/src/test/getWallet.ts (2 hunks)
  • packages/config/src/chains/const/chainIds.ts (2 hunks)
  • packages/config/src/chains/details/linea.ts (1 hunks)
  • packages/config/src/chains/details/plasma.ts (1 hunks)
  • packages/config/src/chains/index.ts (1 hunks)
  • packages/config/src/chains/types.ts (1 hunks)
  • packages/config/src/constants/tokens.ts (1 hunks)
  • packages/order-book/src/api.ts (3 hunks)
  • packages/sdk/README.md (1 hunks)
  • packages/subgraph/src/api.spec.ts (1 hunks)
  • packages/subgraph/src/api.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/config/src/chains/index.ts
🚧 Files skipped from review as they are similar to previous changes (13)
  • packages/bridging/src/test/getWallet.test.ts
  • packages/config/src/chains/types.ts
  • examples/react/wagmi/src/tokens.ts
  • packages/config/src/chains/details/linea.ts
  • packages/config/src/chains/details/plasma.ts
  • packages/config/src/constants/tokens.ts
  • packages/subgraph/src/api.spec.ts
  • packages/config/src/chains/const/chainIds.ts
  • packages/bridging/src/test/getWallet.ts
  • packages/bridging/src/providers/bungee/const/contracts.ts
  • packages/subgraph/src/api.ts
  • packages/bridging/src/providers/across/const/contracts.ts
  • packages/order-book/src/api.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-12T09:15:28.459Z
Learnt from: alfetopito
Repo: cowprotocol/cow-sdk PR: 391
File: src/trading/getEthFlowTransaction.ts:80-85
Timestamp: 2025-08-12T09:15:28.459Z
Learning: In the CoW SDK codebase, ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES are typed as Record<SupportedChainId, string>, which requires all SupportedChainId enum values to have corresponding string entries. TypeScript compilation will fail if any chainId is missing from these mappings, making runtime guards for missing addresses unnecessary in these specific cases.

Applied to files:

  • packages/sdk/README.md
⏰ 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). (3)
  • GitHub Check: eslint
  • GitHub Check: test
  • GitHub Check: Publish to GitHub Packages
🔇 Additional comments (2)
packages/sdk/README.md (2)

28-29: Documentation format is consistent and appropriately marks chains as under development.

The new network entries follow the established pattern and are positioned logically before the testnet section. The "Under development" status marker is clear and appropriate.


28-29: No issues found—documentation and implementation match.

Both LINEA (59144) and PLASMA (9745) are correctly defined in the SupportedChainId enum and present in all Record<SupportedChainId, string> mappings (wrapped tokens, API URLs, contract addresses, etc.). Since the codebase compiles successfully, TypeScript confirms all mappings are complete.


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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

📦 GitHub Packages Published

Last updated: Nov 5, 2025, 03:24:40 PM UTC

The following packages have been published to GitHub Packages with pre-release version pr-606-bac45b77:


Installation

These packages require authentication to install from GitHub Packages. First, create a .npmrc file:

# Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrc

To get your GitHub token:

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token (classic)"
  3. Check only the "read:packages" scope
  4. Copy the token and replace YOUR_GITHUB_TOKEN in the .npmrc file

Then install any of the packages above, either by exact version (i.e. @cowprotocol/[email protected]) or more conveniently by using the tag (@cowprotocol/cow-sdk@pr-606):

# Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-606

# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-606

# NPM
npm install npm:@cowprotocol/cow-sdk@pr-606

Update to the latest version (only if you used the tag)

Every commit will publish a new package. To upgrade to the latest version, run:

# Yarn
yarn upgrade @cowprotocol/cow-sdk

# pnpm
pnpm update @cowprotocol/cow-sdk

# NPM
npm update @cowprotocol/cow-sdk

View Packages

You can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages

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: 5

🧹 Nitpick comments (3)
packages/config/src/chains/types.ts (1)

160-166: New ChainInfo.isUnderDevelopment flag: surface guardrails

Nice addition. Suggest:

  • Expose a small helper (e.g., isChainUnderDevelopment) and use it in consumers that list selectable networks to prevent premature exposure.
  • Consider documenting intended rollout behavior (e.g., hide in UI but enable programmatic access).
packages/subgraph/src/api.ts (1)

110-112: Strengthen unsupported-network guard and use CowError

Broaden the check to catch undefined/empty base URLs and standardize on CowError.

-    if (baseUrl === null) {
-      throw new Error('Unsupported Network. The subgraph API is not available in the Network ' + chainId)
-    }
+    if (baseUrl == null || baseUrl.trim() === '') {
+      throw new CowError(`Unsupported Network. The subgraph API is not available for chainId: ${chainId}`)
+    }
packages/config/src/chains/details/linea.ts (1)

14-17: Consider explicit nativeCurrency configuration for consistency.

Linea relies on nativeCurrencyTemplate for all values except chainId, which should be fine if Linea uses ETH as its native currency (typical for Ethereum L2s). However, Plasma explicitly overrides name, symbol, and logoUrl. For consistency and clarity across chain configurations, consider being explicit here as well.

If you prefer explicit configuration, apply this diff:

   nativeCurrency: {
     ...nativeCurrencyTemplate,
     chainId: SupportedChainId.LINEA,
+    name: 'Ether',
+    symbol: 'ETH',
   },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f502fa9 and 237fffe.

⛔ Files ignored due to path filters (3)
  • packages/config/src/chains/images/linea-logo-dark.svg is excluded by !**/*.svg
  • packages/config/src/chains/images/linea-logo-light.svg is excluded by !**/*.svg
  • packages/config/src/chains/images/plasma-logo.svg is excluded by !**/*.svg
📒 Files selected for processing (16)
  • examples/react/wagmi/src/tokens.ts (1 hunks)
  • packages/bridging/src/providers/across/const/contracts.ts (2 hunks)
  • packages/bridging/src/providers/bungee/const/contracts.ts (3 hunks)
  • packages/bridging/src/test/getWallet.test.ts (2 hunks)
  • packages/bridging/src/test/getWallet.ts (2 hunks)
  • packages/config/src/chains/const/chainIds.ts (2 hunks)
  • packages/config/src/chains/details/linea.ts (1 hunks)
  • packages/config/src/chains/details/plasma.ts (1 hunks)
  • packages/config/src/chains/index.ts (1 hunks)
  • packages/config/src/chains/types.ts (2 hunks)
  • packages/config/src/chains/utils.ts (1 hunks)
  • packages/config/src/constants/tokens.ts (1 hunks)
  • packages/order-book/src/api.ts (3 hunks)
  • packages/sdk/README.md (1 hunks)
  • packages/subgraph/src/api.spec.ts (1 hunks)
  • packages/subgraph/src/api.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-12T09:15:28.459Z
Learnt from: alfetopito
PR: cowprotocol/cow-sdk#391
File: src/trading/getEthFlowTransaction.ts:80-85
Timestamp: 2025-08-12T09:15:28.459Z
Learning: In the CoW SDK codebase, ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES are typed as Record<SupportedChainId, string>, which requires all SupportedChainId enum values to have corresponding string entries. TypeScript compilation will fail if any chainId is missing from these mappings, making runtime guards for missing addresses unnecessary in these specific cases.

Applied to files:

  • packages/bridging/src/providers/bungee/const/contracts.ts
⏰ 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: Publish to GitHub Packages
  • GitHub Check: eslint
🔇 Additional comments (19)
packages/sdk/README.md (1)

28-29: Verify chain IDs for Linea and Plasma networks.

The documentation additions follow the existing format and align with the PR objective to add preliminary support for these networks. However, confirm that the chain IDs are accurate: Linea (59144) and Plasma (9745). The "(Under development)" designation appropriately flags these as preliminary.

Please verify the chain IDs using authoritative sources such as:

Once confirmed, this documentation change is ready to merge.

packages/bridging/src/providers/across/const/contracts.ts (2)

44-45: Complete the ACROSS_MATH_CONTRACT_ADDRESSES for LINEA and PLASMA.

These entries are currently undefined. Before moving out of draft status, confirm whether Across has deployed Math Library contracts for these chains and update accordingly.


18-21: Confirm Across SpokePool contract addresses for LINEA and PLASMA

  • LINEA — 0xE0BCff426509723B18D6b2f0D8F4602d143bE3e0 — confirmed on Across docs (reference: linea-chain-id-59144).
  • PLASMA — 0x50039fAEfebef707cFD94D6d462fE6D10B39207a — not confirmed (verification script produced a broken pipe / truncated output). Re-run verification or manually confirm the Plasma docs page before merging.
packages/bridging/src/providers/bungee/const/contracts.ts (1)

13-14: LINEA and PLASMA bridge contract addresses pending confirmation.

The undefined placeholders with TODO comments are consistent with the pattern used for other pending chains (LENS, BNB). Based on learnings, TypeScript enforces that all SupportedChainId values must be present in these Record types, ensuring type safety.

Before moving to production, confirm whether Bungee/Socket has deployed these contracts for LINEA and PLASMA.

Also applies to: 29-30, 45-46

examples/react/wagmi/src/tokens.ts (1)

60-66: LINEA USDC token configuration looks correct.

The address, decimals, and metadata align with USDC (Native Linea) standards.

packages/config/src/chains/utils.ts (1)

46-52: Well-structured utility function for development chain detection.

The implementation correctly follows the pattern established by isZkSyncChain and safely handles undefined chain info. This will enable feature flagging and conditional logic for LINEA and PLASMA chains during their development phase.

packages/config/src/chains/index.ts (1)

14-15: Chain detail exports added correctly.

The new exports for LINEA and PLASMA follow the established pattern and maintain alphabetical ordering consistency with surrounding entries.

packages/bridging/src/test/getWallet.test.ts (1)

95-96: Test coverage appropriately extended for LINEA and PLASMA.

Adding the new chain IDs to the test array ensures getRpcProvider is validated for all supported chains, maintaining comprehensive test coverage.

packages/subgraph/src/api.spec.ts (1)

340-341: Subgraph configuration test data updated correctly.

The null values for LINEA and PLASMA align with chains that don't have subgraph deployments yet, ensuring the test suite covers all chain IDs without breaking on missing endpoints.

packages/bridging/src/test/getWallet.ts (1)

9-9: RPC URL configuration added correctly for LINEA and PLASMA.

The implementation follows the established pattern of accessing rpcUrls.default.http[0] from chain detail objects. Ensure the corresponding linea.ts and plasma.ts chain detail files define valid RPC endpoints.

Also applies to: 11-11, 27-28

packages/config/src/chains/const/chainIds.ts (1)

12-13: New chains correctly wired into ALL_SUPPORTED_CHAINS_MAP

Mapping PLASMA and LINEA to their details looks good and keeps ALL_SUPPORTED_CHAIN_IDS in sync. No issues spotted.

Also applies to: 27-29

packages/subgraph/src/api.ts (1)

50-52: Placeholders set to null: OK—keep until subgraphs deployed

LINEA/PLASMA set to null is fine to explicitly mark unsupported. Just ensure to flip to the deployed subgraph IDs when ready and add a release note for integrators.

I can help wire the IDs once available; share The Graph subgraph IDs for both chains.

packages/config/src/chains/types.ts (1)

17-21: Chain IDs verified—no changes needed.

Both chain IDs are canonical: Linea mainnet is 59144 and Plasma mainnet is 9745. The enum entries are correct.

The optional suggestion to add a comment linking to a central registry (if one exists) for drift prevention remains a reasonable enhancement, but the code as-is is accurate.

packages/order-book/src/api.ts (1)

51-53: Endpoint verification failed—endpoints return 404

The code changes follow the established pattern and are syntactically correct, but the verification requested in the original comment did not pass: all four endpoints returned HTTP 404 instead of 200.

  • https://api.cow.fi/linea/api/v1/version → 404
  • https://api.cow.fi/plasma/api/v1/version → 404
  • https://barn.api.cow.fi/linea/api/v1/version → 404
  • https://barn.api.cow.fi/plasma/api/v1/version → 404

This PR only updates configuration and does not deploy backend services. Clarify whether the 404 responses are expected (services deploying separately) or indicate a release blocker. If the APIs are not yet live, coordinate deployment timing before merging.

packages/config/src/constants/tokens.ts (1)

85-89: LINEA WETH entry verified as correct

The WETH address 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f for LINEA (chainId 59144) is canonical. Reusing wrappedNativeCurrencyEth across multiple chains (MAINNET, ARBITRUM_ONE, BASE, SEPOLIA, POLYGON, AVALANCHE, LENS, PLASMA, LINEA) is the standard intentional pattern in the codebase—logo reuse via shared token metadata is by design. Checksumming is optional; LINEA follows the existing codebase convention of lowercase addresses (consistent with other entries and the logo URL path construction at line 103).

packages/config/src/chains/details/plasma.ts (2)

4-5: Light and dark logos point to the same file.

Both light and dark logo paths reference plasma-logo.svg. This works if the logo is theme-agnostic, but verify this is intentional. Linea uses separate light/dark variants.


29-46: All Plasma URLs are valid and accessible. No changes required.

Verification results:

  • RPC endpoint (https://rpc.plasma.to): Responds with HTTP 400 to GET requests (expected), but successfully processes JSON-RPC POST requests (verified with eth_chainId call returning valid response)
  • Docs (https://docs.plasma.to/): Returns HTTP 307 redirect with proper redirect location, content accessible
  • Website (https://www.plasma.to/): HTTP 200 ✓
  • Block Explorer (https://plasmascan.to/): HTTP 200 ✓
packages/config/src/chains/details/linea.ts (2)

1-5: LGTM!

Imports and logo paths are correctly configured with separate light/dark theme variants.


20-25: Based on my verification attempts, I was unable to access definitive information about the exact blockCreated value for multicall3 on Linea. While the curl attempt to the block explorer didn't extract the deployment block number in a parseable format, and web searches revealed references to Linea's multicall3 deployment without specific block data, I can note that the blockCreated value should be verified on the block explorer.

Review the multicall3 deployment block on Linea.

The value blockCreated: 42 appears unusually low. Verify this against the Linea block explorer at https://lineascan.build/address/0xca11bde05977b3631167028862be2a173976ca11 to confirm whether 42 is indeed the correct deployment block or if it requires adjustment.

@alfetopito alfetopito marked this pull request as ready for review November 5, 2025 09:10
@alfetopito alfetopito requested review from a team and shoom3301 and removed request for shoom3301 November 5, 2025 09:11
symbol: 'USDC',
},
[SupportedChainId.PLASMA]: {
// TODO: This is USDT, not USDC!!! Update if/when there's a USDC deployment on Plasma
Copy link
Contributor

Choose a reason for hiding this comment

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

👁🩸

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The assumptions on USDC are becoming dangerous. (as if they were not before)

@alfetopito alfetopito requested a review from shoom3301 November 5, 2025 14:06
@alfetopito alfetopito merged commit 2501382 into main Nov 5, 2025
9 checks passed
@alfetopito alfetopito deleted the feat/q4-chains branch November 5, 2025 15:39
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants