Example #1
0
 def _get_service_metadata_from_registry(self):
     rez = self._get_service_registration()
     metadata_hash = bytesuri_to_hash(rez["metadataURI"])
     metadata = get_from_ipfs_and_checkhash(self._get_ipfs_client(),
                                            metadata_hash)
     metadata = metadata.decode("utf-8")
     metadata = mpe_service_metadata_from_json(metadata)
     return metadata
Example #2
0
    def fetch_service_metadata(self, org_id, service_id):
        (found, registration_id, metadata_uri) = self.registry_contract.functions.getServiceRegistrationById(
            bytes(org_id, "utf-8"), bytes(service_id, "utf-8")).call()

        if found is not True:
            raise Exception('No service "{}" found in organization "{}"'.format(service_id, org_id))

        metadata_hash = bytesuri_to_hash(metadata_uri)
        metadata_json = get_from_ipfs_and_checkhash(self._ipfs_client, metadata_hash)
        metadata = mpe_service_metadata_from_json(metadata_json)
        return metadata