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: adapter connection issue #3489

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

magiziz
Copy link
Contributor

@magiziz magiziz commented Dec 17, 2024

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 Dec 17, 2024

⚠️ No Changeset found

Latest commit: 4b32e7a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 17, 2024

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

Name Status Preview Comments Updated (UTC)
appkit-demo ❌ Failed (Inspect) Dec 17, 2024 7:51pm
appkit-laboratory ❌ Failed (Inspect) 💬 Add feedback Dec 17, 2024 7:51pm
appkit-vue-solana ❌ Failed (Inspect) Dec 17, 2024 7:51pm
appkit-wagmi-cdn-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 7:51pm
vue-wagmi-example ❌ Failed (Inspect) Dec 17, 2024 7:51pm

Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 53.98% 14908 / 27614
🔵 Statements 53.98% 14908 / 27614
🔵 Functions 41.09% 1080 / 2628
🔵 Branches 75.15% 1909 / 2540
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client.ts 18.87% 100% 0% 18.87% 196-203, 206-207, 210-246, 250-255, 258-260, 263-264, 268-269, 272-273, 276-285, 288-291, 294-297, 300-301, 304-305, 308-309, 312-314, 317-318, 321-322, 325-327, 330-331, 334-335, 338-349, 352-361, 364-365, 368-369, 372-373, 376-377, 380-381, 384-385, 388-389, 392-393, 396-397, 400-401, 404-405, 408-409, 412-413, 416-417, 420-423, 628-629, 632-635, 638-639, 642-643, 646-647, 650-651, 654-655, 658-662, 666-753, 756-767, 770-790, 793-799, 802-811, 814-1146, 1149-1150, 1153-1285, 1288-1328, 1331-1399, 1402-1411, 1414-1424, 1427-1503, 1506-1526, 1529-1540, 1543-1568, 1574-1595, 1598-1637, 1640-1683, 1686-1697, 1700-1712, 1715-1755, 1758-1759, 1762-1771, 1774-1791, 1794-1816, 1819-1828, 1831-1847, 1850-1900, 1903-1914, 1917-1927, 1930-1946
packages/common/src/utils/SafeLocalStorage.ts 100% 100% 100% 100%
packages/core/src/controllers/ConnectionController.ts 60.12% 80% 35.29% 60.12% 88, 104-134, 149-150, 154-169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 236-237, 245, 249, 257-258, 108
packages/core/src/controllers/SwapController.ts 47.59% 64.7% 56.89% 47.59% 40-43, 166, 170, 180-181, 211-216, 242, 249-251, 260-261, 269-283, 287-299, 311, 315, 320-321, 329-332, 365, 372, 377-395, 405-407, 420-421, 432-433, 445, 452-453, 457-465, 493-494, 516-517, 531, 540-578, 582-639, 643-693, 698-750, 754-839, 856, 469-475, 855
packages/core/src/utils/SIWXUtil.ts 10.96% 66.66% 17.64% 10.96% 23-59, 62-137, 140-151, 154-162, 165-176, 179-270, 273-278, 284-285, 46-262
packages/core/src/utils/StorageUtil.ts 70.81% 76.47% 83.72% 70.81% 59-60, 76-79, 83-87, 94-95, 110-111, 120-123, 130-131, 138-139, 148-151, 158-161, 168-171, 178-179, 186-189, 196-199, 203-208, 212-216, 220-225
packages/scaffold-ui/src/partials/w3m-account-auth-button/index.ts 18.42% 100% 0% 18.42% 14-16, 20-45, 49-52, 55-64
packages/scaffold-ui/src/partials/w3m-account-default-widget/index.ts 14.39% 100% 0% 14.39% 57-84, 87-88, 92-130, 134-152, 155-170, 173-186, 189-206, 209-226, 229-249, 252-253, 256-257, 260-261, 264-265, 268-281, 284-316, 319-342, 345-376, 379-387, 390-400, 403-414, 417-422, 425-427, 397
packages/scaffold-ui/src/views/w3m-account-settings-view/index.ts 15.55% 100% 0% 15.55% 49-73, 76-77, 81-151, 155-175, 178-194, 197-202, 205-213, 216-245, 248-249, 252-277, 280-283, 286-297, 300-302
packages/scaffold-ui/src/views/w3m-account-view/index.ts 36.84% 100% 0% 36.84% 10-18, 22-23, 26-27
packages/scaffold-ui/src/views/w3m-network-switch-view/index.ts 22.36% 100% 0% 22.36% 29-30, 33-34, 37-38, 42-94, 98-107, 110-117, 120-128, 131-139
packages/scaffold-ui/src/views/w3m-networks-view/index.ts 19.81% 100% 0% 19.81% 35-39, 42-43, 47-70, 74-85, 88-89, 96-98, 101-130, 133-147, 150-180
packages/scaffold-ui/src/views/w3m-switch-address-view/index.ts 22.61% 100% 0% 22.61% 39-43, 46-59, 62-67, 71-83, 88-142, 145-150
packages/ui/src/composites/wui-list-account/index.ts 4.16% 100% 0% 4.16% 20-132
packages/ui/src/composites/wui-profile-button-v2/index.ts 7.69% 100% 0% 7.69% 18-82
Generated in workflow #8188 for commit d335a9c by the Vitest Coverage Report Action

if (!authConnector || type !== 'ID_AUTH' || origin.includes(CommonConstantsUtil.SECURE_SITE)) {
if (
!authConnector ||
connector !== 'ID_AUTH' ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for hard coded strings, smth like UtilConstantsUtil.CONNECTOR_ID.AUTH

const activeNamespace = StorageUtil.getActiveNamespace()

if (connectedConnector === UtilConstantsUtil.CONNECTOR_TYPE_WALLET_CONNECT && activeNamespace) {
if (connectedConnector === UtilConstantsUtil.WALLET_CONNECT_CONNECTOR_ID && activeNamespace) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about an object like UtilConstantsUtil.CONNECTOR_ID.WALLET_CONNECT?

@@ -88,7 +88,7 @@ export const SIWXUtil = {

const message = siwxMessage.toString()

if (StorageUtil.getConnectedConnector() === 'ID_AUTH') {
if (StorageUtil.getConnectedConnectorId() === 'ID_AUTH') {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using constant here instead of hard coded?

@@ -174,7 +174,7 @@ export const SwapController = {
const caipAddress = ChainController.state.activeCaipAddress
const address = CoreHelperUtil.getPlainAddress(caipAddress)
const networkAddress = ChainController.getActiveNetworkTokenAddress()
const type = StorageUtil.getConnectedConnector()
const connector = StorageUtil.getConnectedConnectorId()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const connector = StorageUtil.getConnectedConnectorId()
const connectorId = StorageUtil.getConnectedConnectorId()

@@ -131,6 +131,14 @@ export const StorageUtil = {
}
},

setConnectedConnectorId(connectorId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably remove setConnectedConnector

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