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