55
66if TYPE_CHECKING :
77 from bittensor_wallet import Wallet
8- from bittensor .core .subtensor import Subtensor
8+ from bittensor .core .async_subtensor import AsyncSubtensor
99
1010
1111async def transfer_stake_extrinsic (
12- subtensor : "Subtensor " ,
12+ subtensor : "AsyncSubtensor " ,
1313 wallet : "Wallet" ,
1414 destination_coldkey_ss58 : str ,
1515 hotkey_ss58 : str ,
@@ -19,6 +19,24 @@ async def transfer_stake_extrinsic(
1919 wait_for_inclusion : bool = True ,
2020 wait_for_finalization : bool = False ,
2121) -> bool :
22+ """
23+ Transfers stake from one coldkey to another in the Bittensor network.
24+
25+ Args:
26+ subtensor (AsyncSubtensor): The subtensor instance to interact with the blockchain.
27+ wallet (Wallet): The wallet containing the coldkey to authorize the transfer.
28+ destination_coldkey_ss58 (str): SS58 address of the destination coldkey.
29+ hotkey_ss58 (str): SS58 address of the hotkey associated with the stake.
30+ origin_netuid (int): Network UID of the origin subnet.
31+ destination_netuid (int): Network UID of the destination subnet.
32+ amount (Balance): The amount of stake to transfer as a `Balance` object.
33+ wait_for_inclusion (bool): If True, waits for transaction inclusion in a block. Defaults to `True`.
34+ wait_for_finalization (bool): If True, waits for transaction finalization. Defaults to `False`.
35+
36+ Returns:
37+ bool: True if the transfer was successful, False otherwise.
38+ """
39+
2240 amount .set_unit (netuid = origin_netuid )
2341 # Verify ownership
2442 hotkey_owner = await subtensor .get_hotkey_owner (hotkey_ss58 )
@@ -107,7 +125,7 @@ async def transfer_stake_extrinsic(
107125
108126
109127async def swap_stake_extrinsic (
110- subtensor : "Subtensor " ,
128+ subtensor : "AsyncSubtensor " ,
111129 wallet : "Wallet" ,
112130 hotkey_ss58 : str ,
113131 origin_netuid : int ,
@@ -116,6 +134,22 @@ async def swap_stake_extrinsic(
116134 wait_for_inclusion : bool = True ,
117135 wait_for_finalization : bool = False ,
118136) -> bool :
137+ """
138+ Swaps stake from one subnet to another for a given hotkey in the Bittensor network.
139+
140+ Args:
141+ subtensor (AsyncSubtensor): The subtensor instance to interact with the blockchain.
142+ wallet (Wallet): The wallet containing the coldkey to authorize the swap.
143+ hotkey_ss58 (str): SS58 address of the hotkey associated with the stake.
144+ origin_netuid (int): Network UID of the origin subnet.
145+ destination_netuid (int): Network UID of the destination subnet.
146+ amount (Balance): The amount of stake to swap as a `Balance` object.
147+ wait_for_inclusion (bool): If True, waits for transaction inclusion in a block. Defaults to True.
148+ wait_for_finalization (bool): If True, waits for transaction finalization. Defaults to False.
149+
150+ Returns:
151+ bool: True if the swap was successful, False otherwise.
152+ """
119153 amount .set_unit (netuid = origin_netuid )
120154 # Verify ownership
121155 hotkey_owner = await subtensor .get_hotkey_owner (hotkey_ss58 )
@@ -203,7 +237,7 @@ async def swap_stake_extrinsic(
203237
204238
205239async def move_stake_extrinsic (
206- subtensor : "Subtensor " ,
240+ subtensor : "AsyncSubtensor " ,
207241 wallet : "Wallet" ,
208242 origin_hotkey : str ,
209243 origin_netuid : int ,
@@ -213,6 +247,23 @@ async def move_stake_extrinsic(
213247 wait_for_inclusion : bool = True ,
214248 wait_for_finalization : bool = False ,
215249) -> bool :
250+ """
251+ Moves stake from one hotkey to another within subnets in the Bittensor network.
252+
253+ Args:
254+ subtensor (Subtensor): The subtensor instance to interact with the blockchain.
255+ wallet (Wallet): The wallet containing the coldkey to authorize the move.
256+ origin_hotkey (str): SS58 address of the origin hotkey associated with the stake.
257+ origin_netuid (int): Network UID of the origin subnet.
258+ destination_hotkey (str): SS58 address of the destination hotkey.
259+ destination_netuid (int): Network UID of the destination subnet.
260+ amount (Balance): The amount of stake to move as a `Balance` object.
261+ wait_for_inclusion (bool): If True, waits for transaction inclusion in a block. Defaults to True.
262+ wait_for_finalization (bool): If True, waits for transaction finalization. Defaults to False.
263+
264+ Returns:
265+ bool: True if the move was successful, False otherwise.
266+ """
216267 amount .set_unit (netuid = origin_netuid )
217268 # Verify ownership of origin hotkey
218269 origin_owner = await subtensor .get_hotkey_owner (origin_hotkey )
0 commit comments