1

Currently facing issues in trying to get to sign the wallet to get the address on my mobile phone browser, wanted to be able to connect it to a wallet (MetaMask pref.) installed on my mobile phone.

    const provider = new ethers.providers.Web3Provider(window.ethereum, "any");
    await provider.send("eth_requestAccounts", []);

    const signer = provider.getSigner();
    const address = await signer.getAddress();

    console.log(address);

Is there any way to connect it with each other? It works well on a PC

TylerH
  • 20,799
  • 66
  • 75
  • 101
Karl Cusi
  • 21
  • 2

1 Answers1

1

In mobile browser there is no extension support, so if you have installed metamask mobile app on your phone, you can access your website in Metamask's dApp browser.

Also you can use libraries like web3modal or web3-react, which can handle mobile crypto wallet connections.

Monarth Sarvaiya
  • 1,041
  • 8
  • 20
  • Does this also provide a way to call a Smart Contract? Seems like it errors me out when I try to make a connection. `//Get Smart Contract Address const ERC721 = new ethers.Contract( "*contract address*", ERC721ABI, provider );` – Karl Cusi Oct 20 '22 at 09:54
  • The code to call contract functions will be same as the desktop browser, only the web3 provider will be changed. – Monarth Sarvaiya Oct 20 '22 at 10:05