Skip to content

Conversation

@tomiir
Copy link
Collaborator

@tomiir tomiir commented Nov 5, 2025

Description

  • Introduces Smart Account settings menu entry
  • Adds Force Smart Account Version toggle which sets underlying storage and refreshes page to force smart account version

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)

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

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.

  • UI:
    • New View: packages/scaffold-ui/src/views/w3m-smart-account-settings-view with:
      • Toggle preferred account type (account-toggle-preferred-account-type).
      • "Force Smart Account Version" toggle (account-toggle-smart-account-version) persisting to W3mFrameStorage and reloading.
    • Account Settings: w3m-account-settings-view replaces inline toggle with navigation button account-smart-account-settings-button to SmartAccountSettings.
    • Routing/Header:
      • Add SmartAccountSettings route in RouterController and render in w3m-router.
      • Add title mapping in w3m-header.
    • Exports: expose w3m-smart-account-settings-view from exports/embedded-wallet.ts.
  • Tests:
    • New tests: w3m-smart-account-settings-view.test.ts (preferred type + version toggle).
    • Updated w3m-account-settings-view.test.ts to navigate to SmartAccountSettings.
    • E2E: update specs to click smart account settings and use back navigation; add helpers clickSmartAccountSettingsButton and goBack.

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

Copilot AI review requested due to automatic review settings November 5, 2025 16:21
@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

⚠️ No Changeset found

Latest commit: 34c04d1

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

@vercel
Copy link

vercel bot commented Nov 5, 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 Nov 5, 2025 4:58pm
appkit-demo Ready Ready Preview Comment Nov 5, 2025 4:58pm
appkit-gallery Ready Ready Preview Comment Nov 5, 2025 4:58pm
appkit-laboratory Ready Ready Preview Comment Nov 5, 2025 4:58pm
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Nov 5, 2025 4:58pm
appkit-basic-sign-client-example Ignored Ignored Nov 5, 2025 4:58pm
appkit-basic-up-example Ignored Ignored Nov 5, 2025 4:58pm
appkit-ethers5-bera Ignored Ignored Nov 5, 2025 4:58pm
appkit-nansen-demo Ignored Ignored Nov 5, 2025 4:58pm
appkit-vue-solana Ignored Ignored Nov 5, 2025 4:58pm
appkit-wagmi-cdn-example Ignored Ignored Nov 5, 2025 4:58pm
ethereum-provider-wagmi-example Ignored Ignored Nov 5, 2025 4:58pm
next-wagmi-solana-bitcoin-example Ignored Ignored Nov 5, 2025 4:58pm
vue-wagmi-example Ignored Ignored Nov 5, 2025 4:58pm

Copy link
Contributor

Copilot AI left a 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'
Copy link

Copilot AI Nov 5, 2025

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.

Copilot uses AI. Check for mistakes.
private toggleSmartAccountVersion() {
W3mFrameStorage.set('dapp_smart_account_version', this.isV6() ? 'v7' : 'v6')
if (typeof window !== 'undefined') {
window?.location?.reload()
Copy link

Copilot AI Nov 5, 2025

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().

Suggested change
window?.location?.reload()
window.location.reload()

Copilot uses AI. Check for mistakes.

@state() private text = ''

@state() private network = ChainController.state.activeCaipNetwork
Copy link

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).

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Visual Regression Test Results ✅ Passed

✨ No visual changes detected

Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=315
Storybook Preview: https://6493191bf4b10fed8ca7353f-beumwbmbfi.chromatic.com/

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/[email protected] size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         70.59 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 1.4 s    on Snapdragon 410
Total time:   2.8 s
@reown/appkit/react
Size limit:   230 kB
Size:         227.18 kB with all dependencies, minified and gzipped
Loading time: 4.5 s     on slow 3G
Running time: 3 s       on Snapdragon 410
Total time:   7.4 s
@reown/appkit/vue
Size limit:   80 kB
Size:         70.59 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 1.5 s    on Snapdragon 410
Total time:   2.8 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         207.22 kB with all dependencies, minified and gzipped
Loading time: 4.1 s     on slow 3G
Running time: 2 s       on Snapdragon 410
Total time:   6 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.15 kB with all dependencies, minified and gzipped
Loading time: 257 ms   on slow 3G
Running time: 269 ms   on Snapdragon 410
Total time:   526 ms

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.9% 38046 / 47616
🔵 Statements 79.9% 38046 / 47616
🔵 Functions 77.95% 4110 / 5272
🔵 Branches 86.47% 9216 / 10658
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/controllers/src/controllers/RouterController.ts 71.42% 80% 70.58% 71.42% 149-154, 156-158, 160-162, 215, 229-230, 235-246, 251-257, 261-266
packages/scaffold-ui/exports/embedded-wallet.ts 100% 100% 100% 100%
packages/scaffold-ui/src/modal/w3m-router/index.ts 63.41% 15.94% 83.33% 63.41% 50, 62, 66, 70, 72, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 54
packages/scaffold-ui/src/partials/w3m-header/index.ts 91.59% 85.71% 77.77% 91.59% 41, 157-158, 296-300, 303-308, 175-292
packages/scaffold-ui/src/views/w3m-account-settings-view/index.ts 87.07% 83.78% 86.66% 87.07% 53-57, 60-62, 65, 72-73, 216-217, 273-278, 145-244
packages/scaffold-ui/src/views/w3m-smart-account-settings-view/index.ts 88.46% 61.9% 88.88% 88.46% 78, 100, 102, 106-107, 114, 31-92
Generated in workflow #16221 for commit 34c04d1 by the Vitest Coverage Report Action

@tomiir tomiir merged commit b67ac95 into main Nov 5, 2025
44 checks passed
@tomiir tomiir deleted the feat/sa-version-toggle branch November 5, 2025 17:14
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants