feat: abstract chain + addchain scaffolder#12186
feat: abstract chain + addchain scaffolder#12186gomesalexandre merged 10 commits intoshapeshift:developfrom
Conversation
- add Abstract (EVM chain ID 2741) as second-class EVM chain behind VITE_FEATURE_ABSTRACT flag - add scripts/addChain/ scaffolder to automate ~80% of second-class EVM chain integration points - Abstract integrates via Relay swapper with ~1-2s bridge/swap times - native asset: ETH, explorer: abscan.org, rpc: api.mainnet.abs.xyz scaffolder covers: - AST-based engine (typescript compiler API, zero new deps) for enum/object/array/switch insertions - chain config JSON schema (chains/abstract.json as reference) - codemods registry for ~50 insertion points across the codebase - append-only ordering (appendLineAfterLastPattern) to avoid merge conflicts - idempotency: safe to run twice Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Abstract (ABS, eip155:2741) as a second-class EVM chain across the repo: env/config, CAIP constants, chain adapter & plugin, viem/ethers clients, asset data and generation, CSP, HDWallet capability flags, WalletConnectV2 wiring, swapper mappings, feature flags, tests, and a new add-chain scaffolder. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI / User
participant Plugin as AbstractPlugin
participant AssetSvc as AssetService
participant Adapter as AbstractChainAdapter
participant Viem as ViemClient
participant Relay as RelaySwapper
UI->>Plugin: app boot -> register(VITE_ABSTRACT_NODE_URL)
Plugin->>AssetSvc: getKnownTokens(abstractChainId)
AssetSvc-->>Plugin: token list
Plugin->>Adapter: new ChainAdapter(rpcUrl, getKnownTokens)
Adapter->>Viem: createPublicClient(transport using VITE_ABSTRACT_NODE_URL + fallbacks)
UI->>Adapter: buildTx / requestQuote
Adapter->>Relay: request route (relayChainId 2741)
Relay-->>UI: route / quote
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
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 unit tests (beta)
📝 Coding Plan
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 7
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)
55-69:⚠️ Potential issue | 🟠 MajorGate Abstract in WalletConnect config too.
This now advertises chain 2741 in every WalletConnect session, even when the Abstract plugin is disabled. That makes dapps believe Abstract is supported and can route users into missing-adapter/request-handling paths instead of cleanly hiding the network.
💡 Minimal gating change
const { VITE_WALLET_CONNECT_WALLET_PROJECT_ID, VITE_AVALANCHE_NODE_URL, VITE_OPTIMISM_NODE_URL, VITE_BNBSMARTCHAIN_NODE_URL, VITE_POLYGON_NODE_URL, VITE_GNOSIS_NODE_URL, VITE_ETHEREUM_NODE_URL, VITE_ARBITRUM_NODE_URL, VITE_BASE_NODE_URL, VITE_INK_NODE_URL, VITE_FLOWEVM_NODE_URL, + VITE_FEATURE_ABSTRACT, VITE_ABSTRACT_NODE_URL, } = getConfig() export const walletConnectV2OptionalChains: AtLeastOneViemChain = (() => { const optionalViemChains: ViemChain[] = [ optimism, bsc, gnosis, polygon, avalanche, arbitrum, base, ink, flowEvmChain, sei, - abstract, + ...(VITE_FEATURE_ABSTRACT ? [abstract] : []), ] if (optionalViemChains.length === 0) throw new Error('Array must contain at least one element.') return optionalViemChains as AtLeastOneViemChain })() export const walletConnectV2ProviderConfig: EthereumProviderOptions = { ... rpcMap: { [CHAIN_REFERENCE.AvalancheCChain]: VITE_AVALANCHE_NODE_URL, [CHAIN_REFERENCE.OptimismMainnet]: VITE_OPTIMISM_NODE_URL, [CHAIN_REFERENCE.BnbSmartChainMainnet]: VITE_BNBSMARTCHAIN_NODE_URL, [CHAIN_REFERENCE.PolygonMainnet]: VITE_POLYGON_NODE_URL, [CHAIN_REFERENCE.GnosisMainnet]: VITE_GNOSIS_NODE_URL, [CHAIN_REFERENCE.EthereumMainnet]: VITE_ETHEREUM_NODE_URL, [CHAIN_REFERENCE.ArbitrumMainnet]: VITE_ARBITRUM_NODE_URL, [CHAIN_REFERENCE.BaseMainnet]: VITE_BASE_NODE_URL, [CHAIN_REFERENCE.InkMainnet]: VITE_INK_NODE_URL, [CHAIN_REFERENCE.FlowEvmMainnet]: VITE_FLOWEVM_NODE_URL, - [CHAIN_REFERENCE.AbstractMainnet]: VITE_ABSTRACT_NODE_URL, + ...(VITE_FEATURE_ABSTRACT + ? { [CHAIN_REFERENCE.AbstractMainnet]: VITE_ABSTRACT_NODE_URL } + : {}), }, }Also applies to: 80-93, 114-126
🤖 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 55 - 69, The arrays (notably walletConnectV2OptionalChains) currently always include the 'abstract' chain, causing WalletConnect sessions to advertise chain 2741 even when the Abstract plugin is disabled; change these static arrays to only include the 'abstract' ViemChain conditionally by checking a runtime feature flag/config (e.g., an existing enableAbstract or isAbstractPluginEnabled boolean) and pushing/concat-ing the abstract chain only when that flag is true; apply the same conditional inclusion to the other WalletConnect V2 chain arrays referenced in this diff so Abstract is advertised only when the plugin is enabled.
🧹 Nitpick comments (2)
packages/contracts/src/fallbackRpcUrls.ts (1)
34-34: Consider adding official or alternative RPC endpoints for better resilience.The Abstract chain currently has only one fallback URL. Multiple public RPC endpoints are available: the official
https://api.mainnet.abs.xyzand dRPC'shttps://abstract.drpc.org. Adding one or both would improve reliability if any single endpoint becomes unavailable.💡 Suggested improvement
- abstract: ['https://rpc.ankr.com/abstract'], + abstract: ['https://api.mainnet.abs.xyz', 'https://abstract.drpc.org'],🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/contracts/src/fallbackRpcUrls.ts` at line 34, The 'abstract' entry in the fallback RPC URLs array only contains a single endpoint; update the exported fallbackRpcUrls object so the 'abstract' key's array includes additional resilient endpoints (e.g., add "https://api.mainnet.abs.xyz" and/or "https://abstract.drpc.org") alongside the existing "https://rpc.ankr.com/abstract" in the file that defines fallbackRpcUrls (look for the 'abstract' property in fallbackRpcUrls.ts) so consumers will have multiple RPC options if one endpoint is down.package.json (1)
42-42: Usepnpm exec tsxfor consistency with other scripts.All other tsx-based scripts in this file use
pnpm exec tsx(e.g.,generate:chain,generate:asset-data,release). This script should follow the same pattern to ensure lockfile-pinned execution and consistency.Suggested change
- "add-chain": "npx tsx scripts/addChain/index.ts", + "add-chain": "pnpm exec tsx ./scripts/addChain/index.ts",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` at line 42, Update the add-chain package.json script to use the same invocation style as other tsx scripts: replace the current "add-chain" script that uses "npx tsx" with one that uses "pnpm exec tsx" so execution is lockfile-pinned and consistent with scripts like "generate:chain" and "release".
🤖 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/chain-adapters/src/types.ts`:
- Line 332: ChainSignTx is missing an entry for KnownChainIds.AbstractMainnet so
SignTx<KnownChainIds.AbstractMainnet> resolves to never; add a mapping for
KnownChainIds.AbstractMainnet to the appropriate signing type (e.g.,
evm.SignTxInput or whatever the repo uses for EVM-like chains) inside the
ChainSignTx union/map definition to mirror other chain-specific maps (like
ChainBuildTxInput and ChainSpecificAccount), updating the ChainSignTx type to
include [KnownChainIds.AbstractMainnet]: <appropriate sign type> so Abstract
chain signing works correctly.
In `@packages/hdwallet-walletconnectv2/src/walletconnectV2.ts`:
- Line 228: WalletConnectV2 advertises Abstract support via readonly
_supportsAbstract = true but WalletConnectV2WalletInfo.ethSupportsNetwork()
omits chainId 2741, causing ethSupportsNetwork (and
WalletConnectV2HDWallet.ethSupportsNetwork() which delegates to it) to reject
Abstract; fix by adding chainId 2741 to the supported chains/logic inside
WalletConnectV2WalletInfo.ethSupportsNetwork() so that it returns true for 2741
(and ensure WalletConnectV2HDWallet.ethSupportsNetwork() continues to delegate
to that updated method).
In `@scripts/addChain/codemods.ts`:
- Around line 24-30: wrap currently treats a false return from the codemod
function as 'skipped', which hides anchor-miss failures; change wrap (the
function wrap(file: string, operation: string, fn: () => boolean)) so that when
fn() returns true it still returns status 'inserted', but when fn() returns
false it returns status 'error' with a clear message like "anchor not found" (or
similar) instead of 'skipped'; preserve the existing catch branch for thrown
errors and keep the returned object shape { file, operation, status, message? }
so callers/consumers can detect and surface anchor-miss failures from wrap.
In `@scripts/addChain/engine.ts`:
- Around line 160-179: The idempotency check in addNamedImport is brittle
because it uses a raw file string/idempotencyKeyForImport(importName,
modulePath) and can false-skip or duplicate imports; update the logic to use the
TS AST: parseSource and locate the ImportDeclaration for modulePath
(targetImport), then inspect its importClause.namedBindings to determine if the
specific ImportSpecifier (importName) already exists (avoid relying on a global
string search). If no ImportDeclaration exists, generate a new import and use an
idempotency marker that uniquely ties modulePath+importName; if a targetImport
exists and lacks the specifier, mutate the ImportDeclaration to append a new
ImportSpecifier (use TS factory helpers or rebuild the namedBindings) instead of
string insertion so formatting/duplicates are handled correctly; remove or
narrow the current file-wide idempotency check and ensure
idempotencyKeyForImport is scoped to modulePath+importName.
In `@scripts/addChain/report.ts`:
- Around line 80-84: The report currently only logs errors but doesn't cause a
non-zero exit; after runAllCodemods returns results and you call
printReport(results, config) in the main() function (in
scripts/addChain/index.ts), check results for any entries with status ===
'error' (e.g., results.some(r => r.status === 'error')) and call process.exit(1)
when true so CI fails on codemod errors; update main() to perform this
post-report check and exit with code 1 on any error statuses.
In `@scripts/addChain/schema.ts`:
- Around line 93-99: Validate dependent fields and reject empty-string
addresses: when processing the chain config object (c) ensure that if
swappers.relay.supported === true then swappers.relay.relayChainId is present
and non-empty (throw a clear Error mentioning "swappers.relay.relayChainId" if
missing or falsy), and tighten wrappedNativeAddress validation to reject empty
strings (treat "" as invalid and only allow null or a non-empty string, throwing
an Error referencing "wrappedNativeAddress" otherwise). Apply the same stricter
checks in the other related block (lines analogous to 106-114) and use early
throws with descriptive messages so invalid configs fail fast.
In `@src/lib/account/evm.ts`:
- Line 186: Prefetching for chainIds[0] happens before the main loop and calls
adapter.getAddresses(), but for batch-capable wallets that don't support
Abstract this throws before the later check on abstractChainId can skip it;
modify the prefetch logic so it checks whether chainIds[0] === abstractChainId
and !supportsAbstract(wallet) (using the supportsAbstract helper and
abstractChainId symbol) and skip the prefetch in that case, or move that guard
earlier (before adapter.getAddresses is invoked) so account discovery quietly
skips Abstract chains instead of throwing.
---
Outside diff comments:
In `@src/context/WalletProvider/WalletConnectV2/config.ts`:
- Around line 55-69: The arrays (notably walletConnectV2OptionalChains)
currently always include the 'abstract' chain, causing WalletConnect sessions to
advertise chain 2741 even when the Abstract plugin is disabled; change these
static arrays to only include the 'abstract' ViemChain conditionally by checking
a runtime feature flag/config (e.g., an existing enableAbstract or
isAbstractPluginEnabled boolean) and pushing/concat-ing the abstract chain only
when that flag is true; apply the same conditional inclusion to the other
WalletConnect V2 chain arrays referenced in this diff so Abstract is advertised
only when the plugin is enabled.
---
Nitpick comments:
In `@package.json`:
- Line 42: Update the add-chain package.json script to use the same invocation
style as other tsx scripts: replace the current "add-chain" script that uses
"npx tsx" with one that uses "pnpm exec tsx" so execution is lockfile-pinned and
consistent with scripts like "generate:chain" and "release".
In `@packages/contracts/src/fallbackRpcUrls.ts`:
- Line 34: The 'abstract' entry in the fallback RPC URLs array only contains a
single endpoint; update the exported fallbackRpcUrls object so the 'abstract'
key's array includes additional resilient endpoints (e.g., add
"https://api.mainnet.abs.xyz" and/or "https://abstract.drpc.org") alongside the
existing "https://rpc.ankr.com/abstract" in the file that defines
fallbackRpcUrls (look for the 'abstract' property in fallbackRpcUrls.ts) so
consumers will have multiple RPC options if one endpoint is down.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 88a149ef-9a27-45cd-abbe-c3d239360f70
⛔ Files ignored due to path filters (9)
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 (73)
.env.env.developmentchains/abstract.jsone2e/fixtures/abstract-chain.yamlheaders/csps/chains/abstract.tsheaders/csps/index.tspackage.jsonpackages/caip/src/adapters/coingecko/index.tspackages/caip/src/adapters/coingecko/utils.tspackages/caip/src/constants.tspackages/chain-adapters/src/evm/EvmBaseAdapter.tspackages/chain-adapters/src/evm/abstract/AbstractChainAdapter.tspackages/chain-adapters/src/evm/abstract/index.tspackages/chain-adapters/src/evm/index.tspackages/chain-adapters/src/types.tspackages/contracts/src/ethersProviderSingleton.tspackages/contracts/src/fallbackRpcUrls.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/native-multichain.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/addChain/codemods.tsscripts/addChain/engine.tsscripts/addChain/index.tsscripts/addChain/report.tsscripts/addChain/schema.tsscripts/addChain/templates/assetGenerator.ts.tmplscripts/addChain/templates/chainAdapter.ts.tmplscripts/addChain/templates/chainAdapterIndex.ts.tmplscripts/addChain/templates/csp.ts.tmplscripts/addChain/templates/plugin.tsx.tmplscripts/generateAssetData/abstract/index.tsscripts/generateAssetData/coingecko.tsscripts/generateAssetData/generateAssetData.tsscripts/generateAssetData/generateRelatedAssetIndex/generateRelatedAssetIndex.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/lib/market-service/coingecko/coingecko.test.tssrc/pages/Markets/components/MarketsRow.tsxsrc/plugins/abstract/index.tsxsrc/plugins/activePlugins.tssrc/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
|
ser you're drunk @coderabbitai
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 4114
✏️ Learnings added
🧠 Learnings used |
- add AbstractMainnet to ChainSignTx (was missing, would resolve to never) - add chainId 2741 to WalletConnectV2 ethSupportsNetwork() - add process.exit(1) when scaffolder codemods have errors - validate wrappedNativeAddress non-empty string + relay requires relayChainId - use pnpm exec tsx instead of npx tsx for add-chain script - add more fallback RPC endpoints for Abstract (mainnet + drpc) - add eip155:2741 to coingecko utils parseData test (fixes failing CI) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
done @coderabbitai — addressed in the follow-up commit:
dismissing the wrap()/engine idempotency/evm.ts prefetch comments — wrap() already logs via console.warn on misses (surfaced to the user), addNamedImport idempotency key format is intentional, and the evm.ts prefetch uses ethGetAddresses which works for all EVM chains regardless of supportsAbstract |
|
Tip For best results, initiate chat on the files or code changes.
The dismissals also make sense:
🧠 Learnings usedIf you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
- add ChainSignTx (ETHSignTx type map) codemod — was missing, manual fix needed for abstract - add ethSupportsNetwork() chain ID codemod for walletconnectv2 — was missing, manual fix needed for abstract - rename mislabeled types-ChainSignTx → types-ChainSpecificBuildTxInput - add missing clearAssets migration 314 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 QA Automation ReportQABot Run: #59223faa ✅ Build Verification
|
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (1)
scripts/addChain/codemods.ts (1)
24-30:⚠️ Potential issue | 🟠 MajorDon't collapse anchor misses into
skipped.
wrap()still treats everyfalseas an idempotent no-op. That is already wrong for Lines 1020-1023, wherefalsemeans "couldn't find anyclearAssetsanchor". The report stays green andscripts/addChain/index.tsexits 0 even though the scaffold is incomplete.🩹 Suggested shape
-function wrap(file: string, operation: string, fn: () => boolean): CodemodResult { +function wrap( + file: string, + operation: string, + fn: () => 'inserted' | 'skipped', +): CodemodResult { try { - const changed = fn() - return { file, operation, status: changed ? 'inserted' : 'skipped' } + return { file, operation, status: fn() } } catch (err) { return { file, operation, status: 'error', message: String(err) } } }Then make anchor-miss paths throw instead of returning
false.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/addChain/codemods.ts` around lines 24 - 30, wrap() currently treats any falsy result from the codemod function as a benign 'skipped' and hides anchor-misses (e.g., missing clearAssets anchor reported from the codemod run around the clearAssets logic), so change the behavior so anchor-miss paths surface as errors: update the codemod functions that return false on "anchor not found" to throw a descriptive Error (e.g., "anchor clearAssets not found"), and update wrap(fn) to stop converting false into 'skipped' — let thrown errors propagate (or catch and return status: 'error' with the error message) so anchor misses produce error status instead of a green 'skipped'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/addChain/codemods.ts`:
- Around line 1529-1552: The scaffold currently decides to skip creation based
solely on adapterFile existence (variable adapterFile) which leaves index.ts
missing if a previous run failed; update the logic in codemods.ts to check both
the class file and the index file (the path used in the second writeFileSync
call) — if the directory doesn't exist create it, then individually ensure the
class file and the index.ts are created when absent (using the same
fill(tmpl(...), c) calls), and push appropriate results entries for each
artifact instead of a single skipped/inserted result so partial generation is
repaired on re-run.
- Around line 1101-1135: The current conditional branches that check
c.swappers.across.supported, c.swappers.portals.supported and
c.swappers.zerion.supported only add a named import (via addNamedImport) into
AcrossSwapper/constant.ts, PortalsSwapper/constants.ts and
packages/types/src/zerion.ts respectively, which leaves the swappers
functionally unsupported and produces unused imports; update each branch to also
scaffold the actual supported-chain constants and filters by adding the
SupportedChainIds structure (with sell and buy keys) into the swapper's
utils/constants.ts (or constants.ts) and update any supported-chain mappings or
network mappings used by the swappers so the import becomes used and the swapper
is truly enabled (ensure you follow the SupportedChainIds type pattern and
update sell/buy filters and any network mapping arrays referenced by the
swappers when adding ${c.camelName}ChainId).
- Around line 1017-1033: The code computes nextNum and the insertion anchor
using only clearAssets matches which can collide with later non-clearAssets
migrations; update the logic in the wrap callback (the function operating on
migrationsFile) to find the highest migration key by scanning all migration
entries (e.g. match /(\d+): \w+,/ or similar) to derive lastNum and nextNum,
then use that lastNum both to compute nextNum and as the regex anchor passed to
appendLineAfterPattern (instead of the last clearAssets match); keep the
existing use of appendLineAfterPattern and the surrounding wrap/migrationsFile
flow.
In `@scripts/addChain/index.ts`:
- Line 1: The first-line shebang is incorrect because env treats the rest as a
single program name; update the script's first-line shebang (the shebang on the
first line) to use argument-splitting (e.g., use env with -S) so the "npx tsx"
arguments are passed correctly, or remove the shebang altogether and
document/require running the script via `npx tsx scripts/addChain/index.ts`;
ensure the change replaces the existing shebang only.
---
Duplicate comments:
In `@scripts/addChain/codemods.ts`:
- Around line 24-30: wrap() currently treats any falsy result from the codemod
function as a benign 'skipped' and hides anchor-misses (e.g., missing
clearAssets anchor reported from the codemod run around the clearAssets logic),
so change the behavior so anchor-miss paths surface as errors: update the
codemod functions that return false on "anchor not found" to throw a descriptive
Error (e.g., "anchor clearAssets not found"), and update wrap(fn) to stop
converting false into 'skipped' — let thrown errors propagate (or catch and
return status: 'error' with the error message) so anchor misses produce error
status instead of a green 'skipped'.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ce2f8977-3842-47f6-8435-df25973624bf
📒 Files selected for processing (5)
packages/contracts/src/fallbackRpcUrls.tsscripts/addChain/codemods.tsscripts/addChain/index.tsscripts/addChain/schema.tssrc/state/migrations/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- scripts/addChain/schema.ts
- run generate:caip-adapters to create eip155_2741 adapter - add abstract to generated index.ts imports/exports - add ethOnAbstract to index.test.ts coingeckoToAssetIds expectation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- add usdcOnCelo (0xceba9300f2b948710d2653dd7b07f33a8b32118c) to coingeckoToAssetIds 'usd-coin' test — celo adapter regenerated with native USDC entry when generate:caip-adapters ran - fix shebang: #!/usr/bin/env npx tsx doesn't work on Linux (env treats 'npx tsx' as one arg); use -S to split args Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
addressing latest @coderabbitai comments: ethSupportsNetwork (walletconnectV2.ts) — done in prior commit, 2741 is already at line 139 process.exit(1) (report.ts) — done in prior commit schema.ts relay + wrappedNativeAddress guards — done in prior commit shebang (index.ts) — fixed to `#!/usr/bin/env -S npx tsx` in latest commit batch-prefetch ordering (evm.ts) — the prefetch gates on `wallet.ethGetAddresses` which works for any EVM-capable wallet regardless of `supportsAbstract`. All other second-class EVM chains use the identical pattern — dismissing. wrap() masking anchor misses — post-MVP. `false` from engine = skip, exception = error. The "anchor not found" vs "already present" distinction is a UX improvement but doesn't affect scaffold correctness — dismissing. addNamedImport() idempotency — post-MVP, catalogued for a follow-up hardening pass. migration key from highest entry — valid, post-MVP improvement. Across/Portals/Zerion supported branches — acknowledged, full integration per-swapper varies. Post-MVP when those swappers get Abstract support. partial adapter generation idempotency — post-MVP. |
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
🧠 Learnings used |
adapters are iterated in insertion order; celo adapter (eip155_42220) was added by regenerate:caip-adapters before sei, so celo comes first Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
abstract is isNativeEth:true — adds one more entry to findAll() results Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NeOMakinG
left a comment
There was a problem hiding this comment.
CI passing ✅
Code review notes:
- Abstract chain integration follows standard second-class EVM pattern
- Chain scaffolder is a valuable addition for future chain integrations
- Author tested end-to-end: bridge, swap, notifications, balance polling
- Feature flag (VITE_FEATURE_ABSTRACT) properly configured
Approved based on CI status and thorough PR description.
Description
Two things in one:
Abstract chain — adds Abstract (EVM, chain ID 2741, Pudgy Penguins' L2 on ZK Stack) as a second-class EVM chain behind
VITE_FEATURE_ABSTRACT. Native asset is ETH, swapper support via Relay (~1-2s bridge and on-chain swap times). Tested end-to-end: bridge in, on-chain DEX swap (ETH→USDT on Abstract), notification center, balance polling.scripts/addChain/scaffolder — automates ~80% of the second-class EVM chain integration points documented in.claude/contracts/second-class-evm-chain.md. Uses the TypeScript compiler API (zero new deps —typescriptalready installed) to locate insertion points via AST, then string-splices. Abstract is the reference config (chains/abstract.json).Usage:
npx tsx scripts/addChain/index.ts chains/<chain>.jsonScaffolder covers ~50 insertion points:
Append-only ordering via
appendLineAfterLastPatternso running the scaffolder for chain B always inserts after chain A — no merge conflicts. Idempotent: safe to run twice.Issue (if applicable)
closes #11980
Risk
Low — new chain behind feature flag, scaffolder is scripts-only (no runtime impact).
Testing
Engineering
VITE_FEATURE_ABSTRACT=truein.env.developmentpnpm run devScaffolder test:
npx tsx scripts/addChain/index.ts chains/abstract.json(idempotent — no-ops on already-applied entries)Operations
Screenshots (if applicable)
QA run (all 21 steps passed): https://qabot-kappa.vercel.app/runs/52fafd4b-483d-426f-aaa5-841c48c690cb
Summary by CodeRabbit
New Features
Chores
Tests