bittensor-cli 9.7.0__py3-none-any.whl → 9.8.0__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.
- bittensor_cli/cli.py +339 -23
- bittensor_cli/src/__init__.py +8 -0
- bittensor_cli/src/bittensor/chain_data.py +81 -33
- bittensor_cli/src/bittensor/subtensor_interface.py +33 -15
- bittensor_cli/src/bittensor/utils.py +19 -0
- bittensor_cli/src/commands/liquidity/__init__.py +0 -0
- bittensor_cli/src/commands/liquidity/liquidity.py +628 -0
- bittensor_cli/src/commands/liquidity/utils.py +200 -0
- bittensor_cli/src/commands/stake/add.py +4 -4
- bittensor_cli/src/commands/stake/remove.py +4 -4
- bittensor_cli/src/commands/subnets/subnets.py +6 -0
- bittensor_cli/src/commands/sudo.py +28 -15
- bittensor_cli/src/commands/wallets.py +19 -23
- {bittensor_cli-9.7.0.dist-info → bittensor_cli-9.8.0.dist-info}/METADATA +1 -1
- {bittensor_cli-9.7.0.dist-info → bittensor_cli-9.8.0.dist-info}/RECORD +18 -15
- {bittensor_cli-9.7.0.dist-info → bittensor_cli-9.8.0.dist-info}/WHEEL +0 -0
- {bittensor_cli-9.7.0.dist-info → bittensor_cli-9.8.0.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-9.7.0.dist-info → bittensor_cli-9.8.0.dist-info}/top_level.txt +0 -0
@@ -531,6 +531,33 @@ class SubtensorInterface:
|
|
531
531
|
res.append(record[0])
|
532
532
|
return res
|
533
533
|
|
534
|
+
async def is_subnet_active(
|
535
|
+
self,
|
536
|
+
netuid: int,
|
537
|
+
block_hash: Optional[str] = None,
|
538
|
+
reuse_block: bool = False,
|
539
|
+
) -> bool:
|
540
|
+
"""Verify if subnet with provided netuid is active.
|
541
|
+
|
542
|
+
Args:
|
543
|
+
netuid (int): The unique identifier of the subnet.
|
544
|
+
block_hash (Optional[str]): The blockchain block_hash representation of block id.
|
545
|
+
reuse_block (bool): Whether to reuse the last-used block hash.
|
546
|
+
|
547
|
+
Returns:
|
548
|
+
True if subnet is active, False otherwise.
|
549
|
+
|
550
|
+
This means whether the `start_call` was initiated or not.
|
551
|
+
"""
|
552
|
+
query = await self.substrate.query(
|
553
|
+
module="SubtensorModule",
|
554
|
+
storage_function="FirstEmissionBlockNumber",
|
555
|
+
block_hash=block_hash,
|
556
|
+
reuse_block_hash=reuse_block,
|
557
|
+
params=[netuid],
|
558
|
+
)
|
559
|
+
return True if query and query.value > 0 else False
|
560
|
+
|
534
561
|
async def subnet_exists(
|
535
562
|
self, netuid: int, block_hash: Optional[str] = None, reuse_block: bool = False
|
536
563
|
) -> bool:
|
@@ -1128,22 +1155,13 @@ class SubtensorInterface:
|
|
1128
1155
|
Understanding the hyperparameters is crucial for comprehending how subnets are configured and
|
1129
1156
|
managed, and how they interact with the network's consensus and incentive mechanisms.
|
1130
1157
|
"""
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
block_hash=block_hash,
|
1137
|
-
),
|
1138
|
-
self.query("SubtensorModule", "Yuma3On", [netuid]),
|
1139
|
-
self.query("SubtensorModule", "AlphaSigmoidSteepness", [netuid]),
|
1158
|
+
result = await self.query_runtime_api(
|
1159
|
+
runtime_api="SubnetInfoRuntimeApi",
|
1160
|
+
method="get_subnet_hyperparams_v2",
|
1161
|
+
params=[netuid],
|
1162
|
+
block_hash=block_hash,
|
1140
1163
|
)
|
1141
|
-
|
1142
|
-
**main_result,
|
1143
|
-
**{"yuma3_enabled": yuma3_result},
|
1144
|
-
**{"alpha_sigmoid_steepness": sigmoid_steepness},
|
1145
|
-
}
|
1146
|
-
if not main_result:
|
1164
|
+
if not result:
|
1147
1165
|
return []
|
1148
1166
|
|
1149
1167
|
return SubnetHyperparameters.from_any(result)
|
@@ -122,6 +122,11 @@ def u64_normalized_float(x: int) -> float:
|
|
122
122
|
return float(x) / float(U64_MAX)
|
123
123
|
|
124
124
|
|
125
|
+
def string_to_u64(value: str) -> int:
|
126
|
+
"""Converts a string to u64"""
|
127
|
+
return float_to_u64(float(value))
|
128
|
+
|
129
|
+
|
125
130
|
def float_to_u64(value: float) -> int:
|
126
131
|
"""Converts a float to a u64 int"""
|
127
132
|
# Ensure the input is within the expected range
|
@@ -142,6 +147,11 @@ def u64_to_float(value: int) -> float:
|
|
142
147
|
return min(value / u64_max, 1.0) # Ensure the result is never greater than 1.0
|
143
148
|
|
144
149
|
|
150
|
+
def string_to_u16(value: str) -> int:
|
151
|
+
"""Converts a string to a u16 int"""
|
152
|
+
return float_to_u16(float(value))
|
153
|
+
|
154
|
+
|
145
155
|
def float_to_u16(value: float) -> int:
|
146
156
|
# Ensure the input is within the expected range
|
147
157
|
if not (0 <= value <= 1):
|
@@ -1167,6 +1177,7 @@ def prompt_for_subnet_identity(
|
|
1167
1177
|
subnet_url: Optional[str],
|
1168
1178
|
discord: Optional[str],
|
1169
1179
|
description: Optional[str],
|
1180
|
+
logo_url: Optional[str],
|
1170
1181
|
additional: Optional[str],
|
1171
1182
|
):
|
1172
1183
|
"""
|
@@ -1227,6 +1238,13 @@ def prompt_for_subnet_identity(
|
|
1227
1238
|
lambda x: x and len(x.encode("utf-8")) > 1024,
|
1228
1239
|
"[red]Error:[/red] Description must be <= 1024 bytes.",
|
1229
1240
|
),
|
1241
|
+
(
|
1242
|
+
"logo_url",
|
1243
|
+
"[blue]Logo URL [dim](optional)[/blue]",
|
1244
|
+
logo_url,
|
1245
|
+
lambda x: x and len(x.encode("utf-8")) > 1024,
|
1246
|
+
"[red]Error:[/red] Logo URL must be <= 1024 bytes.",
|
1247
|
+
),
|
1230
1248
|
(
|
1231
1249
|
"additional",
|
1232
1250
|
"[blue]Additional information [dim](optional)[/blue]",
|
@@ -1361,6 +1379,7 @@ def unlock_key(
|
|
1361
1379
|
err_msg = f"The password used to decrypt your {unlock_type.capitalize()}key Keyfile is invalid."
|
1362
1380
|
if print_out:
|
1363
1381
|
err_console.print(f":cross_mark: [red]{err_msg}[/red]")
|
1382
|
+
return unlock_key(wallet, unlock_type, print_out)
|
1364
1383
|
return UnlockStatus(False, err_msg)
|
1365
1384
|
except KeyFileError:
|
1366
1385
|
err_msg = f"{unlock_type.capitalize()}key Keyfile is corrupt, non-writable, or non-readable, or non-existent."
|
File without changes
|