Skip to content

Commit

Permalink
Merge pull request #1050 from SatoshiAndKin/mnemonic_passphrase
Browse files Browse the repository at this point in the history
add passphrase kwarg to from_mnemonic
  • Loading branch information
iamdefinitelyahuman authored Apr 14, 2021
2 parents 563a75d + f50c620 commit c76f00b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions brownie/network/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def add(self, private_key: Union[int, bytes, str] = None) -> "LocalAccount":
return account

def from_mnemonic(
self, mnemonic: str, count: int = 1, offset: int = 0
self, mnemonic: str, count: int = 1, offset: int = 0, passphrase: str = ""
) -> Union["LocalAccount", List["LocalAccount"]]:
"""
Generate one or more `LocalAccount` objects from a seed phrase.
Expand All @@ -153,12 +153,14 @@ def from_mnemonic(
The number of `LocalAccount` objects to create
offset : int, optional
The initial account index to create accounts from
passphrase : str, optional
Additional passphrase to combine with the mnemonnic
"""
new_accounts = []

for i in range(offset, offset + count):
w3account = eth_account.Account.from_mnemonic(
mnemonic, account_path=f"m/44'/60'/0'/0/{i}"
mnemonic, passphrase=passphrase, account_path=f"m/44'/60'/0'/0/{i}"
)

account = LocalAccount(w3account.address, w3account, w3account.key)
Expand Down

0 comments on commit c76f00b

Please sign in to comment.