Skip to content

fix: open does not throw when attempting to switch network during send flow#4979

Merged
tomiir merged 5 commits intomainfrom
fix/throw-on-network-switch-failure
Sep 9, 2025
Merged

fix: open does not throw when attempting to switch network during send flow#4979
tomiir merged 5 commits intomainfrom
fix/throw-on-network-switch-failure

Conversation

@0xmkh
Copy link
Copy Markdown
Collaborator

@0xmkh 0xmkh commented Sep 9, 2025

Description

Fixed an issue where using the open function with send arguments and attempting to switch networks did not throw, causing the network state to become inconsistent

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-xxx
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

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

Copilot AI review requested due to automatic review settings September 9, 2025 10:15
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 9, 2025

🦋 Changeset detected

Latest commit: 42e14c6

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

This PR includes changesets to release 25 packages
Name Type
@reown/appkit-controllers Patch
@reown/appkit Patch
pay-test-exchange 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-codemod 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-testing Patch
@reown/appkit-ui Patch
@reown/appkit-universal-connector 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
Copy Markdown

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

Copy link
Copy Markdown
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 fixes a bug where using the open function with send arguments and attempting to switch networks did not throw errors, which could cause network state inconsistencies.

  • Added a throwIfFailedToSwitch parameter to the network switching flow
  • Modified switchActiveNetwork and switchNetwork methods to propagate errors when explicitly requested
  • Added test coverage to verify that network switching failures during send flow properly throw errors

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/controllers/src/controllers/ChainController.ts Added optional parameter to re-throw network switching errors
packages/appkit/src/client/appkit-base-client.ts Modified to pass error throwing flag during send flow network switches
packages/appkit/tests/client/appkit-base-client.test.ts Added test case to verify error throwing behavior during network switching
.changeset/khaki-chairs-start.md Changelog entry documenting the bug fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 9, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.28% 35245 / 45021
🔵 Statements 78.28% 35245 / 45021
🔵 Functions 75.91% 3870 / 5098
🔵 Branches 86.6% 8347 / 9638
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client/appkit-base-client.ts 72.87% 86.95% 76.52% 72.87% 197, 210-213, 216, 228-229, 235-236, 239, 248, 295-296, 342-343, 377-378, 380-381, 386-387, 468-469, 505-511, 576-577, 603-604, 607-608, 650-651, 654, 695-699, 706-707, 710-711, 722-745, 754-755, 772-784, 788-809, 812-818, 821-827, 830-836, 839-845, 848-858, 861-867, 870-876, 896-905, 908-914, 917-918, 921-922, 941-942, 966-1008, 1015-1027, 1033-1066, 1069-1079, 1131-1132, 1137, 1152-1168, 1182, 1186-1193, 1222-1223, 1260-1262, 1266-1279, 1284-1285, 1293-1294, 1296-1297, 1389-1390, 1402-1403, 1408, 1431-1436, 1479, 1500-1501, 1511, 1513-1529, 1534, 1579-1580, 1593-1604, 1650-1663, 1708, 1714-1718, 1737-1738, 1757-1760, 1796-1815, 1838-1849, 1878-1879, 1885-1911, 2121-2122, 2159-2160, 2163-2164, 2180-2183, 2186-2187, 2207-2208, 2211-2212, 2224-2234, 2252-2253, 2256-2263, 2267-2268, 2282, 2290, 2293, 2297, 2302-2321, 2324-2333, 2340-2341, 2355-2356, 2359-2360, 2367-2368, 2407-2408, 2491-2492, 2495-2496, 2499-2502, 2505-2506, 2509-2510, 2513-2514, 2517-2518, 2521-2525, 2534-2543, 2552-2563, 1277, 1845, 2304-2325
packages/controllers/src/controllers/ChainController.ts 74.91% 88.26% 74.72% 74.91% 183-194, 198-217, 221-231, 235-257, 279-280, 301-302, 390-397, 401-414, 424-425, 444-449, 463-464, 469-470, 473-474, 483-484, 489-490, 502-503, 525-528, 549-556, 564-565, 603-609, 622-623, 657-658, 692-712, 740-741, 776-778, 786-787, 105, 201, 738
Generated in workflow #14948 for commit 42e14c6 by the Vitest Coverage Report Action

@tomiir
Copy link
Copy Markdown
Collaborator

tomiir commented Sep 9, 2025

nit: I'd rename to throwOnFailure

cursor[bot]

This comment was marked as outdated.

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.

3 participants