I am using ether js with ganache CLI.
I wanted to know how do I get the array of all the 10 addresses provided the local blockchain ganache.
I am using
const signer = provider.getSigner()
Const account = await signer.getAddress()
console.log(account)
This returns only the first address.
How do I get all the addresses of ganache?
Anyone experienced with ethersjs. Plz help.
Mar 16, 2021, 5:01 PM
@taylor007 @Lauri_P @pedrobergamini .
Would really appreciate any help on this from you guys.
Would really appreciate any help on this from you guys.
Mar 16, 2021, 8:30 PM
Send @taylor007 a DM, his account seems to have some restrictions, so he is unable to chat here for now
Mar 16, 2021, 9:09 PM
https://docs.ethers.io/v5/api/providers/jsonrpc-provider/#JsonRpcProvider-listAccounts
Mar 17, 2021, 12:11 AM
const accounts = await ethers.getSigners();
for (const account of accounts) {
console.log(await account.getAddress());
}
for (const account of accounts) {
console.log(await account.getAddress());
}
that should solve your issue
=D
Mar 17, 2021, 2:31 AM