'How to use BSC with WalletConnect and Web3.js

Like the title says, i need to integrate these technologies together.

I instantiate WalletConnectProvider like this, as per docs:

const provider = new WalletConnectProvider({
rpc:'https://bsc-dataseed.binance.org/'
});

//  Enable session (triggers QR Code modal)
await provider.enable();
web3=new Web3(provider);

But whenever i make a call to a Smart Contract deployed in there, it won'be called. Also, it uses the Trust Wallet ETH account, not the BSC one.

Any help would be appreciated.



Solution 1:[1]

when specifying the rpc link, try creating an object for it with the key as the chain Id and the value as the provider url

rpc = {
  57: "https://your-bsc-provider-url-here.com"
};

Check the custom RPC instructions here https://docs.walletconnect.com/quick-start/dapps/web3-provider

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Random Question