feat: add Ink chain support behind feature flag#11904
feat: add Ink chain support behind feature flag#11904gomesalexandre merged 16 commits intodevelopfrom
Conversation
Add Ink (EVM chainId 57073) as a second-class citizen with: - CAIP constants, types, and base asset definition - SecondClassEvmAdapter chain adapter - Relay swapper chain mapping - HDWallet support flags for all wallet implementations - Plugin, feature flag (VITE_FEATURE_INK), and CSP headers - Asset generation script and CoinGecko adapter - Viem/ethers client configuration - All required shared-file entries (chain gating, portfolio, markets, etc.) Part of #11902
|
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. 📝 WalkthroughWalkthroughAdds first-class Ink mainnet support (eip155:57073) across the app: CAIP constants, env/config, CSP, wallet capability flags, chain adapter and clients, asset generation, plugin registration, feature gating, transaction status utilities, and tests/manifest entries. Changes
Sequence Diagram(s)sequenceDiagram
participant App as App / PluginLoader
participant Plugin as Ink Plugin
participant Adapter as InkChainAdapter
participant Wallet as HDWallet (supportsInk)
participant Node as Ink Node (VITE_INK_NODE_URL)
participant AssetSvc as AssetService / Coingecko
rect rgba(90,90,255,0.5)
App->>Plugin: register plugin (feature flag Ink)
Plugin->>Adapter: construct adapter (rpcUrl, getKnownTokens)
end
rect rgba(90,200,90,0.5)
Wallet->>Adapter: request chain support (supportsInk)
Adapter->>Node: JSON-RPC (eth_getTransactionReceipt) / RPC calls
Node-->>Adapter: receipt / status
Adapter-->>Wallet: tx status / responses
end
rect rgba(255,150,50,0.5)
Adapter->>AssetSvc: getKnownTokens() -> filters assets by inkChainId
AssetSvc-->>Adapter: token list
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 |
Add src/lib/utils/ink.ts with getInkTransactionStatus using eth_getTransactionReceipt via the Ink RPC. Add KnownChainIds.InkMainnet case to useSendActionSubscriber.tsx so Ink transactions resolve in the action center. Update market-service coingecko test expected counts and ETH assetIds array to include Ink ETH (eip155:57073/slip44:60).
Address PR review feedback: - Add inkChainId to getCoingeckoSupportedChainIds (feature-flagged) - Add ink mapping to chainIdToAcrossChainId in Across swapper - Add ink to ZERION_CHAINS array and ZERION_CHAINS_MAP
|
Runtime tested locally with
|
Second round testing (after cache clear)Popular assets + market data now working correctly for Ink chain: https://jam.dev/c/59cfebe1-3f3a-422e-80a6-2c72240ba8d6 Previous round had stale cache causing "No results found" in popular assets and missing market data - both resolved after clearing browser cache. Ink tokens show up in popular with proper market data, search works, native asset visible. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gomesalexandre
left a comment
There was a problem hiding this comment.
Well, now that's a goer! https://jam.dev/c/11050322-0bcf-4ace-ac9e-150092db516b
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/hooks/useWalletSupportsChain/useWalletSupportsChain.ts`:
- Line 49: The import/use of supportsInk in useWalletSupportsChain.ts is invalid
because `@shapeshiftoss/hdwallet-core` doesn't export supportsInk or the
ETHWallet._supportsInk flag; either remove references to supportsInk from
useWalletSupportsChain (and any related checks) or add a proper
supportsInk(wallet) export in packages/hdwallet-core/src/wallet.ts and add
readonly _supportsInk: boolean to the ETHWallet interface so the pattern matches
supportsMonad (i.e., implement supportsInk function and the corresponding
_supportsInk flag in hdwallet-core before using supportsInk in
useWalletSupportsChain).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/context/WalletProvider/WalletConnectV2/config.ts (1)
52-65:⚠️ Potential issue | 🟡 MinorCorrect the module-scope feature flag check for
inkin WalletConnect optional chains.
walletConnectV2OptionalChainsunconditionally includesinkregardless ofVITE_FEATURE_INK. If a dApp issues an Ink request when the flag is disabled, the chain adapter won't exist and the request will fail silently. The suggested fix pattern should usegetConfig().VITE_FEATURE_INK(notgetFeatureFlag(), which is a React hook):Gate `ink` on the feature flag using getConfig()
export const walletConnectV2OptionalChains: AtLeastOneViemChain = (() => { const optionalViemChains: ViemChain[] = [ optimism, bsc, gnosis, polygon, avalanche, arbitrum, base, - ink, + ...(getConfig().VITE_FEATURE_INK ? [ink] : []), ] if (optionalViemChains.length === 0) throw new Error('Array must contain at least one element.') return optionalViemChains as AtLeastOneViemChain })()Mirror the same guard for the rpcMap entry:
rpcMap: { ... [CHAIN_REFERENCE.BaseMainnet]: VITE_BASE_NODE_URL, - [CHAIN_REFERENCE.InkMainnet]: VITE_INK_NODE_URL, + ...(getConfig().VITE_FEATURE_INK ? { [CHAIN_REFERENCE.InkMainnet]: VITE_INK_NODE_URL } : {}), },Note: Other second-class feature-flagged chains (Plasma, MegaEth, Scroll, Katana) are not included in WalletConnect at all, so this pattern applies only to Ink.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/context/WalletProvider/WalletConnectV2/config.ts` around lines 52 - 65, walletConnectV2OptionalChains currently always includes the ink chain; update the module-scope guard to check getConfig().VITE_FEATURE_INK before pushing ink into optionalViemChains (mirror the pattern used for other feature-gated chains), and apply the same getConfig().VITE_FEATURE_INK guard when adding the ink entry to rpcMap so WalletConnect only exposes ink when the feature flag is enabled; reference the const walletConnectV2OptionalChains, the ink symbol, rpcMap, and getConfig().VITE_FEATURE_INK when making the changes.
🧹 Nitpick comments (1)
packages/caip/src/adapters/coingecko/index.test.ts (1)
217-222: LGTM —usdcOnInkaddress and array ordering are correct.Circle's official announcement confirms the Ink USDC mainnet address is
0x2D270e6886d130D724215A266106e6832161EAEd, which matches the lowercase form used here (0x2d270e6886d130d724215a266106e6832161eaed) — consistent with the all-lowercase address style used for most entries in this test file.Optional: consider adding a
chainIdToCoingeckoAssetPlatformcoverage case for Ink.The
chainIdToCoingeckoAssetPlatformdescribe-block has no new case for the Ink chainId, even though the adapter presumably now mapseip155:57073toCoingeckoAssetPlatform.Ink. Adding a test case here would close that gap symmetrically with the other two tests:🧪 Suggested addition to the `chainIdToCoingeckoAssetPlatform` block
import { ASSET_REFERENCE, btcChainId, CHAIN_NAMESPACE, CHAIN_REFERENCE, ethChainId, foxOnArbitrumOneAssetId, + inkChainId, } from '../../constants'describe('chainIdToCoingeckoAssetPlatform', () => { it('can get CoinGecko asset platform from ChainId', () => { const chainId = ethChainId expect(chainIdToCoingeckoAssetPlatform(chainId)).toEqual(CoingeckoAssetPlatform.Ethereum) }) + it('can get CoinGecko asset platform for Ink', () => { + expect(chainIdToCoingeckoAssetPlatform(inkChainId)).toEqual(CoingeckoAssetPlatform.Ink) + }) + it('throws on invalid ChainId', () => {Also applies to: 238-238
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/caip/src/adapters/coingecko/index.test.ts` around lines 217 - 222, Add a test case to the chainIdToCoingeckoAssetPlatform describe-block that verifies the Ink chainId mapping: assert that the input "eip155:57073" (or the constant used for Ink chain id) maps to CoingeckoAssetPlatform.Ink; update the test suite in packages/caip/src/adapters/coingecko/index.test.ts near the other chainIdToCoingeckoAssetPlatform cases so the adapter's mapping is covered alongside existing EVM entries and uses the same assertion style as the other tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/context/WalletProvider/WalletConnectV2/config.ts`:
- Around line 52-65: walletConnectV2OptionalChains currently always includes the
ink chain; update the module-scope guard to check getConfig().VITE_FEATURE_INK
before pushing ink into optionalViemChains (mirror the pattern used for other
feature-gated chains), and apply the same getConfig().VITE_FEATURE_INK guard
when adding the ink entry to rpcMap so WalletConnect only exposes ink when the
feature flag is enabled; reference the const walletConnectV2OptionalChains, the
ink symbol, rpcMap, and getConfig().VITE_FEATURE_INK when making the changes.
---
Nitpick comments:
In `@packages/caip/src/adapters/coingecko/index.test.ts`:
- Around line 217-222: Add a test case to the chainIdToCoingeckoAssetPlatform
describe-block that verifies the Ink chainId mapping: assert that the input
"eip155:57073" (or the constant used for Ink chain id) maps to
CoingeckoAssetPlatform.Ink; update the test suite in
packages/caip/src/adapters/coingecko/index.test.ts near the other
chainIdToCoingeckoAssetPlatform cases so the adapter's mapping is covered
alongside existing EVM entries and uses the same assertion style as the other
tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Description
Add support for Ink (EVM chain, chainId 57073) as a second-class citizen. Ink is a Layer 2 scaling solution built on the OP Stack, providing fast and low-cost EVM transactions.
Implements: CAIP constants, chain adapter (SecondClassEvmAdapter), plugin, feature flag, Relay swapper mapping, HDWallet support flags, CSP headers, asset generation script, viem/ethers client configuration, and all required shared-file entries (chain gating, portfolio, markets, UI).
Issue (if applicable)
Part of #11902
Risk
Low - All changes are behind the
Inkfeature flag (VITE_FEATURE_INK), disabled by default in production.No new on-chain transactions or contract interactions. Standard EVM chain support using existing SecondClassEvmAdapter pattern (identical to MegaETH integration).
Testing
Engineering
VITE_FEATURE_INK=truein.env.developmentyarn devyarn lint— passes with 0 errorsyarn type-check— verify no new type errorsOperations
Screenshots (if applicable)
N/A - Behind feature flag, no visual changes until enabled.
Summary by CodeRabbit
New Features
Bug Fixes