def add_step(self, name): """ Add a new step to list step. :param name: variable hold the step name. Using to report. """ from utilities import utils step_id = len(self.__steps) utils.print_header("\n{0}. {1}\n".format(step_id + 1, name)) new_step = Step(step_id + 1, name) self.__steps.append(new_step)
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))
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))
async def create_and_open_wallet(pool_name, wallet_name): """ Creates a new secure wallet with the given unique name. Then open that wallet and get the wallet handle that can be used later to use in methods that require wallet access. :param pool_name: Name of the pool that corresponds to this wallet. :param wallet_name: Name of the wallet. :return: The wallet handle was created. """ utils.print_header("\nCreate wallet\n") await wallet.create_wallet(pool_name, wallet_name, None, None, None) utils.print_header("\nGet wallet handle\n") wallet_handle = await wallet.open_wallet(wallet_name, None, None) return wallet_handle
async def create_and_open_pool(pool_name, pool_genesis_txn_file): """ Creates a new local pool ledger configuration. Then open that pool and return the pool handle that can be used later to connect pool nodes. :param pool_name: Name of the pool ledger configuration. :param pool_genesis_txn_file: Pool configuration json. if NULL, then default config will be used. :return: The pool handle was created. """ utils.print_header("\nCreate Ledger\n") await create_pool_ledger_config(pool_name, pool_genesis_txn_file) utils.print_header("\nOpen pool ledger\n") pool_handle = await pool.open_pool_ledger(pool_name, None) return pool_handle
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))