hippius 0.2.3__py3-none-any.whl → 0.2.4__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.
- {hippius-0.2.3.dist-info → hippius-0.2.4.dist-info}/METADATA +207 -151
- hippius-0.2.4.dist-info/RECORD +16 -0
- hippius_sdk/__init__.py +10 -21
- hippius_sdk/cli.py +7 -1
- hippius_sdk/cli_assets.py +8 -6
- hippius_sdk/cli_handlers.py +540 -137
- hippius_sdk/cli_parser.py +5 -0
- hippius_sdk/cli_rich.py +2 -8
- hippius_sdk/client.py +14 -14
- hippius_sdk/config.py +108 -141
- hippius_sdk/ipfs.py +64 -43
- hippius_sdk/substrate.py +24 -33
- hippius-0.2.3.dist-info/RECORD +0 -16
- {hippius-0.2.3.dist-info → hippius-0.2.4.dist-info}/WHEEL +0 -0
- {hippius-0.2.3.dist-info → hippius-0.2.4.dist-info}/entry_points.txt +0 -0
hippius_sdk/substrate.py
CHANGED
@@ -11,20 +11,12 @@ from dotenv import load_dotenv
|
|
11
11
|
from mnemonic import Mnemonic
|
12
12
|
from substrateinterface import Keypair, SubstrateInterface
|
13
13
|
|
14
|
-
from hippius_sdk.config import (
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
set_active_account,
|
21
|
-
set_seed_phrase,
|
22
|
-
)
|
23
|
-
from hippius_sdk.utils import (
|
24
|
-
format_size,
|
25
|
-
hex_to_ipfs_cid,
|
26
|
-
initialize_substrate_connection,
|
27
|
-
)
|
14
|
+
from hippius_sdk.config import (get_account_address, get_active_account,
|
15
|
+
get_all_config, get_config_value,
|
16
|
+
get_seed_phrase, set_active_account,
|
17
|
+
set_seed_phrase)
|
18
|
+
from hippius_sdk.utils import (format_size, hex_to_ipfs_cid,
|
19
|
+
initialize_substrate_connection)
|
28
20
|
|
29
21
|
# Load environment variables
|
30
22
|
load_dotenv()
|
@@ -155,7 +147,6 @@ class SubstrateClient:
|
|
155
147
|
try:
|
156
148
|
self._keypair = Keypair.create_from_mnemonic(self._seed_phrase)
|
157
149
|
self._account_address = self._keypair.ss58_address
|
158
|
-
print(f"Keypair created for account: {self._keypair.ss58_address}")
|
159
150
|
self._read_only = False
|
160
151
|
return True
|
161
152
|
except Exception as e:
|
@@ -163,22 +154,14 @@ class SubstrateClient:
|
|
163
154
|
return False
|
164
155
|
|
165
156
|
# Otherwise, try to get the seed phrase from config
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
print(f"Keypair created for account: {self._keypair.ss58_address}")
|
175
|
-
self._read_only = False
|
176
|
-
return True
|
177
|
-
else:
|
178
|
-
print("No seed phrase available. Cannot sign transactions.")
|
179
|
-
return False
|
180
|
-
except Exception as e:
|
181
|
-
print(f"Warning: Could not get seed phrase from config: {e}")
|
157
|
+
config_seed = get_seed_phrase(self._seed_phrase_password, self._account_name)
|
158
|
+
if config_seed:
|
159
|
+
self._seed_phrase = config_seed
|
160
|
+
self._keypair = Keypair.create_from_mnemonic(self._seed_phrase)
|
161
|
+
self._account_address = self._keypair.ss58_address
|
162
|
+
self._read_only = False
|
163
|
+
return True
|
164
|
+
else:
|
182
165
|
return False
|
183
166
|
|
184
167
|
def generate_mnemonic(self) -> str:
|
@@ -194,6 +177,15 @@ class SubstrateClient:
|
|
194
177
|
except Exception as e:
|
195
178
|
raise ValueError(f"Error generating mnemonic: {e}")
|
196
179
|
|
180
|
+
def generate_seed_phrase(self) -> str:
|
181
|
+
"""
|
182
|
+
Generate a new random seed phrase (alias for generate_mnemonic).
|
183
|
+
|
184
|
+
Returns:
|
185
|
+
str: A 12-word mnemonic seed phrase
|
186
|
+
"""
|
187
|
+
return self.generate_mnemonic()
|
188
|
+
|
197
189
|
def create_account(
|
198
190
|
self, name: str, encode: bool = False, password: Optional[str] = None
|
199
191
|
) -> Dict[str, Any]:
|
@@ -482,9 +474,8 @@ class SubstrateClient:
|
|
482
474
|
try:
|
483
475
|
self._keypair = Keypair.create_from_mnemonic(self._seed_phrase)
|
484
476
|
self._account_address = self._keypair.ss58_address
|
485
|
-
print(f"Keypair created for account: {self._keypair.ss58_address}")
|
486
477
|
except Exception as e:
|
487
|
-
|
478
|
+
raise ValueError(f"Could not create keypair from seed phrase: {e}")
|
488
479
|
|
489
480
|
async def storage_request(
|
490
481
|
self, files: List[Union[FileInput, Dict[str, str]]], miner_ids: List[str] = None
|
hippius-0.2.3.dist-info/RECORD
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
hippius_sdk/__init__.py,sha256=usXyUpz3sVTOfYuhYSbxsVL0TjbwtffjLDELEKDpEo4,1391
|
2
|
-
hippius_sdk/cli.py,sha256=Auy9eIlQYMpmIOIRfMBILiT5edoaW4NK6R5ETABCQ5k,16987
|
3
|
-
hippius_sdk/cli_assets.py,sha256=XUQyiyswa2-9t5MsW_oGrWytG0Mz8geXGLnA3w0jyv8,781
|
4
|
-
hippius_sdk/cli_handlers.py,sha256=BGpAAYph83kPsEDzf5t-0B-z6zV75_AtYjwDOk7z7dU,87803
|
5
|
-
hippius_sdk/cli_parser.py,sha256=vZUGpi-NoYm4Bv9NrkjrnEVZJ3NMwhHVyV-7cEYZ7Gg,18737
|
6
|
-
hippius_sdk/cli_rich.py,sha256=_jTBYMdHi2--fIVwoeNi-EtkdOb6Zy_O2TUiGvU3O7s,7324
|
7
|
-
hippius_sdk/client.py,sha256=a-jr3_RAin_laT2qGvMm8taUb_5yYlNMwi7JVQSFj0w,16689
|
8
|
-
hippius_sdk/config.py,sha256=JDI0Vb4s-FfJsOJ25wEA6rTiCS0tzfDmzlGGOy77Zko,22962
|
9
|
-
hippius_sdk/ipfs.py,sha256=fld4YUZFrBnsq69gQNpEMCsvowE1QwOFhhSxF7Aed-k,72700
|
10
|
-
hippius_sdk/ipfs_core.py,sha256=AS5jjpJ9lbC5wbDP_asB3-pZBEpHsE9VjL8aQA5VUxM,7291
|
11
|
-
hippius_sdk/substrate.py,sha256=RIm2acNAxMJCxywXQJ-9V_usqs01g5CcaEfdSFwhVfo,44734
|
12
|
-
hippius_sdk/utils.py,sha256=Ur7P_7iVnXXYvbg7a0aVrdN_8NkVxjhdngn8NzR_zpc,7066
|
13
|
-
hippius-0.2.3.dist-info/METADATA,sha256=zrxR5YdTOb0bt_9aX0Waby76v8Pg8MyjA1_kI7NO_78,28143
|
14
|
-
hippius-0.2.3.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
15
|
-
hippius-0.2.3.dist-info/entry_points.txt,sha256=b1lo60zRXmv1ud-c5BC-cJcAfGE5FD4qM_nia6XeQtM,98
|
16
|
-
hippius-0.2.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|