@main.command()<EOL>@click.pass_context<EOL>@onlineChain<EOL>@click.argument("<STR_LIT>", nargs=<NUM_LIT:1>)<EOL>@click.option(<EOL>"<STR_LIT>", type=click.Choice(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]), default="<STR_LIT>"<EOL>)<EOL>@unlockWallet<EOL>def importaccount(ctx, account, role):
from peerplaysbase.account import PasswordKey<EOL>password = click.prompt("<STR_LIT>", hide_input=True)<EOL>account = Account(account, peerplays_instance=ctx.peerplays)<EOL>imported = False<EOL>if role == "<STR_LIT>":<EOL><INDENT>owner_key = PasswordKey(account["<STR_LIT:name>"], password, role="<STR_LIT>")<EOL>owner_pubkey = format(<EOL>owner_key.get_public_key(), ctx.peerplays.rpc.chain_params["<STR_LIT>"]<EOL>)<EOL>if owner_pubkey in [x[<NUM_LIT:0>] for x in account["<STR_LIT>"]["<STR_LIT>"]]:<EOL><INDENT>click.echo("<STR_LIT>")<EOL>owner_privkey = owner_key.get_private_key()<EOL>ctx.peerplays.wallet.addPrivateKey(owner_privkey)<EOL>imported = True<EOL><DEDENT><DEDENT>if role == "<STR_LIT>":<EOL><INDENT>active_key = PasswordKey(account["<STR_LIT:name>"], password, role="<STR_LIT>")<EOL>active_pubkey = format(<EOL>active_key.get_public_key(), ctx.peerplays.rpc.chain_params["<STR_LIT>"]<EOL>)<EOL>if active_pubkey in [x[<NUM_LIT:0>] for x in account["<STR_LIT>"]["<STR_LIT>"]]:<EOL><INDENT>click.echo("<STR_LIT>")<EOL>active_privkey = active_key.get_private_key()<EOL>ctx.peerplays.wallet.addPrivateKey(active_privkey)<EOL>imported = True<EOL><DEDENT><DEDENT>if role == "<STR_LIT>":<EOL><INDENT>memo_key = PasswordKey(account["<STR_LIT:name>"], password, role=role)<EOL>memo_pubkey = format(<EOL>memo_key.get_public_key(), ctx.peerplays.rpc.chain_params["<STR_LIT>"]<EOL>)<EOL>if memo_pubkey == account["<STR_LIT>"]:<EOL><INDENT>click.echo("<STR_LIT>")<EOL>memo_privkey = memo_key.get_private_key()<EOL>ctx.peerplays.wallet.addPrivateKey(memo_privkey)<EOL>imported = True<EOL><DEDENT><DEDENT>if not imported:<EOL><INDENT>click.echo("<STR_LIT>")<EOL><DEDENT>
Import an account using an account password