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: displaying pure EIP-6963 wallets #2777

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bulgakovk
Copy link

Description

This PR stops checking if a wallet is installed for EIP-6963 connectors. checkInstalled relies on window.ethereum internally, which shouldn't necessarily be defined according to the EIP-6963 spec. This causes a bug when a pure EIP-6963 (no window.ethereum injection) wallet is not displayed in the list.

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 #2769

Showcase (Optional)

Tested with the repro steps in my minimal reproducible example: https://github.com/ExodusMovement/web3modal-eip6963-bug/tree/master?tab=readme-ov-file#steps-to-reproduce. I can finally see the Example Wallet (pure EIP-6963) in the list with no enabled ethereum extensions.

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

Copy link

vercel bot commented Aug 31, 2024

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

Name Status Preview Updated (UTC)
web3modal-gallery ✅ Ready (Inspect) Visit Preview Sep 3, 2024 0:56am
web3modal-laboratory ✅ Ready (Inspect) Visit Preview Sep 3, 2024 0:56am

Copy link

vercel bot commented Aug 31, 2024

@bulgakovk is attempting to deploy a commit to the WalletConnect Team on Vercel.

A member of the Team first needs to authorize it.

@bulgakovk
Copy link
Author

@glitch-txs Hey could you review this one?

@bulgakovk
Copy link
Author

Hey there 👋 Is there anything I can do to help get it rolling?

Copy link
Contributor

@arein arein left a comment

Choose a reason for hiding this comment

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

@bulgakovk can you pls add a Unit Test to make sure there are no regressions?

@@ -54,7 +54,7 @@ export class W3mConnectInjectedWidget extends LitElement {
return null
}

if (!ConnectionController.checkInstalled(undefined, connector.chain)) {
if (!connector.info && !ConnectionController.checkInstalled(undefined, connector.chain)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

re:unit tests requests.

We don't have snapshot testing for UI components, we have E2E and unit tests. What we can do for this test something related with ConnectorController;

Not every connector have info field, only the injected ones. So we could add a test to the ConnectorController.test.ts like the following:

// Example 
it('should throw error when adding injected connector without info field', () => {
    expect(() => ConnectorController.addConnector({
      ...injectedConnector,
      info: undefined
    })
    ).toThrow('Connector info is required for injected connectors')
  })

And we could update the .addConnector and setConnectors logics to check if the type is INJECTED and don't have info field, it should throw error.

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.

[bug] pure EIP6963 wallets are not displayed
3 participants