Skip to content

Commit

Permalink
Added listAccounts to JsonRpcProvider (ethers-io#3778).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo authored and Woodpile37 committed Jan 14, 2024
1 parent e99862f commit e296291
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src.ts/providers/provider-jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,11 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {

throw new Error("invalid account");
}

async listAccounts(): Promise<Array<JsonRpcSigner>> {
const accounts: Array<string> = await this.send("eth_accounts", [ ]);
return accounts.map((a) => new JsonRpcSigner(this, a));
}
}

export abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider {
Expand Down

0 comments on commit e296291

Please sign in to comment.