Skip to content

ConnectKit 2.0: wagmi v3 upgrade with per-connector entry points - #514

Open
sammdec wants to merge 4 commits into
family:mainfrom
sammdec:wagmi-v3
Open

sammdec wants to merge 4 commits into
family:mainfrom
sammdec:wagmi-v3

Conversation

@sammdec

@sammdec sammdec commented Jul 26, 2026 •

Copy link
Copy Markdown

Summary

Upgrades ConnectKit to wagmi v3 (3.7.4) / latest viem 2.x (2.55.8) and adopts wagmi v3's connector model: connector SDKs become optional peer dependencies and connectors are added individually, so apps only install and bundle what they use.

Phase 1 — smallest-diff wagmi v3 compatibility (98b6cb0)

  • Peer deps: wagmi 3.x, react >=18; TypeScript 5.9.3; version → 2.0.0
  • All v2 hook call sites kept on their (deprecated but supported) v3 aliases — the useConnection/mutate rename is deferred to a follow-up chore
  • Per-connector subpath imports (wagmi/connectors/<name>) instead of the barrel, which drags porto's uninstalled optional SDK into bundler graphs
  • CoinbaseWalletParameters version generic removed (SDK v4-only); overrideIsMetaMask gone; coinbaseWalletPreference is object-form only
  • useBalance().formatted removed in wagmi 3 → local formatUnits
  • window.ethereum declared locally (no longer provided transitively)
  • @aave/account wagmi peer widened to 2.x || 3.x via yarn packageExtensions — needs a real release before ConnectKit 2.0 ships
  • viem deduped to a single instance (root resolution + TS 5.9 in all workspaces)

