def construction_build(self, actions, print_response=False, ask_user=False): with core_api.ApiClient(self.system_config) as api_client: api_client = self.set_basic_auth(api_client, "admin", "admin") try: network_configuration: NetworkConfigurationResponse = self.network_configuration( ) key_list: KeyListResponse = self.key_list() operation_groups = ValidatorConfig.build_operations( actions, key_list, ask_user=ask_user) if len(operation_groups) == 0: return api = construction_api.ConstructionApi(api_client) build_request = ConstructionBuildRequest( network_identifier=network_configuration. network_identifier, fee_payer=key_list.public_keys[0].identifiers. account_entity_identifier, operation_groups=operation_groups) Helpers.print_request_body(build_request, "/construction/build") build: ConstructionBuildResponse = api.construction_build_post( build_request) return self.handle_response(build, print_response) except ApiException as e: Helpers.handleApiException(e)
def vote(self, print_response=False): with core_api.ApiClient(self.system_config) as api_client: api_client = self.set_basic_auth(api_client, "superadmin", "superadmin") try: api = key_api.KeyApi(api_client) request = UpdateVoteRequest( network_identifier=self.network_configuration( ).network_identifier) Helpers.print_request_body(request, "/key/vote") response: UpdateVoteResponse = api.key_vote_post(request) return self.handle_response(response, print_response) except ApiException as e: Helpers.handleApiException(e)
def entity(self, entity_identifier, print_response=False): with core_api.ApiClient(self.system_config) as api_client: api_client = self.set_basic_auth(api_client, "admin", "admin") try: api = entity_api.EntityApi(api_client) entityRequest = EntityRequest( network_identifier=self.network_configuration( ).network_identifier, entity_identifier=entity_identifier) Helpers.print_request_body(entityRequest, "/entity") response: EntityResponse = api.entity_post(entityRequest) return self.handle_response(response, print_response) except ApiException as e: Helpers.handleApiException(e)
def construction_submit(self, signed_transaction, print_response=False): with core_api.ApiClient(self.system_config) as api_client: api_client = self.set_basic_auth(api_client, "admin", "admin") try: api = construction_api.ConstructionApi(api_client) network_configuration: NetworkConfigurationResponse = self.network_configuration( ) request = ConstructionSubmitRequest( network_identifier=network_configuration. network_identifier, signed_transaction=signed_transaction) Helpers.print_request_body(request, "/construction/submit") response = api.construction_submit_post(request) return self.handle_response(response, print_response) except ApiException as e: Helpers.handleApiException(e)
def key_sign(self, unsigned_transaction, print_response=False): with core_api.ApiClient(self.system_config) as api_client: api_client = self.set_basic_auth(api_client, "superadmin", "superadmin") try: network_configuration: NetworkConfigurationResponse = self.network_configuration( ) key_list: KeyListResponse = self.key_list() api = key_api.KeyApi(api_client) request = KeySignRequest( network_identifier=network_configuration. network_identifier, public_key=key_list.public_keys[0].public_key, unsigned_transaction=unsigned_transaction) Helpers.print_request_body(request, "/key/sign") response = api.key_sign_post(request) return self.handle_response(response, print_response) except ApiException as e: Helpers.handleApiException(e)