예제 #1
0
def delete_wallet_folder(wallet_name: str):
    """
    Delete wallet folder by os operation.

    :param wallet_name:
    """
    if not wallet_name:
        return

    utils.print_header("\nClean up wallet\n")
    work_dir = constant.work_dir
    if os.path.exists(work_dir + "/wallet/" + wallet_name):
        try:
            shutil.rmtree(work_dir + "/wallet/" + wallet_name)
        except IOError as E:
            utils.print_error(str(E))
예제 #2
0
def delete_pool_folder(pool_name: str):
    """
    Delete pool folder by os operation.

    :param pool_name:
    """
    if not pool_name:
        return

    work_dir = constant.work_dir
    utils.print_header("\nClean up pool ledger\n")
    if os.path.exists(work_dir + "/pool/" + pool_name):
        try:
            shutil.rmtree(work_dir + "/pool/" + pool_name)
        except IOError as E:
            utils.print_error(str(E))
예제 #3
0
async def close_and_delete_pool(pool_name, pool_handle):
    """
    Close and delete pool ledger by using libindy.

    :param pool_name:
    :param pool_handle: return by pool.open_pool_ledger.
    """
    if pool_handle:
        try:
            utils.print_header("\nClose pool\n")
            await pool.close_pool_ledger(pool_handle)
        except IndyError as ie:
            utils.print_error(str(ie))

    if pool_name:
        try:
            utils.print_header("\nDelete pool\n")
            await pool.delete_pool_ledger_config(pool_name)
        except IndyError as ie:
            utils.print_error(str(ie))
async def close_and_delete_wallet(wallet_name, wallet_handle,
                                  wallet_credentials):
    """
    Close and delete wallet by using libindy.

    :param wallet_name:
    :param wallet_handle: return by wallet.open_wallet.
    :param credentials: (optional) credentials of wallet.
    """
    if wallet_handle:
        try:
            utils.print_header("\nClose wallet\n")
            await wallet.close_wallet(wallet_handle)
        except IndyError as ie:
            utils.print_error(str(ie))

    if wallet_name:
        try:
            utils.print_header("\nDelete wallet\n")
            await wallet.delete_wallet(wallet_name, wallet_credentials)
        except IndyError as ie:
            utils.print_error(str(ie))