@@ -388,6 +388,23 @@ def all_subnets(self, block: Optional[int] = None) -> Optional[list["DynamicInfo
388
388
)
389
389
return DynamicInfo .list_from_dicts (query .decode ())
390
390
391
+ def blocks_since_last_step (
392
+ self , netuid : int , block : Optional [int ] = None
393
+ ) -> Optional [int ]:
394
+ """Returns number of blocks since the last epoch of the subnet.
395
+
396
+ Arguments:
397
+ netuid (int): The unique identifier of the subnetwork.
398
+ block: the block number for this query.
399
+
400
+ Returns:
401
+ block number of the last step in the subnet.
402
+ """
403
+ query = self .query_subtensor (
404
+ name = "BlocksSinceLastStep" , block = block , params = [netuid ]
405
+ )
406
+ return query .value if query is not None and hasattr (query , "value" ) else query
407
+
391
408
def blocks_since_last_update (self , netuid : int , uid : int ) -> Optional [int ]:
392
409
"""
393
410
Returns the number of blocks since the last update for a specific UID in the subnetwork.
@@ -2575,6 +2592,46 @@ def get_timestamp(self, block: Optional[int] = None) -> datetime:
2575
2592
unix = cast (ScaleObj , self .query_module ("Timestamp" , "Now" , block = block )).value
2576
2593
return datetime .fromtimestamp (unix / 1000 , tz = timezone .utc )
2577
2594
2595
+ def get_subnet_owner_hotkey (
2596
+ self , netuid : int , block : Optional [int ] = None
2597
+ ) -> Optional [str ]:
2598
+ """
2599
+ Retrieves the hotkey of the subnet owner for a given network UID.
2600
+
2601
+ This function queries the subtensor network to fetch the hotkey of the owner of a subnet specified by its
2602
+ netuid. If no data is found or the query fails, the function returns None.
2603
+
2604
+ Arguments:
2605
+ netuid: The network UID of the subnet to fetch the owner's hotkey for.
2606
+ block: The specific block number to query the data from.
2607
+
2608
+ Returns:
2609
+ The hotkey of the subnet owner if available; None otherwise.
2610
+ """
2611
+ return self .query_subtensor (
2612
+ name = "SubnetOwnerHotkey" , params = [netuid ], block = block
2613
+ )
2614
+
2615
+ def get_subnet_validator_permits (
2616
+ self , netuid : int , block : Optional [int ] = None
2617
+ ) -> Optional [list [bool ]]:
2618
+ """
2619
+ Retrieves the list of validator permits for a given subnet as boolean values.
2620
+
2621
+ Arguments:
2622
+ netuid: The unique identifier of the subnetwork.
2623
+ block: The blockchain block number for the query.
2624
+
2625
+ Returns:
2626
+ A list of boolean values representing validator permits, or None if not available.
2627
+ """
2628
+ query = self .query_subtensor (
2629
+ name = "ValidatorPermit" ,
2630
+ params = [netuid ],
2631
+ block = block ,
2632
+ )
2633
+ return query .value if query is not None and hasattr (query , "value" ) else query
2634
+
2578
2635
# Extrinsics helper ================================================================================================
2579
2636
2580
2637
def sign_and_send_extrinsic (
@@ -2598,6 +2655,9 @@ def sign_and_send_extrinsic(
2598
2655
wait_for_inclusion (bool): whether to wait until the extrinsic call is included on the chain
2599
2656
wait_for_finalization (bool): whether to wait until the extrinsic call is finalized on the chain
2600
2657
sign_with: the wallet's keypair to use for the signing. Options are "coldkey", "hotkey", "coldkeypub"
2658
+ use_nonce: unique identifier for the transaction related with hot/coldkey.
2659
+ period: the period of the transaction as ERA part for transaction. Means how many blocks the transaction will be valid for.
2660
+ nonce_key: the type on nonce to use. Options are "hotkey" or "coldkey".
2601
2661
raise_error: raises relevant exception rather than returning `False` if unsuccessful.
2602
2662
2603
2663
Returns:
0 commit comments