Skip to content

feat: add Ink chain support behind feature flag#11904

Merged
gomesalexandre merged 16 commits intodevelopfrom
feat/integrate-ink-relay
Feb 20, 2026
Merged

feat: add Ink chain support behind feature flag#11904
gomesalexandre merged 16 commits intodevelopfrom
feat/integrate-ink-relay

Conversation

@NeOMakinG
Copy link
Collaborator

@NeOMakinG NeOMakinG commented Feb 17, 2026

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 Ink feature 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).

No protocols, transaction types, wallets or contract interactions are affected until the feature flag is enabled.

Testing

Engineering

  1. Set VITE_FEATURE_INK=true in .env.development
  2. Run yarn dev
  3. Verify Ink appears in chain selector when feature flag is enabled
  4. Verify native ETH balance loads on Ink
  5. Verify Relay swap routes include Ink as source/destination chain
  6. Run yarn lint — passes with 0 errors
  7. Run yarn type-check — verify no new type errors

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

N/A - Behind feature flag, no visual changes until enabled.

Summary by CodeRabbit

  • New Features

    • Added user-facing support for the Ink blockchain: view/manage Ink-native ETH assets, accounts, and market data; integrated Ink with wallet providers and swaps.
    • Feature flag to enable/disable Ink support and a configurable Ink node URL for connectivity.
  • Bug Fixes

    • Improved indexing and asset mappings so Ink-native ETH variants appear correctly in searches and listings.

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
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

Warning

Rate limit exceeded

@gomesalexandre has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Environment & Headers
\.env, \.env.development, src/vite-env.d.ts, src/config.ts, headers/csps/chains/ink.ts, headers/csps/index.ts
Added VITE_INK_NODE_URL & VITE_FEATURE_INK, CSP for Ink node, and type/env validators.
CAIP & Core Types
packages/types/src/base.ts, packages/caip/src/constants.ts
Introduced InkMainnet constants and assetId/chainId entries and extended EVM type unions.
Chain Adapters & Clients
packages/chain-adapters/src/evm/EvmBaseAdapter.ts, packages/chain-adapters/src/evm/index.ts, packages/chain-adapters/src/evm/ink/*, packages/contracts/src/viemClient.ts, packages/contracts/src/ethersProviderSingleton.ts
New InkChainAdapter, EvmBaseAdapter wiring, viem/ethers clients and RPC wiring for Ink.
HD Wallets & Capability Guards
packages/hdwallet-core/src/{ethereum.ts,wallet.ts}, multiple packages/hdwallet-*/* files
Added _supportsInk flags across wallet implementations and supportsInk type guard.
Coingecko & Asset Parsing
packages/caip/src/adapters/coingecko/{index.ts,utils.ts,*.test.ts}
Added Ink as a Coingecko platform, parsing and platform↔chain mappings, and tests updated for new mappings.
Asset Data & Generation
packages/utils/src/assetData/baseAssets.ts, scripts/generateAssetData/{*,ink/*} , scripts/generateAssetData/generateRelatedAssetIndex/*
Declared Ink base asset, added ink asset generation module, merged ink assets into generated output, and added inkAssetId to related-asset index.
Swapper & Relay Mappings
packages/swapper/src/swappers/.../constant.ts, packages/swapper/src/swappers/RelaySwapper/utils/relayTokenToAssetId.ts
Mapped inkChainId to Across/Relay identifiers and resolved native token asset reference for Ink.
App Feature Flags & State
src/state/slices/preferencesSlice/preferencesSlice.ts, src/state/migrations/index.ts, src/test/mocks/store.ts, src/constants/chains.ts
Added Ink feature flag, migration entry, test mock flag, and gated chain listing/filtering behind the feature flag.
Hooks, Providers & Services
src/hooks/*, src/context/*, src/lib/*/ink.ts, src/lib/asset-service/service/AssetService.ts, src/lib/coingecko/utils.ts
Wired wallet support checks, transaction status polling for Ink (JSON‑RPC), WalletConnectV2 RPC config, asset filtering, and Coingecko supported chains.
UI & Plugins
src/components/TradeAssetSearch/*, src/pages/Markets/components/MarketsRow.tsx, src/plugins/activePlugins.ts, src/plugins/ink/index.tsx
Conditionally included Ink assets in UI queries, added Ink plugin registration exposing an Ink chain adapter and known-tokens provider.
Misc / Tests / Metadata
.beads/pr-context.jsonl, .beads/ss-dx5.2.json, various tests
Added project task/epic entries and updated tests to include Ink asset variants.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

high risk

Poem

🐰 I hopped through constants, flags, and code,
Planted Ink nodes down the new road,
Adapters, wallets, tokens in tow,
Assets and plugins now bloom and grow,
A carrot‑crumb trail where Ink streams flow. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: adding Ink chain support behind a feature flag. It is specific, directly related to the changeset, and conveys the primary objective without vagueness.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/integrate-ink-relay

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.

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
@gomes-bot
Copy link
Contributor

Runtime tested locally with VITE_FEATURE_INK=true, tested with native:

  • ✅ same chain ETH -> token happy, same chain token -> ETH happy
  • ✅ second class Tx history is happy for token receive and ETH receive
  • ✅ swap status detection is happy
  • ✅ second class balance updates happy
  • ✅ approvals are happy
  • ✅ execution price is happy
  • ✅ markets page shows Ink
  • 🚫 most tokens missing in trade to and need to search for them including ETH native asset
  • 🚫 market data doesn't seem to be working

https://jam.dev/c/62388624-0d39-489d-83e6-cf4a58a621c1

@gomes-bot
Copy link
Contributor

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.

@gomesalexandre gomesalexandre marked this pull request as ready for review February 19, 2026 16:24
@gomesalexandre gomesalexandre requested a review from a team as a code owner February 19, 2026 16:24
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

@gomesalexandre gomesalexandre enabled auto-merge (squash) February 19, 2026 16:30
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

🤖 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).

gomesalexandre and others added 2 commits February 19, 2026 17:32
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

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 | 🟡 Minor

Correct the module-scope feature flag check for ink in WalletConnect optional chains.

walletConnectV2OptionalChains unconditionally includes ink regardless of VITE_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 use getConfig().VITE_FEATURE_INK (not getFeatureFlag(), 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 — usdcOnInk address 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 chainIdToCoingeckoAssetPlatform coverage case for Ink.

The chainIdToCoingeckoAssetPlatform describe-block has no new case for the Ink chainId, even though the adapter presumably now maps eip155:57073 to CoingeckoAssetPlatform.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants