コード例 #1
0
 def publish_to_ipfs(filename, data):
     json_to_file(data, filename)
     service_metadata_ipfs_hash = IPFSUtil(
         IPFS_URL['url'],
         IPFS_URL['port']).write_file_in_ipfs(filename,
                                              wrap_with_directory=False)
     return service_metadata_ipfs_hash
コード例 #2
0
 def publish_to_ipfs(self):
     self.publish_assets()
     ipfs_utils = ipfs_util.IPFSUtil(IPFS_URL['url'], IPFS_URL['port'])
     metadata = self.to_metadata()
     filename = f"{METADATA_FILE_PATH}/{self.__uuid}_org_metadata.json"
     json_to_file(metadata, filename)
     ipfs_hash = ipfs_utils.write_file_in_ipfs(filename, wrap_with_directory=False)
     self.__metadata_ipfs_uri = f"ipfs://{ipfs_hash}"
 def publish_service_data_to_ipfs(self, service, environment):
     # publish assets
     service = self.publish_service_proto_to_ipfs(service)
     self.publish_assets(service)
     service_metadata = self.get_service_metadata(service, environment)
     service_metadata_filename = f"{METADATA_FILE_PATH}/{service.uuid}_service_metadata.json"
     json_to_file(service_metadata, service_metadata_filename)
     service.metadata_uri = METADATA_URI_PREFIX + self.publish_file_to_ipfs(
         service_metadata_filename)
     return service