#StackBounty: #metamask #ganache #ethers.js #web3-providers Only one account is listed by the configured Web3Provider

Bounty: 50

I am trying to configure ethers.js together with metamask.

Here is how I configure my provider:

  initProvider() {
    const ethereum = window['ethereum'];
    this.provider = new ethers.providers.Web3Provider(ethereum);//Metamask is used but only one account is listed...

I have Ganache running with a number of accounts. However, when I try to retrieve/list the accounts like so: this.provider.listAccounts(), I only get one element in the array…

Note that I can see all accounts when I use the following configuration for my provider:

const provider = new ethers.providers.JsonRpcProvider(url);//Metamask is left out but I can list all accounts.

However, I need both metamask and the full list of accounts. What am I getting wrong? Do I need two separate providers?

edit: note that metamask itself lists all Ganache accounts properly.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.