Skip to content

Commit

Permalink
Go back to using SignerWithAddress type
Browse files Browse the repository at this point in the history
As `SignerWithAddress` is still available - let's use it instead of ethers' `Signer` type
  • Loading branch information
jagodarybacka committed Jan 16, 2024
1 parent d9b7f37 commit 180ac30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "@nomicfoundation/hardhat-ethers"

import { parseUnits, parseEther, Signer } from "ethers"
import type { HardhatRuntimeEnvironment } from "hardhat/types"
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";

Check failure on line 5 in src/account.ts

View workflow job for this annotation

GitHub Actions / format

Delete `;`

export type FundOptions = {
from: Signer
Expand All @@ -13,7 +14,7 @@ export interface HardhatAccountHelpers {
impersonateAccount(
accountAddress: string,
fundOptions?: FundOptions
): Promise<Signer>
): Promise<SignerWithAddress>
}

async function impersonateAccount(
Expand Down
12 changes: 6 additions & 6 deletions src/signers.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Signer } from "ethers"
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"
import type { HardhatRuntimeEnvironment } from "hardhat/types"

type NamedSigners = {
[name: string]: Signer
[name: string]: SignerWithAddress
}

export interface HardhatSignersHelpers {
getNamedSigners(): Promise<NamedSigners>
getUnnamedSigners(): Promise<Signer[]>
getUnnamedSigners(): Promise<SignerWithAddress[]>
}

async function getNamedSigners(
hre: HardhatRuntimeEnvironment
): Promise<NamedSigners> {
const namedSigners: { [name: string]: Signer } = {}
const namedSigners: { [name: string]: SignerWithAddress } = {}

await Promise.all(
Object.entries(await hre.getNamedAccounts()).map(
Expand All @@ -28,8 +28,8 @@ async function getNamedSigners(

async function getUnnamedSigners(
hre: HardhatRuntimeEnvironment
): Promise<Signer[]> {
const unnamedSigners: Signer[] = []
): Promise<SignerWithAddress[]> {
const unnamedSigners: SignerWithAddress[] = []

await Promise.all(
(
Expand Down

0 comments on commit 180ac30

Please sign in to comment.