Skip to content

Conversation

@magiziz
Copy link
Member

@magiziz magiziz commented Sep 10, 2025

Description

Fixed an issue where upon user connection rejection a CONNECT_ERROR event was logged. It now logs a new new event error called USER_REJECTED

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-3748

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 Copilot AI review requested due to automatic review settings September 10, 2025 13:17
@linear
Copy link

linear bot commented Sep 10, 2025

@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2025

🦋 Changeset detected

Latest commit: d4cd6d1

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-adapter-bitcoin Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-controllers Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit Patch
@reown/appkit-common Patch
pay-test-exchange Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills 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

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

@magiziz magiziz changed the title chore: avoid throwing CONNECT_ERROR when connection request is rejected fi: avoid throwing CONNECT_ERROR when connection request is rejected Sep 10, 2025
@magiziz magiziz changed the title fi: avoid throwing CONNECT_ERROR when connection request is rejected fix: avoid throwing CONNECT_ERROR when connection request is rejected Sep 10, 2025
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 fixes an issue where CONNECT_ERROR events were incorrectly logged when users rejected connection requests. It introduces a new USER_REJECTED event type to properly distinguish user rejections from actual connection errors.

  • Introduces new error handling utilities and UserRejectedRequestError class in the common package
  • Updates multiple connection flows to detect user rejection errors and emit USER_REJECTED events instead of CONNECT_ERROR
  • Adds comprehensive test coverage for the new error detection utilities

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/common/src/utils/ErrorUtil.ts New error utility with user rejection detection and error classes
packages/common/tests/ErrorUtil.test.ts Test coverage for new error utilities
packages/controllers/src/utils/withErrorBoundary.ts Enhanced AppKitError class to track original error names
packages/controllers/src/utils/TypeUtil.ts Added USER_REJECTED event type definition
packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts Updated error handling to emit USER_REJECTED for user rejections
packages/scaffold-ui/src/views/w3m-connecting-external-view/index.ts Updated error handling to emit USER_REJECTED for user rejections
packages/scaffold-ui/src/partials/w3m-connecting-wc-browser/index.ts Updated error handling to emit USER_REJECTED for user rejections
packages/appkit/src/utils/HelpersUtil.ts Added WalletConnect specific user rejection error detection
packages/appkit/src/adapters/ChainAdapterBlueprint.ts Enhanced connectWalletConnect with user rejection handling
packages/adapters/wagmi/src/client.ts Updated connect methods to throw UserRejectedRequestError for user rejections
packages/adapters/solana/src/providers/WalletStandardProvider.ts Updated connect to throw UserRejectedRequestError
packages/adapters/solana/src/providers/CoinbaseWalletProvider.ts Updated connect to throw UserRejectedRequestError
packages/adapters/ethers5/src/client.ts Wrapped connect method with user rejection error handling
packages/adapters/ethers/src/client.ts Wrapped connect method with user rejection error handling
packages/adapters/bitcoin/src/adapter.ts Updated connect to throw UserRejectedRequestError
.changeset/tall-sites-exist.md Changeset documenting the fix

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

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 10, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.27% 35363 / 45178
🔵 Statements 78.27% 35363 / 45178
🔵 Functions 76.01% 3882 / 5107
🔵 Branches 86.55% 8385 / 9687
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/bitcoin/src/adapter.ts 84.94% 84.78% 73.33% 84.94% 68-81, 84, 205-206, 294-295, 327-328, 340-341, 389-390, 446-449, 453-486, 490-491
packages/adapters/ethers/src/client.ts 64.43% 72.26% 68.57% 64.43% 56-57, 60-61, 68-70, 92-93, 107-110, 152-153, 184-185, 199-222, 235-271, 277-278, 285-302, 370-392, 395-400, 413-414, 424-445, 450-451, 476, 505-506, 515-516, 544-549, 568-614, 621-622, 644, 673-674, 685-686, 720-721, 725, 752-757, 766-784, 790-791, 800-801, 812-813, 819-831
packages/adapters/ethers5/src/client.ts 55.37% 71.42% 60% 55.37% 53-139, 155-156, 187-188, 202-225, 238-274, 280-281, 288-305, 373-395, 398-403, 416-417, 427-448, 453-454, 479, 508-509, 518-519, 547-552, 556-602, 624-625, 647, 676-677, 689-690, 727-728, 732, 751-765, 773-791, 797-798, 807-808, 819-820, 826-838
packages/adapters/solana/src/providers/CoinbaseWalletProvider.ts 67.36% 75% 64.28% 67.36% 56-57, 60-61, 76-78, 107-115, 122-123, 126-138, 145-146
packages/adapters/solana/src/providers/WalletStandardProvider.ts 70.31% 83.78% 59.09% 70.31% 79-82, 85-91, 94-95, 98-99, 102-109, 112-113, 128, 151-152, 170-171, 200-201, 209-217, 237-238, 251-252, 255-262, 274-275, 296-297, 306-312
packages/adapters/wagmi/src/client.ts 76.73% 65.21% 80.95% 76.73% 122-123, 128-129, 140-142, 144, 206-207, 247-250, 353-354, 368, 388-389, 464-465, 476-477, 512-513, 530-531, 545-562, 582-583, 596-605, 616-617, 621-622, 627-659, 676-685, 689-695, 698-709, 718-719, 730-731, 752-754, 768-769, 782-783, 798-799, 848-849, 861-862, 870-871, 876-877, 884-885, 893-894, 899-900, 909-910, 918-919, 924-925, 931-953, 956-969
packages/appkit/src/adapters/ChainAdapterBlueprint.ts 74.92% 90.47% 75.75% 74.92% 153-164, 246-247, 251-252, 275-279, 285-288, 318-319, 520-547, 575-580, 607-608, 621-649, 658-659, 558
packages/appkit/src/utils/HelpersUtil.ts 82.86% 93.87% 90.47% 82.86% 154-155, 214-217, 246, 265-266, 285, 294-297, 301, 324, 334-370, 393-399, 403-404
packages/common/index.ts 100% 100% 100% 100%
packages/common/src/utils/ErrorUtil.ts 95.23% 91.66% 100% 95.23% 60-61
packages/controllers/src/utils/withErrorBoundary.ts 91.48% 94.28% 100% 91.48% 46, 54-61, 81-85
packages/scaffold-ui/src/partials/w3m-connecting-wc-browser/index.ts 85.93% 50% 75% 85.93% 19-20, 43-44, 68-72
packages/scaffold-ui/src/views/w3m-connecting-external-view/index.ts 68.88% 68.18% 71.42% 68.88% 38-39, 63-73, 80-81, 99-109, 112-130, 181, 107
packages/scaffold-ui/src/views/w3m-connecting-wc-view/index.ts 71.27% 63.46% 66.66% 71.27% 59-60, 68, 77, 89-90, 99, 110-111, 140-141, 144-157, 173-174, 188-189, 197-198, 209, 213-216, 221, 225, 242, 246-260
Generated in workflow #14996 for commit d4cd6d1 by the Vitest Coverage Report Action

cursor[bot]

This comment was marked as outdated.

@magiziz magiziz added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit 2d27d48 Sep 11, 2025
58 of 61 checks passed
@magiziz magiziz deleted the chore/improve-user-rejection-error-event branch September 11, 2025 10:43
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 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