hippius 0.2.25__tar.gz → 0.2.26__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.25 → hippius-0.2.26}/PKG-INFO +1 -1
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/__init__.py +1 -1
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/client.py +6 -1
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/substrate.py +51 -6
- {hippius-0.2.25 → hippius-0.2.26}/pyproject.toml +1 -1
- {hippius-0.2.25 → hippius-0.2.26}/README.md +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/cli.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/cli_assets.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/cli_handlers.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/cli_parser.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/cli_rich.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/config.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/db/README.md +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/db/env.db.template +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/db/setup_database.sh +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/db_utils.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/errors.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/ipfs.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/ipfs_core.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/hippius_sdk/key_storage.py +0 -0
- {hippius-0.2.25 → hippius-0.2.26}/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.26"
|
30
30
|
__all__ = [
|
31
31
|
"HippiusClient",
|
32
32
|
"IPFSClient",
|
@@ -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,
|
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(
|
@@ -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"
|
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,52 @@ class SubstrateClient:
|
|
1258
1254
|
raise HippiusFailedSubstrateDelete(
|
1259
1255
|
f"Failed to cancel storage request: {str(e)}"
|
1260
1256
|
)
|
1257
|
+
|
1258
|
+
|
1259
|
+
def query_sub_account(self, account_id: str, seed_phrase: str) -> str | None:
|
1260
|
+
try:
|
1261
|
+
if not self._substrate:
|
1262
|
+
self.connect(seed_phrase)
|
1263
|
+
# Initialize connection to the Substrate node
|
1264
|
+
result = self._substrate.query(
|
1265
|
+
module="SubAccount",
|
1266
|
+
storage_function="SubAccount",
|
1267
|
+
params=[account_id]
|
1268
|
+
)
|
1269
|
+
|
1270
|
+
# Check if the result exists and return the value
|
1271
|
+
if result and result.value:
|
1272
|
+
return result.value
|
1273
|
+
return None
|
1274
|
+
|
1275
|
+
except Exception as e:
|
1276
|
+
print(f"Error querying SubAccount: {e}")
|
1277
|
+
return None
|
1278
|
+
|
1279
|
+
|
1280
|
+
def is_main_account(self, account_id: str, seed_phrase: str) -> bool:
|
1281
|
+
sub_account = self.query_sub_account(account_id, seed_phrase=seed_phrase)
|
1282
|
+
return sub_account is None
|
1283
|
+
|
1284
|
+
|
1285
|
+
def query_free_credits(self, account_id: str, seed_phrase) -> int:
|
1286
|
+
try:
|
1287
|
+
if not self._substrate:
|
1288
|
+
self.connect(seed_phrase)
|
1289
|
+
|
1290
|
+
# Query the FreeCredits storage map
|
1291
|
+
result = self._substrate.query(
|
1292
|
+
module="Credits",
|
1293
|
+
storage_function="FreeCredits",
|
1294
|
+
params=[account_id]
|
1295
|
+
)
|
1296
|
+
|
1297
|
+
# Return the u128 value (converted to int for Python compatibility)
|
1298
|
+
return int(result.value) if result and result.value is not None else 0
|
1299
|
+
|
1300
|
+
except RemainingScaleBytesNotEmptyException as e:
|
1301
|
+
print(f"Scale decoding error in query_free_credits: {e}")
|
1302
|
+
return 0
|
1303
|
+
except Exception as e:
|
1304
|
+
print(f"Error querying FreeCredits: {e}")
|
1305
|
+
return 0
|
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
|