Phase 2 — individual connectors (73adf0c)

  • New entry points: connectkit/connectors/{coinbaseWallet,walletConnect,safe} (each isolates its SDK) plus dependency-free injected/metaMask/aaveAccount on the main entry
  • Factories return descriptors that getDefaultConfig hydrates with app-level context (appName/appIcon, walletConnectProjectId, …); factory options win; plain wagmi connectors mix in; descriptors may resolve to null (safe outside app frames, walletConnect without a project id — matching 1.x)
  • @coinbase/wallet-sdk, @walletconnect/ethereum-provider, @safe-global/* → optional peers; default connector set = Aave Account + MetaMask (injected)
  • useWalletConnectModal reads the WC factory from a registry populated by the walletConnect entry point (a static import would break SDK-less builds)
  • Multi-entry rollup build + exports/typesVersions maps; MIGRATION.md ships with the package; README + all examples migrated

Verification

  • Packed-tarball smoke tests: SDK-less app builds on the zero-dep defaults; walletConnect subpath builds with only the WC SDK installed
  • Built main entry's import graph contains no SDK connectors
  • connectkit, connectkit-next-siwe, vite, nextjs, nextjs-app, testbench all build (nextjs-siwe fails only on its pre-existing missing tailwindcss dep, broken on main)
  • Manual QA of live connect flows (WC QR, Coinbase, Safe iframe, SIWE) still to do in testbench

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

sammdec and others added 3 commits July 26, 2026 17:22
Phase 1 of the wagmi v3 migration — smallest diff to run on wagmi 3.7 /
viem 2.55. All v2 hook call sites are kept on their (deprecated but
still-exported) v3 aliases; renames to useConnection/mutate etc. are
deferred to a follow-up.

Breaking / notable changes:
- peerDependencies: wagmi 3.x, react/react-dom >=18 (wagmi 3 drops 17)
- wagmi 3 no longer bundles connector SDKs; declare
  @coinbase/wallet-sdk, @walletconnect/ethereum-provider and
  @safe-global/* as direct deps so getDefaultConfig stays
  batteries-included
- import connectors from per-connector entry points
  (wagmi/connectors/<name>) instead of the barrel — the barrel drags
  porto's uninstalled optional SDK into bundler module graphs
- coinbaseWallet: version generic removed from CoinbaseWalletParameters
  (SDK v4 only); overrideIsMetaMask option no longer exists;
  coinbaseWalletPreference is now object-form only
- useBalance no longer returns `formatted` — format via viem formatUnits
- declare window.ethereum locally (no longer provided transitively)
- widen @aave/account wagmi peer to 2.x || 3.x via packageExtensions
  until a release ships with the updated range
- dedupe viem to a single instance (root resolution + TS 5.9 bump in
  connectkit-next-siwe) to avoid duplicate-type errors
- examples: bump wagmi/viem/typescript, tsconfig target es5 -> ES2020
  (viem's ox requires ES2020+)

Verified: connectkit, connectkit-next-siwe, vite, nextjs, nextjs-app
and testbench all build. nextjs-siwe fails on a pre-existing missing
tailwindcss dep (broken on main, unrelated).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Phase 2 of the wagmi v3 migration — adopt wagmi's individual-connector
model so apps only install and bundle the connectors they use.

- New connectkit/connectors/* entry points: injected, metaMask,
  aaveAccount (dependency-free, also exported from the main entry) and
  coinbaseWallet, walletConnect, safe (each isolated in its own entry so
  their SDK never enters the bundle graph of apps that don't import it)
- Factories return a ConnectKitConnector descriptor that getDefaultConfig
  resolves with app-level context (appName/appIcon, walletConnectProjectId,
  coinbaseWalletPreference, aaveAccountOptions); factory options take
  precedence, plain wagmi CreateConnectorFn values pass through, and
  descriptors may resolve to null (safe outside app frames, walletConnect
  without a project id — both matching 1.x behavior)
- @coinbase/wallet-sdk, @walletconnect/ethereum-provider and
  @safe-global/* move from dependencies to optional peerDependencies
- getDefaultConfig's default connector set shrinks to the dependency-free
  connectors: aaveAccount + metaMask; walletConnectProjectId is now
  optional
- useWalletConnectModal gets the wagmi walletConnect factory from a
  registry populated by the walletConnect entry point instead of a static
  import (which would break SDK-less builds)
- Multi-entry rollup build (index + connectors/*) with exports map and
  typesVersions for node-resolution consumers
- Examples migrated to the explicit connectors API with SDKs added to
  their dependencies; MIGRATION.md added and shipped with the package

Verified: packed-tarball smoke tests (SDK-less app builds with defaults;
walletConnect subpath builds with only the WC SDK installed); built main
entry imports only zero-dependency connector modules; connectkit,
connectkit-next-siwe, vite, nextjs, nextjs-app and testbench all build
(nextjs-siwe still fails on its pre-existing missing tailwindcss dep).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds install + provider setup snippets, the per-connector opt-in
example (connectkit/connectors/*), and a link to the migration guide.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@sammdec is attempting to deploy a commit to the Aave Team on Vercel.

A member of the Team first needs to authorize it.

@coinbase/cdp-sdk pins axios@1.16.0 exactly, which carries one high and
several moderate advisories flagged by the dependency-review check.
Override via root resolutions, matching the repo's existing security
pins.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tkowalczyk pushed a commit to auditmos/tstack-on-cf-onchain that referenced this pull request Aug 7, 2026
Both majors stay frozen, with reasoning recorded rather than assumed:

- wagmi 3: ConnectKit's only release (1.9.2) peer-pins wagmi to 2.x.
  ConnectKit's wagmi-v3 upgrade is in progress upstream
  (family/connectkit#514) but unmerged, with manual QA outstanding and
  blocked on an upstream @aave/account release. Decision: stay on
  wagmi 2 + ConnectKit 1.9.2 until that ships.
- vite 8: every load-bearing plugin (@cloudflare/vite-plugin,
  @tanstack/react-start, vite-tsconfig-paths, @tailwindcss/vite,
  vitest) already supports vite 8 — except @vitejs/plugin-react's
  current major, which tops out at vite 7. Lifting the pin cleanly
  would require a second, unscoped @vitejs/plugin-react major bump.
  Decision: keep the pin; reason recorded next to it in vite.config.ts
  and in README's new Dependency Policy section.

Neither migration is executed here; both stay visible via the
majors-report tracked issue (#50) until the blocking dependency moves.

Closes #51

This branch has not been deployed

No deployments
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.

1 participant