Skip to content

Commit

Permalink
remove cast to number and clarify error
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeyTM committed Nov 4, 2021
1 parent b06f5f5 commit f0f1fa3
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export function getValidationErrors(config: any): string[] {

// manual validation of accounts
if (Array.isArray(accounts)) {
for (const [index, account] of Object.entries(accounts)) {
for (const [index, account] of accounts.entries()) {
if (typeof account !== "object") {
errors.push(
getPrivateKeyError(
Expand All @@ -319,7 +319,7 @@ export function getValidationErrors(config: any): string[] {

const { privateKey, balance } = account;

validatePrivateKey(privateKey, +index, HARDHAT_NETWORK_NAME, errors);
validatePrivateKey(privateKey, index, HARDHAT_NETWORK_NAME, errors);

if (typeof balance !== "string") {
errors.push(
Expand Down Expand Up @@ -430,11 +430,7 @@ export function getValidationErrors(config: any): string[] {
} else if (typeof accounts === "string") {
if (accounts !== "remote") {
errors.push(
getPrivateKeyError(
0,
networkName,
`Expected "remote", received ${accounts}`
)
`Invalid 'accounts' entry for network '${networkName}': expected an array of accounts or the string 'remote', but got the string '${accounts}'`
);
}
} else if (accounts !== undefined) {
Expand Down

0 comments on commit f0f1fa3

Please sign in to comment.