hippius 0.2.44__tar.gz → 0.2.45__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hippius-0.2.44 → hippius-0.2.45}/PKG-INFO +1 -1
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/__init__.py +1 -1
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/ipfs.py +20 -4
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/ipfs_core.py +4 -2
- {hippius-0.2.44 → hippius-0.2.45}/pyproject.toml +1 -1
- {hippius-0.2.44 → hippius-0.2.45}/README.md +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/cli.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/cli_assets.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/cli_handlers.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/cli_parser.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/cli_rich.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/client.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/config.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/db/README.md +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/db/env.db.template +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/db/setup_database.sh +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/db_utils.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/errors.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/key_storage.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/substrate.py +0 -0
- {hippius-0.2.44 → hippius-0.2.45}/hippius_sdk/utils.py +0 -0
@@ -26,7 +26,7 @@ from hippius_sdk.config import (
|
|
26
26
|
from hippius_sdk.ipfs import IPFSClient, S3PublishResult, S3DownloadResult
|
27
27
|
from hippius_sdk.utils import format_cid, format_size, hex_to_ipfs_cid
|
28
28
|
|
29
|
-
__version__ = "0.2.
|
29
|
+
__version__ = "0.2.45"
|
30
30
|
__all__ = [
|
31
31
|
"HippiusClient",
|
32
32
|
"IPFSClient",
|
@@ -2109,7 +2109,23 @@ class IPFSClient:
|
|
2109
2109
|
content_bytes,
|
2110
2110
|
filename=filename,
|
2111
2111
|
)
|
2112
|
-
|
2112
|
+
if isinstance(result, bytes): # must be multiple json lines
|
2113
|
+
lines = result.decode("utf-8").strip().split("\n")
|
2114
|
+
objects = [json.loads(line) for line in lines if line.strip()]
|
2115
|
+
|
2116
|
+
logger.info(f"Got {len(objects)=} from {store_node=}")
|
2117
|
+
# filter out just the one file cid, ignore dirs, it's usually the first item,
|
2118
|
+
# but hey let's not risk it
|
2119
|
+
for o in objects:
|
2120
|
+
if o["Name"] == file_name:
|
2121
|
+
cid = o[0]["Hash"]
|
2122
|
+
break
|
2123
|
+
else:
|
2124
|
+
raise KeyError(
|
2125
|
+
f"Store call failed, {file_name=} not found in {objects=}"
|
2126
|
+
)
|
2127
|
+
else:
|
2128
|
+
cid = result["Hash"]
|
2113
2129
|
logger.info(f"Content uploaded to store node {store_node} with CID: {cid}")
|
2114
2130
|
except Exception as e:
|
2115
2131
|
raise HippiusIPFSError(
|
@@ -2120,10 +2136,10 @@ class IPFSClient:
|
|
2120
2136
|
try:
|
2121
2137
|
pin_client = AsyncIPFSClient(api_url=pin_node)
|
2122
2138
|
await pin_client.pin(cid)
|
2123
|
-
logger.info(f"File pinned to
|
2139
|
+
logger.info(f"File pinned to {pin_node=}")
|
2124
2140
|
except Exception as e:
|
2125
2141
|
raise HippiusIPFSError(
|
2126
|
-
f"Failed to pin content to
|
2142
|
+
f"Failed to pin content to {pin_node=}: {str(e)}"
|
2127
2143
|
) from e
|
2128
2144
|
|
2129
2145
|
# Conditionally publish to substrate marketplace based on publish flag
|
@@ -2135,7 +2151,7 @@ class IPFSClient:
|
|
2135
2151
|
url=substrate_url,
|
2136
2152
|
)
|
2137
2153
|
logger.info(
|
2138
|
-
f"Submitting storage request to substrate for file: {
|
2154
|
+
f"Submitting storage request to substrate for file: {file_name}, CID: {cid}"
|
2139
2155
|
)
|
2140
2156
|
|
2141
2157
|
tx_hash = await substrate_client.storage_request(
|
@@ -80,7 +80,9 @@ class AsyncIPFSClient:
|
|
80
80
|
response.raise_for_status()
|
81
81
|
return response.json()
|
82
82
|
|
83
|
-
async def add_bytes(
|
83
|
+
async def add_bytes(
|
84
|
+
self, data: bytes, filename: str = "file"
|
85
|
+
) -> Dict[str, Any] | bytes:
|
84
86
|
"""
|
85
87
|
Add bytes to IPFS.
|
86
88
|
|
@@ -106,7 +108,7 @@ class AsyncIPFSClient:
|
|
106
108
|
logger.warning(
|
107
109
|
f"Corrupted response returned from {url=} {filename=} ({len(data)=}) {response.content=}"
|
108
110
|
)
|
109
|
-
|
111
|
+
return response.content
|
110
112
|
|
111
113
|
async def add_str(self, content: str, filename: str = "file") -> Dict[str, Any]:
|
112
114
|
"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|