def exec_command(self, cmd, params): """ exec_command """ self.client = BcosClient() function_name = self.get_func_name(cmd) # execute function ret_json = eval(function_name)(*params) common.print_info("INFO", self.cmd) common.print_result(ret_json) return ret_json
def exec_command(self, cmd, params): """ exec_command """ self.client = BcosClient() function_name = self.get_func_name(cmd) # execute function ret_json = eval(function_name)(*params) common.print_info("INFO", self.cmd) if cmd in RPCConsole.functions["human_friendly_output"]: ret_json = self.convertHexToDec(cmd, ret_json) common.print_result(ret_json) return ret_json
def print_cns_info(cns_info): """ print cns information """ common.print_result(cns_info) for cns_item in cns_info: cns_obj = json.loads(cns_item) i = 0 for cns in cns_obj: print("CNS ITEM {} >>".format(i)) print("\tContractName: {}".format(cns["name"])) print("\tContractVersion: {}".format(cns["version"])) print("\tContractAddress: {}".format(cns["address"])) i = i + 1 if i == 0: common.print_info(" ", "Empty Set, result: {}".format(cns_info))