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

refactor: clean up and reuse wallet connect connector #3619

Merged
merged 17 commits into from
Jan 15, 2025

Conversation

zoruka
Copy link
Contributor

@zoruka zoruka commented Jan 13, 2025

Description

Please include a brief summary of the change.

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 Jan 13, 2025

🦋 Changeset detected

Latest commit: dfb8ae6

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

This PR includes changesets to release 19 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 Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-common Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx 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

Copy link

vercel bot commented Jan 13, 2025

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

Name Status Preview Comments Updated (UTC)
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 3:43pm
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 3:43pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-vue-solana ⬜️ Ignored (Inspect) Jan 15, 2025 3:43pm
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Jan 15, 2025 3:43pm
vue-wagmi-example ⬜️ Ignored (Inspect) Jan 15, 2025 3:43pm

Copy link
Contributor

github-actions bot commented Jan 13, 2025

Warnings
⚠️ Changes were made to one or more package.json(s), but not to pnpm-lock.yaml

Generated by 🚫 dangerJS against dfb8ae6

Copy link
Contributor

github-actions bot commented Jan 13, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.55% 18909 / 28412
🔵 Statements 66.55% 18909 / 28412
🔵 Functions 57.66% 1652 / 2865
🔵 Branches 78.71% 3199 / 4064
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/bitcoin/src/adapter.ts 100% 100% 92.85% 100%
packages/adapters/bitcoin/tests/mocks/mockUniversalProvider.ts 100% 100% 100% 100%
packages/adapters/ethers/src/client.ts 48.47% 56.45% 63.63% 48.47% 43-101, 117-118, 149-150, 163-186, 189-199, 212-249, 254-255, 262-279, 284-291, 294-316, 319-324, 335-336, 343-348, 362-363, 372-373, 389-399, 402-429, 433-434, 447-448, 450, 472-473, 477, 491, 508-510, 517-521, 561-562, 566-571, 580-598, 604-605, 609-614, 623-624, 635-636
packages/adapters/ethers5/src/client.ts 47.58% 56.89% 63.63% 47.58% 44-102, 118-119, 150-151, 164-187, 190-200, 213-249, 254-255, 262-279, 284-291, 294-316, 319-324, 334-335, 342-347, 361-362, 371-372, 388-415, 418-428, 432-433, 446-447, 449, 474-475, 479, 493, 510-512, 519-523, 561-574, 582-600, 606-607, 611-616, 625-626, 637-638
packages/adapters/solana/src/client.ts 51.3% 75% 34.48% 51.3% 50-57, 62-69, 73-74, 102-105, 108-111, 114-115, 118-119, 122-123, 126-134, 141-142, 152-172, 175-208, 211-212, 215-216, 224-225, 263-264, 286-288, 291-295, 301, 316-322, 325-332, 350-351, 357-361, 364-370
packages/adapters/solana/src/tests/mocks/UniversalProvider.ts 99.11% 100% 100% 99.11% 58
packages/adapters/wagmi/src/client.ts 73.4% 59.09% 73.52% 73.4% 124-150, 175, 236-240, 246-249, 280, 282, 311-312, 363-366, 371-372, 382-383, 422-423, 434, 454, 459-474, 477-508, 518-519, 523-524, 541-552, 591, 595-596, 617-618, 626-627, 632-633, 637-642, 649-650, 658-659, 664-665, 674-675, 683-684, 689-690, 696-703
packages/appkit/exports/connectors.ts 100% 100% 100% 100%
packages/appkit/src/client.ts 61.42% 83.98% 77.17% 61.42% 172-173, 202-203, 218-219, 222-223, 238-241, 244-247, 267-268, 271-272, 288-305, 308-317, 588-589, 592-595, 598-599, 602-603, 606-607, 610-611, 618-622, 685-688, 715-716, 730-731, 740-741, 744-745, 750-751, 768-769, 790-806, 833-844, 847-884, 887-892, 908-912, 925-936, 939-958, 961-967, 970-980, 983-995, 998-1000, 1003-1005, 1008-1010, 1013-1015, 1018-1025, 1030-1088, 1092-1111, 1119-1133, 1136-1143, 1146-1160, 1163-1169, 1174, 1178, 1192, 1205-1206, 1214, 1217-1220, 1223-1229, 1239-1240, 1269-1285, 1293-1296, 1300, 1316-1326, 1341, 1347-1365, 1371-1378, 1389-1397, 1402-1411, 1414-1424, 1427-1507, 1510-1530, 1549, 1556, 1573, 1586-1587, 1622, 1645-1652, 1654-1665, 1668-1676, 1705-1721, 1724, 1736-1740, 1771-1775, 1780, 1782-1783, 1796-1797, 1802-1803, 1805-1806, 1811-1814, 1865-1869, 1894-1895, 1919-1920, 1949-1950, 1954-1955, 2044, 2046-2048, 299-804
packages/appkit/src/adapters/ChainAdapterBlueprint.ts 80.83% 93.54% 68.75% 80.83% 105-114, 136-137, 160-164, 170-173, 230-231
packages/appkit/src/connectors/WalletConnectConnector.ts 100% 100% 100% 100%
packages/appkit/src/connectors/index.ts 100% 100% 100% 100%
packages/appkit/src/universal-adapter/client.ts 37.03% 76.92% 21.05% 37.03% 17-24, 31-34, 40-49, 82-83, 86-91, 94-127, 136-139, 142-146, 149-152, 155-158, 161-164, 167-168, 171-172, 175-176, 179-180, 183-184, 187-194, 204-209, 41, 95-110
Generated in workflow #8892 for commit dfb8ae6 by the Vitest Coverage Report Action

protected caipNetworks: CaipNetwork[]

constructor({ provider, caipNetworks, namespace }: WalletConnectConnector.Options<Namespace>) {
this.caipNetworks = caipNetworks
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've seen you populate this with namespace scoped chains. Won't that have issues? WC session has all of the namespaces combined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

namespace is a mandatory key of Connector interface. I don't think it will have a problem because still each adapter have a WalletConnectConnect with its own namespace. If this would be a problem than we would need to set a kind of Connector that combines namespaces.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean we'd need to triple check how chain switching is working. I'd assume that my WC connector has all the namespaces available not jsut the ones scoped to the current adapter (since I can switch to a diff namespace=

@zoruka zoruka marked this pull request as ready for review January 13, 2025 19:25
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