Example #1
0
def run_action_account_list():
    print("\nAvailable accounts:\n")
    for account in Account.get_user_accounts():
        print("\t", account.keystore_file_path, account.address)

    print("\n")
    return main_prompt()
Example #2
0
def prompt_account_selection(validate_passphrase=True):

    account = single_question_prompt({
        "type":
        "list",
        "message":
        Messages.input_account_select,
        "choices": [{
            "name": account.address,
            "value": account
        } for account in Account.get_user_accounts()],
    })

    if validate_passphrase:
        validated = False

        while not validated:
            try:
                account.unlock(
                    single_question_prompt({
                        "name":
                        "passphrase",
                        "type":
                        "password",
                        "message":
                        Messages.input_account_verify_passphrase,
                    }))
                validated = True
            except ValueError:
                pass

    return account
Example #3
0
def main_prompt():

    configuration_choices = [Messages.action_configuration_setup]
    account_choices = [Messages.action_account_create]
    raiden_release_management_choices = [Messages.action_release_manager]

    if RaidenConfigurationFile.get_available_configurations():
        configuration_choices.insert(0, Messages.action_launch_raiden)
        configuration_choices.append(Messages.action_configuration_list)

    if Account.get_user_accounts():
        account_choices.append(Messages.action_account_list)
        account_choices.append(Messages.action_account_fund)
        account_choices.append(Messages.action_swap_kyber)

    available_choices = configuration_choices + account_choices + raiden_release_management_choices

    available_choices.append(Messages.action_quit)

    return {
        "type": "list",
        "message": "What would you like to do?",
        "choices": available_choices
    }