bittensor-cli 9.7.1__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.
@@ -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
- main_result, yuma3_result, sigmoid_steepness = await asyncio.gather(
1132
- self.query_runtime_api(
1133
- runtime_api="SubnetInfoRuntimeApi",
1134
- method="get_subnet_hyperparams",
1135
- params=[netuid],
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
- result = {
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)
@@ -1177,6 +1177,7 @@ def prompt_for_subnet_identity(
1177
1177
  subnet_url: Optional[str],
1178
1178
  discord: Optional[str],
1179
1179
  description: Optional[str],
1180
+ logo_url: Optional[str],
1180
1181
  additional: Optional[str],
1181
1182
  ):
1182
1183
  """
@@ -1237,6 +1238,13 @@ def prompt_for_subnet_identity(
1237
1238
  lambda x: x and len(x.encode("utf-8")) > 1024,
1238
1239
  "[red]Error:[/red] Description must be <= 1024 bytes.",
1239
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
+ ),
1240
1248
  (
1241
1249
  "additional",
1242
1250
  "[blue]Additional information [dim](optional)[/blue]",
@@ -1371,6 +1379,7 @@ def unlock_key(
1371
1379
  err_msg = f"The password used to decrypt your {unlock_type.capitalize()}key Keyfile is invalid."
1372
1380
  if print_out:
1373
1381
  err_console.print(f":cross_mark: [red]{err_msg}[/red]")
1382
+ return unlock_key(wallet, unlock_type, print_out)
1374
1383
  return UnlockStatus(False, err_msg)
1375
1384
  except KeyFileError:
1376
1385
  err_msg = f"{unlock_type.capitalize()}key Keyfile is corrupt, non-writable, or non-readable, or non-existent."
File without changes