WalletConnect – Web3 Provider Issue with TrustWallet (Multi-Coin Wallet)

blockchainbscwalletconnectweb3-providersweb3js

I am using walletconnect/web3-provider to try to connect to trustwallet ios APP. My config on walletconnect is listed below:

try {
    console.log("Log in with connect wallet")
    const provider = await new WalletConnectProvider({
        rpc: {
            56: "https://bsc-dataseed1.binance.org",
        },
    });
    // provider.networkId = 56;
    await provider.enable();
    const web3 = await new Web3(provider);
    console.log(web3)
    resolve(web3)
} catch {
    console.log("Install metamask or use wallet connect")
} 

It is normally connected to the wallet, but it is not working right.
So I check the provider and find out that the chain ID is pointing to "1" instead of the BSC chainID "56". see below:
enter image description here

Am I doing anything not correct?

Best Answer

I found the solution on github repo, check below discussion: https://github.com/WalletConnect/walletconnect-monorepo/issues/522#issuecomment-860773569

Related Topic