Skip to content

Conversation

@enesozturk
Copy link
Contributor

@enesozturk enesozturk commented May 16, 2025

Description

When using Auth provider and switch network, our current business logic doesn't call the adapter.switchNetwork if the switched namespace is already connected. This causing issues while switching to different network than the namespace's last active network.

Reproduction steps

  • Active network is Ethereum on Appkit
  • Connect with auth
  • Switch to Solana
  • Sign message (and see on the sign message modal that secure site switched to Solana as expected)
  • Switch to any EVM network other than Ethereum
  • AppKit switching rapidly
  • Sign message with Wagmi
  • See that the secure site still on the Solana

Bc in this condition we don't call adapter.switchNetwork. This PR introduces changes to call it for proper network switching.

Additionally, adds a return to unsupported network logic on ChainController.switchActiveNetwork method where we are redirecting user to previous screen, but since we don't return the function, the code will be executed for the rest of the function body. We didn't came up with result of it but it's a possible issue.

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

For Linear issues: Closes APKT-2936
For GH issues: closes #...

Showcase (Optional)

Before:

Screen.Recording.2025-05-16.at.15.56.38.mov

After:

Screen.Recording.2025-05-16.at.17.38.38.mov

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

@linear
Copy link

linear bot commented May 16, 2025

@changeset-bot
Copy link

changeset-bot bot commented May 16, 2025

🦋 Changeset detected

Latest commit: ccc52c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@reown/appkit-controllers Patch
@reown/appkit Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-common Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-ui Patch
@reown/appkit-wallet Patch
@reown/appkit-wallet-button Patch

Not sure what this means? Click here to learn what changesets are.

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

@vercel
Copy link

vercel bot commented May 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 2:45pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 2:45pm
11 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-basic-ep ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-basic-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-basic-sign-client-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-basic-up-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-ethers5-bera ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-nansen-demo ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-vue-solana ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
ethereum-provider-wagmi-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
next-wagmi-solana-bitcoin-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm
vue-wagmi-example ⬜️ Ignored (Inspect) May 26, 2025 2:45pm

@github-actions
Copy link
Contributor

github-actions bot commented May 16, 2025

Warnings
⚠️ Changes were made to one or more package.json(s), but not to pnpm-lock.yaml
⚠️ File apps/laboratory/tests/multichain/multichain-ethers-solana-email.spec.ts contains a KEY or SECRET
⚠️ File apps/laboratory/tests/multichain/multichain-ethers5-solana-email.spec.ts contains a KEY or SECRET
⚠️ File apps/laboratory/tests/multichain/multichain-wagmi-solana-email.spec.ts contains a KEY or SECRET
⚠️ File apps/laboratory/tests/shared/pages/ModalPage.ts contains a KEY or SECRET
⚠️ File apps/laboratory/tests/smart-account.spec.ts contains a KEY or SECRET
⚠️ File packages/wallet/src/W3mFrameProvider.ts contains a KEY or SECRET
⚠️ File apps/laboratory/tests/email-default-account-types.spec.ts contains a KEY or SECRET
⚠️ Testing spec changed
⚠️ File apps/laboratory/tests/email-default-account-types.spec.ts contains a KEY or SECRET

Generated by 🚫 dangerJS against ccc52c8

@github-actions
Copy link
Contributor

github-actions bot commented May 16, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 76.43% 27247 / 35647
🔵 Statements 76.43% 27247 / 35647
🔵 Functions 68.16% 2312 / 3392
🔵 Branches 83.81% 5503 / 6566
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client/appkit.ts 51.89% 79.31% 85% 51.89% 67-81, 84-91, 94-110, 113-119, 124, 128, 134-137, 165-170, 177-180, 183-186, 189-196, 204-205, 212-213, 248-257, 260-262, 273-285, 287, 289-308, 310-324, 331-332, 348-355, 382-383, 387-474, 511-515, 537-538, 561-563, 571-572, 611-612, 169
packages/wallet/src/W3mFrameProvider.ts 48.67% 73.91% 49.35% 48.67% 65-68, 72-73, 81-87, 104-112, 132-140, 149-151, 160-162, 165-173, 177-189, 192-205, 208-220, 223-234, 237-252, 261-263, 275-277, 281-294, 297-306, 323-324, 333-335, 351-353, 369-371, 375-391, 394-405, 408-422, 435-437, 441-459, 462-481, 498-506, 510-518, 525-527, 535-537, 542-551, 557-561, 567-571, 576-577, 583-585, 589-590, 651-653, 655-659, 664-665, 680-690, 705-706, 718-722, 731-735, 738-268, 489-555
Generated in workflow #12117 for commit ccc52c8 by the Vitest Coverage Report Action

@enesozturk enesozturk requested a review from a team May 16, 2025 14:45
@enesozturk enesozturk changed the title feat: auth provider switch network while switching to another namespace fix: auth provider switch network while switching to another namespace May 16, 2025
@enesozturk enesozturk force-pushed the enes/apkt-2898-auth-provider-switching-namespace-doesnt-actually-switch branch from 1ead472 to 1d4a6a1 Compare May 20, 2025 15:52
@linear
Copy link

linear bot commented May 26, 2025

@enesozturk enesozturk added this pull request to the merge queue May 26, 2025
@tomiir tomiir removed this pull request from the merge queue due to a manual request May 26, 2025
@tomiir tomiir merged commit 5b26c53 into main May 26, 2025
39 checks passed
@tomiir tomiir deleted the enes/apkt-2898-auth-provider-switching-namespace-doesnt-actually-switch branch May 26, 2025 15:04
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.

4 participants