hippius 0.2.33__py3-none-any.whl → 0.2.34__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.33
3
+ Version: 0.2.34
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,7 +1,7 @@
1
- hippius_sdk/__init__.py,sha256=CvasBbIH70_O5Hdlb4pyWtTwY4FLMxo_W3QZbaHdApo,1474
1
+ hippius_sdk/__init__.py,sha256=c0zwjDuA4dbZ70JwwoWMYg4aS0pIRDlpXvAKhFoBbjc,1474
2
2
  hippius_sdk/cli.py,sha256=aqKOYSBSWt7UhcpFt7wf9yIPJ3bznpsJ6ehOnuZ4usI,18235
3
3
  hippius_sdk/cli_assets.py,sha256=rjH3Z5A1CQr2d5CIAAAb0WMCjoZZlMWcdo0f93KqluE,635
4
- hippius_sdk/cli_handlers.py,sha256=2V9fKTCnYrGVAMEPF6wZ2-NCF612SZUH13hApptx_gw,129125
4
+ hippius_sdk/cli_handlers.py,sha256=1AwUhYtrQXXoIz6VYAGjcnM3l84FwKYdB46Up1DC4D4,128250
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
7
  hippius_sdk/client.py,sha256=JIoKwq3YskuJO4YoRU8hJxVrCnk-t2oP6VDjEwZLIco,22666
@@ -16,9 +16,9 @@ hippius_sdk/errors.py,sha256=LScJJmawVAx7aRzqqQguYSkf9iazSjEQEBNlD_GXZ6Y,1589
16
16
  hippius_sdk/ipfs.py,sha256=22xHOrOer2KHvSMepaUNRMYAK04L-AKyv8sEPSAYg7g,95429
17
17
  hippius_sdk/ipfs_core.py,sha256=eOOgLoyP9mvwndnCjldnTc7z94ImYCXY3nm7JU3e_Mo,12676
18
18
  hippius_sdk/key_storage.py,sha256=SXFd6aGQw9MDLGX2vSBuAY7rdX-k5EvFm63z7_n-8yQ,8148
19
- hippius_sdk/substrate.py,sha256=MFQcJARFw-Ej1WDSPGF8ryejXLmda5DdqcwPYS-KI10,49668
19
+ hippius_sdk/substrate.py,sha256=4a7UIE4UqGcDW7luKTBgSDqfb2OIZusB39G1UiRs_YU,50158
20
20
  hippius_sdk/utils.py,sha256=rJ611yvwKSyiBpYU3w-SuyQxoghMGU-ePuslrPv5H5g,7388
21
- hippius-0.2.33.dist-info/METADATA,sha256=5dJwfcoCSSv53prz-quMpGu99WQhNDWJhF6uT81iUYE,30088
22
- hippius-0.2.33.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
- hippius-0.2.33.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
- hippius-0.2.33.dist-info/RECORD,,
21
+ hippius-0.2.34.dist-info/METADATA,sha256=O2TPie_-lOL8W2K1p4VrULmZCi9DSviFQSa8f7dSEGk,30088
22
+ hippius-0.2.34.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
+ hippius-0.2.34.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
+ hippius-0.2.34.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.33"
29
+ __version__ = "0.2.34"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
@@ -130,9 +130,7 @@ def create_client(args: Any) -> HippiusClient:
130
130
  ):
131
131
  needs_password = True
132
132
  # Special case for pin - only needs password if we're publishing
133
- elif command == "pin" and not (
134
- hasattr(args, "no_publish") and args.no_publish
135
- ):
133
+ elif command == "pin" and not (hasattr(args, "no_publish") and args.no_publish):
136
134
  needs_password = True
137
135
 
138
136
  # If this command doesn't need password access, set to empty string to skip prompting
@@ -1258,35 +1256,17 @@ async def handle_erasure_code(
1258
1256
  )
1259
1257
  return 1
1260
1258
 
1261
- # Request password early if we're going to publish to the blockchain
1262
- if publish and client.substrate_client._seed_phrase is None:
1263
- # First check if we have an encrypted seed phrase that will require a password
1264
- config = load_config()
1265
- account_name = client.substrate_client._account_name or get_active_account()
1266
-
1267
- if account_name and account_name in config["substrate"].get("accounts", {}):
1268
- account_data = config["substrate"]["accounts"][account_name]
1269
- is_encoded = account_data.get("seed_phrase_encoded", False)
1270
-
1271
- if is_encoded:
1272
- warning("Wallet password will be required for publishing to blockchain")
1273
- password = getpass.getpass(
1274
- "Enter password to decrypt seed phrase: \n\n"
1275
- )
1276
-
1277
- # Store the password in client for later use
1278
- client.substrate_client._seed_phrase_password = password
1279
-
1280
- # Pre-authenticate to ensure the password is correct
1281
- try:
1282
- seed_phrase = decrypt_seed_phrase(password, account_name)
1283
- if not seed_phrase:
1284
- error("Failed to decrypt seed phrase. Incorrect password?")
1285
- return 1
1286
- client.substrate_client._seed_phrase = seed_phrase
1287
- except Exception as e:
1288
- error(f"Error decrypting seed phrase: {e}")
1289
- return 1
1259
+ # If publishing is enabled, ensure we have a valid substrate client by accessing it
1260
+ # This will trigger password prompts if needed right at the beginning
1261
+ if publish and hasattr(client, "substrate_client") and client.substrate_client:
1262
+ try:
1263
+ # Force keypair initialization - this will prompt for password if needed
1264
+ _ = client.substrate_client._ensure_keypair()
1265
+ except Exception as e:
1266
+ warning(f"Failed to initialize blockchain client: {str(e)}")
1267
+ warning(
1268
+ "Will continue with erasure coding but blockchain publishing may fail"
1269
+ )
1290
1270
 
1291
1271
  # Get file size
1292
1272
  file_size = os.path.getsize(file_path)
hippius_sdk/substrate.py CHANGED
@@ -165,6 +165,17 @@ class SubstrateClient:
165
165
  )
166
166
  return False
167
167
 
168
+ # Check if we have a pre-stored seed phrase first
169
+ if self._seed_phrase:
170
+ try:
171
+ self._keypair = Keypair.create_from_mnemonic(self._seed_phrase)
172
+ self._account_address = self._keypair.ss58_address
173
+ self._read_only = False
174
+ return True
175
+ except Exception as e:
176
+ print(f"Warning: Could not create keypair from stored seed phrase: {e}")
177
+ # Fall through to try config
178
+
168
179
  # Otherwise, try to get the seed phrase from config
169
180
  config_seed = get_seed_phrase(self._seed_phrase_password, self._account_name)
170
181
  if config_seed: