Skip to content

Commit 4c7df84

Browse files
author
Roman
committed
add extrinsics call in Async/Subtensor
1 parent 5c9961f commit 4c7df84

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

bittensor/core/async_subtensor.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
publish_metadata,
5858
get_metadata,
5959
)
60+
from bittensor.core.extrinsics.asyncex.start_call import start_call_extrinsic
6061
from bittensor.core.extrinsics.asyncex.serving import serve_axon_extrinsic
6162
from bittensor.core.extrinsics.asyncex.staking import (
6263
add_stake_extrinsic,
@@ -3986,6 +3987,36 @@ async def serve_axon(
39863987
certificate=certificate,
39873988
)
39883989

3990+
async def start_call(
3991+
self,
3992+
wallet: "Wallet",
3993+
netuid: int,
3994+
wait_for_inclusion: bool = True,
3995+
wait_for_finalization: bool = False,
3996+
) -> tuple[bool, str]:
3997+
"""
3998+
Submits a `start_call` extrinsic to the blockchain, indicating that the caller wishes to begin responding
3999+
to a specific challenge on the specified subnet (`netuid`).
4000+
4001+
Args:
4002+
wallet (Wallet): The wallet used to sign the extrinsic (must be unlocked).
4003+
netuid (int): The UID of the target subnet for which the call is being initiated.
4004+
wait_for_inclusion (bool, optional): Whether to wait for the extrinsic to be included in a block. Defaults to True.
4005+
wait_for_finalization (bool, optional): Whether to wait for finalization of the extrinsic. Defaults to False.
4006+
4007+
Returns:
4008+
Tuple[bool, str]:
4009+
- True and a success message if the extrinsic is successfully submitted or processed.
4010+
- False and an error message if the submission fails or the wallet cannot be unlocked.
4011+
"""
4012+
return await start_call_extrinsic(
4013+
subtensor=self,
4014+
wallet=wallet,
4015+
netuid=netuid,
4016+
wait_for_inclusion=wait_for_inclusion,
4017+
wait_for_finalization=wait_for_finalization,
4018+
)
4019+
39894020
async def swap_stake(
39904021
self,
39914022
wallet: "Wallet",

bittensor/core/subtensor.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
get_metadata,
6161
serve_axon_extrinsic,
6262
)
63+
from bittensor.core.extrinsics.start_call import start_call_extrinsic
6364
from bittensor.core.extrinsics.set_weights import set_weights_extrinsic
6465
from bittensor.core.extrinsics.staking import (
6566
add_stake_extrinsic,
@@ -3252,6 +3253,36 @@ def serve_axon(
32523253
certificate=certificate,
32533254
)
32543255

3256+
def start_call(
3257+
self,
3258+
wallet: "Wallet",
3259+
netuid: int,
3260+
wait_for_inclusion: bool = True,
3261+
wait_for_finalization: bool = False,
3262+
) -> tuple[bool, str]:
3263+
"""
3264+
Submits a `start_call` extrinsic to the blockchain, indicating that the caller wishes to begin responding
3265+
to a specific challenge on the specified subnet (`netuid`).
3266+
3267+
Args:
3268+
wallet (Wallet): The wallet used to sign the extrinsic (must be unlocked).
3269+
netuid (int): The UID of the target subnet for which the call is being initiated.
3270+
wait_for_inclusion (bool, optional): Whether to wait for the extrinsic to be included in a block. Defaults to True.
3271+
wait_for_finalization (bool, optional): Whether to wait for finalization of the extrinsic. Defaults to False.
3272+
3273+
Returns:
3274+
Tuple[bool, str]:
3275+
- True and a success message if the extrinsic is successfully submitted or processed.
3276+
- False and an error message if the submission fails or the wallet cannot be unlocked.
3277+
"""
3278+
return start_call_extrinsic(
3279+
subtensor=self,
3280+
wallet=wallet,
3281+
netuid=netuid,
3282+
wait_for_inclusion=wait_for_inclusion,
3283+
wait_for_finalization=wait_for_finalization,
3284+
)
3285+
32553286
def swap_stake(
32563287
self,
32573288
wallet: "Wallet",

0 commit comments

Comments
 (0)