blocknative / web3-onboard

Client library to onboard users to web3 apps
https://onboard.blocknative.com/
MIT License
812 stars 472 forks source link

[Bug] MetaMaskSDK `extensionOnly: true` breaks the connecting to MetaMask #2035

Open itsmnthn opened 6 months ago

itsmnthn commented 6 months ago

Current Behavior

When using MetaMaskSDK with extensionOnly: false works as expected it opens MetaMask Modal to connect which works fine. But on desktop(with browser extention) need to click on desktop and than one more button even if previously connected.

This is supposed to be solved by extensionOnly: true but doing this breaks it without any error just not able to connect with MetaMask at all.

Expected Behavior

Expected behavior is to connect browser wallet if already previously connected and unlocked.

Steps To Reproduce

Use this MetaMask SDK config

import Onboard from '@web3-onboard/core'
import MetaMaskModule from '@web3-onboard/metamask'
import InjectedModule from '@web3-onboard/injected-wallets'

const injected = InjectedModule({ displayUnavailable: ['MetaMask', 'Core'], })
const metamask = MetaMaskModule({
    options: {
      extensionOnly: true,
      dappMetadata: {
        name: 'My Test DApp',
      },
    },
  })

  const onboard = Onboard({
    wallets: [metamask, injected ], // other wallets
    [chains],
    appMetadata: {
      name: 'My Test DApp',
      icon: '', // svg string icon
      description: 'my test app',
      recommendedInjectedWallets: [{ name: 'MetaMask', url: 'https://metamask.io' }],
      explore: 'dapp url',
    },
    disableFontDownload: true,
    connect: { autoConnectLastWallet: true, disableUDResolution: true },
    accountCenter: { desktop: { enabled: false }, mobile: { enabled: false } },
  })

Ignore typo here if any

What package is effected by this issue?

@web3-onboard/core

Is this a build or a runtime issue?

Build, Runtime

Package Version

2.24.18

Node Version

20

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Relevant log output

No response

Anything else?

No response

Sanity Check

Adamj1232 commented 3 months ago

@itsmnthn this is a known issue and we will be following up with the MetaMask team for assistance