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:

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

1 ответ

Решение

Я выяснил, в чем проблема.

не забудьте добавить chainId объекту вроде этого:

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

Тогда он должен работать без проблем, вы даже можете опустить infuraId поле

Другие вопросы по тегам