|
23 | 23 | NeuronInfo,
|
24 | 24 | ProposalVoteData,
|
25 | 25 | StakeInfo,
|
26 |
| - SelectiveMetagraphIndex, |
27 | 26 | SubnetHyperparameters,
|
28 | 27 | SubnetIdentity,
|
29 | 28 | SubnetInfo,
|
@@ -1543,59 +1542,32 @@ async def get_minimum_required_stake(self):
|
1543 | 1542 | async def get_metagraph_info(
|
1544 | 1543 | self,
|
1545 | 1544 | netuid: int,
|
1546 |
| - field_indices: Optional[list["SelectiveMetagraphIndex"]] = None, |
1547 | 1545 | block: Optional[int] = None,
|
1548 | 1546 | block_hash: Optional[str] = None,
|
1549 | 1547 | reuse_block: bool = False,
|
1550 | 1548 | ) -> Optional[MetagraphInfo]:
|
1551 | 1549 | """
|
1552 |
| - Retrieves full or partial metagraph information for the specified subnet (netuid). |
| 1550 | + Retrieves the MetagraphInfo dataclass from the node for a single subnet (netuid) |
1553 | 1551 |
|
1554 | 1552 | Arguments:
|
1555 |
| - netuid: The NetUID of the subnet to query. |
1556 |
| - field_indices: An optional list of SelectiveMetagraphIndex values specifying which fields to retrieve. If |
1557 |
| - not provided, all available fields will be returned. |
| 1553 | + netuid: The NetUID of the subnet. |
1558 | 1554 | block: the block number at which to retrieve the hyperparameter. Do not specify if using block_hash or
|
1559 | 1555 | reuse_block
|
1560 | 1556 | block_hash: The hash of blockchain block number for the query. Do not specify if using
|
1561 | 1557 | block or reuse_block
|
1562 | 1558 | reuse_block: Whether to reuse the last-used block hash. Do not set if using block_hash or block.
|
1563 | 1559 |
|
1564 | 1560 | Returns:
|
1565 |
| - Optional[MetagraphInfo]: A MetagraphInfo object containing the requested subnet data, or None if the subnet |
1566 |
| - with the given netuid does not exist. |
1567 |
| -
|
1568 |
| - Example: |
1569 |
| - meta_info = await subtensor.get_metagraph_info(netuid=2) |
1570 |
| -
|
1571 |
| - partial_meta_info = await subtensor.get_metagraph_info( |
1572 |
| - netuid=2, |
1573 |
| - field_indices=[SelectiveMetagraphIndex.Name, SelectiveMetagraphIndex.OwnerHotkeys] |
1574 |
| - ) |
| 1561 | + MetagraphInfo dataclass |
1575 | 1562 | """
|
1576 |
| - indexes = SelectiveMetagraphIndex.all_indices() |
1577 |
| - |
1578 |
| - if field_indices: |
1579 |
| - if isinstance(field_indices, list) and all( |
1580 |
| - isinstance(f, (SelectiveMetagraphIndex, int)) for f in field_indices |
1581 |
| - ): |
1582 |
| - indexes = [ |
1583 |
| - f.value if isinstance(f, SelectiveMetagraphIndex) else f |
1584 |
| - for f in field_indices |
1585 |
| - ] |
1586 |
| - else: |
1587 |
| - raise ValueError( |
1588 |
| - "`field_indices` must be a list of SelectiveMetagraphIndex items." |
1589 |
| - ) |
1590 |
| - |
1591 | 1563 | block_hash = await self.determine_block_hash(block, block_hash, reuse_block)
|
1592 | 1564 | if not block_hash and reuse_block:
|
1593 | 1565 | block_hash = self.substrate.last_block_hash
|
1594 | 1566 |
|
1595 | 1567 | query = await self.substrate.runtime_call(
|
1596 | 1568 | "SubnetInfoRuntimeApi",
|
1597 |
| - "get_selective_metagraph", |
1598 |
| - params=[netuid, indexes if 0 in indexes else [0] + indexes], |
| 1569 | + "get_metagraph", |
| 1570 | + params=[netuid], |
1599 | 1571 | block_hash=block_hash,
|
1600 | 1572 | )
|
1601 | 1573 | if query.value is None:
|
|
0 commit comments