wevm / wagmi

Reactive primitives for Ethereum apps
https://wagmi.sh
MIT License
5.99k stars 1.07k forks source link

connect() does not work on the EIP-1193 connector target. #3375

Closed sinolopes closed 10 months ago

sinolopes commented 10 months ago

Describe the bug

I am using the following configuration:

const config = createConfig({
  chains: chains,
  connectors: [
    injected({
      target: "metaMask",
    }),
    injected({
      target: "braveWallet",
    }),
  ],
  transports: transports,
});

Metamask works fine with connect(), but Brave Wallet does not. A temporary fix is as follows:

const config = createConfig({
  chains: chains,
  connectors: [
    injected({
      target: "metaMask",
    }),
    injected({
      target() {
        return {
          id: "braveWallet",
          name: "Brave Wallet",
          provider: window.ethereum,
        };
      },
    }),
  ],
  transports: transports,
});

Link to Minimal Reproducible Example

No response

Steps To Reproduce

Set config connectors to : [ injected({ target: "metaMask", }), injected({ target: "braveWallet", }), ],

try to connect on braveWallet.

Package Version

2.0.1

Viem Version

2.0.0

TypeScript Version

5.3.3

Anything else?

No response

Validations

tmm commented 10 months ago

Brave and MetaMask tend to clash with each other over window.ethereum so the best thing to do is rely on EIP-6963 support in Wagmi to determine what connectors t show or use your current workaround.

sinolopes commented 10 months ago

Ok thanks !

github-actions[bot] commented 10 months ago

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest wagmi version. If you have any other comments you can create a new discussion.