You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:
(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.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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:
Account Operations:
Provider execution
Utility Methods:
Updated Adapter Integration
Adapters now call ConnectionController methods directly instead of through client
Type of change
Associated Issues
Closes APKT-3837
Checklist
Note
Eliminates ConnectionControllerClient and moves account/connection and RPC ops into ConnectionController, refactoring adapters/UI/tests to call controllers directly.
ConnectionControllerClient
; shift connection, account sync, identity, balance, unit conversion, ENS, install checks, and RPC ops (request
,signMessage
,sendTransaction
,estimateGas
,writeContract
) intoConnectionController
.views → controllers → adapters
; drop client indirection fromAppKitBaseClient
andAppKit
.AdapterController
now stores adapters by namespace;ChainController.initialize
no longer accepts client; add helpers for approved networks and CAIP network lookup.ProviderController
; usenetworks
instead ofgetCaipNetworks()
; tighten error messages; minor WalletConnect wiring.networks
; adjustsignMessage
.BalanceUtil
usesConnectionController.request
and ERC-7811 paths;BlockchainApiController.fetchIdentity
simplified and safe.SmartSessionsController
usesConnectionController.request
for permissions.SendController
/SwapController
invokeConnectionController.updateBalance
andsendTransaction
.ConnectionController.connectWalletConnect
,disconnect
, anddisconnectConnector
directly; update multi-wallet flows.Written by Cursor Bugbot for commit 522553f. This will update automatically on new commits. Configure here.