Skip to content

Toggle chain not working with Metamask in WebGL #1257

@juans-chainsafe

Description

@juans-chainsafe

Describe the bug
The sample ToggleChain is throwing a error when I try it on Metamask.
I have the chain added to my metamask, so there is no need to add it again.

Steps
Steps to reproduce the behavior:

  1. Build on WebGL
  2. Login with Metamask
  3. Click on "ToggleChain" button in "Switch Chains" section
  4. Error appears

Expected behavior
Network is switched

Console errors

Web3Exception: Received unexpected keys on object parameter. Unsupported keys:
0
Rethrow as InvalidOperationException: Failed to add or switch to the network.
  at ChainSafe.Gaming.Web3.Evm.Wallet.WalletProvider.AddNetworkIfNotExistInWallet (ChainSafe.Gaming.Web3.IChainConfig config) [0x00000] in <00000000000000000000000000000000>:0 
Rethrow as Web3Exception: Error occured while trying to switch wallet chain.
  at ChainSafe.Gaming.Web3.Evm.Wallet.WalletProvider.HandleChainSwitching () [0x00000] in <00000000000000000000000000000000>:0 
Rethrow as Web3Exception: One of the handlers thrown an exception. Reverted ChainManager to the previous chain configuration.
  at ChainSafe.Gaming.Web3.Core.Chains.ChainManager.SwitchChain (System.String newChainId) [0x00000] in <00000000000000000000000000000000>:0

Screenshots/Video
Image

Desktop (please complete the following information):

  • Chainsafe SDK version: [dev]
  • Unity Version: [2022.3.44]
  • Operating System: [Mac]
  • Platform: [WebGL]

Additional context
This is working with web3auth in WebGL, and also with HyperPlay in the editor (same wallet as metamask)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P0Added to issues and PRs relating to a critical severity bugs.Type: BugAdded to issues and PRs if they are addressing a bug

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions