Search code examples
wallet-connectdecentralized-applications

WalletConnect disable infura error message


I am currently developing a dapp and I am integrating walletconnect.

I use this code for connecting:

const chainId = ContractService.getPreferredChainId();
const rpc = ContractService.getRpcAddress();
provider = new WalletConnectProvider({
  infuraId: undefined,
  rpc: {
    [chainId]: rpc,
  },
});
await provider.enable();

chainId is dynamically chosen based on if the app is in development mode or not. while in development it runs on chain id 97. RPC is the same story, it just gets the binance smart chain RPC JSON provider.

Connecting works well, but I get the following error:

enter image description here

Any idea on how I can fix this without making an infura account? Or is that required..


Solution

  • I found out what the problem was.

    make sure to add a chainId to the object like this:

    new WalletConnectProvider({
      infuraId: undefined,
      rpc: {
        1: "https://RPC_URL",
      },
      chainId: 1
    });
    

    Then it should work without issues, you can even omit the infuraId field