Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:fix switch network improvements & wagmi to recognize wc session #3299

Merged
merged 33 commits into from
Nov 22, 2024

Conversation

svenvoskamp
Copy link
Contributor

@svenvoskamp svenvoskamp commented Nov 21, 2024

Description

Resolve cases where wagmi doesn't recognize wc session and unable to switch from unsupported network"

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

Copy link

changeset-bot bot commented Nov 21, 2024

🦋 Changeset detected

Latest commit: 5a7873d

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

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

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package "@apps/laboratory" depends on the ignored package "@reown/appkit-adapter-bitcoin", but "@apps/laboratory" is not being ignored. Please add "@apps/laboratory" to the `ignore` option.

Copy link

vercel bot commented Nov 21, 2024

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

Name Status Preview Comments Updated (UTC)
appkit-gallery-new ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 10:43am
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 10:43am
appkit-vue-solana ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 10:43am
appkit-wagmi-cdn-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 10:43am
vue-wagmi-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 10:43am

Copy link
Contributor

github-actions bot commented Nov 21, 2024

Coverage Report for Coverage

Status Category Percentage Covered / Total
🔵 Lines 336.34999999999997% 4864 / 23621
🔵 Statements 336.34999999999997% 4864 / 23621
🔵 Functions 368.88% 388 / 1431
🔵 Branches 475.4999999999999% 745 / 1725
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client.ts 49.65% 72.22% 71.31% 49.65% 189-190, 233-234, 237-238, 253-256, 259-262, 265-266, 295-306, 309-318, 413, 417, 424, 462-465, 471-478, 481, 569-581, 600-603, 610-611, 619-620, 635-636, 639-640, 643-644, 647-648, 657-667, 673-680, 697-700, 709-738, 740-777, 779-783, 805-810, 812-820, 822-831, 833-853, 855-862, 864-875, 877-890, 892-895, 897-900, 902-905, 907-910, 912-919, 924-985, 988-1001, 1009-1010, 1018-1129, 1135-1138, 1142-1172, 1181-1196, 1200-1202, 1206-1221, 1226-1236, 1239-1317, 1320-1334, 1361, 1378, 1407-1413, 1415-1426, 1428-1435, 1457-1473, 1488-1492, 1507, 1521, 1523-1524, 1556, 1558-1559, 1565-1576, 1583-1584, 1594, 1596, 1677, 1688-1700
packages/core/src/utils/SIWXUtil.ts 5.31% 100% 0% 5.31% 17-18, 20-53, 55-131, 133-145, 147-156, 158-170, 172-259, 261-267
packages/scaffold-ui/src/modal/w3m-modal/index.ts 0% 0% 0% 0% 1-200
packages/scaffold-ui/src/views/w3m-unsupported-chain-view/index.ts 0% 0% 0% 0% 1-151
Generated in workflow #7553 for commit 5a7873d by the Vitest Coverage Report Action

Comment on lines +1286 to +1290
if (adapter?.reconnect) {
adapter?.reconnect({
id: 'walletConnect',
type: 'WALLET_CONNECT'
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we add a comment on why this is required? not sure why this or a switch network would be required if a connection fails? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment:

Handle edge case where wagmi detects existing connection but lacks to complete UniversalProvider instance. Connection attempt fails due to already connected state - reconnect to restore provider state.

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.

2 participants