Skip to content

Commit 50db030

Browse files
author
Roman
committed
add async subtensor extrinsic method
1 parent 19f53f0 commit 50db030

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

bittensor/core/async_subtensor.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
NeuronInfo,
2222
ProposalVoteData,
2323
SubnetHyperparameters,
24+
SubnetIdentity,
2425
SubnetInfo,
2526
WeightCommitInfo,
2627
decode_account_id,
@@ -34,6 +35,7 @@
3435
burned_register_extrinsic,
3536
register_extrinsic,
3637
register_subnet_extrinsic,
38+
set_subnet_identity_extrinsic,
3739
)
3840
from bittensor.core.extrinsics.asyncex.move_stake import (
3941
transfer_stake_extrinsic,
@@ -3188,6 +3190,44 @@ async def root_set_weights(
31883190
wait_for_inclusion=wait_for_inclusion,
31893191
)
31903192

3193+
async def set_subnet_identity(
3194+
self,
3195+
wallet: "Wallet",
3196+
netuid: int,
3197+
subnet_identity: SubnetIdentity,
3198+
wait_for_inclusion: bool = False,
3199+
wait_for_finalization: bool = True,
3200+
) -> tuple[bool, str]:
3201+
"""
3202+
Sets the identity of a subnet for a specific wallet and network.
3203+
3204+
Arguments:
3205+
wallet (Wallet): The wallet instance that will authorize the transaction.
3206+
netuid (int): The unique ID of the network on which the operation takes place.
3207+
subnet_identity (SubnetIdentity): The identity data of the subnet including attributes like name, GitHub
3208+
repository, contact, URL, discord, description, and any additional metadata.
3209+
wait_for_inclusion (bool): Indicates if the function should wait for the transaction to be included in the block.
3210+
wait_for_finalization (bool): Indicates if the function should wait for the transaction to reach finalization.
3211+
3212+
Returns:
3213+
tuple[bool, str]: A tuple where the first element is a boolean indicating success or failure of the
3214+
operation, and the second element is a message providing additional information.
3215+
"""
3216+
return await set_subnet_identity_extrinsic(
3217+
subtensor=self,
3218+
wallet=wallet,
3219+
netuid=netuid,
3220+
subnet_name=subnet_identity.subnet_name,
3221+
github_repo=subnet_identity.github_repo,
3222+
subnet_contact=subnet_identity.subnet_contact,
3223+
subnet_url=subnet_identity.subnet_url,
3224+
discord=subnet_identity.discord,
3225+
description=subnet_identity.description,
3226+
additional=subnet_identity.additional,
3227+
wait_for_inclusion=wait_for_inclusion,
3228+
wait_for_finalization=wait_for_finalization,
3229+
)
3230+
31913231
async def set_weights(
31923232
self,
31933233
wallet: "Wallet",

0 commit comments

Comments
 (0)