Skip to content

Conversation

tomiir
Copy link
Collaborator

@tomiir tomiir commented Sep 25, 2025

Description

Overview

This PR implements a significant architectural refactoring that moves account-related logic from AppKitBaseClient to ConnectionController and completely removes the connectionControllerClient abstraction layer. This change aligns with the AppKit stability improvements initiative and moves us closer to atomic state management.

🎯 Motivation

As outlined in the AppKit Refactor POC Findings & Recommendations, the current architecture has several issues:
Circular Dependencies: Controllers have circular deps through client abstractions
Tangled State: Multiple cross-controller dependencies make atomic updates impossible
Blurry Boundaries: State responsibilities are unclear between controllers
Proxy Pattern Anti-pattern: connectionControllerClient acts as unnecessary middleware

🔄 Changes Made

✅ Removed connectionControllerClient Completely

  • Eliminated the client abstraction layer that was creating circular dependencies
  • Direct controller-to-controller communication replaces client-mediated calls
  • Simplified the call chain: views → controllers → adapters (instead of views → controllers → client → adapters)

🏗️ Moved Account Logic to ConnectionController

The following methods were moved from AppKitBaseClient to ConnectionController:

Connection Management Methods:

  • connectExternal() - External wallet connection logic
  • reconnectExternal() - Reconnection handling
  • disconnect() - Disconnection flows
  • switchConnection() - Multi-wallet connection switching

Account Operations:

  • syncAccount() - Account synchronization
  • syncIdentity() - Identity/ENS resolution
  • updateBalance() - Balance updates

Provider execution

  • signMessage() - Message signing functionality
  • sendTransaction() - Transaction sending
  • estimateGas() - Gas estimation
  • writeContract() - Smart contract interactions
  • (new) request() - Generic RPC request. Removed specific namespace requests

Utility Methods:

  • parseUnits() / formatUnits() - Unit conversion utilities
  • getEnsAddress() / getEnsAvatar() - ENS resolution
  • checkInstalled() - Wallet installation checks

Updated Adapter Integration

Adapters now call ConnectionController methods directly instead of through client

  • Removed adapter dependency on connectionControllerClient
  • Simplified adapter initialization and connection flows

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

Closes APKT-3837

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Note

Eliminates ConnectionControllerClient and moves account/connection and RPC ops into ConnectionController, refactoring adapters/UI/tests to call controllers directly.

  • Core/Architecture
    • Remove ConnectionControllerClient; shift connection, account sync, identity, balance, unit conversion, ENS, install checks, and RPC ops (request, signMessage, sendTransaction, estimateGas, writeContract) into ConnectionController.
    • Simplify flow to views → controllers → adapters; drop client indirection from AppKitBaseClient and AppKit.
    • AdapterController now stores adapters by namespace; ChainController.initialize no longer accepts client; add helpers for approved networks and CAIP network lookup.
  • Adapters
    • Bitcoin/Ethers/Ethers5/Solana/Wagmi: stop passing providers via params; fetch via ProviderController; use networks instead of getCaipNetworks(); tighten error messages; minor WalletConnect wiring.
    • UniversalAdapter: use internal provider and networks; adjust signMessage.
  • Controllers/Utils
    • BalanceUtil uses ConnectionController.request and ERC-7811 paths; BlockchainApiController.fetchIdentity simplified and safe.
    • SmartSessionsController uses ConnectionController.request for permissions.
    • SendController/SwapController invoke ConnectionController.updateBalance and sendTransaction.
  • UI
    • Views/widgets call ConnectionController.connectWalletConnect, disconnect, and disconnectConnector directly; update multi-wallet flows.
  • Tests
    • Remove client references; update mocks to new controller methods and adapter construction.
  • Misc
    • Minor Next/env formatting; lockfile resolver tweaks.

Written by Cursor Bugbot for commit 522553f. This will update automatically on new commits. Configure here.

Copy link

linear bot commented Sep 25, 2025

Copy link

changeset-bot bot commented Sep 25, 2025

⚠️ No Changeset found

Latest commit: 522553f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Oct 2, 2025 2:05pm
appkit-demo Ready Ready Preview Comment Oct 2, 2025 2:05pm
appkit-gallery Ready Ready Preview Comment Oct 2, 2025 2:05pm
appkit-laboratory Ready Ready Preview Oct 2, 2025 2:05pm
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Oct 2, 2025 2:05pm
appkit-basic-sign-client-example Ignored Ignored Oct 2, 2025 2:05pm
appkit-basic-up-example Ignored Ignored Oct 2, 2025 2:05pm
appkit-ethers5-bera Ignored Ignored Oct 2, 2025 2:05pm
appkit-nansen-demo Ignored Ignored Oct 2, 2025 2:05pm
appkit-vue-solana Ignored Ignored Oct 2, 2025 2:05pm
appkit-wagmi-cdn-example Ignored Ignored Oct 2, 2025 2:05pm
ethereum-provider-wagmi-example Ignored Ignored Oct 2, 2025 2:05pm
next-wagmi-solana-bitcoin-example Ignored Ignored Oct 2, 2025 2:05pm
vue-wagmi-example Ignored Ignored Oct 2, 2025 2:05pm

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

socket-security bot commented Oct 2, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​wagmi/​vue@​0.2.11871007797100
Addedvite@​6.3.6961008399100
Addedvite@​5.4.20961008399100

View full report

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