Initial commit cherry-pick #1398.

This commit is contained in:
Florin Chirica 2021-04-18 21:07:02 +03:00 committed by Gene Hoffman
parent 166ab7c99a
commit 68a11e5161
2 changed files with 10 additions and 7 deletions

View File

@ -23,10 +23,12 @@ def generate_cmd(ctx: click.Context):
@keys_cmd.command("show", short_help="Displays all the keys in keychain")
def show_cmd():
@click.option(
"--show-mnemonic-seed", help="Show the mnemonic seed of the keys", default=False, show_default=True, is_flag=True
)
def show_cmd(show_mnemonic_seed):
from .keys_funcs import show_all_keys
show_all_keys()
show_all_keys(show_mnemonic_seed)
@keys_cmd.command("add", short_help="Add a private key by mnemonic")

View File

@ -57,7 +57,7 @@ def add_private_key_seed(mnemonic: str):
return
def show_all_keys():
def show_all_keys(show_mnemonic: bool):
"""
Prints all keys and mnemonics (if available).
"""
@ -89,9 +89,10 @@ def show_all_keys():
encode_puzzle_hash(create_puzzlehash_for_pk(master_sk_to_wallet_sk(sk, uint32(0)).get_g1()), prefix),
)
assert seed is not None
mnemonic = bytes_to_mnemonic(seed)
print(" Mnemonic seed (24 secret words):")
print(mnemonic)
if show_mnemonic:
mnemonic = bytes_to_mnemonic(seed)
print(" Mnemonic seed (24 secret words):")
print(mnemonic)
def delete(fingerprint: int):