Skip to content

Commit 2506f65

Browse files
committed
fix: return no accounts if eth_accounts is deprecated
Erigon now responds that `eth_accounts` is deprecated. Instead of crashing we now return an empty set of accounts, the same as if running against mainnet. Fixes #5572.
1 parent 303d697 commit 2506f65

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/hardhat-ethers/src/internal/helpers.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ function isArtifact(artifact: any): artifact is Artifact {
4040
export async function getSigners(
4141
hre: HardhatRuntimeEnvironment
4242
): Promise<HardhatEthersSigner[]> {
43-
const accounts: string[] = await hre.ethers.provider.send("eth_accounts", []);
43+
let accounts: string[];
44+
45+
try {
46+
accounts = await hre.ethers.provider.send("eth_accounts", []);
47+
} catch (error) {
48+
console.log(error);
49+
console.log(JSON.stringify(error));
50+
return [];
51+
}
4452

4553
const signersWithAddress = await Promise.all(
4654
accounts.map((account) => getSigner(hre, account))

0 commit comments

Comments
 (0)