Skip to content

Cannot connect to metamask default chain #208

Closed
@quurkyhongyu

Description

@quurkyhongyu

When on sepolia test net, metamask can't connect due to it has to connected through "wallet_switchEthereumChain" and not "wallet_addEthereumChain". But inside the Blockchains.MetaMaskDefaults does not contains sepolia test net, so after comment the condition sanitisation then can work alr.

(we tested so far only arbitrum-sepolia can work)

        protected async Task ConnectWithDefaultChain()
        {
            var chainData =  #DefaultChainInfo;

            // after comment out this then can connect to metamask wallet, sepolia test net
            //if (Blockchains.MetaMaskDefaults.Contains((long)defaultChain))
            {
                await _wallet.ConnectWith<object>(RpcMethods.WalletSwitchEthereumChain,
                    new object[] { chainData.AsSwitchChainRequest() });
                return;
            }
            
            await _wallet.ConnectWith<object>(RpcMethods.WalletAddEthereumChain,
                new object[] { chainData });
        }

here is the error log in unity
unitysdk-metamask-error.txt

Hope this will get fixed soon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions