hippius 0.2.25__py3-none-any.whl → 0.2.27__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hippius
3
- Version: 0.2.25
3
+ Version: 0.2.27
4
4
  Summary: Python SDK and CLI for Hippius blockchain storage
5
5
  Home-page: https://github.com/thenervelab/hippius-sdk
6
6
  Author: Dubs
@@ -1,10 +1,10 @@
1
- hippius_sdk/__init__.py,sha256=MFk7nPNG_uETVQXBkQ6NKW4A-TXZHOPRvlfiYSEPdRg,1474
1
+ hippius_sdk/__init__.py,sha256=96b5xPdEj_YwFmbCKq7olfuiXRQCsFTamAfQWRvUQ6k,1474
2
2
  hippius_sdk/cli.py,sha256=aqKOYSBSWt7UhcpFt7wf9yIPJ3bznpsJ6ehOnuZ4usI,18235
3
3
  hippius_sdk/cli_assets.py,sha256=V3MX63QTiex6mCp0VDXQJ7cagm5v1s4xtsu8c1O4G_k,371
4
4
  hippius_sdk/cli_handlers.py,sha256=TQNE9os87gRzRKLEO-SIwhFnBtEFMiaSESv-Bu7omfo,128909
5
5
  hippius_sdk/cli_parser.py,sha256=z7UvgWvvy04ey-R56qZiCqYc_9RaNq1rVDkQyXoK3JU,21100
6
6
  hippius_sdk/cli_rich.py,sha256=_jTBYMdHi2--fIVwoeNi-EtkdOb6Zy_O2TUiGvU3O7s,7324
7
- hippius_sdk/client.py,sha256=w470cLv91DodgoRbjemhEIok70RTTLKSmmqHf94xFTs,22445
7
+ hippius_sdk/client.py,sha256=ft4gxn3NUvpiWm2R037BbsmJ9xOe8AiQpkrGQo4WUBw,22505
8
8
  hippius_sdk/config.py,sha256=Hf_aUYzG9ylzqauA_ABUSSB5mBTYbp-VtB36VQt2XDw,21981
9
9
  hippius_sdk/db/README.md,sha256=okDeI1qgkaZqXSlJ8L0xIE4UpuxO-qEGPIbXUvSHQjU,2030
10
10
  hippius_sdk/db/env.db.template,sha256=_6hEC3IvkzCDOAzG1_yJUKRUfCTMciNaJUicZpMCat4,217
@@ -15,9 +15,9 @@ hippius_sdk/errors.py,sha256=LScJJmawVAx7aRzqqQguYSkf9iazSjEQEBNlD_GXZ6Y,1589
15
15
  hippius_sdk/ipfs.py,sha256=8OLkBkNV7zEKqrtokAwrvD842qXt8qgFMIc03h_sdN0,94610
16
16
  hippius_sdk/ipfs_core.py,sha256=eOOgLoyP9mvwndnCjldnTc7z94ImYCXY3nm7JU3e_Mo,12676
17
17
  hippius_sdk/key_storage.py,sha256=oxfRRQXu8XVncUjhKJJ8rsc81JAkaj9MqZEwQa96idc,9474
18
- hippius_sdk/substrate.py,sha256=-lIavQkfE6Kw2KzllH9IMgNkzl2d6vEmU3RmwKNJQvc,48093
18
+ hippius_sdk/substrate.py,sha256=5ndCGmHgzRL4I7n8lmJug8505sctJ74DgyeTHmT1vLM,50107
19
19
  hippius_sdk/utils.py,sha256=rJ611yvwKSyiBpYU3w-SuyQxoghMGU-ePuslrPv5H5g,7388
20
- hippius-0.2.25.dist-info/METADATA,sha256=EwVtBbbvgLEv4mpeyUJjXmM_fiYTACyHbDdiZ_zmOlE,30088
21
- hippius-0.2.25.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
22
- hippius-0.2.25.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
23
- hippius-0.2.25.dist-info/RECORD,,
20
+ hippius-0.2.27.dist-info/METADATA,sha256=tFP3AcRjyKphB4dyLgzDZfT6IpCziAux39t2kgXa4ag,30088
21
+ hippius-0.2.27.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
22
+ hippius-0.2.27.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
23
+ hippius-0.2.27.dist-info/RECORD,,
hippius_sdk/__init__.py CHANGED
@@ -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.25"
29
+ __version__ = "0.2.27"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
hippius_sdk/client.py CHANGED
@@ -545,7 +545,12 @@ class HippiusClient:
545
545
  ValueError: If encryption is requested but not available
546
546
  """
547
547
  return await self.ipfs_client.s3_publish(
548
- file_path, encrypt, seed_phrase, store_node, pin_node, substrate_url,
548
+ file_path,
549
+ encrypt,
550
+ seed_phrase,
551
+ store_node,
552
+ pin_node,
553
+ substrate_url,
549
554
  )
550
555
 
551
556
  async def s3_download(
hippius_sdk/substrate.py CHANGED
@@ -1,7 +1,6 @@
1
1
  import datetime
2
2
  import json
3
3
  import os
4
- import pprint
5
4
  import tempfile
6
5
  import time
7
6
  import uuid
@@ -9,6 +8,7 @@ from typing import Any, Dict, List, Optional, Union
9
8
 
10
9
  from dotenv import load_dotenv
11
10
  from mnemonic import Mnemonic
11
+ from scalecodec.exceptions import RemainingScaleBytesNotEmptyException
12
12
  from substrateinterface import Keypair, SubstrateInterface
13
13
 
14
14
  from hippius_sdk.config import (
@@ -21,11 +21,7 @@ from hippius_sdk.config import (
21
21
  set_seed_phrase,
22
22
  )
23
23
  from hippius_sdk.errors import (
24
- HippiusAlreadyDeletedError,
25
24
  HippiusFailedSubstrateDelete,
26
- HippiusNotFoundError,
27
- HippiusSubstrateAuthError,
28
- HippiusSubstrateConnectionError,
29
25
  )
30
26
  from hippius_sdk.utils import (
31
27
  format_size,
@@ -608,7 +604,7 @@ class SubstrateClient:
608
604
  keypair=self._keypair,
609
605
  )
610
606
 
611
- print(f"]Payment info: {json.dumps(payment_info, indent=2)}")
607
+ print(f"Payment info: {json.dumps(payment_info, indent=2)}")
612
608
 
613
609
  # Convert partialFee from Substrate (10^18 units) to a more readable format
614
610
  estimated_fee = payment_info.get("partialFee", 0)
@@ -1258,3 +1254,59 @@ class SubstrateClient:
1258
1254
  raise HippiusFailedSubstrateDelete(
1259
1255
  f"Failed to cancel storage request: {str(e)}"
1260
1256
  )
1257
+
1258
+ def query_sub_account(self, account_id: str, seed_phrase: str) -> str | None:
1259
+ try:
1260
+ if not self._substrate:
1261
+ self.connect(seed_phrase)
1262
+ # Initialize connection to the Substrate node
1263
+ result = self._substrate.query(
1264
+ module="SubAccount", storage_function="SubAccount", params=[account_id]
1265
+ )
1266
+
1267
+ # Check if the result exists and return the value
1268
+ if result and result.value:
1269
+ return result.value
1270
+ return None
1271
+
1272
+ except Exception as e:
1273
+ print(f"Error querying SubAccount: {e}")
1274
+ return None
1275
+
1276
+ def is_main_account(self, account_id: str, seed_phrase: str) -> bool:
1277
+ sub_account = self.query_sub_account(account_id, seed_phrase=seed_phrase)
1278
+ return sub_account is None
1279
+
1280
+ def query_free_credits(self, account_id: str, seed_phrase) -> int:
1281
+ try:
1282
+ if not self._substrate:
1283
+ self.connect(seed_phrase)
1284
+
1285
+ # Query the FreeCredits storage map
1286
+ result = self._substrate.query(
1287
+ module="Credits", storage_function="FreeCredits", params=[account_id]
1288
+ )
1289
+
1290
+ # Return the u128 value (converted to int for Python compatibility)
1291
+ return int(result.value) if result and result.value is not None else 0
1292
+
1293
+ except RemainingScaleBytesNotEmptyException as e:
1294
+ print(f"Scale decoding error in query_free_credits: {e}")
1295
+ return 0
1296
+ except Exception as e:
1297
+ print(f"Error querying FreeCredits: {e}")
1298
+ return 0
1299
+
1300
+ def get_account_roles(self, account_id: str, seed_phrase) -> int:
1301
+ try:
1302
+ if not self._substrate:
1303
+ self.connect(seed_phrase)
1304
+
1305
+ result = self._substrate.query(
1306
+ module="SubAccount",
1307
+ storage_function="SubAccountRole",
1308
+ params=[account_id],
1309
+ )
1310
+ return result.value
1311
+ except Exception as e:
1312
+ print(f"Error querying SubAccountRole: {e}")