Skip to content
Snippets Groups Projects
Commit 64773a4d authored by Moul's avatar Moul
Browse files

[mod] Introduce has_auth_method() used in `balance`

parent 803172d1
No related branches found
No related tags found
2 merge requests!146Merge dev into master branch to complete v0.8.0 development cycle,!143#301: Generalize pubkey checksum display and check
......@@ -46,6 +46,16 @@ def auth_method(ctx):
return auth_by_scrypt()
@pass_context
def has_auth_method(ctx):
return (
ctx.obj["AUTH_SCRYPT"]
or ctx.obj["AUTH_FILE"]
or ctx.obj["AUTH_SEED"]
or ctx.obj["AUTH_WIF"]
)
@command("authfile", help="Generate authentication file")
@option("--file", default="authfile", show_default=True, help="Path file")
def generate_auth_file(file):
......
......@@ -21,7 +21,7 @@ from tabulate import tabulate
from silkaj.network_tools import ClientInstance
from silkaj.blockchain_tools import HeadBlock
from silkaj.tools import CurrencySymbol, message_exit, coroutine
from silkaj.auth import auth_method
from silkaj.auth import auth_method, has_auth_method
# had to import wot to prevent loop dependency. No use here.
from silkaj import wot
......@@ -38,12 +38,7 @@ from duniterpy.documents.transaction import InputSource
@coroutine
async def cmd_amount(ctx, pubkeys):
client = ClientInstance().client
if not (
ctx.obj["AUTH_SCRYPT"]
or ctx.obj["AUTH_FILE"]
or ctx.obj["AUTH_SEED"]
or ctx.obj["AUTH_WIF"]
):
if not has_auth_method():
if not pubkeys:
message_exit("You should specify one or many pubkeys")
pubkey_list = list()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment