7

I'm trying to link BSC chain with wallet connect in my react DAPP.

  const walletConnectProvider = await new WalletConnectProvider({
    rpc: {
     56: "https://bsc-dataseed.binance.org",
    },
  });

  await walletConnectProvider.enable();

  console.log("walletConnectProvider", walletConnectProvider);

  if (walletConnectProvider.connected) {
     setAddr(walletConnectProvider.accounts[0]);
  }

After trying to get connection with trust wallet. I'm getting this error:

Unhandled Rejection (Error): unknown account #0 (operation="getAddress", code=UNSUPPORTED_OPERATION, version=providers/5.4.1)

This is the console of walletConnectProvider

While reviewing i identified that the chainid is still 1 and rpcurl is pointing to infura.

Please help me out in this issue. Thanks

junaid2012
  • 121
  • 2
  • 4

1 Answers1

0

Hi :) try to do something like this:

infuraId: "your_infura_id",
pollingInterval: 15000,
qrcode: true,
qrcodeModalOptions: {
  mobileLinks: [
    "trust",
  ]
},
chainId: integer number with chain id like in rpc (56 for example),
rpc: your rpc object here
Jasperan
  • 2,154
  • 1
  • 16
  • 40
  • 2
    Hi, I'm not sure if this answer is correct or not, but it is hard to read. Please consider formatting the code: https://stackoverflow.com/editing-help#code – Amit Kumar Gupta Dec 28 '21 at 02:34