def unlock(f):
""" This decorator will unlock the wallet by either asking for a
passphrase or taking the environmental variable ``UNLOCK``
"""
@click.pass_context
def new_func(ctx, *args, **kwargs):
if not ctx.obj.get("unsigned", False):
if ctx.bitshares.wallet.created():
if "UNLOCK" in os.environ:
pwd = os.environ["UNLOCK"]
else:
pwd = click.prompt("Current Wallet Passphrase", hide_input=True)
ctx.bitshares.wallet.unlock(pwd)
else:
click.echo("No wallet installed yet. Creating ...")
pwd = click.prompt("Wallet Encryption Passphrase", hide_input=True, confirmation_prompt=True)
ctx.bitshares.wallet.create(pwd)
return ctx.invoke(f, *args, **kwargs)
return update_wrapper(new_func, f)
评论列表
文章目录