coinbase-wallet-sdk icon indicating copy to clipboard operation
coinbase-wallet-sdk copied to clipboard

Bug: chainId is incorrect

Open agmitron opened this issue 2 years ago • 2 comments

Describe the bug

chainId shows 0x4, when it should be 43113

Steps

  1. Change network in Coinbase Wallet
  2. Check window.ethereum.providers, find CoinbaseProvider (has property isWalletLink: true), check property chainId.
  3. You can also run provider.request({ method: 'eth_chainId' });, but the result will be the same.

Expected behavior

On change network in Coinbase property chainId is also changed to the current one.

Version

3.4.0

Additional info

My dApp supports only BSC and ETH, and to make my dApp working properly I need to check chainId in wallet before start, and if it's not supported - change it.

image image image

Desktop

  • MacOS 12.1
  • Chrome Version 103.0.5060.134 (Official Build) (arm64)

Smartphone

No response

agmitron avatar Aug 08 '22 12:08 agmitron

The same reproducing steps will lead to one more interesting behavior: chainChanged handler will not be called.

agmitron avatar Aug 08 '22 14:08 agmitron

bug

ghost avatar Aug 26 '22 01:08 ghost

I'm facing the same issue. Regardless which network I choose, I always get back chainId = 1. Coinbase Wallet desktop extension version 2.31.4.

ccosmincc avatar Sep 26 '22 13:09 ccosmincc

Hi,

The Default Network tab in Coinbase Wallet corresponds to the default network the wallet will connect to when initially establishing a connection with a dapp.

Establishing a connection and then switching your default network will not update the chainId.

Instead, to switch your network and update the chainId, make a wallet_switchEthereumChain request. Alternatively, remove the currently established dapp connection within settings, and reconnect with your updated Default Network.

taycaldwell avatar Sep 26 '22 15:09 taycaldwell

Same issue here. My app is not working as expected

Sotatek-HiepNguyen2 avatar Oct 07 '22 08:10 Sotatek-HiepNguyen2

Same incorrect behavior observed on our end, the chainId doesn't reflect the selected network on the wallet.

antonio-ivanovski avatar Jan 13 '23 16:01 antonio-ivanovski