-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: SA version toggle #5326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: SA version toggle #5326
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
10 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a Smart Account Settings menu that allows users to toggle between Smart Account versions (v6/v7) and switch between account types (Smart Account/EOA). The implementation refactors existing account type switching functionality into a dedicated settings view.
Key Changes:
- Created new Smart Account Settings view with version toggle and account type switching
- Refactored account settings to navigate to the new dedicated settings view
- Added router configuration for the new settings view
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/scaffold-ui/src/views/w3m-smart-account-settings-view/index.ts |
New view component containing Smart Account version toggle and account type switching functionality |
packages/scaffold-ui/src/views/w3m-account-settings-view/index.ts |
Refactored to remove inline account type switching and navigate to dedicated settings view |
packages/scaffold-ui/src/partials/w3m-header/index.ts |
Added header title for Smart Account Settings view |
packages/scaffold-ui/src/modal/w3m-router/index.ts |
Added router case for Smart Account Settings view |
packages/scaffold-ui/exports/embedded-wallet.ts |
Exported new Smart Account Settings view |
packages/controllers/src/controllers/RouterController.ts |
Added SmartAccountSettings to router view type definitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| private isV6() { | ||
| const currentVersion = W3mFrameStorage.get('dapp_smart_account_version') || 'v6' |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default version 'v6' is hardcoded in multiple places. Consider extracting this as a constant (e.g., DEFAULT_SMART_ACCOUNT_VERSION) to ensure consistency and easier maintenance if the default changes.
| private toggleSmartAccountVersion() { | ||
| W3mFrameStorage.set('dapp_smart_account_version', this.isV6() ? 'v7' : 'v6') | ||
| if (typeof window !== 'undefined') { | ||
| window?.location?.reload() |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The optional chaining on window?.location?.reload() is redundant since the condition already checks that window is defined. Simplify to window.location.reload().
| window?.location?.reload() | |
| window.location.reload() |
|
|
||
| @state() private text = '' | ||
|
|
||
| @state() private network = ChainController.state.activeCaipNetwork |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Network state not subscribed, causing stale data usage
The component initializes this.network from ChainController.state.activeCaipNetwork but never subscribes to network changes. This means if the user switches networks while on the Smart Account Settings view, the component will continue using the stale network value. This can cause incorrect behavior in togglePreferredAccountTypeTemplate() and changePreferredAccountType() methods which rely on this.network?.chainNamespace. The component should subscribe to network changes in the constructor and unsubscribe in a disconnectedCallback() method, similar to how W3mAccountSettingsView handles it (lines 60-64 in w3m-account-settings-view/index.ts).
Visual Regression Test Results ✅ Passed✨ No visual changes detected Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=315 |
📦 Bundle Size Check✅ All bundles are within size limits 📊 View detailed bundle sizes> @reown/[email protected] size /home/runner/work/appkit/appkit > size-limit |
Description
Force Smart Account Versiontoggle which sets underlying storage and refreshes page to force smart account versionType of change
Checklist
Note
Introduces a dedicated Smart Account Settings view with preferred account toggle and a Force Smart Account Version control, wiring it into routing/header and updating tests and e2e helpers.
packages/scaffold-ui/src/views/w3m-smart-account-settings-viewwith:account-toggle-preferred-account-type).account-toggle-smart-account-version) persisting toW3mFrameStorageand reloading.w3m-account-settings-viewreplaces inline toggle with navigation buttonaccount-smart-account-settings-buttontoSmartAccountSettings.SmartAccountSettingsroute inRouterControllerand render inw3m-router.w3m-header.w3m-smart-account-settings-viewfromexports/embedded-wallet.ts.w3m-smart-account-settings-view.test.ts(preferred type + version toggle).w3m-account-settings-view.test.tsto navigate toSmartAccountSettings.clickSmartAccountSettingsButtonandgoBack.Written by Cursor Bugbot for commit 34c04d1. This will update automatically on new commits. Configure here.