Skip to content

chore: always send initialize event and add chainId to CONNECT_SUCCESS and CONNECT_SOCIAL_SUCCESS#4609

Merged
tomiir merged 15 commits intomainfrom
feat/chainId-in-events
Jul 8, 2025
Merged

chore: always send initialize event and add chainId to CONNECT_SUCCESS and CONNECT_SOCIAL_SUCCESS#4609
tomiir merged 15 commits intomainfrom
feat/chainId-in-events

Conversation

@tomiir
Copy link
Copy Markdown
Collaborator

@tomiir tomiir commented Jul 4, 2025

Description

  • Always sends INITIALIZE event
  • Adds chainId to CONNECT_SUCCESS and CONNECT_SOCIAL_SUCCESS

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

Closes APKT-3037

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
Copy Markdown

linear bot commented Jul 4, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 4, 2025

🦋 Changeset detected

Latest commit: f9cafed

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

This PR includes changesets to release 23 packages
Name Type
@reown/appkit-controllers Patch
@reown/appkit-scaffold-ui 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-codemod Patch
@reown/appkit-common 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-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 Jul 4, 2025

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

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

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 4, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.77% 30698 / 39469
🔵 Statements 77.77% 30698 / 39469
🔵 Functions 68.8% 2528 / 3674
🔵 Branches 84.26% 6390 / 7583
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client/appkit.ts 45.97% 79.38% 84.61% 45.97% 69-129, 132-146, 149-156, 159-175, 178-190, 195-205, 211-212, 237-238, 245-246, 259-282, 290-302, 304, 306-328, 330-344, 369-375, 391, 412-413, 418-419, 434-518, 555-559, 581-582, 605-607, 615-616, 655-656, 326
packages/controllers/src/controllers/ConnectionController.ts 80.83% 80.2% 52.87% 80.83% 162, 217-221, 224-228, 257-261, 269-270, 277-296, 303, 311, 315, 319, 323, 327, 331, 335, 339, 370-371, 374-375, 411, 415, 449-451, 462-463, 498-499, 509-510, 512-513, 521-522, 524-525, 531-543, 384
packages/controllers/src/controllers/EventsController.ts 100% 100% 85.71% 100%
packages/controllers/src/utils/ConnectorControllerUtil.ts 18.36% 88.88% 33.33% 18.36% 73-74, 94-107, 110-285, 288-318, 321-361, 364-370, 186
packages/scaffold-ui/src/partials/w3m-connecting-wc-browser/index.ts 92.15% 61.53% 75% 92.15% 18-19, 38-39
packages/scaffold-ui/src/views/w3m-connecting-external-view/index.ts 73.6% 71.42% 71.42% 73.6% 34-35, 58-68, 75-76, 94-105, 108-114, 165, 103
packages/scaffold-ui/src/views/w3m-connecting-farcaster-view/index.ts 75.97% 88.88% 66.66% 75.97% 60-63, 66-68, 71, 80-83, 95-96, 122, 155, 159-188, 248-260, 285, 299, 308-316
packages/scaffold-ui/src/views/w3m-connecting-social-view/index.ts 81.17% 64.7% 62.5% 81.17% 65-68, 74-75, 77-78, 81, 142, 223-235, 241-248, 192
packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts 72.54% 63.63% 50% 72.54% 34-35, 57-63, 67-71
Generated in workflow #13268 for commit f9cafed by the Vitest Coverage Report Action

@cursor
Copy link
Copy Markdown

cursor bot commented Jul 4, 2025

🚨 BugBot couldn't run

Something went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_a013a690-1e1e-442e-b2ac-51c54615291d).

@tomiir tomiir enabled auto-merge July 8, 2025 02:43
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Undefined Cast Violates Event Property Contracts

The expression ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId can result in undefined being cast to CaipNetworkId. This violates type contracts for event properties (e.g., chainId), which expect a non-nullable CaipNetworkId, potentially causing runtime errors in downstream consumers. This unsafe pattern is repeated in multiple event dispatches.

packages/scaffold-ui/src/views/w3m-email-verify-otp-view/index.ts#L43-L44

name: this.authConnector.name || 'Unknown',
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

packages/controllers/src/utils/ConnectorControllerUtil.ts#L187-L192

event: 'SOCIAL_LOGIN_SUCCESS',
properties: {
provider: socialProvider,
chainId: ChainController.getActiveCaipNetwork()
?.caipNetworkId as CaipNetworkId
}

packages/controllers/src/controllers/ConnectionController.ts#L383-L384

name: RouterController.state.data?.wallet?.name || 'Unknown',
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

packages/scaffold-ui/src/partials/w3m-connecting-wc-browser/index.ts#L56-L57

name: this.wallet?.name || 'Unknown',
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

packages/appkit/src/client/appkit.ts#L324-L325

provider: socialProviderToConnect,
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

packages/scaffold-ui/src/views/w3m-connecting-social-view/index.ts#L191-L192

provider: this.socialProvider,
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

packages/scaffold-ui/src/views/w3m-connecting-farcaster-view/index.ts#L222-L223

provider: this.socialProvider,
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

packages/scaffold-ui/src/views/w3m-connecting-external-view/index.ts#L101-L102

name: this.connector.name || 'Unknown',
chainId: ChainController.getActiveCaipNetwork()?.caipNetworkId as CaipNetworkId

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Copy Markdown
Contributor

@enesozturk enesozturk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments 🙏🏽

@tomiir tomiir removed this pull request from the merge queue due to a manual request Jul 8, 2025
@tomiir tomiir added this pull request to the merge queue Jul 8, 2025
@tomiir tomiir removed this pull request from the merge queue due to a manual request Jul 8, 2025
@tomiir tomiir merged commit c3e42fa into main Jul 8, 2025
17 of 21 checks passed
@tomiir tomiir deleted the feat/chainId-in-events branch July 8, 2025 22:42
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