feat: expose approved CAIP network IDs in useAppKitNetwork - #5570
Conversation
Surface WalletConnect session-approved networks through the useAppKitNetwork hook across React, Vue, and vanilla JS. Adds approvedCaipNetworkIds and supportsAllNetworks fields so developers can check which networks a connected wallet supports without accessing internal controllers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 751d591 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
9 Skipped Deployments
|
Visual Regression Test Results ✅ PassedChromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=813 👉 Please review the visual changes in Chromatic and accept or reject them. |
There was a problem hiding this comment.
Pull request overview
This PR exposes WalletConnect session-approved CAIP network IDs through the useAppKitNetwork hook by adding approvedCaipNetworkIds: CaipNetworkId[] | undefined and supportsAllNetworks: boolean to UseAppKitNetworkReturn. These fields reflect per-chain network state already tracked in ChainController, making it available through public-facing hooks and subscription APIs.
Changes:
- Extended
UseAppKitNetworkReturntype with two new fields and updated the ReactuseAppKitNetworkCoreto read them fromChainControllerstate. - Updated the Vue (
vue.tsandvue-core.ts)useAppKitNetworkhooks with a secondsubscribeChainPropsubscription for reactive updates. - Extended
subscribeNetworkinAppKitBaseClientto include the new fields in the callback payload.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/controllers/src/utils/TypeUtil.ts |
Adds approvedCaipNetworkIds and supportsAllNetworks to UseAppKitNetworkReturn |
packages/controllers/exports/react.ts |
Updates useAppKitNetworkCore to read new fields from ChainController state snapshot |
packages/appkit/exports/react.ts |
Passes new fields through useAppKitNetwork |
packages/appkit/exports/react-core.ts |
Same as react.ts for the core variant |
packages/appkit/exports/vue.ts |
Adds initial read and subscribeChainProp subscription for reactive updates |
packages/appkit/exports/vue-core.ts |
Same as vue.ts for the core variant |
packages/appkit/src/client/appkit-base-client.ts |
Includes new fields in the subscribeNetwork callback |
packages/controllers/tests/hooks/react.test.ts |
Adds test cases for the two new fields in both active and no-chain scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Bundle Size Check✅ All bundles are within size limits 📊 View detailed bundle sizes> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit > size-limit |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
When activeCaipNetwork changes (namespace switch), also read the new active chain's networkState so approvedCaipNetworkIds and supportsAllNetworks don't stay stale from the previous namespace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
useAppKitNetworkhookapprovedCaipNetworkIds(CaipNetworkId[] | undefined) andsupportsAllNetworks(boolean) toUseAppKitNetworkReturnsubscribeNetwork) entry pointsBehavior by connection type
approvedCaipNetworkIdssupportsAllNetworksundefinedtruefalsetrue(special case)undefinedtrueUsage
Test plan
pnpm build)pnpm test)useAppKitNetworkCorecover both active chain and no-chain scenariosapprovedCaipNetworkIdspopulatesapprovedCaipNetworkIdsisundefined🤖 Generated with Claude Code
Note
Low Risk
Additive API change that plumbs existing per-chain network metadata into hooks and subscriptions; risk is mainly around consumers relying on prior return shapes and correctness of derived defaults when no active chain is set.
Overview
useAppKitNetwork(React + Vue) andAppKitBaseClient.subscribeNetworknow surface WalletConnect session network constraints by addingapprovedCaipNetworkIdsandsupportsAllNetworksto the returned network state.This extends the shared
UseAppKitNetworkReturntype, wires the values from each chain’snetworkState, updates Vue reactivity/unsubscribe handling to tracknetworkStatechanges, bumps@reown/appkitto1.8.19, and adds/updates unit tests to cover defaults and subscription behavior.Written by Cursor Bugbot for commit 751d591. This will update automatically on new commits. Configure here.