Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keychain: adds support for private keys as non-array #169

Merged
merged 3 commits into from
Aug 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/config/mnemonic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isHexString } from 'ethers/utils'
import { homedir } from 'os'
import path from 'path'
import { isArray } from 'lodash'
import { ConfigExtender, HttpNetworkConfig } from '@nomiclabs/buidler/types'
import { aragenMnemonic } from '~/src/params'
import { readJsonIfExists } from '~/src/utils/fsUtils'
Expand Down Expand Up @@ -46,7 +47,9 @@ export const configExtender: ConfigExtender = (finalConfig, userConfig) => {
const { rpc, keys } = byNetworkMnemonic
if (!finalNetwork.url && rpc) finalNetwork.url = rpc
if (!finalNetwork.accounts && keys)
finalNetwork.accounts = ensureHexEncoding(keys)
finalNetwork.accounts = isArray(keys)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, rather than importing this from lodash, we can just use Array.isArray().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

? ensureHexEncoding(keys)
: ensureHexEncoding([keys])
}
// Generic mnemonic
if (genericMnemonic && !finalNetwork.accounts) {
Expand Down