I'm trying to get a React site work with web3modal and walletconnect.

When in a Metamask browser, my dapp on BSC works, but on Safari (MacOs and iOS), I show the web3modal, user gives permissions to TrustWallet (for example), but returning back to Safari, site doesn't get accounts and nothing works.

This is my code:

const providerOptions = {
    walletconnect: {
    package: WalletConnectProvider,
    options: {
        rpc: {
            56: "https://bsc-dataseed.binance.org/"
        network: 'binance'
const web3Modal = new Web3Modal({
    cacheProvider: true, 

const provider = await web3Modal.connect();
const web3 = new Web3(provider);

At this point, when I try to get the accounts with:

const accounts = await web3.eth.getAccounts();

I get:

Unhandled Promise Rejection: Error: Failed to get accounts

And in the console, a lot of calls to infura, what I cannot understand, why I need infura if using BSC (or the next question: how the f configure infura for this)



I recommend you using Moralis. It has SDK for React with cool hooks. It also supports different providers (walletconnect, metamask, ...). Take a look at Moralis React Github. It has own speedy nodes for BSC, ETH and Matic networks.

Example of getting user wallet address:

import React from "react";
import { useMoralis } from "react-moralis";

function App() {
  const { authenticate, isAuthenticated, user } = useMoralis();

  if (!isAuthenticated) {
    return (
        <button onClick={() => authenticate()}>Authenticate</button>

  return (
      <h1>Welcome {user.attributes.ethAddress}</h1>
  • Will check, thank you! Jul 15 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.