feat: integrate Flow EVM (747) as second-class Relay chain#11938
feat: integrate Flow EVM (747) as second-class Relay chain#11938gomesalexandre merged 10 commits intodevelopfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR integrates Flow EVM (chainId: 747) as a new second-class EVM chain. Changes span environment configuration, CAIP constants, chain adapters, viem/ethers clients, feature flags, asset generation, plugin registration, and wallet capability declarations across the codebase. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This reverts commit 4bdc5fc.
…w-evm-relay # Conflicts: # .env # .env.development # headers/csps/index.ts # packages/caip/src/adapters/coingecko/generated/index.ts # packages/caip/src/adapters/coingecko/index.ts # packages/caip/src/adapters/coingecko/utils.test.ts # packages/caip/src/adapters/coingecko/utils.ts # packages/caip/src/constants.ts # packages/chain-adapters/src/evm/EvmBaseAdapter.ts # packages/chain-adapters/src/evm/index.ts # packages/chain-adapters/src/types.ts # packages/contracts/src/ethersProviderSingleton.ts # packages/contracts/src/viemClient.ts # packages/hdwallet-coinbase/src/coinbase.ts # packages/hdwallet-core/src/ethereum.ts # packages/hdwallet-core/src/wallet.ts # packages/hdwallet-gridplus/src/gridplus.ts # packages/hdwallet-keepkey/src/keepkey.ts # packages/hdwallet-ledger/src/ledger.ts # packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts # packages/hdwallet-native/src/ethereum.ts # packages/hdwallet-phantom/src/phantom.ts # packages/hdwallet-trezor/src/trezor.ts # packages/hdwallet-vultisig/src/vultisig.ts # packages/hdwallet-walletconnectv2/src/walletconnectV2.ts # packages/swapper/src/swappers/RelaySwapper/constant.ts # packages/swapper/src/swappers/RelaySwapper/utils/relayTokenToAssetId.ts # packages/types/src/base.ts # packages/types/src/zerion.ts # packages/utils/src/assetData/baseAssets.ts # packages/utils/src/assetData/getBaseAsset.ts # packages/utils/src/chainIdToFeeAssetId.ts # packages/utils/src/getAssetNamespaceFromChainId.ts # packages/utils/src/getChainShortName.ts # packages/utils/src/getNativeFeeAssetReference.ts # scripts/generateAssetData/coingecko.ts # scripts/generateAssetData/generateAssetData.ts # src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx # src/config.ts # src/constants/chains.ts # src/context/PluginProvider/PluginProvider.tsx # src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx # src/hooks/useWalletSupportsChain/useWalletSupportsChain.ts # src/lib/account/evm.ts # src/lib/asset-service/service/AssetService.ts # src/lib/coingecko/utils.ts # src/pages/Markets/components/MarketsRow.tsx # src/state/slices/opportunitiesSlice/mappings.ts # src/state/slices/portfolioSlice/utils/index.ts # src/state/slices/preferencesSlice/preferencesSlice.ts # src/test/mocks/store.ts
This reverts commit 0342c89.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.env.development (1)
64-64: Addressdotenv-linterkey ordering warnings.
VITE_FLOWEVM_NODE_URLshould be placed beforeVITE_GNOSIS_NODE_URL(F < G), andVITE_FEATURE_FLOWEVMbeforeVITE_FEATURE_INK(F < I), to match the alphabetical ordering expected by the linter.Also applies to: 124-124
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.env.development at line 64, Reorder the environment keys to satisfy dotenv-linter alphabetical rules: move VITE_FLOWEVM_NODE_URL so it appears before VITE_GNOSIS_NODE_URL and move VITE_FEATURE_FLOWEVM so it appears before VITE_FEATURE_INK; update the .env entries where these keys occur (including the second occurrence noted) so all VITE_* keys are in alphabetical order by key name.src/vite-env.d.ts (1)
73-73:VITE_FEATURE_FLOWEVMandVITE_FLOWEVM_NODE_URLare split across sections.Every other recent chain co-locates its feature flag and node URL (e.g., Mantle at lines 65–66, Ink at 67–68, Plume at 210–211). Here the feature flag landed in the upper "Feature flags" block (line 73) while the node URL landed in the lower "Unchained URLs and node URLs" block (line 212). No functional impact, but it breaks the visual grouping convention.
♻️ Proposed fix — move both to the same block
- readonly VITE_FEATURE_FLOWEVM: string readonly VITE_ZKSYNC_ERA_NODE_URL: string + readonly VITE_FEATURE_FLOWEVM: string + readonly VITE_FLOWEVM_NODE_URL: stringAnd remove the orphaned entry at line 212:
- readonly VITE_FLOWEVM_NODE_URL: string readonly VITE_WORLDCHAIN_NODE_URL: string🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/vite-env.d.ts` at line 73, The VITE_FEATURE_FLOWEVM declaration is in the "Feature flags" section while VITE_FLOWEVM_NODE_URL sits in the "Unchained URLs and node URLs" block, breaking visual grouping; move the VITE_FLOWEVM_NODE_URL entry so it sits alongside VITE_FEATURE_FLOWEVM in the "Feature flags" block (co-locate VITE_FEATURE_FLOWEVM and VITE_FLOWEVM_NODE_URL) and delete the duplicate/orphaned VITE_FLOWEVM_NODE_URL entry from the lower block (the one at line ~212) so there’s a single, co-located pair for FlowEVM.src/plugins/flowEvm/index.tsx (1)
22-36: Minor:fromAssetIdcalled twice per asset.
fromAssetIdis called once in.filter()(line 26) and again in.map()(line 31) for each matching asset. You could destructure once and reuse, but sincegetKnownTokensis a cold-path initialization and this matches other chain plugins, it's fine as-is.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/plugins/flowEvm/index.tsx` around lines 22 - 36, The getKnownTokens function calls fromAssetId(asset.assetId) twice per asset; change getKnownTokens so you compute and reuse the parsed asset id once per asset (e.g., call const parsed = fromAssetId(asset.assetId) inside the iteration) and use parsed.chainId and parsed.assetReference in both the filter condition and the mapped object (adjust the filter+map to a single loop or map that both tests chainId === flowEvmChainId && assetNamespace === 'erc20' and returns the object), updating references in getKnownTokens accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/contracts/src/viemClient.ts`:
- Around line 38-57: Remove the locally-defined flowEvm constant and instead
import flowMainnet from 'viem/chains'; replace all references to flowEvm in this
file (including where the viem client is configured and any chain mapping
objects) with flowMainnet so the client and mappings use the exported viem chain
object; ensure the import statement for flowMainnet is added at the top and the
flowEvm defineChain block and its identifier are deleted.
---
Nitpick comments:
In @.env.development:
- Line 64: Reorder the environment keys to satisfy dotenv-linter alphabetical
rules: move VITE_FLOWEVM_NODE_URL so it appears before VITE_GNOSIS_NODE_URL and
move VITE_FEATURE_FLOWEVM so it appears before VITE_FEATURE_INK; update the .env
entries where these keys occur (including the second occurrence noted) so all
VITE_* keys are in alphabetical order by key name.
In `@src/plugins/flowEvm/index.tsx`:
- Around line 22-36: The getKnownTokens function calls
fromAssetId(asset.assetId) twice per asset; change getKnownTokens so you compute
and reuse the parsed asset id once per asset (e.g., call const parsed =
fromAssetId(asset.assetId) inside the iteration) and use parsed.chainId and
parsed.assetReference in both the filter condition and the mapped object (adjust
the filter+map to a single loop or map that both tests chainId ===
flowEvmChainId && assetNamespace === 'erc20' and returns the object), updating
references in getKnownTokens accordingly.
In `@src/vite-env.d.ts`:
- Line 73: The VITE_FEATURE_FLOWEVM declaration is in the "Feature flags"
section while VITE_FLOWEVM_NODE_URL sits in the "Unchained URLs and node URLs"
block, breaking visual grouping; move the VITE_FLOWEVM_NODE_URL entry so it sits
alongside VITE_FEATURE_FLOWEVM in the "Feature flags" block (co-locate
VITE_FEATURE_FLOWEVM and VITE_FLOWEVM_NODE_URL) and delete the
duplicate/orphaned VITE_FLOWEVM_NODE_URL entry from the lower block (the one at
line ~212) so there’s a single, co-located pair for FlowEVM.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (11)
packages/caip/src/adapters/coingecko/generated/eip155_747/adapter.jsonis excluded by!**/generated/**packages/caip/src/adapters/coingecko/generated/index.tsis excluded by!**/generated/**public/generated/asset-manifest.jsonis excluded by!**/generated/**public/generated/asset-manifest.json.bris excluded by!**/generated/**public/generated/asset-manifest.json.gzis excluded by!**/*.gz,!**/generated/**public/generated/generatedAssetData.jsonis excluded by!**/generated/**public/generated/generatedAssetData.json.bris excluded by!**/generated/**public/generated/generatedAssetData.json.gzis excluded by!**/*.gz,!**/generated/**public/generated/relatedAssetIndex.jsonis excluded by!**/generated/**public/generated/relatedAssetIndex.json.bris excluded by!**/generated/**public/generated/relatedAssetIndex.json.gzis excluded by!**/*.gz,!**/generated/**
📒 Files selected for processing (61)
.beads/ss-dx5.20.json.env.env.development.env.productionheaders/csps/chains/flowEvm.tsheaders/csps/index.tspackages/caip/src/adapters/coingecko/index.test.tspackages/caip/src/adapters/coingecko/index.tspackages/caip/src/adapters/coingecko/utils.test.tspackages/caip/src/adapters/coingecko/utils.tspackages/caip/src/constants.tspackages/chain-adapters/src/evm/EvmBaseAdapter.tspackages/chain-adapters/src/evm/SecondClassEvmAdapter.tspackages/chain-adapters/src/evm/flowEvm/FlowEvmChainAdapter.tspackages/chain-adapters/src/evm/flowEvm/index.tspackages/chain-adapters/src/evm/index.tspackages/chain-adapters/src/types.tspackages/contracts/src/ethersProviderSingleton.tspackages/contracts/src/viemClient.tspackages/hdwallet-coinbase/src/coinbase.tspackages/hdwallet-core/src/ethereum.tspackages/hdwallet-core/src/wallet.tspackages/hdwallet-gridplus/src/gridplus.tspackages/hdwallet-keepkey/src/keepkey.tspackages/hdwallet-ledger/src/ledger.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-native/src/ethereum.tspackages/hdwallet-phantom/src/phantom.tspackages/hdwallet-trezor/src/trezor.tspackages/hdwallet-vultisig/src/vultisig.tspackages/hdwallet-walletconnectv2/src/walletconnectV2.tspackages/swapper/src/swappers/RelaySwapper/constant.tspackages/swapper/src/swappers/RelaySwapper/utils/relayTokenToAssetId.tspackages/types/src/base.tspackages/utils/src/assetData/baseAssets.tspackages/utils/src/assetData/getBaseAsset.tspackages/utils/src/chainIdToFeeAssetId.tspackages/utils/src/getAssetNamespaceFromChainId.tspackages/utils/src/getChainShortName.tspackages/utils/src/getNativeFeeAssetReference.tsscripts/generateAssetData/coingecko.tsscripts/generateAssetData/flowEvm/index.tsscripts/generateAssetData/generateAssetData.tssrc/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsxsrc/config.tssrc/constants/chains.tssrc/context/PluginProvider/PluginProvider.tsxsrc/context/WalletProvider/WalletConnectV2/config.tssrc/hooks/useWalletSupportsChain/useWalletSupportsChain.tssrc/lib/account/evm.tssrc/lib/asset-service/service/AssetService.tssrc/lib/coingecko/utils.tssrc/pages/Markets/components/MarketsRow.tsxsrc/plugins/activePlugins.tssrc/plugins/flowEvm/index.tsxsrc/state/migrations/index.tssrc/state/slices/opportunitiesSlice/mappings.tssrc/state/slices/portfolioSlice/utils/index.tssrc/state/slices/preferencesSlice/preferencesSlice.tssrc/test/mocks/store.tssrc/vite-env.d.ts
gomesalexandre
left a comment
There was a problem hiding this comment.
diff gucci, me happy, tbd testing of many evm chains in last PR
Description
Integrate Flow EVM (chainId: 747, CAIP:
eip155:747) as a second-class citizen EVM chain with Relay swapper support. Follows the exact pattern established by the Sonic chain integration.This is PR 14 of 17 in a sequential chain integration series. These PRs must be reviewed and merged in order, as each builds on the previous one (stacked branches).
PR merge order:
Chain Details:
eip155:747)flow-evmflow-evmflowMainnethttps://mainnet.evm.nodes.onflow.orghttps://evm.flowscan.io59 files changed across:
Issue (if applicable)
Risk
Low risk — all changes are behind the
FlowEvmfeature flag (disabled by default in production, enabled in development). No existing chains or transaction flows are affected.Testing
Engineering
VITE_FEATURE_FLOW_EVM=truein.envor.env.developmentyarn devOperations
Screenshots (if applicable)
N/A — no visual changes beyond chain appearing in existing UI when flag is enabled.
Summary by CodeRabbit
Release Notes