WalletConnect / walletconnect-monorepo

WalletConnect Monorepo
Apache License 2.0
1.46k stars 715 forks source link

How to enable WalletConnect to directly connect to Binance Smart Chain instead of Ethereum? #1208

Closed devturi closed 1 year ago

devturi commented 2 years ago

Discussed in https://github.com/WalletConnect/walletconnect-monorepo/discussions/1207

Originally posted by **devturi** July 1, 2022 I am working on a DAPP which works on Binance Smart Chain. Now, when I scan the qrcode with trust wallet, it shows Ethereum Chain by default and I have to change it manually to Binance Smart Chain from the option. However, this does not look good. Normally on metamask, I can use ` await window.ethereum.request({ method: "wallet_addEthereumChain", params: [ { ...networks2[networkName], }, ], }); } catch (err) { console.error(err); // setError(err.message); } ` However, on trust wallet, I dont get to change the network once walletConnect connection is established. So, I need to enable BSC before the connection. Can anyone please help?
Horlarhold commented 2 years ago

Hello how are you

tomisinteazer commented 2 years ago

I found a solution here #529

tomisinteazer commented 2 years ago

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

this was added to make it work directly note on metamask it might still use the ethereum chain by default I hope it helps

the line in question everything must be added to the new WalletconnectProvider instance rpc: { 56: 'https://bsc-dataseed.binance.org/', }, network: 'binance', chainId: 56,

FosterSOAsare commented 2 years ago

@tomisinteazer Is there an rpc for stellar? Or do you have a solution for stellar chains to work instead of Ethereum?

finessevanes commented 1 year ago

Is this still an issue?

EvanTedesco commented 1 year ago

It is still an issue as far as I can tell

glitch-txs commented 1 year ago

I’m closing this issue because it has been inactive for a few months.

This feature is now available on Web3Modal v2

Please reopen if you still encounter this issue with the latest version :)