blocknative / web3-onboard

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

Bug: Web3onboard not connecting to metmask in new release #1725

Closed mbcse closed 1 year ago

mbcse commented 1 year ago

Current Behavior

Web3onboard is throwing an error when connecting to metamask when the selected chain in metamask doesn't match the chains specified in the web3onboard init function. Seems like a condition is missed in the recent release of the secondary token balances feature. It's possible that appChain can be "undefined" where the chain selected in metamask is different than the chains mentioned while configuring web3onboard

Error shown: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'secondaryTokens')

Expected Behavior

Should connect to metamask despite having rpc in chains array

Steps To Reproduce

  1. Choose a polygon chain in metamask
  2. Mention only Ethereum chain rpc while initiating web3 onboard
  3. It will not connect and throw an error

What package is effected by this issue?

@web3-onboard/core

Is this a build or a runtime issue?

Runtime

Package Version

2.22.1

Node Version

No response

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Anything else?

No response

Sanity Check

Adamj1232 commented 1 year ago

@mbcse thanks for reporting! There is a fix for this on @web3-onboard/core v2.19.0-alpha.1 and an official release will be out shortly.

Adamj1232 commented 1 year ago

@mbcse a fix for this is available with the latest versions of the core/react/vue packages. Thanks for raising this issue and please let us know if you have any other issues!